Skalv is a fast-paced First Person Arena Shooter, in a demon infested world. You need to shoot and blast yourself through hordes of demons in order to reach the evil skull.
Problems I Encountered
We had a problem in our game with making the AI jump, as we didn’t thought we had time to tell our level designers to put jumping pads between every height difference and connect them we thought we needed a better solution.
First of all we decided that we didn’t have time to implement actual jumping and settled with teleportation instead. It is easier and since our enemies are demons it fits within the games boundaries.
So I came up with the algorithm here to the right. It starts of to check that if the end of the AI’s path doesn’t end with the player, then the player is on another part of the navmesh that we need to get to. So we then pathfind from the player as close as we can get to the AI and if those two ending points are close enough to each other then we have our connection and we are done. If they are too far apart then we get the middle point between them and work out the closest point on navmesh to that one, we then choose that point and teleport to it. I also make all the vector math in 2D because we didn’t want the AI to be limited to how high up it could teleport.
I think that if would have had another game with more advanced level structure we would have run the algorithm either recursively or at least till we are absolutely sure that they are close enough to connect for a teleportation. For this project however our solution worked very well and made sure that the AI never walked into walls and looked stupid.