Project Description
In this project my goal was to create clone of the Call of Duty: Kino der Toten zombie game mode. I made this as a 2D top down shooter in SDL2 whilst trying to make an ES Engine/Framework to create my game off.
Video of Gameplay
Overall, I am quite proud of the end result. I think the codebase came together quite well and the finished product game a feeling of the original zombie's game mode.
Currently I know of two bugs: Enemies spawning outside the map and the death screen being off centred occasionally.
An explanation of the spawning out of the map will be discussed in the later section.
Engine Architecture
For this project I created an engine using an Entity System (ES).
Scene:
A scene is a collection of Game Object and their Components.Game Object:
An abstract concept of an "object" in the world. A Game Object has no behaviour. The behaviours are added with Components. Game Object always have a Transform by default (position and rotation).Component:
A behaviour that is added to a game object.
I took this approach as I feel like it would simplify the gameplay coding a ton as no system work such as rendering, collision, audio, etc., needed to delt with in the gameplay coding. This helped abstract out the system code from the gameplay code, trying to ensure that SOILD principles are followed throughout development.
Using and ES really helped development, however there were some drawbacks and lessons to learn from it. The biggest issue was due to waste of method calls. Whilst this can lead to poor performance, for this scale of a project, there was no issues. The wasted calls came from some components requiring an Update method, whilst other not. So when it came to static objects such as the walls, each wall has 2 components, with an approximation of 700 walls, there are about 2100 wasted update calls (components and game object Update). This is a down side to the ES system and a better approach would be to abstract out the component management into a system, making it an Entity Component System.
The engine had two configurations: Debug and Release. In debug mode optimisations were not enabled and there were additional debug renders to the screen for things like colliders, sprite size, and triggers. Release mode was with the optimisations enabled and all the debug output/checks stripped out.
Loading methods and Gameplay
For the gameplay side of the programming, I spent quite a bit of time on the level loading as well as the gun loading. This was mainly for two reasons:
It makes the game more flexible and easy to add additions in the future, with very minimal gameplay code to change.
It keeps room for improvement and thought of working on this project in a bigger team. If the engine was made properly and on a larger scale, the values would be serialized or exposed in the engine, therefore having the loading system load from a file means that this would fit well in a serializable engine. This helps for when, for example, a designer is looking at balancing/adding more levels/guns.
In terms of gameplay there are quite a few editions that I tried to add in order to make the game feel similar to the original.
Some of these additions include:
Perks: The player has the ability to purchase perks in order to give their stats a boost to help survive longer.
Interactable triggers: These triggers were used in the purchasing of perks and doors.
Pop-ups: Some text pop-ups were used to tell the player when they had to reload, the price of perks and doors.
"Story" conditions: In the original Kino der Toten zombies, the power had to be turned on before perks could be purchased, I added this Lore into the game with relevant feedback by pop-ups displayed.
Issues and Improvements
Zombies spawning outside the map:
The reason this happens is due to the pathfinding of the zombies. The zombies follow a simple movement pattern of moving the player regardless of obstacles. This causes an issue in the following example:
Player is at the Northern point of the map (above a spawner), a zombie spawns and walks up directly into a wall, second zombie tries to spawn causing the collision system to push the zombie outside the wall.
A "fix" that I added was to fill the in-between gaps with box colliders, this means that eventually they will be pushed back into the map. A proper fix would be to fix the pathfinding - which is one of the biggest drawbacks of the game.
Having something like A* making the enemies navigate around a map would make the gameplay a lot more intense as well as more enjoyable. As seen in the video, gameplay can have movements of slow traversal from North to South to get to the zombies who are running into walls.
I did try implement an additional cooldown to each spawner making that two zombies don't spawn soon after each other, however this does not solve the problem as if the player stays on the Northern side for most of the game, the first zombie will be stuck there for most of the game, so there is no fixed cooldown that could work.
Better graphics and feedback:
Better graphics would enhance the gameplay and make it more enjoyable. Simply adding floor textures, would make the environment feel more immersive and the overall playable experience better.
For feedback there could be lots of additions to make the game feel more playable. Lighting making it feel more tense, hit animations for when bullets collide, shooting feedback etc.
Overall these would enhance the feeling of the game but require a lot of art assets, which is out of the scope of the project.