Zombie Killer

Zombie Killer is a first-person shooting game where the player is at the center of a city, surrounded by zombies. The goal is to kill a specific number of zombies to win while surviving and avoiding zombie bites.

Created In: 2022
Collaboration: Made it Myself – Solo
Link to Play the Game: m4tin – itch.io
Game Engine: Unity- C#

In this game, I used C# delegates and followed Observer design pattern to manage class communications. like communication between the game manager and player health and zombie health.

Also, I used Unity coroutines to make the code easier to read, handle, and maintain. Like the code example below in the Shooting and Bullet tap.

Pure CSS3 Tabs
  • GameManager

  • PlayerHealth

  • Zombie Health

  • Shooting

  • Bullet

Pure CSS3 Tabs
  • GameStateController

  1. Main Menu Settings:
    Before starting the game, players can adjust:
    • Mouse Sensitivity
    • Camera Field of View
    • Game Difficulty
    • Number of Zombies required to win
  2. In-Game Settings:
    While playing, players can still modify:
    • Camera Field of View
    • Mouse Sensitivity

This setup ensures flexibility and allows players to tailor the game experience to their preferences at any time.

Pure CSS3 Tabs
  • Settings

In the game, there are four difficulty levels: Easy, Normal, Hard, and Impossible. Each difficulty mainly affects how the zombies behave.

As the game gets harder:

  • Zombies walk faster.
  • They spawn more often and in strategic intersections to surround the player.
  • Their idle time between attacks gets shorter, so they attack faster.
  • Players also need to kill more zombies to win the game.

These changes make the game more intense and challenging with every difficulty level.

Each zombie in the game has health, walking speed, and biting speed properties.

  • Health and Color:
    • A zombie’s health is represented by its color:
      • At full health, the zombie is green, and its speed is normal.
      • At low health, the zombie turns red and walks faster.
    • When the zombie’s health is restored to full, its color returns to green, and its speed returns to normal.
  • Biting Speed:
    • Game difficulty affects the zombies’ biting speed:
      • At the hardest difficulty, zombies bite faster and more rapidly.
      • At the easiest difficulty, they bite slower.
  • Health Restoration:
    • Each time a zombie bites the player, it fully restores its health and returns to its original color.
  • Navigation and Custom Algorithm:
    • Zombies navigate through the town using Unity’s AI Navigator plugin, which handles pathfinding and following.
    • However, turning toward the player and biting animations are controlled by a custom algorithm I created. This algorithm involves math designed specifically to enhance the zombies’ behavior.

This combination of Unity tools and custom logic creates zombies that are both dynamic and challenging, adding depth to the gameplay.

Pure CSS3 Tabs
  • Zombie

Instead of a traditional bullet gun, the game features a heat-based gun mechanism to match its scary vibe. This system prevents the player from shooting rapidly when surrounded by zombies, adding tension to the gameplay.

  • Heat Mechanism:
    • The gun heats up with continuous shooting, eventually preventing the player from shooting until it cools down.
    • This limits rapid shooting in situations where the player is surrounded by zombies, adding strategic pressure.
  • Visual Feedback:
    • The gun’s heat level is displayed using a UI bar and by the gun’s tip, which turns red as it heats up.
  • Implementation:
    • Shooting and gun heat are managed using separate coroutines to simplify the code, reduce unnecessary checks, and improve maintainability.
    • This design ensures cleaner, more modular code that is easier to expand and maintain for future development.

The heat-based gun system enhances the game’s tension and aligns with its overall atmospheric design.

Pure CSS3 Tabs
  • Shooting

When creating this game, I prioritized programming over 3D modeling since I didn’t have much experience with modeling at the time. The game design uses simple shapes, such as cubes of varying sizes for buildings and capsules for zombies, to keep the visuals straightforward and focus on functionality.

  • Map Generator:

The city generator uses Perlin noise to place buildings with different sizes and colors each time randomly around the city.

In order to surround the player with zombies, I used angle to vector mathematic technique to create areas around the player to spawn zombies.

The zombie spawner areas will detect the intersections and empty areas on the map and spawns the zombies exactly at the street intersections, avoiding spawning any zombie in/on the buildings when the map is procedurally generated.

To fully take advantage of this technique I increased and decreased the zombie spawner areas based on the game difficulty level