Rico's World ? 16-Bit Persistent Colony-Sim MMO
  • TypeScript 82.8%
  • HTML 8.1%
  • CSS 4.3%
  • Python 2.4%
  • JavaScript 2.2%
  • Other 0.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
agent-claude f6b39ec40d Merge branch 'claude/241-sleepfix' into main (#242)
Approved-by: johnw (via Claude Code chat)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-22 11:53:07 +02:00
client fix: colonists bouncing back to bed at 95% rest 2026-10-22 04:47:17 -05:00
content fix: colonists bouncing back to bed at 95% rest 2026-10-22 04:47:17 -05:00
docs fix: colonists bouncing back to bed at 95% rest 2026-10-22 04:47:17 -05:00
scripts tooling: forgejo.mjs merge-pr command 2026-10-21 07:41:43 -05:00
server feat: wildlife & hunting (#64) 2026-10-20 14:59:09 -05:00
sim-core fix: colonists bouncing back to bed at 95% rest 2026-10-22 04:47:17 -05:00
.gitignore chore(tooling): add automated headless browser screenshot runner (npm run screenshot) 2026-10-19 03:10:38 -05:00
AGENTS.md tooling: forgejo.mjs merge-pr command 2026-10-21 07:41:43 -05:00
CLAUDE.md docs: add AGENTS.md, CLAUDE.md, and GEMINI.md for Forgejo workflow on RicosWorld 2026-10-17 15:57:04 -05:00
docker-compose.yml chore: initialize monorepo workspace and data-driven content definitions 2026-10-17 07:49:04 -05:00
GEMINI.md docs: add AGENTS.md, CLAUDE.md, and GEMINI.md for Forgejo workflow on RicosWorld 2026-10-17 15:57:04 -05:00
geo_msg.txt.final feat: RimWorld geothermal power 2026-10-21 14:39:07 -05:00
package-lock.json chore(tooling): add automated headless browser screenshot runner (npm run screenshot) 2026-10-19 03:10:38 -05:00
package.json chore(tooling): add automated headless browser screenshot runner (npm run screenshot) 2026-10-19 03:10:38 -05:00
README.md docs: align all project markdown files and directives with Forgejo git workflow 2026-10-17 16:05:16 -05:00
tsconfig.base.json chore: initialize monorepo workspace and data-driven content definitions 2026-10-17 07:49:04 -05:00

RICO'S WORLD (RicosWorld) — 16-Bit Persistent Colony-Sim MMO

Rico's World (RicosWorld) is a top-down 16-bit SNES-styled persistent 2D colony simulation MMO where players act as Charter Pioneers issuing high-level designations (wall blueprints, stockpile & farming zones, mining orders, workbench bills, and inter-colony trade contracts) while autonomous colonists with physiological needs (hunger, rest), psychological moods & thoughts, traits, and skills carry them out on a persistent 100×100 tile grid (10 Hz simulation) connected to a shared planetary world map (1 Hz simulation).


Quick Start (One-Command Run)

Prerequisites

  • Node.js v22.5+ / v24 LTS (uses Node's built-in node:sqlite out-of-the-box; optional PostgreSQL via DATABASE_URL).

1. Install & Launch Everything

npm install
npm run dev

This single command starts:

  • Authoritative Simulation Server on http://localhost:4000 (10 Hz local colony ticks, 1 Hz world map loop, password/session auth, binary WebSocket transport, SQLite/PostgreSQL persistence).
  • 2D PixiJS Web Client on http://localhost:5173.

2. Test Two-Player World Map & Escrowed Trading

Open two browser tabs at http://localhost:5173, register or sign in as two different pioneers (e.g. Commander_Vance and Pioneer_Lyra), and click World Map [M] in the top-right bar to view both settlements on the shared world grid, dispatch an escrowed trade offer (e.g., offer 10 Timber Log for 8 Cut Slate), and accept it from the other player's tab.


Git Workflow & Issue Tracking (scripts/forgejo.mjs)

All development on Rico's World is tracked via issues and pull requests on our self-hosted Forgejo instance (https://git.johnathonwheeler.com/game-dev/RicosWorld). Read AGENTS.md before making any changes.

node scripts/forgejo.mjs whoami      # Verify active agent identity (agent-gemini / agent-claude / agent-kimi)
node scripts/forgejo.mjs issues      # List open issues on game-dev/RicosWorld
node scripts/forgejo.mjs prs         # List open pull requests

Running Tests & Determinism Verification

Run the full headless test suite (unit tests, binary snapshot/delta sync tests, headless 300-tick command-log replay determinism test, and 2-player server integration tests):

npm test

Or run individual workspace suites:

npm run test:sim      # Headless sim-core unit & command-log replay determinism tests
npm run test:server   # Multi-client server persistence, auth, offline shield & world trade tests
npm run typecheck     # Strict TypeScript verification across all workspaces

Repository Structure

.
├── AGENTS.md                 # AI Agent Collaboration Guide & Git/PR workflow rules
├── CLAUDE.md                 # Directive pointer to AGENTS.md for Claude Code
├── GEMINI.md                 # Directive pointer to AGENTS.md for Gemini / Antigravity
├── content/                  # Data-driven JSON definitions (hashed for replay parity)
│   ├── terrains.json         # Terrain walkability, movement cost, fertility, ore yield
│   ├── items.json            # Materials, crops & rations with stack limits and nutrition
│   ├── buildings.json        # Walls, sleeping cots, campfire hearth & masonry workbench
│   ├── needs.json            # Hunger & rest basis-point decay and thresholds
│   ├── jobs.json             # Priority weights for eat, sleep, build, haul, farm, mine, craft
│   ├── traits.json           # Colonist traits (Guild Mason, Fleet-Footed, Iron Metabolism)
│   ├── recipes.json          # Crafting recipe definitions
│   └── events.json           # Colony & world event definitions
├── sim-core/                 # Pure deterministic simulation library (zero I/O or engine deps)
│   ├── src/
│   │   ├── content-registry.ts
│   │   ├── prng.ts           # Seeded 32-bit Mulberry32 PRNG
│   │   ├── types.ts          # Structure-of-Arrays TileMap (100x100) & ECS records
│   │   ├── pathfinding.ts    # Deterministic A* pathfinder & adjacent work positioning
│   │   ├── binary-codec.ts   # Binary snapshot & WebSocket frame serializer (ArrayBuffer)
│   │   └── colony-sim.ts     # Fixed-tick simulation loop, needs, mood, skills & job AI
│   └── tests/                # Unit tests & headless command-log replay determinism check
├── server/                   # Authoritative game server
│   ├── src/
│   │   ├── auth.ts           # Scrypt password hashing & session token verification
│   │   ├── persistence.ts    # Dual SQLite (node:sqlite) & PostgreSQL (pg) adapters
│   │   ├── game-server.ts    # Interest management, Protected Offline Hibernation, World Trade
│   │   └── main.ts           # Server entrypoint
│   └── tests/                # 2-player WebSocket trade, auth & persistence integration tests
├── client/                   # Web / TypeScript + PixiJS v8 2D Client
│   ├── index.html            # 16-bit SNES title screen, HUD & modal layout
│   ├── public/sprites/       # Blender-rendered 3D-to-2D SNES sprite PNGs & manifest.json
│   └── src/
│       ├── snes-pixel-sprites.ts # External sprite sheet loader + procedural pixel fallback
│       ├── colony-renderer.ts    # PixiJS 2D tile, zone, blueprint, item & pawn renderer
│       ├── main.ts               # Binary WebSocket client, auth UI, HUD & world map UI
│       └── styles.css
├── scripts/
│   ├── forgejo.mjs           # CLI wrapper for Forgejo issues, PRs, labels & reviews
│   ├── deploy.mjs            # Production deployment script for ricosworld.themels.online
│   ├── dev.mjs               # Local multi-process development runner
│   └── blender_generate_snes_assets.py # Blender 4.x Python script for 3D-to-2D SNES sprites
└── docs/
    ├── ARCHITECTURE.md       # System design, tick pipeline, binary protocol & offline rules
    ├── GAME_DESIGN.md        # Lore, fixed-point math formulas, mood/skills & balance bible
    ├── ROADMAP.md            # Engineering roadmap mapped to Forgejo Issues (#1–#8)
    ├── BLENDER_SNES_ASSET_PROMPT.md # 3D-to-2D Blender asset generation spec
    └── SETUP.md              # Forgejo git server, agent tokens & VPS infrastructure guide

Optional PostgreSQL Mode

By default, the server persists accounts, settlements, binary colony snapshots (BLOB), command logs, and world trades to server/data/frontier.db via Node 24's built-in node:sqlite.

To run against PostgreSQL instead:

docker compose up -d
DATABASE_URL="postgres://frontier:frontier_dev_password@localhost:5432/frontier_mmo" npm run dev