Centipede Re-creation
The Centipede re-creation was an exercise to practice game software development skills on a medium scale project in C++. The game was built in 10 weeks for a class called Object Oriented Game Development. Centipede allowed me to get concrete experience with the implementation of design patterns.
The Centipede re-creation was an exercise to practice game software development skills on a medium scale project in C++. The game was built in 10 weeks for a class called Object Oriented Game Development. Centipede allowed me to get concrete experience with the implementation of design patterns.
This is the game of centipede. The main enemy slithers across the screen and loops downward every time it hits a wall or a mushroom.
The player is confined to the bottom portion of the screen and can shoot a laser bullet upwards towards the enemies.
Other enemies such as the spider, flea, and scorpion can spawn on different levels. They all interact with the map in different ways, and have different stats for each level.
This image shows two player mode, each player gets their own map, score and lives.
The game data is read in from a text file and can be easily edited to create new levels.
The spider zig-zags across the screen, the flea drops down and spawns mushrooms, and the scorpion turns the mushrooms poison.
State Machines
Centipede
The main enemy, the centipede, uses a state machine to navigate the level. The states allow the centipede to be moving horizontally, turning up or down, and to be poisoned.
Main Menu AI
The AI in the main menu is using a very simple state machine to move around and fire. He needs more practice...
Efficient Player Control
Player Control
The player control is implemented to accommodate various control modes using the strategy pattern.
Bullet Movement
The bullet has two movement strategies: follow the player or fire upward.
Score and Sound Command Systems
The score system and sound system utilize the Command design pattern. The commands are registered by other objects and then simply executed upon an event occurring.
Score System
The score data is consolidated here and associated with each command.
Sound System
Likewise, the sound system controls all of the sounds with commands. This allows all game sounds to easily be adjusted and muted.
Simple Factories
Factory Interface
The program uses simple factories and object pools for every destructible object, such as the enemies. This encapsulates and simplifies memory management.
Flyweight Text
The display system uses flyweight elements called Glyphs to convert a character into a sprite using the game font. The Glyphs are grouped into GlyphString objects to be used in the HUD.
GlyphString
Glyphs in action...
High Score Input
The game allows the player to enter a high score if they score enough points.
The high score list in the main menu is updated with the players name and score.
Display Strategies
The Heads-Up-Display uses a different strategy for each game mode, displaying different text for the main menu, single player, and two player modes.
Attractor
Single Player
Two Player