# Life Rewrite

This is a clean rewrite project. It does not inherit the old fixed-stat core.

## Stack

- React
- TypeScript
- Vite

## Goals

- Move the core to a world-driven engine
- Keep stats, actions, events, and time phases fully data-driven
- Support best-timing modifiers without hard-coding them into UI logic
- Leave room for `wuxia`, `xianxia`, `cyberpunk`, and other worlds
- Validate world definitions before runtime boot so schema drift fails fast
- Keep the rewrite grounded in the original project's real data packs and runtime behavior

## Structure

- `src/engine`: shared engine runtime
- `src/worlds`: registered world definitions
- `src/hooks`: app-level world session state
- `src/components`: reusable UI slices for multi-world rendering
- `src/legacy`: adapter layer for the original `Life` runtime and data packs
- `src/App.tsx`: shell that can switch between legacy compatibility mode and sandbox worlds

## Run

```bash
pnpm install
pnpm dev
```

Optional type check:

```bash
pnpm check
```

Production build:

```bash
pnpm build
```

## Current State

Already implemented:

- legacy runtime compatibility inside the rewrite shell
- legacy achievement catalog and special thanks views backed by the original data packs
- legacy home screen flow, persisted theme toggle, and keyboard-first primary actions
- unified feedback center that drives both transient banners and recent activity history
- shared `WorldRuntime`
- world validation and normalization before runtime creation
- shared `GameState`
- condition matching and effect resolution
- phase-based time progression
- first-class `resources` and `inventory` definitions
- a world registry that can switch demos without touching the engine
- a `modern` world demo and a `wuxia` world demo

Next step: migrate the remaining legacy pages and flows into typed React modules, then decide whether the future engine should fully subsume the legacy rule syntax or keep an adapter boundary.
