Monday 10 September 2012

Project "Lead" Update #2

Previous Blogpost:
http://ahamnett.blogspot.com/2012/07/project-lead.html

What features have you added since the last blogpost?

In the last update, I said that I'd be working on weapons, animations, AI and some art assets. Of those four I pursued two, the weapons and AI.

I've extended the weapon structure to allow for different types with different fire modes (assault rifles, shotguns, etc.) as well as moving some of the statistics into an external XML format. As such, I can now add new variants of existing weapon types by just creating a new XML file and including it in the WeaponManager class.

AI has been the biggest area of growth however. The previously created targets now have some rudimentary AI, which allows them to wander about the environment, investigate sources of sound (like gunfire) and chase the player if they are spotted.


What technical aspects have you explored for these features?

For these features I've had to research XML serialisation in order to make some areas of the project external. In addition, I've also had to refresh my knowledge on AI basics like Finite State Machines, Pathfinding Algorithms and Navigation Meshes. In particular, I've been looking into a technique known as the Funnel Algorithm for generating the path vertices from a list of triangle nodes.

What makes the Funnel Algorithm special?

One of the more commonly suggested methods for generating path vertices from a list of triangles is to simply take the centre point from each connecting edge and then remove any redundant vertices using a path smoothing algorithm. The problem with this approach is that, depending on how large the triangles are, this can cause odd-looking behaviour where characters will walk in a wide arc around corners.


The Funnel Algorithm instead works using the edges of the triangle corridor, or "channel", that you create from pathfinding. This way, any corners that need to be navigated around are done so as efficiently as possible. In addition, the algorithm output does not require any post-smoothing since it finds the furthest visible vertex position before moving onto the next.

What features are you planning on working on next?

Currently I'm working on making the level data (floors, walls, etc.) serialisable so that it's easier to edit without having to change any code. This will be somewhat more interesting than the weapon statistics and navigation mesh because it will involve custom content readers for referential entities like the player and weapons.

After that, it depends. Development will likely soon be shifting onto a more focused approach in order to develop an actual game (rather than a tech demo for various game elements). As such, I may consider taking some time out to develop a level editor so that I can more easily create and edit map data. In addition, I would likely also spend some time trying to develop a navigation mesh generation algorithm to go along with it.