A Horse / Vehicle System

Hello developers, today I’d like your input on something.

This is a new area for me and I really have no idea what I’m doing. There are two issues I’d like to solve, those are listed below. The maps I make are huge in space and part count, and so with both of these I will need the most efficient, lag-free system possible.

Horses
I’d like to make a horse system for my game. I have no idea how you would do this in an efficient and lag-free way. I don’t even really know how you’d go about making the horse move. I’d love to have it be animated to some degree.

Vehicles
Like horses, I’d love to implement vehicles in my game. I’m not looking for something super unique or realistic, just something efficient that will perform great on a part-heavy map. I also have no idea how you would go about making these move. If a suspension system helps the efficiency/performance then I’d love to have it, but if not then I can do without it.

I know both of these are tall orders with big issues involved, but I greatly appreciate any and all responses! I’m also open to buying a modular system for either of these if it’s available, but I’d prefer to make it myself with y’alls guidance.

4 Likes

What exactly is the part count on your game, over 20,000?

And do you use Smooth Terrain?

This all may come down to Performance.

I would suggest using a mesh horse probably for less parts, a large smooth terrain map may cause more memory than a brick map, but a brick map can lag a lot more.

This will be tough to do but I bet you can pull it off.

1 Like

Thanks for the reply! It’s probably over 20k, and we only use smooth terrain for water. I think I can do the animations and mesh for the horse, but I have no idea how I’d go about making it move. Body movers??

Do you know how I could make a horse move? Or even a vehicle with suspension?

2 Likes

What I did for my game’s horse(s) is use a Humanoid, and set auto-rotate to false. Your steed’s speed can be lerped, or manually set to “gears”. In a loop, make the horse move a few studs ahead of the player’s root part using the CFrame’s lookVector. Using a BodyMover or constraint, you can steer the horse within that loop.

4 Likes

That’s interesting. Why would you CFrame it a few studs ahead? Is that done locally or server side? Which body mover or constraint would you use for that?

1 Like

It’s giving the position by which the horse is facing, ideally. I would probably use a local script if at all possible, but a server script could work. Perhaps a hacky way to do this, is to change the horse’s parent to the player thru a server script. As for the bodymover, I used BodyRotVelocity, and set the Y value to a positive or negative, depending on direction.

Summary

The horse in my game in action. Note that this is quite out-of-date, but is still applicable nonetheless.
https://youtu.be/6VKML8j8alI

Happy dev’ing!

4 Likes

That’s a super cool horse system! Is it a model with a seat in it? Does the Client have a local script that runs when it detects they’ve sat on a horse? Is BodyRotVelocity the only body mover you used? I’m still very lost on this, but I really appreciate the answers!

Recap

Within a loop, I specifically make the horse’s humanoid move towards a Vector3 position/in a direction, with variables in the local script/values in a folder for checking player-input. I use a while loop, checking whether or not the seat.Occupant is in fact the LocalPlayer. I set the horse’s Humanoid.WalkSpeed to one of four speeds: idle, trot, canter, and gallop. Within the loop, I check whether the player’s pressing A or D, and if so, I change the BodyRotVelocity’s Y value to a positive or negative number, depending on the speed the horse is going.

The horse has a seat, which is rigged to the horse’s torso, which in turn is animated through normal means (Humanoid). I have yet to make the script completely local, as the horse has the script, and gets dupe’d into the player. I’m not familiar with constraints, but have used bodymovers in the past.

If you have anymore questions, I’ll be glad to answer them!

3 Likes

For a basic car system, try this.

The following videos show you how to make the car move, and how to go about steering.

I’m not sure if spring constraints place more strain on the server or not, but I’d have to imagine they put more strain on the server than not having them. Really, suspensions are only needed when you are making a vehicle that is meant to be driven heavily off road, up hills, over jumps, etc.

My cars here don’t utilize any suspension systems, and you’ll see they drive fine for a mostly flat roadway with only small amounts of incline.

1 Like