"Your village has been corrupted by a parasitic blight. With your god-given powers, you must fight your way deeper into the swamp to destroy the source."
Spite is our sixth game project at The Game Assembly, and is the first game we made in our very own engine. The engine is running DirectX11 and PhysX. In this game I had a lot of focus on navigation and enemies. I had to develop my own navigation mesh, which reads an .fbx navmesh created from Unreal Engine. I also wrote all navigation in the game, including pathfinding and path smoothing, which uses my own navmesh to function. I also worked on the AI of the enemies.
This was the first game where we had to make more intelligent AI, and moreover it was also the first game in our own engine. We used Unreal
Engine to build our levels, and then export them from unreal as a json file which we use to load the level into our engine. Unreal also exports its navmesh as a .fbx. I use this .fbx to get all vertices and indices from the unreal navmesh, and use it to create navtiles. After that I connect all neighboring navtiles to each other, and save it as a complete navmesh.
After that, a pathfinding algorithm is up. I decides to use Astar, a classic and proven pathfinding algorithm. But the algorithm only returns which navtiles the player should walk over for the fastest path, not where it should walk on said tiles. So we also need a path smoothing algorithm to reach the finnish line.
I decided to use a funnel algorith from DigestingDucks blog, and after putting it all together, we now had enemies and a player that can navigate the environment naturally and find their way around objects.
For this project, I developed a system I called crowd nodes for enemies. They generate by themselves after the level is done importing all enemies. The code then finds groups of enemies clumped together, and creates a crowd node for the group. When one enemy gets aggroed, it sends a message to the crowd node, which in turn aggroes all enemies paired to the node. The crowd node also remebers the starting positions of all paired enemies, and gives them the information they need to find their way home should they drop aggro. The crowd node also works as a LOD system for enemies, deactivating all enemy behaviors should the player be too far away from the node.