Feb 072013

Just finished the new escape system I wrote about (here) and everything seems to be working so far.

With standard game pathfinding, you pick an NPC and tell it where to go. It then calculates the shortest path to get there and follows it. This works fine in most cases: make a noise, the npc goes toward the noise to investigate; a cop sees you, walks towards your position and shoots, etc.

Designing a system where NPCs flee from you is a bit more complicated. People being afraid of you is kind of the whole point to a game like this. If they see you they should run away, towards an exit or hide. However, because standard pathfinding calculates the shortest path to a point, if you’re standing in that path, instead of running away from you, the NPC with run towards you to get to the exit. This breaks the game.

I won’t go into the old system I had set up (you can try it in Halloween Beta 3.2) but it had a major problems scaling to larger levels and didn’t work in the more linear areas. So I came up with something new.

The game takes the node that the player is standing closest to and switches it off. The nodes surrounding the player are taxed and picked last, so the NPC won’t run by the player unless there is no other way.

The npc then calculates a path to each exit point (up to 2 per level) and picks the shortest one. Each time the NPC reaches a new node on that path, it draws a new path. Because the player is always moving, the NPC needs to take the player’s new position into account at every node.

If the player is spotted, the NPC spins around in the opposite direction, screams, and draws a new path. If they ever get cornered, they give up and surrender.

The good news is that the debugging to make all of that work is probably the biggest pain the the ass I had left for completing the game.

 February 7, 2013  Posted by at 4:12 pm Sanitarium Massacre  Add comments

  6 Responses to “New Escape System”

  1. sounds awesome? I just have 2 questions:
    1. do you know when this will get released?
    2. could you please make a short demo to hold us over till it gets released?
    anyway, good luck! hope the project is going well?

  2. 1. 6 months to a year
    2. Probably not. Making demos takes away too much time from finishing the full game.


  3. Calm down Brad! Remember, life comes first. He’s currently working on two projects. One is this and the other is Minotaur. Demos like he said take forever! To get some idea of what it will be like there should still be the old HalloweeN demos up for download, all that will be different in the final game is the character. Don’t quote him on the six months to a year either. It could be three months, it could be three years. He’s been working on it for over ten years already and has still done more single handed then a full team of AAA game developers.

  4. All ways remember on pig farmers old site getting exited when he announced a new demo, of course majority never happend.

  5. Sounds like a pretty cool (and terribly complex) system. I’m really looking forward to the full game.

 Leave a Reply



You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>