Skip to main content

Collection Game

Written by: Akram Taghavi-Burris | © Copyright 2024
Status

Our plan is to take this simple prototype game and refactor it to allow for scalability and reusability. By implementing various design patterns and adhering to SOLID principles, we aim to create a modular architecture where base components can be easily adapted and reused in multiple game projects. This approach will enhance maintainability, facilitate updates, and enable the addition of new features without disrupting existing functionality.


Game Design Brief

Overview

  • Title: Apple Picker
  • Genre: Action / Collection
  • Platform: PC/Web
  • Target Audience: E for Everyone

Game Concept

Apple Picker is a 2D action game where players control a basket to catch falling apples from a moving apple tree. The objective is to catch as many apples as possible before any apple falls off the screen. This game serves as a simplified version of the classic Kaboom!, featuring a single endless level and a limited number of baskets.

Game Level Requirements

  • Minimum of 1 game level.
  • Heads-Up Display (HUD) that displays both high and current scores.
  • Menu and End Scene will be included in the final game build.
  • Golden Apple: A special collectible worth 200 points.
  • Good Flow: Levels have a logical progression and follow an S-curve challenge flow.

Game Objects

  • Baskets: Controlled by the player using mouse movements, these catch falling apples and contribute to the player's score.
  • Apples: Dropped from the apple tree, falling straight down. Apples that fall off the screen cause all other apples to disappear, resulting in the loss of a basket.
  • Apple Tree: Moves left and right randomly while dropping apples at regular intervals.

Game Controls

  • Mouse Movement: Controls the horizontal movement of the baskets.
  • ESC Key: Quits the game.

Game Flow and Mechanics

Start Screen

  • Features a splash image, instructions, and a start button to begin the game.

Main Gameplay

  • The apple tree randomly moves left and right, dropping apples at regular intervals.
  • Players move the baskets left and right with the mouse to catch the falling apples.
  • Each apple caught increases the player's score.
  • If an apple falls past the bottom of the screen, all apples currently on the screen disappear, and one basket is lost.
  • The player starts with three baskets. When all are lost, the game transitions to the end screen.

End Screen

  • Displays the final score, high score, and options to play again or quit.

Game End Conditions

The game ends when the player loses all three baskets.


Design Patterns and Principles

To achieve scalability and modularity in Apple Picker, we will implement the following design patterns and principles:

SOLID Principles

  • Single Responsibility Principle: Each class will have a single responsibility, making the codebase easier to maintain and extend.
  • Open/Closed Principle: Classes will be open for extension but closed for modification, allowing new features to be added without altering existing code.

Design Patterns

  • Object-Oriented Design: Utilizing interfaces and abstract classes to promote reusability and flexibility in the game's architecture.
  • Singleton Pattern: Implementing a MovableController as a singleton to manage the game's movable objects efficiently.
  • State Pattern: Using states in the Movable class to handle various object behaviors, such as moving, paused, and stopped.
  • Observer Pattern: Employing an observer pattern for event handling, allowing game objects to respond to events without tight coupling.

Scriptable Objects

Implementing scriptable objects for collectibles to facilitate data-driven design. This allows for easy customization and updating of collectible properties (e.g., point values, behaviors) without modifying the core gameplay code.

Summary

Refactoring is an integral part of the iterative game development process. By initially creating a quick prototype of Apple Picker, we can rapidly test core gameplay mechanics and gather valuable feedback. This prototype phase allows us to identify strengths and weaknesses in our design. Afterward, we will refactor the game with a focus on scalability and performance, ensuring that the architecture can support future enhancements and new features.

Implementing these methodologies, such as design patterns and SOLID principles, not only enhances the maintainability of our code but also facilitates collaboration with team members. A modular design allows different developers to work on various components simultaneously without stepping on each other's toes. This collaborative approach fosters creativity and innovation, ultimately leading to a more polished and engaging gaming experience.