Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions web/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
dist
.DS_Store
*.local
39 changes: 39 additions & 0 deletions web/PARITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# FactoryForge Web — Parity Checklist

Mapped against iOS `FactoryForge/Docs/INSTRUCTIONS.md` and the Complete Parity plan.

## Core loop
- [x] Procedural chunks / resources / trees
- [x] Player move (WASD), mine, chop
- [x] Inventory + hand crafting
- [x] Place / rotate / remove buildings
- [x] Belts + inserters
- [x] Furnaces + assemblers + chests
- [x] Power poles, boilers, steam engines, solar, accumulators
- [x] Research / tech tree / labs
- [x] Fluids (pipes, pumps, boilers/steam, pumpjack oil)
- [x] Oil refinery / chemical plant shells
- [x] Pollution + biters + turrets + walls
- [x] Player shoot (F / double-click)
- [x] Units + unit production buildings
- [x] Rocket silo + satellite → space science victory
- [x] Save / load / autosave (localStorage)
- [x] AutoPlay scenarios + game speed
- [x] PvAI + lobby UI
- [x] Fog of war helper
- [x] WebSocket multiplayer (handshake / snapshot / delta / command / ping)
- [x] Hybrid 2D ortho + 3D perspective toggle (V)

## Controls (web equivalents)
- [x] WASD move, wheel zoom, MMB/RMB pan
- [x] LMB select/mine/place, R rotate, Esc cancel
- [x] I/C/B/T menus, P pause, V view mode

## Intentionally out of scope
- [ ] StoreKit IAP
- [ ] CoreMotion tilt / shake / haptics
- [ ] iOS MCP debug bridge as gameplay dependency
- [ ] Full PNG sprite atlas (procedural colors until assets copied from iOS bundle)

## Asset note
Copy PNGs from the iOS app bundle into `web/public/assets/` per `FactoryForge/Assets/SPRITE_LIST.md` when available; `ColorAtlas` provides fallbacks.
48 changes: 48 additions & 0 deletions web/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# FactoryForge Web

Three.js (WebGPU + WebGL2 fallback) port of FactoryForge with keyboard/mouse controls, full single-player systems, PvAI, AutoPlay, and WebSocket multiplayer.

## Assets

Game sprites are copied from `FactoryForge/Assets/` into `public/assets/`.

```bash
powershell -File scripts/sync-assets.ps1
```

The splash screen loads `/assets/splash.png` and preloads all PNGs listed in `public/assets/manifest.json`. The renderer uses these via `AssetCatalog` (nearest filtering), falling back to procedural textures only if a file is missing.

### Multiplayer server

```bash
npm run server
```

In-game: Menu → Lobby → Connect Multiplayer (`ws://localhost:8080`).

## Controls

| Action | Input |
|--------|--------|
| Move | WASD / arrows |
| Zoom | Mouse wheel / trackpad |
| Pan camera | MMB or RMB drag |
| Mine / select / place | LMB |
| Shoot | Double-click or F |
| Rotate building | R / Q / E |
| Inventory / Craft / Build / Research | I / C / B / T |
| Toggle 2D/3D view | V |
| Pause | Space / P |
| Deselect / cancel | Esc |

## Architecture

- `src/engine` — ECS, GameLoop (60 Hz fixed), input, render
- `src/game` — systems (mining→rockets), world, AI, multiplayer helpers
- `shared/data` — items, recipes, techs, building_configs JSON
- `shared/net` — `NetworkMessage` protocol
- `server` — authoritative WebSocket host

## Parity checklist

See in-game Menu help and iOS `FactoryForge/Docs/INSTRUCTIONS.md`. Win by launching a rocket with a satellite (space science).
16 changes: 16 additions & 0 deletions web/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>FactoryForge</title>
<link rel="stylesheet" href="/src/styles.css" />
</head>
<body>
<div id="app">
<canvas id="game-canvas"></canvas>
<div id="ui-root"></div>
</div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
Loading