Split Rust game src into modules; update AGENTS.md for dual toolchain
- Refactor apps/game/src/main.rs into modules: state.rs, camera.rs, ui/, gameplay/ - Add gameplay/galaxy_creation.rs scaffold (stubs only, no new logic) - Update root AGENTS.md: separate TS workspace vs Rust game commands - Update apps/AGENTS.md: docs/game/site use two toolchains, not one - Add apps/game/AGENTS.md: build commands, module layout, naming conventions, Plugin pattern
This commit is contained in:
51
AGENTS.md
51
AGENTS.md
@@ -6,37 +6,54 @@ Single-player open-world space exploration RPG. Windward Horizon in space with F
|
||||
|
||||
| Path | Purpose |
|
||||
|------|---------|
|
||||
| `apps/docs` | Living design docs, interactive demos, and vertical-slice prototype |
|
||||
| `apps/game` | Playable game shell connected to SpacetimeDB |
|
||||
| `apps/site` | Public landing page |
|
||||
| `packages/ui` | Shared UI primitives and design tokens |
|
||||
| `services/spacetimedb` | SpacetimeDB TypeScript backend module |
|
||||
| `apps/docs` | Living design docs, interactive demos, and vertical-slice prototype (Vite + React) |
|
||||
| `apps/game` | Playable game client — **Rust + Bevy** (independent of the JS/TS workspace) |
|
||||
| `apps/site` | Public landing page (Vite + React) |
|
||||
| `packages/ui` | Shared UI primitives and design tokens for the TS apps |
|
||||
| `services/spacetimedb` | SpacetimeDB TypeScript backend module (authoritative game state) |
|
||||
| `scripts/` | Dev tooling (dev.sh startup script) |
|
||||
| `archive/` | Legacy pre-monorepo files kept for reference |
|
||||
| `src/module_bindings/` | Empty; generated bindings go to `apps/game/src/module_bindings` |
|
||||
|
||||
## Key Files
|
||||
|
||||
- `package.json` — pnpm workspace scripts (`dev`, `build`, `check`, `generate:bindings`)
|
||||
- `pnpm-workspace.yaml` — workspace glob patterns
|
||||
- `pnpm-workspace.yaml` — workspace glob patterns (covers TS apps only)
|
||||
- `spacetime.json` — SpacetimeDB module path and binding generation config
|
||||
- `tsconfig.base.json` — Shared TypeScript config (ES2020, React JSX)
|
||||
- `tsconfig.base.json` — Shared TypeScript config (ES2020, React JSX) — does not apply to `apps/game`
|
||||
- `apps/game/Cargo.toml` — Rust manifest for the game binary
|
||||
|
||||
## Commands
|
||||
|
||||
### JS/TS workspace (docs, site, packages/ui, services)
|
||||
|
||||
```bash
|
||||
pnpm dev # Full stack: SpacetimeDB + game (port 5175)
|
||||
pnpm dev # Full stack: SpacetimeDB + docs/site
|
||||
pnpm dev:docs # Docs only (port 5173)
|
||||
pnpm dev:site # Site only (port 5174)
|
||||
pnpm dev:game # Game frontend only (requires running SpacetimeDB)
|
||||
pnpm build # Build all apps
|
||||
pnpm check # Typecheck all packages
|
||||
pnpm build # Build all TS packages
|
||||
pnpm check # Typecheck all TS packages
|
||||
pnpm generate:bindings # Regenerate SpacetimeDB TypeScript bindings
|
||||
```
|
||||
|
||||
## Conventions
|
||||
### Rust game (`apps/game`)
|
||||
|
||||
- SpacetimeDB is the persistence layer from day 1 — no localStorage for game state
|
||||
- All UI uses Tailwind CSS v4 with custom design tokens from `packages/ui`
|
||||
- 3D rendering uses React Three Fiber + Drei + Three.js
|
||||
- Module bindings are auto-generated — never edit `module_bindings/` by hand
|
||||
```bash
|
||||
cd apps/game
|
||||
cargo run # Build + run the game binary
|
||||
cargo check # Fast typecheck
|
||||
cargo build # Build without running
|
||||
cargo clippy # Lint
|
||||
```
|
||||
|
||||
## Architecture Notes
|
||||
|
||||
- **Two independent toolchains coexist**: the pnpm/TS workspace (docs, site, UI lib, SpacetimeDB backend) and the Cargo/Rust game client. They share no code.
|
||||
- **SpacetimeDB** remains the authoritative persistence layer. The game client will connect to it via the SpacetimeDB Rust SDK when wired up (TS bindings generated by `pnpm generate:bindings` are consumed by the docs prototype, not the game).
|
||||
- **Naming follows RFC 344**: see `apps/game/AGENTS.md` for Rust/Bevy conventions.
|
||||
|
||||
## Conventions (TS apps)
|
||||
|
||||
- SpacetimeDB is the persistence layer from day 1 — no localStorage for game state in the docs prototype
|
||||
- TS apps use Tailwind CSS v4 with custom design tokens from `packages/ui`
|
||||
- 3D rendering in `apps/docs` uses React Three Fiber + Drei + Three.js
|
||||
- Module bindings are auto-generated — never edit generated bindings by hand
|
||||
|
||||
Reference in New Issue
Block a user