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::Timerto drive updates - Custom drawing → maps to using
GUI::Painterto draw game elements instead of widgets - Handling real-time input → maps to overriding
keydown_eventon your main widget - Managing game state → maps to structuring your code to track score, positions, etc.
Key Concepts
- Timers:
Core::Timerfor periodic events. - Keyboard Events:
GUI::KeyEventfor user input. - Custom Painting: Overriding
paint_eventon aGUI::Frame.
Real-World Outcome
Deliver a working demo with observable output that proves the feature is correct.
Implementation Guide
- Reproduce the simplest happy-path scenario.
- Build the smallest working version of the core feature.
- Add input validation and error handling.
- Add instrumentation/logging to confirm behavior.
- 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