About this blog
Development of a 3d stealth rpg
Entries in this blog
My last entry was over a year ago - but I'm still alive. Now that the major coding phase for my master's thesis is behind me, I find myself tinkering again in my spare time.
Here are some of the major changes since last year:
I really wanted access to some of the DX11 features and the SharpDX toolkit makes the transition from XNA very painless. I was never really a big fan of XNA's content pipeline, so I created my own. Turns out, Assimp is a a lot faster, more flexible, and robust than XNA's importers and crunch does an excellent job of compressing textures.
I always thought the math involved in skeletal animation was scary. However, implementing it for myself was surprisingly easy. Besides simply playing and mixing animations, I can now easily sync gameplay actions with events embedded in the animations.
While working on the AI, I realized that the classic waypoint graphs weren't working for me anymore. They had to be way too dense in order to allow the kinds of behaviors I wanted. So now I entered the 21st century and use navmeshes that are automatically generated from the level geometry. Since the walkable areas are 2D, I use the excellent libraries Clipper and Poly2Tri to generate and triangulate the meshes.
I've mostly been working on the AI lately, because without an AI that gives the player at least somewhat of a challenge, a stealth-based game would be rather boring. Behavior trees seem to be very popular these days, so I implemented the basic node types using iterators in C#. "Abusing" iterators for anything other than lazily evaluated collections is a lot of fun, although it certainly takes a moment to wrap your head around the unfamiliar control flow.
In my specific case, I found behavior trees to be awesome for fine-grained behaviors. For example, when one of the enemy avatars hears a suspicious noise, I want it to stop for a few milliseconds, turn around, raise it's weapon and look around for a couple of seconds. Using behavior trees makes that very easy. For higher-lever AI though, like deciding the most probable position of the player and doing a systematic sweep of a room (possibly with the aid of some allies), a simple hierarchical state machine turned out to get me the desired result much quicker and with less code.
I decided to use an influence map to allow the AI to track the player's position. Unfortunately, the enemies would often run around in circles because by the time they had investigated one corner of the room, another, already visited part of the room had filled back up. Tweaking the momentum and decay only got me so far, so I added an additional "channel" to the map to slow down the momentum for areas the AI had already visited. I'm pretty happy with how it turned out, the AI seems considerably less stupid now.
Here is a screenshot of my avatar being chased by an enemy:
Better quality: 
For the past several months, I've been working on what is supposed to become a 3d top-down action-rpg with a focus on stealth and subtlety. Now that the engine is working adequately well, I wanted to start this journal in order to make me focus more on actual gameplay. After a couple of exams in the coming weeks, I hope to put together a small demo for all of you to try with some preliminary gameplay.
This is what it looks like so far:
Better quality: