View Full Version : Simulating an army

06-11-2002, 04:11 PM
We were talking (http://terraqueous.f2o.org/dgdev/viewtopic.php?p=72#72) about simulating the movements of a (potentially) massive army where each soldier follows some simple rules. Alimonster mentioned flocking algorithms which seems to be on the right track but I was wondering, has this already been done. I think *something* like this was done in Lord of the Rings to make the battle scenes look as real as possible. But can it be done in real-time with modern hardware?

06-11-2002, 05:10 PM
I think so... I don't have much 3D (game) programming experience, so correct me if I'm wrong, but isn't the 3D battle AI much like 2D battle AI?

If you look at simple 2D games, like Age Of Empires or Cossacks (bad game, btw) they used large scale battles and the AI seemed quite realistic.
The Lord Of The Rings battle-creator (or how the thing was called) was indeed very cool, however it was a very new piece of software and I had never seen anything like it.

06-11-2002, 05:48 PM
I'd guess 3D would be very similar in execution when everything's stuck to the ground (i'm thinking in terms of an outdoor terrain engine like mine), you'd just take into account the slope of the terrain. Now if you introduce flying soldiers you would have to think in 3 dimensions!

This is a very interesting subject, I'm going to put development of my game on hold while I learn some basic AI and look into crowd movement algorithms. I remember at Uni we had a lecture in which we were told about a crowd simulation to find out how to make safer buildings. As far as I can remember, they found that in a fire, a door which allowed one person through at a time got people out quicker than one which allowed two people side by side. In the simulation, people just got stuck trying to squeeze through, but with a narrow door they went through single file and escaped.

07-11-2002, 10:51 PM
What you might want to try is a 2 part AI.
The first is the standard stuff for one entity.
*move toward target
*move away from target
*shoot at traget

The second is a group AI. It can effect the or override the result of the
first AI. You attach entity to this groupe and thy strat reacting differently.

This type of thing was being fooled around with by the guy who did the AI
for Black and White. {think I saw a link off slashdot}

Does this help or just complicate things for you?


07-11-2002, 11:04 PM
can it be done in real-time with modern hardware?

Certainly. One of the main benifits of flocking algorithms is that they reduce the complexity of the problem by having each unit only examine the closest units, and make a decision based on a simple set of rules. In this system you no longer get the exponentional complexity found when trying to make units evaluate their entire environment.

Steve has had a ]here[/url]. (You can also checkout Steven Woodcock/Ferretman's AI page http://www.gameai.com)

12-11-2002, 10:02 AM
Another great AI page is http://www.ai-depot.com. You may also want to check out what Alex J. Champandard has done with his "fear" AI engine over @ http://fear.sourceforge.net/. Though that relates to First Person shooter I am sure it could be tweaked for other game genres.

Boids and the whole flocking algorithm thing have been used before LOTR, in such films as Jurrassic Park ( remember the scene when the dinosours are running around Sam Neil ), and also the Lion King ( stampede scene )and probably a few more. For simulating group movement, I have yet to see anything better.

12-11-2002, 11:35 PM
Thanks for all your help, I have a LOT of reading to do 8)