Skip to main content

Spiteful Hangover

The spite project was our first project where we as a group worked towards a predetermined reference game, Diablo, acting as an extension of all previous TGA Spite projects.

My role included implementing a navmesh to our custom engine using the Recast library, creating pathfinding for all moving entities within the game, working on enemy logic aswell as spawning and creating the boss at the end of the game.

Recast Implementation
#

Recast in its whole is a navmesh generator, capable of outputting necessary data from meshes to create a navigational field for a game. It also includes “Detour” that uses the navmesh data to perform agent movement. For this game, we included only the navmesh generation and handled agent movement on our own.

The implementation and usage of Recast was divided into three parts

  • CreationTool
  • NavmeshWrapper
  • NavmeshSystem

CreationTool - Included
#

Our custom engine was built using the schools engine as a base foundation which came with the Recast library and the CreationTool class that saved a .obj file from the vertices and polygons created.

Wrapper
#

I created the wrapper to handle the outputted .obj file from the creator. On initialisation of the current scene, it would read the corresponding .obj file and fill the data needed. Recast makes that easy, saving the vertices with “v x, y, z” and face indices as “f 0, 1, 2”. This makes the filereader simple to create resulting in a struct where the data is purely:

struct Mesh
{
    std::vector<Vector3f> vertices;
    std::vector<int> indices;
};

And thats the mesh. Only thing missing to make it into a navmesh is connections. For that end, I created a vector of nodes where I passed the mesh data

for (int nodeIndex = 0; nodeIndex < myMesh.indices.size(); nodeIndex += 3)
{
    Node newNode;
    newNode.indices[0] = myMesh.indices[nodeIndex + 0];
    newNode.indices[1] = myMesh.indices[nodeIndex + 1];
    newNode.indices[2] = myMesh.indices[nodeIndex + 2];
    newNode.center = (myMesh.vertices[newNode.indices[0]] + myMesh.vertices[newNode.indices[1]] + myMesh.vertices[newNode.indices[2]]) / 3.f;
    newNode.id = nodeIndex / 3;
        
    myNodes.push_back(newNode);
}

System
#

Pathfinding
#

This is me explaining the pathfinding and how it works

Boss
#

This is me explaining the boss and its states

Trailer & Screenshots
#

#

Related