For the past month I've been working on a top down 2D stealth prototype. The game itself will evolve into much more than a stealth game I hope. I have bigger ideas for it, but for now I want to explore some of the concepts and ensure they will work.
So like most prototypes you start off drawing simple shapes, or using very little art, much like below:
As you can see the walls have boxes around them which are collidable bodies. The first level here is static. It's broken up into individual parts, and placed relative to each level. Using libgdx this process was actually fairly straight forward. What took some more doing was getting the camera to clamp to the edges of the level, while still following the player.
Movement with box2d, even arcade movement is pretty straight forward. Just have to set linear velocity accordingly. I've read from others in the past "don't use a physics engine for a platformer!". Honestly, I disagree. While you can point to funny examples like Box2D tetris, using it correctly can yield a lot of benefits. AABB collision & correction can be simple, but once you want to use polygon shapes, or triangles. I have 45 degree angle walls for example. It gets much harder on the math. I'm not very good at physics stuff, so I leverage Box2D.
Once the level got layed out, it needed some guards:
The guards have a cone vision, very similar to that of metal gear solid. The AI is super simple right now. There's two modes: chase or shoot. Both types start off patrolling from one point to another. If they catch you in their cone, they switch to their designated mode. The Chase one is pretty straight forward:
The red signifies you've been spotted, and the npc will chase you. If the npc catches you, you're done. If you get away, the NPC goes to your last position and looks around for a second:
It's pretty neat, but I have to say i'm not finding it compelling enough. I'm going to explore more group mentality with the NPCs in the near future. The AI in a stealth game needs to be perfect. For the shoot npc, if you get caught you die. They are very unforgiving, and will shoot you quickly and deadly.
The general view for the character at this time is completely non violent. They will use cunning and technical skills to hack around their enemies. Once I get the AI the way I want it, hacking puzzles and work arounds in the level is what I will explore next.