# apps/docs/src/prototypes/game-slice/ — MVP Loop Prototype

A self-contained, playable implementation of the full MVP game loop using localStorage for persistence. This is the **most complete gameplay implementation** in the repo — every other game system prototype feeds into or from this slice.

## Core Files

| File | Purpose |
|------|---------|
| `types.ts` | Full type system: 8 flight modes, 19 event types, combat modules, skills, objectives, Zora state |
| `gameSliceState.ts` | Event sourcing engine: `applySliceEvent()` handles 19 event types, localStorage persistence, XP awards |
| `sliceController.ts` | Action gating: `getContextualSliceActions()` returns enabled/disabled actions with reasons |
| `sliceObjectives.ts` | 7-objective tutorial chain: undock → navigate → mine → dock → refine → fit → sell (+ optional combat) |
| `sliceWorld.ts` | World constants: 2 POIs (station + belt), travel durations, ship stats |
| `sliceEconomy.ts` | Cargo management (upsert/remove/clamp), refining (Veldspar → Tritanium + Pyerite), selling |
| `sliceNavigationBridge.ts` | Bridge between game-slice state and warp travel sessions |
| `useGameSliceSession.ts` | React hook: reads/writes localStorage, exposes session + event dispatcher |
| `useSliceController.ts` | React hook: derives contextual actions and computed facts from session |
| `SeamlessGameLoopSlice.tsx` | Root component: composes all stages with mode-based rendering |

## UI Components (`ui/`)

22 components covering every game state:
- Station: `SliceStationStage`, `SliceStationPanel`
- Flight: `SliceFlightStage` (with ambient traffic entities, context menus)
- Travel: `SliceTravelStage`
- Mining: `SliceMiningStage`
- Combat: `SliceCombatStage`
- Services: `SliceServicesStage`, `SliceRefiningService`, `SliceFittingService`, `SliceMarketService`
- Shell: `SliceShell`, `SliceTopBar`, `SliceActionRail`, `SliceObjectiveTracker`
- Shared: `SliceModuleRack`, `SliceShipStatus`, `SliceCargoPanel`, `SliceEventLog`, `SliceProgressBar`, `SliceStage`, `SliceDemoLinks`, `sliceStyles`

## Systems Implemented (not yet in production)

| System | Status | Production Target |
|--------|--------|-------------------|
| Refining (ore → minerals) | Working | Phase 6 |
| Fitting (module slots + CPU/PG) | Working | Phase 4 |
| Combat (FTL power allocation) | Working | Phase 3 |
| XP/Skills (5 skills, level 0-5) | Working | Phase 7 |
| Objective chain (tutorial) | Working | Phase 7 |
| Zora modules (personality + soul depth) | Partial | Phase 7 |
| Multi-system travel (5 systems) | Working | Phase 7 |
