mirror of
https://github.com/cliffe/BreakEscape.git
synced 2026-02-21 11:18:08 +00:00
df992cf71d65ebe52e963b9097e387c0296e7b5c
Created complete scenario.json.erb and mission.json for Mission 5 "Insider Trading" ## Stage 9: Scenario Assembly Complete ### Files Created **scenario.json.erb (494 lines)** - ERB helpers for Base64 encoding - 25 global variables for state tracking - 11 fully configured rooms with progressive unlocking - 6 in-person NPCs with Ink integration - 2 phone NPCs with 11 event mappings - Hybrid architecture: VM + physical evidence correlation **mission.json** - Mission metadata (difficulty 2, 5400s duration) - ENTROPY cell: Insider Threat Initiative - 5 CyBOK areas, 5 learning objectives - VM integration (Bludit CVE-2019-16113, 4 flags) - 3-act narrative summary - 6 key NPCs with roles - Moral complexity explanation - Campaign positioning (Mission 5 of 10) **Supporting Documentation** - ROOM_SUMMARY.md: Quick reference for 11 rooms - STAGE_9_SUMMARY.md: Comprehensive completion report (500+ lines) ### Room Structure (11 Rooms) All rooms use valid types (room_reception, hall_1x2gu, room_office, room_servers) Progressive unlocking: visitor → employee badge → research badge → server password Evidence gathering: Physical (medical bills, journal) + Digital (4 VM flags) Correlation threshold: evidence_level >= 4 unlocks confrontation ### NPC Integration In-Person: Opening briefing, Patricia Morgan, Lisa Park, Kevin Park, Dr. Chen, David Torres Phone: Agent 0x99 handler (7 events), Closing debrief trigger (4 events) Terminal: Drop-site flag submission (4 flags) All NPCs reference compiled Ink scripts from Stage 7 ### Global Variables (25 total) Player state: approach, priority, handler_trust Investigation: objectives_completed, evidence_level, lore_collected Evidence flags: found_medical_bills, found_journal, found_briefcase_comms VM flags: flag1-4_submitted, bludit_server_discovered, etc. Outcome: torres_turned/arrested/killed, elena_treatment_funded, entropy_program_exposed ### 5 Ending Paths 1. Turn Double Agent: Torres intel asset through M10, Elena treatment 2. Arrest with Cooperation: Partial intel, Elena treatment, reduced sentence 3. Arrest without Cooperation: No intel, no treatment, full sentence 4. Combat Lethal: Torres killed, family destroyed, intel lost 5. Public Exposure: ENTROPY program burned, retaliation invited All endings trigger closing debrief via global variable event mappings ### Design Philosophy: Evil Radicals + Player Agency ENTROPY: Clearly evil, calculate 12-40 casualties, view Torres as expendable Torres: Radicalized (knows deaths) but salvageable (3 months in) Player: 5 meaningful choices with campaign consequences Hostile NPC tag (#hostile:david_torres) set in combat path per user requirement ### Technical Compliance ✅ All room types valid (no placeholder types) ✅ All connections use cardinal directions only ✅ Bidirectional connections properly configured ✅ Lock types: badge, password, keycard, key (with keyPins) ✅ NPC items use type field matching #give_item tags ✅ Event mappings link Ink knots to game events ### Ready For - Playtesting (all 5 ending paths) - Integration testing (VM flag submission, evidence correlation) - Campaign integration (Mission 4 → 5 → 6 flow) **Mission 5 Planning: Stages 0-9 Complete** Total: 2,298 lines Ink + 494 lines scenario structure
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%