Skip to content
bl4tczPublic

About

Cozy first-person farming game in the browser: turn a wheat field into a steam-powered conveyor-belt factory to meet the King's quotas. Three.js + Vite. Built in a weekend by an AI coding agent inside a strict test harness.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

El Legado del Viejo

A cozy first-person farming game where your wheat field slowly turns into a steam-powered factory of conveyor belts, all to keep a demanding King fed.

Wheat title screen

No install, no account. Click, grab the mouse, start farming.

Three.js r128 Vite 5 JavaScript License: MIT Play on Netlify

Language note: the in-game text is in Spanish. The mechanics are visual (you watch items travel along the belts), so you can play without reading much.


Gameplay

You are a villager working the old man's wheat farm at night, under a starry sky. The King keeps sending letters with delivery quotas, and you'd better meet them.

You start by hand: plow the land, harvest wheat, carry it to the sales cart. Then you buy steam machines and conveyor belts, and the farm starts running itself. Every item is a physical object that rides the belts across the farm grid. When a machine's output backs up, it stops and its smoke goes out, so you find bottlenecks by looking at the farm, not by reading spreadsheets.

The production chain grows as the King asks for more:

wheat ──► flour (mill) ──► bread (bakery) ──┐
wheat ──► eggs  (henhouse) ─────────────────┼──► cake (pastry shop) ──┐
wheat ──► milk  (barn/stable) ──────────────┘                        │
                 milk ──► cheese (cheese press) ─────────────────────┼──► feast (King's Table)
fruit (steam orchard) ──► jam (confectionery) ───────────────────────┘

Meet the final delivery and the story reaches its ending. After that, the farm is yours to keep running.

Features

  • First-person farming + automation. Hold the mouse to work the land yourself, then hand the job over to machines.
  • Physical conveyor belts. Belts carry real items, merge, and auto-adjust; splitters alternate outputs; silos buffer jams and release items first-in, first-out.
  • 14 placeable pieces: steam harvester, belt, splitter, mill, bakery, henhouse, stable, silo, sales cart, steam orchard, confectionery, cheese press, pastry shop and the King's Table.
  • Multi-input machines. The pastry shop takes bread, milk and eggs through any of its three inputs; the King's Table combines cake, cheese and jam into feasts.
  • The King's quotas drive the progression, told through letters and a short story.
  • Living village. Little helper sprites load the cart and carry goods to market stalls, where they're sold.
  • Retro night look. Low-poly world rendered at low resolution with toon shading, bloom, color grading, a moon, clouds, shooting stars, fireflies and torches.
  • Procedural everything. Pixel-art sprites are drawn in code and music is generative, so the game needs no asset files to run (real GLTF models or music dropped into public/assets/ replace the fallbacks).
  • Autosave to your browser's local storage, a reset option (hold 5 s to confirm), and a guided tutorial you can skip.

Controls

Input Action
W A S D Move
Mouse Look around
Hold left click Work the land (plow, harvest)
Left click on a belt / cart Drop or pick up items / sell what you carry
Left click (while placing) Place the machine
Mouse wheel (while placing) Rotate the machine
Middle click on a machine Buy another one of the same kind
Right click Cancel placement / pull up wheat
Hold right click on a machine Dismantle it and get the gold back
E Open / close the machine catalog
Esc Cancel placement / release the mouse (pauses)

How it was built

This game was made over a weekend as an experiment: can a small, cheap model build a full game if the harness around it is strict enough?

  • The coding was done by DeepSeek v4 Flash running inside OpenCode.
  • The harness (rules, specs and verification) was designed with Claude Opus.

The harness is what's in the repo, and it's the interesting part:

  • AGENTS.md: the project rules any agent must follow (no code without a written story, modules under 300 lines, Three.js pinned to r128, etc.).
  • docs/stories/: every feature was written first as a user story with acceptance criteria and a time estimate, then implemented.
  • tests/: contract tests for the game rules (belts, ratios, quotas, saves, determinism, render invariants…).
  • tools/verify.mjs: npm run check runs lint + tests + build; npm run check:full also plays a smoke test of the game in a real Chrome.

The model didn't get to call anything "done" until the checks were green.

Run locally

Requirements: Node.js 22+ and npm.

git clone https://github.com/bl4tcz/wheat.git
cd wheat
npm install
npm run dev        # opens http://localhost:5173

Other scripts:

npm run build      # production build into dist/
npm run preview    # serve dist/ locally
npm test           # contract tests (node --test)
npm run check      # lint + tests + build
npm run check:full # also smoke-tests the game in a real Chrome (via playwright-core)

Project structure

├─ AGENTS.md         rules for AI agents working on the repo
├─ docs/stories/     the plan: one user story per feature
├─ index.html        HUD skeleton
├─ src/
│  ├─ main.js        entry point
│  ├─ game.js        game loop and system wiring
│  ├─ config.js      economy, King's quotas, world size
│  ├─ game/          rules: machines, belts, production, saving
│  ├─ world/         terrain, farm, village, buildings, animals
│  ├─ art/           procedural pixel-art drawing
│  ├─ render/        pixelated renderer and post-processing
│  ├─ sky/ lighting/ night sky, moon, torches
│  ├─ ui/            HUD, panels, shop, tutorial
│  └─ vfx/           particles and smoke
├─ public/assets/    optional GLTF models, textures and audio
├─ tests/            contract tests
└─ tools/            verification and browser smoke test

Tuning lives in three places: src/config.js (gameplay numbers), src/style/settings.js (visuals) and src/style/palette.js (colors).

License

MIT

Author

Made by Bryant Caballero: dev.criollolabs.com


If you enjoyed the game or the AI-harness experiment, consider giving the repo a ⭐. It helps a lot.

About

Cozy first-person farming game in the browser: turn a wheat field into a steam-powered conveyor-belt factory to meet the King's quotas. Three.js + Vite. Built in a weekend by an AI coding agent inside a strict test harness.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages