Jump to content
  • Advertisement
Michael Aganier

Physics for strategy games

Recommended Posts

Hi, I'm trying to implement physics for a strategy game, but I don't know much about physics other than basic techniques (radius, AABB). How does soldier collision work in a game like Total War?

Right now, I can move troops in square formations, but collision wise, there is 2 possible cases.

  1. either my troops aren't in combat in which case collision is disabled so they can move freely.
  2. either they are in combat, in which case collision is enabled, but is very stiff. Units will completely stop moving on collision instead of pushing their way through a crowd.

I want colliding soldiers to be able to push each other, but it doesn't need to be very accurate because it must be fast enough to support a vast amount of entities.

Share this post


Link to post
Share on other sites
Advertisement

You can look into using something like Bullet Physics, in which case you can give each soldier a rigid body like a sphere and some basic physical parameters like mass.  You can then move them by giving them forces, impulses, or by directly setting the velocity.  The rigid body object will contain the transform you need to render the soldier, determine AI behavior, etc.  You just let Bullet do the physics calculations.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!