mirror of
https://github.com/cliffe/BreakEscape.git
synced 2026-02-20 13:50:46 +00:00
6.6 KiB
6.6 KiB
Objectives System - TODO Checklist
Track implementation progress here. Check off items as completed.
Phase 0: Prerequisites (Do First) ✅
- 0.1 CRITICAL: Verify
door_unlockedevent emission exists inunlock-system.js- ✅ VERIFIED (line 560) - 0.2 Add key pickup events to
inventory.jsaddKeyToInventory()function - ✅ IMPLEMENTED - 0.3 Verify
item_unlockedevent name inunlock-system.js(line ~587) - ✅ VERIFIED - 0.4 Add
objectivesStateto server bootstrap ingames_controller.rb- ✅ IMPLEMENTED
Phase 1: Core Infrastructure ⬜
- 1.1 Create database migration
db/migrate/XXXXXX_add_objectives_to_games.rb - 1.2 Add objective methods to
app/models/break_escape/game.rb:initialize_objectivescomplete_task!(task_id, validation_data)update_task_progress!(task_id, progress)aim_status(aim_id)/task_status(task_id)- Private helpers:
validate_collection,process_task_completion, etc.
- 1.3 Add RESTful API routes to
config/routes.rb:GET objectives- Get current objective statePOST objectives/tasks/:task_id- Complete a specific taskPUT objectives/tasks/:task_id- Update task progress
- 1.4 Add controller actions to
games_controller.rb:def objectivesdef complete_taskdef update_task_progress
- 1.5 Update
scenarioaction to includeobjectivesStatefor reload recovery - 1.6 Create
public/break_escape/js/systems/objectives-manager.js - 1.7 Create
public/break_escape/css/objectives.css
Phase 2: Event Integration ⬜
- 2.1 Subscribe to
item_picked_up:*wildcard events →handleItemPickup() - 2.2 Subscribe to
door_unlockedevents →handleRoomUnlock()(useconnectedRoom) - 2.3 Subscribe to
door_unlocked_by_npcevents - 2.4 Subscribe to
item_unlockedevents →handleObjectUnlock()(NOTobject_unlocked) - 2.5 Subscribe to
room_enteredevents →handleRoomEntered() - 2.6 Subscribe to
task_completed_by_npcevents
Phase 3: UI Implementation ⬜
- 3.1 Create
public/break_escape/js/ui/objectives-panel.js - 3.2 Implement
createPanel()with header and content areas - 3.3 Implement
render(aims)for aim/task hierarchy - 3.4 Implement
toggleCollapse()functionality - 3.5 Add progress text for
showProgress: truetasks - 3.6 Add completion animations (CSS keyframes)
- 3.7 Ensure CSS follows project conventions (2px borders, no border-radius)
Phase 4: Integration & Wiring ⬜
- 4.1 Add imports to
public/break_escape/js/main.js:import ObjectivesManagerimport ObjectivesPanel
- 4.2 Initialize
window.objectivesManagerinmain.js initializeGame()(manager only) - 4.3 Call
objectivesManager.initialize()ingame.js create()after scenario loads - 4.4 Restore
objectivesStatetowindow.gameState.objectivesingame.js create() - 4.5 Create
ObjectivesPanelinstance ingame.js create() - 4.6 Add
<link>to objectives.css in game HTML template
Phase 5: Server Validation ⬜
- 5.1 Update
sync_stateaction to accept/return objectives - 5.2 Validate
collect_itemstasks againstplayer_state['inventory'] - 5.3 Validate
unlock_roomtasks againstplayer_state['unlockedRooms'] - 5.4 Validate
unlock_objecttasks againstplayer_state['unlockedObjects'] - 5.5 Validate
npc_conversationtasks againstplayer_state['encounteredNPCs'] - 5.6 Increment
tasks_completedandobjectives_completedcounters
Phase 6: Ink Tag Extensions ⬜
- 6.1 Add
complete_taskcase tochat-helpers.jsprocessGameActionTags() - 6.2 Add
unlock_taskcase - 6.3 Add
unlock_aimcase - 6.4 Test tags in phone-chat minigame
- 6.5 Test tags in person-chat minigame
Phase 7: Reconciliation & Edge Cases ⬜
- 7.1 Implement
reconcileWithGameState()in ObjectivesManager - 7.2 Handle collect_items reconciliation (check existing inventory)
- 7.3 Handle unlock_room reconciliation (check discoveredRooms)
- 7.4 Handle enter_room reconciliation (check discoveredRooms)
- 7.5 Add debounced
syncTaskProgress()with timeout tracking - 7.6 Store
originalStatusfor debug reset functionality
Phase 8: Testing ⬜
- 8.1 Create test scenario in
scenarios/test-objectives/scenario.json.erb - 8.2 Create test Ink story in
scenarios/test-objectives/guide.ink - 8.3 Test
collect_itemsobjective (pick up multiple items) - 8.4 Test
unlock_roomobjective (unlock a door) - 8.5 Test
unlock_objectobjective (unlock a container) - 8.6 Test
npc_conversationobjective (ink tag completion) - 8.7 Test
enter_roomobjective (walk into room) - 8.8 Test chained objectives (
onComplete.unlockTask) - 8.9 Test aim completion (all tasks done → aim complete)
- 8.10 Test aim unlock conditions (
unlockCondition.aimCompleted) - 8.11 Test server validation (complete without meeting conditions)
- 8.12 Test state persistence (reload page, check objectives restored)
- 8.13 Test reconciliation (collect items, then reload - should reconcile)
Phase 9: Documentation ⬜
- 9.1 Create
docs/OBJECTIVES_USAGE.mdwith full documentation - 9.2 Update
README_scenario_design.mdwith objectives section - 9.3 Add objectives examples to existing scenario documentation
- 9.4 Document ink tags in docs/INK_BEST_PRACTICES.md
Notes
Add implementation notes, blockers, or decisions here:
- CRITICAL:
door_unlockedevents are NOT emitted in current codebase - must add todoors.js - Event name is
item_unlockedNOTobject_unlocked(unlock-system.js line 587) ✅ door_unlockedevent should provide bothroomIdandconnectedRoom(useconnectedRoomfor unlock tasks)- Keys do NOT emit pickup events - requires fix in
addKeyToInventory() - Objectives init happens in
game.js create()NOTmain.js(scenario not available until then) - Server includes
objectivesStatein scenario bootstrap for reload recovery - Use RESTful routes:
POST /objectives/tasks/:task_id(task_id in path)
Completion Summary
| Phase | Status | Completed |
|---|---|---|
| Phase 0: Prerequisites | ✅ | 4/4 |
| Phase 1: Core Infrastructure | ⬜ | 0/7 |
| Phase 2: Event Integration | ⬜ | 0/6 |
| Phase 3: UI Implementation | ⬜ | 0/7 |
| Phase 4: Integration | ⬜ | 0/6 |
| Phase 5: Server Validation | ⬜ | 0/6 |
| Phase 6: Ink Tags | ⬜ | 0/5 |
| Phase 7: Reconciliation | ⬜ | 0/6 |
| Phase 8: Testing | ⬜ | 0/13 |
| Phase 9: Documentation | ⬜ | 0/4 |
| Total | ⬜ | 4/64 |