2
\$\begingroup\$

I am wondering what would be a good way to handle enemy crowds generation and simulation.

For example in a hack'n'slash game, how would one go about placing enemies and managing their movement in the world with it feeling at least a bit natural?

What I am looking for is the general approach behind this. I can write (and have written) some code to simulate as best as I can these things, but it feels a bit "hacky", it's just each enemy having a pre-scripted behavior. I am wondering if there are general simulations method to manage enemies walking in the world and chasing players, as it is an element that exists in many games.

In my case, what I have done is to give them random intervals of time in which they can choose a random direction and move for a random duration. Then if the player gets near a certain range they will stop that and chase him (applying pathfinding), but maybe there are more general ways of thinking others than pre-scripting pseudo-random behavior?

\$\endgroup\$

closed as too broad by Trevor Powell, Anko, MrCranky, Seth Battin, bummzack Mar 31 '14 at 10:05

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • \$\begingroup\$ This is interesting, but too broad as it stands. I can imagine putting a year of research into a paper on general solutions to crowd simulation. Is there a more specific problem you're stuck with? \$\endgroup\$ – Anko Mar 25 '14 at 13:12
  • \$\begingroup\$ Well yes my question is a bit large, but I don't think it is that much different between games. The idea is to have enemies moving around, and that can go chasing the player if he comes near, as seen in MMO, or roguelikes \$\endgroup\$ – Malharhak Mar 25 '14 at 18:18
  • \$\begingroup\$ I agree with Anko. To make your question narrower, you can say what approach have you tried? Why do you think it does not look natural? For example: was it jerky, did the enemies stroll around aimlessly, or perhaps their movements were too predictable? \$\endgroup\$ – Willem Mar 26 '14 at 15:06
  • \$\begingroup\$ My question was more about getting a "general approach" to this sort of thing. But I will update my question with what I have for now \$\endgroup\$ – Malharhak Mar 27 '14 at 17:59
  • \$\begingroup\$ You may find the GDC 2012 "Crowds in Hitman: Absolution" slides useful: gdcvault.com/play/1015315/Crowds-in-Hitman \$\endgroup\$ – leander Mar 27 '14 at 18:12