This is a survival game that the player should kill a number of zombies in the game in order to survive and win the game.
The zombies spawn around the city and will hit the player when they get close to him/her.
Each time that a zombie hits the player the screen will turn red and the player will lose some health. Player loses when he/she gets out of health.
The color of the zombies is represented as their health amount, the lowest their health is, the redder they turn.
In order to survive, player is faster than zombies, and it has a gun to shoot from and kill zombies.
Different parts of the game:
The game itself has 3 main parts, main menu, settings and playground.
- Main menu is the first part that you will see. From there you can start the game, change the setting of the game and completely close the game.
- On the settings section you can change your mouse sensitivity, field of view (FOV) of the camera, the number of zombies that player should kill in order to win the game and the difficulty level of the game.
- When you start the game (in the playground section) you can see your gun heat bar at the left-bottom of the screen, the player’s health on the left-top of the screen, number of zombies that spawn, and the number of zombies that the player killed and should kill in order to win the game on the right-top of the screen.
The challenges of the game
- Time is the first challenge for the player as the zombies will spawn every 30 seconds.
- Each time that the player shoots at a zombie the zombie’s speed increases depending on the damage that it takes.
- And every time that a zombie hits the player, the zombie’s health will be fully revived.
- The gun has an unlimited number of bullets but with each shot it will heat up and will take some time to cool down so the player can’t shoot rapidly for a long time.
The mechanic of the game
- You can walk with arrow keys or WASD keys on the keyboard and the camera is placed on the head of the player, and you can rotate and see around by moving the mouse.
- Shoot with left mouse button.
The Algorithms and techniques that I used
- To generate the city, I used Perlin noise because of two reasons:
- First, I wanted the buildings of the city to have a new look, and roads and the path to be unpredictable to player every time that the player replays the game.
- Second, I want the city to be procedural generator and unlimited for the future versions of the game.
- For zombies to follow the player, I used AI Navigation unity package.
- Also, I did not use random functions to spawn zombies in the city, instead, because I wanted the zombies to surround the player and the player spawn at the middle of the city, I used some trigonometry to make a circle around the player to spawn zombies equally around him/her.
This figure shows the calculation. I made it with sine of angle (as Y component of a vector) and cosine of angle (as X component of a vector) to convert angles into positions then I used OnDrawGizmos function inside unity to draw spheres at positions that we calculated earlier.
(Figure 01)
I used the same calculation here in the project to surround the player with zombies at the beginning of the game.
Green cubes represent positions (white spheres) that I made in the last figure (Figure 01).
Blue cubes detect the street injections around the green cube.
And red cubes are the nearest street injection to the green cube. Red cubes are the positions that zombies spawn from.
(Figure 02)