Skip to content

alienown/Left4Dead

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Left4Dead

A computer game created for the purpose of passing the Advanced Programming Techniques course. The purpose of the project was to implement several programming patterns. As a player you have to survive waves of zombies that want to kill you.

Main menu

image

How to play:

image

Game interface

image

Used programing patterns

The project includes the following patterns:

Singleton

  • Use case: There is one only one player in game. Player object should be created only at the beginning of the game

  • Player class is singleton

  • Lazy initialization: create only when game starts

  • When game ends, player object is disposed

  • UML diagram:

    image

Builder

  • Use case: user should be able to change interface look & feel

  • InterfaceDirector directs the building process using IInterfaceBuilder

  • There are three builder implementations:

    • DefaultInterfaceBuilder

    • MathematicsInterfaceBuilder

      image

    • RainbowInterfaceBuilder

      image

  • Builder creates Product class that contains interface look & feel properties

  • UML diagram:

    image

Decorator

  • Use case: zombies should drop loot. Dropped objects should vary in attributes. Harder to kill zombies should drop more appealing loot. What matters is flexibility and complete freedom in loot design.

  • There are different objects that zombies drop: Sniper rifles (SniperRifleDrop), AK47's (AK47Drop), Health packs (HealthPack), Ammo packs (AmmoPack)

  • Bonus class is a decorator that adds additional value to dropped items

  • UML diagram:

    image

Strategy

  • Use case: player can change game difficulty. Different difficulties should affect gameplay. Right now it affects zombie spawn rate and zombie kind

  • There are three difficulties:

    • Easy: only normal zombies are being spawned. Spawn interval is constant - it doesn't change throughout the game
    • Medium: normal and tank zombies are spawned. Zombie kind is chosen based upon player score. The better player is, more tanks will be spawned. Spawn interval is random
    • Hard: normal, tank and hunter zombies are spawned. Spawn interval and zombie kind depend on player score and his health. If player is at high health, more zombies are spawned
  • ZombieMaker is a context class that is responsible for creating zombies

  • Spawn interval and zombie kind is chosen in difficulty classes: EasyDifficulty, MediumDifficulty and HardDifficulty classes

  • The context class is passed to difficulty implementations that modify its properties

  • UML diagram:

    image

Template method

  • Use case: Although there are different kind of zombies, each with unique abilities, their life-cycle is the same. Their goal is to follow player and hurt him

  • Zombie is an abstract class containing LiveTemplateMethod method

  • There are three kind of zombies:

    • Normal
    • Hunter: can jump from a long distance to player location
    • Tank: can throw player on a long distance. A player is stunned for a short time upon stopping
  • Concrete zombies (Tank, Hunter, Normal) override life-cycle abilities to drop loot (DropGoodies), add player score upon death (AddScore) and follow player (FollowPlayer)

  • UML diagram:

    image

State

  • Use case: zombies can change their behavior based on their health points

  • There are three states that zombie can be in:

    • Normal: the usual zombie behavior
    • Angry: only normal and hunter can enter this state, a zombie can also move diagonal now, can push other zombies that are not angry
    • Enraged: only Tank can enter this state, can also move diagonal now, instead of pushing zombies away, tank kills other zombies that are on his way to player
  • A zombie can only transition from normal state to either angry or enraged

  • Each state implementation can trigger a transition to another state based upon zombie health using MakeUpset zombie method

  • UML diagram:

    image

Observer

  • Use case: The game architecture is based on threads. Every zombie in game is a different thread. Also push tracker that tracks player stun time, jump tracker that tracks hunter flight, or zombie maker, these objects are also threads. There is a need for notify mechanism which tells threads when game pauses so that they will sleep and wait until game is resumed

  • Observer represents an object that can be pasued, Subject allows for observer subscription

  • UML diagram:

    image

Iterator

  • Use case: Player scoreboard should be pageable image

  • There are 10 scores on a single page. GetPage returns at most 10 scores

  • ScoreAggregate contains list of all scores

  • UML diagram:

    image

About

A simple computer game created for the purpose of passing the Advanced Programming Techniques course.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages