Project 7: Write a Game

A clone of a classic arcade game like Pong or Snake.

Quick Reference

Attribute Value
Primary Language C++
Alternative Languages N/A
Difficulty Level 2: Intermediate
Time Estimate 1-2 weeks
Knowledge Area Game Loop / Graphics / Input Handling
Tooling LibGUI, LibGfx, LibCore
Prerequisites Project 2, basic C++.

What You Will Build

A clone of a classic arcade game like Pong or Snake.

Why It Matters

This project builds core skills that appear repeatedly in real-world systems and tooling.

Core Challenges

  • Creating a game loop → maps to using Core::Timer to drive updates
  • Custom drawing → maps to using GUI::Painter to draw game elements instead of widgets
  • Handling real-time input → maps to overriding keydown_event on your main widget
  • Managing game state → maps to structuring your code to track score, positions, etc.

Key Concepts

  • Timers: Core::Timer for periodic events.
  • Keyboard Events: GUI::KeyEvent for user input.
  • Custom Painting: Overriding paint_event on a GUI::Frame.

Real-World Outcome

Deliver a working demo with observable output that proves the feature is correct.


Implementation Guide

  1. Reproduce the simplest happy-path scenario.
  2. Build the smallest working version of the core feature.
  3. Add input validation and error handling.
  4. Add instrumentation/logging to confirm behavior.
  5. Refactor into clean modules with tests.

Milestones

  • Milestone 1: Minimal working program that runs end-to-end.
  • Milestone 2: Correct outputs for typical inputs.
  • Milestone 3: Robust handling of edge cases.
  • Milestone 4: Clean structure and documented usage.

Validation Checklist

  • Output matches the real-world outcome example
  • Handles invalid inputs safely
  • Provides clear errors and exit codes
  • Repeatable results across runs

References

  • Main guide: LEARN_SERENITYOS_DEEP_DIVE.md
  • “Game Programming Patterns” by Robert Nystrom