CLI Minigame Zelda
The Brief
This is a classic text-based adventure game where you play as a hero exploring a castle to rescue a princess. Instead of graphics, the game uses text descriptions to paint vivid pictures in your imagination - just like the adventure books and early computer games of the past. You'll move through different rooms, find useful items like magic shields and daggers, and face dangerous monsters that guard your path. Each monster has a specific weakness, so strategy and careful exploration are key to success.
Architecture & Technology Stack
This CLI adventure game showcases classic PHP development patterns with object-oriented design:
- Language: PHP with modern PSR-4 autoloading via Composer
- Architecture: Command-pattern based game loop with object-oriented room/character system
- Input System: Interactive CLI using PHP's
readline()for command history and user input - Data Storage: File-based text content with in-memory object state management
- Game Logic: Coordinate-based grid navigation with dynamic room unlocking system
Key Features
- Interactive CLI Gameplay: Real-time command processing with
readline()support - Object-Oriented Design: Separate classes for Hero, Monster, Item, Room, and game logic
- Strategic Combat System: Item-weakness based monster encounters requiring specific tools
- Dynamic World Navigation: 3x3 grid system with coordinate-based movement constraints
- Text-Based Storytelling: Narrative content loaded from external text files
- Italian Language Interface: Authentic Italian game commands and descriptions
Game Architecture
- Game Controller (
src/Commands/Play.php) manages the main game loop and room definitions - Character System (
src/Characters/) handles Hero movement and Monster combat logic - Room Navigation (
src/Room/) provides coordinate-based movement with directional constraints - Item Management (
src/Item/) implements collectible objects for inventory and combat - Text Content (
src/ReadFile/) loads narrative descriptions from external text files