0
\$\begingroup\$

I'm working on a turn based strategy game (like Jagged Alliance), where the player moves his units individually during his turn, while the enemies (zombies) all move and react simultaneously.

I use potential fields for determining where the enemies should go. But I haven't decided yet if the units are only allowed to move in 8 directions, or if they can move in a straight lines when no obstacles are in between several tiles (eliminating zig-zag effect). Using 8d is probably a lot easier for this particular problem.

Steering behaviors seem to fit the bill quite nicely, but they do not go very well with the grid-based world (a unit should always end up within a tile), nor are they deterministic (how many AP did this unit consume). At least I never got it to work very well.

I also briefly considered Silver's cooperative pathfinding, but it does not work too well for units with slight speed differences (or it does given sufficiently small timesteps, but it consumes a lot of memory and processing power).

Any ideas on how to tackle this problem are greatly appreciated!

\$\endgroup\$
  • \$\begingroup\$ What's AP? Could you be more specific about what units need to do and in what way they're currently failing to? \$\endgroup\$ – Anko Sep 25 '15 at 0:45
  • \$\begingroup\$ AP stands for Action Points. Each action (move, attack, etc) costs certain amount of points. For example, one unit might use two AP to move one tile, others might only need one. Basically like most other turn based strategy games. The difference is that while the player commands his units individually (i.e. only one moves/uses and action at a time), ALL AI entities will move/perform actions at the same time. This causes problems in f.ex. pathing, due to blocking. EDIT: Should clarify that the player and AI take turns in moving their units. \$\endgroup\$ – Painless Sep 25 '15 at 4:43
  • \$\begingroup\$ This is absolutely not a trivial problem. I think I would try to treat the zombies as if they acted one after the other, trying different movement order permutations for each turn in a Monte Carlo fashion. Then check for collisions in the best solution and tinker with it until no more collisions occur. It's an approximation but it might give good-enough results and could be made quite fast, as long as collisions aren't too frequent. \$\endgroup\$ – Christian Sep 28 '15 at 16:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.