arrow_back Back to Projects
php

CLI Minigame Zelda

A nostalgic text-based adventure game inspired by The Legend of Zelda, built entirely in PHP with interactive CLI gameplay. Navigate through a mysterious 3x3 castle grid, collect magical items, defeat monsters with strategic combat, and rescue the princess in this classic retro gaming experience. Perfect for developers who love both PHP and old-school adventure games, or anyone wanting to experience the charm of text-based storytelling.

Timeline

2024

Links

deployed_code

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

  1. Game Controller (src/Commands/Play.php) manages the main game loop and room definitions
  2. Character System (src/Characters/) handles Hero movement and Monster combat logic
  3. Room Navigation (src/Room/) provides coordinate-based movement with directional constraints
  4. Item Management (src/Item/) implements collectible objects for inventory and combat
  5. Text Content (src/ReadFile/) loads narrative descriptions from external text files

Technical Stack

code php
code laravel
code vue
code tailwind