🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Physics for strategy games

Started by
1 comment, last by 0r0d 6 years, 8 months ago

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.

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.

This topic is closed to new replies.

Advertisement