A sophisticated text-based escape room game demonstrating advanced C# programming concepts including control flow, regex pattern matching, object-oriented design, and Windows Forms integration.
🎯 Features • 🚀 Getting Started • 🎓 Educational Value • 📖 Documentation
Text-Based Escape Room is an educational game project that combines programming fundamentals with engaging gameplay mechanics. Players navigate through four progressively challenging levels, solving regex-based puzzles, managing resources, and battling enemies to escape from a mysterious device.
The project showcases practical application of programming language concepts including:
- Control Statements - Complex conditional logic and nested decisions
- Loops - Game loop patterns and collection iteration
- Functions - Modular code organization and reusable components
- Regular Expressions - Pattern matching and validation in puzzles
- Data Structures - 2D arrays, lists, dictionaries, and custom objects
- State Management - Checkpoint systems and game state persistence
- 4 Challenging Levels - Progressively difficult maze-based stages
- Three Difficulty Modes - Easy, Normal, and Hard with different starting resources
- Resource Management - Health Points (HP) and Oxygen (O2) tracking
- Checkpoint System - Auto-save at door openings with death recovery
- Achievement Tracking - Unlock achievements for special actions
- Regex-Based Challenges - Educational puzzles requiring pattern matching knowledge
- Level 1: IP address extraction from security log entries
- Level 2: Email address format validation
- Level 3: HTTPS URL structure verification
- Level 4: Password strength validation with multiple criteria
- Educational Feedback - Detailed explanations of regex patterns and solutions
- Penalty System - HP loss for incorrect answers
- Multiple Enemy Types:
- Melee Enemies (M) - Random movement AI with collision detection
- Shooter Enemies (R) - Ranged attackers firing tracking projectiles
- Boss (B) - Player-tracking AI with 10 HP and pathfinding
- Weapon System - Collect weapons and shoot in 4 directions with limited ammo
- Collision Detection - Real-time bullet and enemy collision checking
- Four Color Themes - Dark, Normal, Retro, and Neon visual styles
- Dual Interface Modes:
- Console Mode - Classic text-based terminal experience
- GUI Mode - Windows Forms with enhanced graphics and animations
- Real-time Status Display - HP bars, oxygen gauges, score tracking
- Background Music - WAV audio playback with sound effects
- Shield (S) - Absorbs 3 enemy hits
- Speed Boost (L) - Double movement for 10 turns
- Invisibility (I) - Temporary enemy detection immunity
- Health Packs (H) - Restore 2 HP
- Oxygen Tanks (O) - Refill 30-40 oxygen points
- Weapons (W) - Enable shooting with 30 bullets
- Keys (K) - Required to open doors
Navigate through challenging mazes with enemies, puzzles, and power-ups
Educational challenges requiring pattern matching knowledge
Face the final boss with player-tracking AI and 10 HP
Complete all levels and view your achievement summary
- WASD / Arrow Keys - Move player
- E - Interact with items and puzzles
- F - Shoot weapon (4 directions simultaneously)
- I - Open inventory screen
- P - Pause menu
- T - Switch color theme
- Q - Quit game (with confirmation)
- WASD - Movement controls
- E - Interact with objects
- I - View inventory and achievements
- P - Pause and menu options
- T - Change visual theme
- Q - Exit game
- Operating System: Windows 10/11
- .NET Version: .NET 9.0 SDK or Runtime
- Display: 1280x720 resolution recommended
- Audio: Sound card (optional, for music and effects)
# Clone the repository
git clone https://github.com/bahadirkarakus/Text-Based-Escape-Room.git
cd Text-Based-Escape-Room/ConsoleApp1
# Build the project
dotnet build
# Run GUI version (recommended)
dotnet run --project ConsoleApp1.csproj
# Or open in Visual Studio 2022
# Open ConsoleApp1.sln and press F5- Introduction Screen - Read the story and mission briefing
- Difficulty Selection - Choose Easy, Normal, or Hard
- Theme Selection - Pick your preferred color scheme
- Level 1-4 - Navigate mazes, solve puzzles, defeat enemies
- Victory Screen - View final score and statistics
ConsoleApp1/
├── GameForm.cs # Main Windows Forms game (GUI version)
├── Program.cs # Console version entry point
├── ProgramGUI.cs # GUI launcher
├── GameState.cs # Static game state management
├── LevelData.cs # Level map definitions
├── Enemy.cs # Melee enemy AI
├── Boss.cs # Boss pathfinding and tracking
├── ThemeColors.cs # Color scheme definitions
├── Levels/ # External level files
│ ├── level1.txt
│ ├── level2.txt
│ ├── level3.txt
│ └── level4.txt
└── bin/Debug/net9.0-windows/
└── Levels/ # Runtime level files
- Control Flow: Complex if-else chains, switch statements, nested conditionals
- Loops: while (game loop), for (2D array traversal), foreach (collections)
- Functions: Modular design with Move(), Interact(), DoPuzzle(), CheckCollisions()
- Regular Expressions: Pattern matching in all four puzzle challenges
- Data Structures: 2D char arrays (maps), List, Dictionary<string, ThemeColors>
- Object-Oriented Design: Enemy, Boss, Bullet classes with encapsulation
- State Management: Centralized GameState class for global state
- Event-Driven Programming: Keyboard events, timer events, form events
- Separation of Concerns: LevelData, GameState, and UI are separate modules
- Error Handling: Input validation, collision detection, boundary checking
- Random Movement AI - Enemy pathfinding with collision avoidance
- Player Tracking - Boss AI using distance calculations
- Collision Detection - Entity overlap checking for bullets and enemies
- Checkpoint System - State serialization and restoration
Security Log Entry: "[2024-12-26 14:32:15 ERROR 192.168.1.105] User:admin Login:FAILED Attempts:3"
Task: Extract the IP address from this security log using regex
Pattern: \d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}
Answer: 192.168.1.105
Which email is valid?
A) user@example.com ✓
B) invalid.email@
C) @nouser.com
D) test@@double.com
Pattern: ^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$
Which URL has valid HTTPS format?
A) https://github.com/user/repo ✓
B) http://example.com
C) ftp://files.server.net
D) https://test
Pattern: ^https://[\w\.-]+/[\w/\.-]*$
Which password is STRONG? (8+ chars, uppercase, lowercase, digit, special)
A) Password123! ✓
B) pass123
C) HELLO@2024
D) test
Pattern: ^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&#])[A-Za-z\d@$!%*?&#]{8,}$
| Symbol | Item | Function |
|---|---|---|
@ |
Player | Your character |
# |
Wall | Impassable obstacle |
M |
Melee Enemy | Random movement, damages on contact |
R |
Shooter | Stationary, fires projectiles |
B |
Boss | Tracks player, 10 HP |
K |
Key | Opens doors (D) |
P |
Puzzle | Regex challenge |
H |
Health Pack | +2 HP |
O |
Oxygen Tank | +30-40 O2 |
W |
Weapon | Enables shooting, 30 ammo |
S |
Shield | Blocks 3 hits |
L |
Speed Boost | Double movement, 10 turns |
D |
Door | Requires key, auto-saves checkpoint |
E |
Exit | Level completion |
The game includes four fully customizable color themes:
- Dark - Dark background with high contrast
- Normal - Balanced colors for standard play
- Retro - Classic terminal green aesthetic
- Neon - Vibrant cyberpunk colors
Press T during gameplay to cycle through themes.
- 💡 Save Ammunition - Weapons are limited, conserve bullets for boss fight
- 💡 Shield First - Collect shields before engaging shooter enemies
- 💡 Oxygen Management - Watch your O2 gauge, every move consumes oxygen
- 💡 Checkpoint Awareness - Doors auto-save progress, safe zones for experimentation
- 💡 Invisibility Timing - Use invisibility power-up to bypass enemy clusters
- 💡 Puzzle Preparation - Study regex patterns before attempting puzzles (HP penalty for wrong answers)
- 💡 Boss Strategy - Boss tracks your position, use obstacles to break line of sight
- 💡 Speed Boost Usage - Double movement is crucial for escaping dangerous situations
- Language: C# 12.0
- Framework: .NET 9.0
- Target Platform: Windows (Windows Forms)
System.Windows.Forms- GUI components and event handlingSystem.Drawing- Graphics rendering and color managementSystem.Text.RegularExpressions- Regex pattern matching in puzzlesSystem.Collections.Generic- Lists, dictionaries for game entitiesSystem.Media- Background music and sound effectsSystem.Threading- Game loop timing and delaysSystem.IO- External level file loading
- IDE: Visual Studio 2022
- Build System: MSBuild / .NET CLI
- Version Control: Git
By studying this project, students will understand:
- Game Loop Architecture - Continuous execution with input, update, render cycle
- State Management - Centralized game state across multiple components
- Event-Driven Programming - Keyboard events, timer events, form events
- Collision Detection - 2D grid-based collision and entity overlap
- AI Pathfinding - Random movement, player tracking, and obstacle avoidance
- Regex Applications - Practical pattern matching in puzzle validation
- Object-Oriented Design - Classes, encapsulation, inheritance concepts
- Resource Management - HP, O2, ammunition, inventory systems
- User Interface Design - Status displays, menus, visual feedback
- Audio Integration - Background music and sound effect implementation
- Lines of Code: ~2,500+ LOC
- Classes: 8+ custom classes (Enemy, Boss, Bullet, ThemeColors, GameState, etc.)
- Levels: 4 complete levels with unique layouts
- Enemy Types: 3 (Melee, Shooter, Boss)
- Power-ups: 7 collectible types
- Themes: 4 visual color schemes
- Puzzles: 4 regex-based challenges
- Achievements: Multiple unlock conditions
Contributions for bug fixes and feature enhancements are welcome:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Fatih Bahadır Karakuş
- 🔗 GitHub Repository: Text-Based-Escape-Room
- 📧 Email: bahadirkarakus261@gmail.com
Made with ❤️ using C# and Windows Forms