mirror of
https://github.com/cliffe/BreakEscape.git
synced 2026-02-21 11:18:08 +00:00
33042ee7de89ce479654f891329fa40fe7b0f249
Step 2 Complete: Consistency Validation - ✅ PASS WITH MINOR NOTES Narrative Consistency - ✅ PASS: - All 5 characters (Agent 0x99, Victoria, Guard, Receptionist, James) voice consistent Stage 2 → Stage 7 - Story logic sound, no contradictions in event sequence or timeline - Tone appropriate (professional, grounded, no Hollywood hacking) - Minor note: Victoria's emotional vulnerability in confrontation (acceptable character arc) Technical Consistency - ✅ PASS: - All Stage 0 challenges align with Stage 4 objectives - Spatial design coherent (Stage 2 descriptions → Stage 5 room layouts) - All NPC positions match dialogue locations - Item placement supports challenge requirements - All LORE fragments logically placed - Stage 3 moral choices fully implemented in Stage 7 with consequences - Variables track state correctly (victoria_fate, james_fate) Universe Canon Consistency - ✅ PASS: - ENTROPY cell (Zero Day) portrayed accurately per universe bible - SAFETYNET protocols respected (field ops rules, handler behavior) - Technology realistic and appropriate for world - Timeline fits with M2 (May 2024) and sets up Phase 2 (Q4 2024-Q1 2025) - Cross-scenario references accurate (St. Catherine's Hospital, GHOST buyers) Issues Found: NONE (blocking) Minor Notes: 1 (Victoria tonal shift - acceptable) Verdict: Excellent consistency across all stages Next: Step 3 (Technical Validation)
BreakEscape Rails Engine
Cybersecurity training escape room game as a mountable Rails Engine.
Features
- 24+ cybersecurity escape room scenarios
- Server-side progress tracking with 2-table schema
- Randomized passwords per game instance via ERB
- JIT Ink script compilation for NPC dialogue
- Polymorphic player support (User/DemoUser)
- Pundit authorization
- RESTful API for game state management
- Session-based state persistence
Installation
In your Gemfile:
gem 'break_escape', path: 'path/to/break_escape'
Then:
bundle install
rails break_escape:install:migrations
rails db:migrate
rails db:seed # Optional: creates missions from scenarios
Mounting in Host App
In your config/routes.rb:
mount BreakEscape::Engine => "/break_escape"
Usage
Standalone Mode (Development)
export BREAK_ESCAPE_STANDALONE=true
rails server
# Visit http://localhost:3000/break_escape/
Mounted Mode (Production)
Mount in Hacktivity or another Rails app. The engine will use the host app's current_user via Devise.
Configuration
# config/initializers/break_escape.rb
BreakEscape.configure do |config|
config.standalone_mode = false # true for development
config.demo_user_handle = 'demo_player'
end
Database Schema
break_escape_missions- Scenario metadata (name, display_name, published, difficulty)break_escape_games- Player state + scenario snapshot (JSONB)break_escape_demo_users- Standalone mode only (optional)
API Endpoints
GET /games/:id/scenario- Scenario JSON (ERB-generated)GET /games/:id/ink?npc=X- NPC script (JIT compiled from .ink)GET /games/:id/bootstrap- Initial game dataPUT /games/:id/sync_state- Sync player statePOST /games/:id/unlock- Validate unlock attemptPOST /games/:id/inventory- Update inventory
Architecture
ERB Scenario Generation
Scenarios are stored as .json.erb templates and rendered on-demand with randomized values:
<%= random_password %>- Generates unique password per game<%= random_pin %>- Generates unique 4-digit PIN<%= random_code %>- Generates unique hex code
JIT Ink Compilation
NPC dialogue scripts compile on first request (~300ms):
- Check if
.jsonexists and is newer than.ink - If needed, run
inklecateto compile - Cache compiled JSON for subsequent requests
State Management
Player state stored in JSONB column:
- Current room and unlocked rooms
- Inventory and collected items
- NPC encounters
- Global variables (synced with client)
- Health and minigame state
Testing
rails test
License
AGPL v3 - See LICENSE file for details
Documentation
See HACKTIVITY_INTEGRATION.md for integration guide.
Description
Languages
JavaScript
86.5%
Ink
7%
HTML
2.9%
CSS
2.5%
Ruby
0.9%
Other
0.2%