Friday, June 7, 2013

Beginnings of a Sneaking Game

Inspired a bit by Monaco as well as the movie Safety Last, I've been working on a game where you attempt to bypass a guard.

I'll admit that the connection to Safety Last seems tenuous right now. Perhaps I'll bring it together by the end of the month.

So far, the player (the pink dot) can move around the level and bump into walls. The cop (green dot) patrols around the center of the level.

It won't be hard at this point to add in a ray cast from the guard to the player to see if the guard can see the player. After that, adding in some better AI for the guard will consist of:

  • scripted patrol path - right now, he's on a circular track, moving at a constant velocity. I imagine him having a series of waypoints, with ability to stop in place and turn to face a specified destination (usually his next movement waypoint, but adding in times when the guard loops the opposite direction will make him harder to evade).
  • Pursuit - when the guard sees the player, the guard will break off his scripted path and follow the player. If the guard loses sight of the player, I want to have him head to the spot where the player was last sighted, look around, and if there's nothing there, then break off pursuit.
  • Return to patrol - this might be the trickiest part - being able to navigate back to the patrol path and pick up the patrol script. I could do a pathfinding approach, which would be complex, but fun to implement (I hope), or I could do something simpler, like dropping breadcrumbs during the pursuit, and then following them backwards to retrace the guard's steps.

No comments:

Post a Comment