2009 · The OOP click
The C++ dungeon
2009: my first real project — the one where I moved from iterative C to object-oriented C++. A text-mode dungeon crawler — hero, rooms, items, enemies, all modeled as classes. No code survives, but a lot of happy hours do.
- C++
The code is gone and it doesn’t deserve to be revived. But this is the project where I genuinely felt a shift — the one that took me from iterative C to object-oriented C++, with the whole joyful retinue that comes along: classes, inheritance, polymorphism.
The brief was simple: a dungeon crawler in terminal mode, no graphics. All the fun was in the modeling. What is a character? A room? An item, an inventory, an enemy? For the first time I stopped thinking in loops and arrays and started thinking in class: a base Creature, a Hero and Enemy types inheriting from it, an attack() method overridden for each. Polymorphism suddenly made sense — it wasn’t a textbook chapter anymore, it was the tool that made my dungeon possible.
Nothing serious, just a tiny text game I poured an unreasonable number of hours into. Here’s its spirit, playable: a 5×5 dungeon, a few enemies, two items and a potion, one locked exit. Type ‘help’ for commands — and if you know the magic word from the old adventure games, try it.