Skip to main content
2 of 3
added 189 characters in body

Ensure a path always exists between moving objects

I am working on a small game where monster are coming towards player in random direction, sort of the very simple asteroid shooter game. It kind of works, but I sometimes face a situation where player is doomed: monsters are popping in such a way that it is impossible for player to find a way out.

I would like to get rid of this frustration by, upon generating a new monster, ensuring there will always be a way out for the player. Point is that it does not, to me, looks like an simple static pathfinding-like problem, since:

  • I just have to make sure a solution exist (maybe easier than finding one ?)
  • Objects are moving
  • Objects and player can collide

Note: I am not looking for any type of cooked solution, just some references to existing algorithms, implementations,... to look into by myself.

I understand this fairly looks like collision prediction, but what I am looking for is a solution in which a path exists without such collision, which might be a slightly different problem, at least new developers in the domain such as myself...

edit: Generating monsters in a random-like direction seems OK to me, as long as it does not feel like the pattern is "static" and they all can be avoided by following always that same pattern.