Gameplay demo of 'Sea Snake', showcasing the custom linked list body, underwater breath mechanic, sinking water level (and water spray particle effects), fruits growing from the vine, and an AI opponent.
This project page details the work completed for the 'Game Software Engineering' module at Teesside University (Year 1, 2025). The primary assessment was the 'Sea Snake' game, a complex C++/SFML project built to specification. To reinforce the necessary C++ and Object-Oriented Programming skills, the module also included several supporting exercises exploring class design, inheritance, and simulation logic. The "Snake Chan" font used in 'Sea Snake' was created by Darrel Flood at DaFont. Starter code/frameworks for the main Snake Game, Conway's Game of Life, and the initial circles project (from the previous module) were provided by the lecturer.
Object-Oriented Design: utilised by an abstract base Snake Class - demonstrating inheritance and polymorphism
Derived Player Snake Class
Handles keyboard input via in input manager using the observer pattern
Derived balanced AI Snake Class with a reward-based system to make decisions based on proximity to food, breath level, and wall/hazard avoidance
Templated custom Linked List Class for managing the dynamically growing and shrinking snake body segments
Implemented a dynamically sinking water level
The snake employs this through it's breath system, requiring to get air every now and then, as well as staying within the water (or just above) to stay moist
Particle system to help visualise the water leak
Randomly spawning collectables with different growth/score values
Growing animation, through the Vine Class
Collision detection: collisions with self, others, walls and collectables
Game flow is managed through different states: front end, in game, and end game.
Score is tracked and saved to show the top 10 high scores
Winner is decided on first who lasted the longest, if that's a tie it goes to score
Revisiting the Shapes Project: Explored inheritance and polymorphism by creating a base shape class and deriving Circle, Rectangle, Polygon classes, each with unique draw and move implementations managed via a vector of pointers to the base shape class. This was crucial for understanding hierarchies, relevant for the snake design.
Card Game: Practiced class design, encapsulation, and game logic implementation by building Playing Card, Deck, and Hand classes for a basic card game, later adapting it to Pontoon. This helped solidify class structuring skills.
Conway's Game of Life: Implemented simulation logic and 2D array manipulation, providing valuable practice in algorithmic thinking relevant to game state updates.
Language: C++
Libraries/Frameworks: SFML, C++ Standard Libraries (vector, fstream, string, algorithm, iostream, cstlib, ctime)
Core Concepts: OOP (Encapsulation, Inheritance, Polymorphism), Custom Templated Data Structures (Linked List), State Machines, Basic AI (Reward System), Collision Detection, File I/O, Algorithms, Particle Systems, UML (Design)
IDE: Visual Studio
Tools: GitHub
This module presented several significant technical challenges, each providing valuable learning experiences in C++ and game software engineering:
Mastering OOP & Architecture: Early exercises like the Shapes project were crucial for understanding inheritance and polymorphism, involving initial struggles with base class pointers and virtual functions. Designing the class structure for the Card Game (and implementing tricky logic like the dual-value Ace in Pontoon) reinforced encapsulation principles. Applying these OOP concepts rigorously in the Sea Snake hierarchy, while managing dependencies (requiring forward declarations and header placement), solidified my grasp of code architecture. Debugging a critical bug related to listener persistence after game resets also highlighted the importance of robust state management and clean-up.
Applying Design Patterns: Successfully implementing the Observer Pattern to decouple input handling was complex, but it ultimately demonstrated the power of design patterns for creating flexible and maintainable systems.
Implementing Strategic AI: Designing and fine-tuning the reward-based system for the AI Snake required careful balancing of competing priorities (survival vs score-seeking), deepening my understanding of AI decision-making logic.
Advanced C++ in Practice: Developing the custom linked list template class provided hands-on experience with templates, pointer management, and the importance of thorough error checking (e.g. handling empty list cases) for data structure integrity. Managing dynamically allocated objects (new/delete for snakes/collectables) reinforced core C++ memory management concepts.
Complex Game Logic & Libraries: The initial hurdle with Conway's Game of Life's logic served as a reminder to fully understand requirements before coding. Implementing intricate logic like the state-dependent winner determination in 'Sea Snake', and leveraging SFML features (time, shapes and, drawing order) required careful debugging and planning. Implementing visual enhancements like the Water Leak Particle System involved challenges in efficiently managing and recycling graphical objects (particles) to maintain performance, as well as just the complex logic involved with angular spray, density and velocity. Implementing time-based effects like the Vine growth and the water sinking (in jumps) required precise use of sf::Clock for smooth animation independent of frame rate.
Project Management & Planning: This project underscored the critical importance of initial planning and anticipating dependencies. Encountering architectural challenges late in 'Sea Snake's' development reinforced the value of design before implementation.
Module Grade: 85%