Implement comprehensive multi-protocol RFID system with deterministic
card_id-based generation, MIFARE key attacks, and protocol-specific UI.
## New Protocol System (4 protocols):
- EM4100 (low security) - Instant clone, already implemented
- MIFARE_Classic_Weak_Defaults (low) - Dictionary attack succeeds (95%)
- MIFARE_Classic_Custom_Keys (medium) - Requires Darkside attack (30s)
- MIFARE_DESFire (high) - UID only, forces physical theft
## Key Features:
### 1. Protocol Foundation
- Created rfid-protocols.js with protocol definitions
- Added protocol detection, capabilities, security levels
- Defined attack durations and common MIFARE keys
### 2. Deterministic Card Generation
- Updated rfid-data.js with card_id-based generation
- Same card_id always produces same hex/UID (deterministic)
- Simplified scenario format - no manual hex/UID needed
- getCardDisplayData() supports all protocols
### 3. MIFARE Attack System
- Created rfid-attacks.js with MIFAREAttackManager
- Dictionary Attack: Instant, 95% success on weak defaults
- Darkside Attack: 30 sec (10s on weak), cracks all keys
- Nested Attack: 10 sec, uses known key to crack rest
- Protocol-aware attack behavior
### 4. UI Enhancements
- Updated rfid-ui.js with protocol-specific displays
- showProtocolInfo() with color-coded security badges
- showAttackProgress() and updateAttackProgress()
- Protocol headers with icons and frequency info
- Updated showCardDataScreen() and showEmulationScreen()
### 5. Unlock System Integration
- Updated unlock-system.js for card_id matching
- Support multiple valid cards per door (array)
- Added acceptsUIDOnly flag for DESFire UID emulation
- Backward compatible with legacy key_id format
### 6. Minigame Integration
- Updated rfid-minigame.js with attack methods
- startKeyAttack() triggers dictionary/darkside/nested
- handleCardTap() and handleEmulate() use card_id arrays
- UID-only emulation validation for DESFire
- Attack manager cleanup on minigame exit
### 7. Styling
- Added CSS for protocol headers and security badges
- Color-coded security levels (red=low, teal=medium, green=high)
- Attack progress styling with smooth transitions
- Dimmed menu items for unlikely attack options
## Scenario Format Changes:
Before (manual technical data):
```json
{
"type": "keycard",
"rfid_hex": "01AB34CD56",
"rfid_facility": 1,
"key_id": "employee_badge"
}
```
After (simplified with card_id):
```json
{
"type": "keycard",
"card_id": "employee_badge",
"rfid_protocol": "MIFARE_Classic_Weak_Defaults",
"name": "Employee Badge"
}
```
Technical data (hex/UID) generated automatically from card_id.
## Door Configuration:
Multiple valid cards per door:
```json
{
"lockType": "rfid",
"requires": ["employee_badge", "contractor_badge", "master_card"],
"acceptsUIDOnly": false
}
```
## Files Modified:
- js/minigames/rfid/rfid-protocols.js (NEW)
- js/minigames/rfid/rfid-attacks.js (NEW)
- js/minigames/rfid/rfid-data.js
- js/minigames/rfid/rfid-ui.js
- js/minigames/rfid/rfid-minigame.js
- js/systems/unlock-system.js
- css/rfid-minigame.css
- planning_notes/rfid_keycard/protocols_and_interactions/03_UPDATES_SUMMARY.md (NEW)
## Next Steps:
- Phase 5: Ink integration (syncCardProtocolsToInk)
- Test with scenarios for each protocol
- Add Ink variable documentation
Estimated implementation time: ~12 hours (Phases 1-4 complete)
RFID Keycard Lock System - Planning Documentation
Welcome to the planning documentation for the RFID Keycard Lock System feature!
Quick Links
📋 00_OVERVIEW.md - Executive summary, user stories, system architecture 🏗️ 01_TECHNICAL_ARCHITECTURE.md - Detailed technical design, file structure, code architecture ✅ 02_IMPLEMENTATION_TODO.md - Complete implementation checklist with tasks, estimates, and priorities 🎨 03_ASSETS_REQUIREMENTS.md - Asset specifications, placeholders, and creation guides
What is This Feature?
The RFID Keycard Lock System adds a new lock type to BreakEscape inspired by the Flipper Zero device. Players can:
- Use physical keycards to unlock RFID-protected doors
- Clone keycards using an RFID cloner device (Flipper Zero-style interface)
- Emulate saved cards to unlock doors without the physical card
- Secretly clone NPC badges during conversations for social engineering gameplay
Feature Highlights
🎮 Realistic Flipper Zero Interface
- Authentic monospace display
- Orange and black color scheme
- Navigation breadcrumbs (RFID > Saved > Emulate)
- Card reading animations
- EM4100 RFID protocol support
🔐 Two Gameplay Modes
Unlock Mode: Tap a keycard or emulate a saved card to open doors Clone Mode: Read and save RFID card data from NPCs or your own cards
🗣️ Ink Conversation Integration
New tag: # clone_keycard:Card Name|HEX_ID
Allows stealthy card cloning during NPC conversations
📦 Inventory Integration
Click keycards in inventory to clone them (requires RFID cloner)
Documentation Structure
00_OVERVIEW.md
Purpose: High-level understanding of the feature Audience: Everyone (designers, developers, stakeholders) Contents:
- Executive summary
- User stories (5 scenarios)
- System architecture diagram
- Component breakdown
- Key features
- Technical specifications
- Success criteria
- Benefits and alignment with existing systems
Start here if: You want to understand what this feature does and why
01_TECHNICAL_ARCHITECTURE.md
Purpose: Detailed technical implementation guide Audience: Developers Contents:
- Complete file structure
- Code architecture for all classes
- Integration points with existing systems
- Data flow diagrams (unlock, clone, emulation)
- CSS styling strategy
- State management
- Error handling
- Performance considerations
- Accessibility notes
Start here if: You need to understand how to build this feature
02_IMPLEMENTATION_TODO.md
Purpose: Step-by-step implementation checklist Audience: Developers doing the work Contents:
- 8 implementation phases
- 90+ individual tasks
- Priority levels (P0-P3)
- Time estimates per task
- Acceptance criteria for each task
- Test cases
- Dependencies diagram
- Risk mitigation
Start here if: You're ready to start coding
03_ASSETS_REQUIREMENTS.md
Purpose: Asset creation specifications Audience: Artists, asset creators Contents:
- All required sprites and icons
- Exact dimensions and formats
- Color palettes
- Placeholder creation scripts
- Image editing guidelines
- Asset testing checklist
- Reference images and links
Start here if: You're creating the visual assets
Implementation Roadmap
Week 1
├─ Day 1-2: Core Infrastructure (Data, Animations, UI Classes)
├─ Day 3-4: Minigame Controller
└─ Day 5: System Integration
Week 2
├─ Day 6: Styling (CSS)
├─ Day 7: Assets (Sprites, Icons)
├─ Day 8: Testing & Integration
├─ Day 9: Documentation & Polish
└─ Day 10: Final Review & Deploy
Total Estimated Time: 102 hours (~13 working days) Note: Updated from 91 hours after comprehensive implementation review
Key Design Decisions
Why Flipper Zero?
- Recognizable: Popular hacking tool, culturally relevant
- Authentic: Teaches real RFID concepts
- Fun: Satisfying UI to interact with
- Expandable: Can add more protocols later
Why EM4100 Protocol?
- Simple: 125kHz, easy to implement
- Common: Most access cards use this
- Realistic: Real-world standard
- Educational: Players learn actual RFID tech
Why Two Modes (Unlock vs Clone)?
- Flexibility: Multiple puzzle solutions
- Progression: Upgrade from cards to cloner
- Stealth: Social engineering gameplay
- Realism: Matches real-world RFID usage
How to Use This Documentation
For Project Managers
- Read 00_OVERVIEW.md for scope
- Review 02_IMPLEMENTATION_TODO.md for timeline
- Use task estimates for planning
For Developers
- Read 00_OVERVIEW.md for context
- Study 01_TECHNICAL_ARCHITECTURE.md thoroughly
- Follow 02_IMPLEMENTATION_TODO.md step-by-step
- Reference 03_ASSETS_REQUIREMENTS.md for placeholders
For Artists
- Skim 00_OVERVIEW.md for visual style
- Use 03_ASSETS_REQUIREMENTS.md as your guide
- Follow placeholder scripts to get started quickly
- Reference Flipper Zero device for inspiration
For QA/Testers
- Read 00_OVERVIEW.md for user stories
- Use user stories as test scenarios
- Follow test cases in 02_IMPLEMENTATION_TODO.md Phase 6
Quick Start
Want to implement this feature? Follow these steps:
- ✅ Read this README
- ✅ Review 00_OVERVIEW.md - User Stories section
- ✅ Study 01_TECHNICAL_ARCHITECTURE.md - Code Architecture section
- ✅ Start 02_IMPLEMENTATION_TODO.md - Phase 1, Task 1.1
- ✅ Create placeholder assets using 03_ASSETS_REQUIREMENTS.md scripts
- ✅ Code, test, iterate!
Example Usage in Scenarios
Scenario JSON
{
"room_server": {
"locked": true,
"lockType": "rfid",
"requires": "server_keycard"
},
"startItemsInInventory": [
{
"type": "keycard",
"name": "Server Room Keycard",
"key_id": "server_keycard",
"rfid_hex": "9876543210",
"rfid_facility": 42,
"rfid_card_number": 5000
},
{
"type": "rfid_cloner",
"name": "RFID Cloner",
"saved_cards": []
}
]
}
Ink Conversation
=== talk_to_ceo ===
# speaker:npc
Hello, what can I do for you?
* [Ask about server access]
# speaker:npc
I have the server keycard, but I can't give it to you.
-> hub
* [Secretly clone their keycard]
# clone_keycard:CEO Keycard|ABCDEF0123
# speaker:player
*Subtly scans their badge*
# speaker:npc
Is something wrong?
-> hub
Success Metrics
Must-Have (P0)
- ✅ RFID locks work in scenarios
- ✅ Keycards unlock matching doors
- ✅ RFID cloner can save and emulate cards
- ✅ Clone mode works from Ink conversations
- ✅ Flipper Zero UI is recognizable
Should-Have (P1)
- ✅ All animations smooth
- ✅ Multiple saved cards supported
- ✅ Error messages clear
- ✅ Inventory click triggers clone
Nice-to-Have (P2-P3)
- 🎵 Sound effects
- 🎨 Advanced animations
- 🔧 Multiple RFID protocols
- ⚙️ Card programming features
Related Systems
This feature integrates with:
- Lock System (
unlock-system.js) - New lock type - Minigame Framework (
minigame-manager.js) - New minigame - Inventory System (
inventory.js) - Clickable items - Ink Conversations (
chat-helpers.js) - New tag - Key/Lock System (
key-lock-system.js) - Similar patterns
Questions?
Feature unclear? → Read 00_OVERVIEW.md Implementation details? → Read 01_TECHNICAL_ARCHITECTURE.md How to build it? → Follow 02_IMPLEMENTATION_TODO.md Need assets? → Check 03_ASSETS_REQUIREMENTS.md
Version History
| Version | Date | Author | Changes |
|---|---|---|---|
| 1.0 | 2024-01-15 | Planning Team | Initial planning documentation |
Status: ✅ Planning Complete, Ready for Implementation Next Action: Begin Phase 1, Task 1.1 - Create base files and folder structure Estimated Completion: 11 working days from start
License & Attribution
- Flipper Zero is a trademark of Flipper Devices Inc.
- This implementation is inspired by Flipper Zero but is an independent creation
- All assets created should be original or properly licensed
- RFID/NFC technical specifications are based on industry standards (EM4100, ISO 14443, etc.)
Happy Building! 🛠️