Deepgrain Foundry: move from a claude.ai artifact to a local repository

The game as of artifact version 24, ready for local development with
coding agents.

- Source split from three large files into 52 small ones under src/sim,
  src/render and src/ui, joined in the order in src/manifest.json by
  build.py. The joined code is unchanged apart from comments; every
  headless suite gives the same output, and screenshots in both looks
  are pixel-identical to before.
- Light tidying with no change in behaviour: one movement scan loop,
  shared hazard-stripe and belt shader helpers, unused code removed, a
  shared check helper for the test suites.
- World files can be exported as an ordinary download outside claude.ai.
- Tests: broken old scripts removed, experiments moved to tools/,
  test/run_all.py added. Tools: shot.py (repeatable screenshots),
  where.py, map.py.
- Docs: AGENTS.md, CLAUDE.md, NOTES.md (the owner's to-do inbox),
  docs/PROJECT_MAP.md, DESIGN.md, TESTING.md, systems notes, the
  owner's requests and an agent log.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K9kLmYADKSEjuwUN3rFxDA
This commit is contained in:
2026-10-23 16:05:31 -04:00
co-authored by Claude Opus 5.5
commit 3f971a94c2
100 changed files with 11928 additions and 0 deletions
+64
View File
@@ -0,0 +1,64 @@
# Deepgrain Foundry
A falling-sand factory game in the browser, in the style of Sandustry.
Every grain of sand, ore, water and fire is simulated. You fly a small bot over a side-view
world, dig with a resonance drill and vacuum up what breaks loose. You build furnaces from
blocks, melt ore with coal and air, and cast the metal in molds. Then you sell bars, alloys and
other goods at a trade dock, automating with belts, screw tubes, filters, fans, pipes and
machines, until the land claim is paid off and beyond.
## Play
```sh
python3 build.py
python3 -m http.server -d dist # then open http://localhost:8000
```
Opening `dist/index.html` directly works too. The game is one self-contained page with no
downloads; sound and graphics are all generated in code. Saves stay in your browser.
- To keep or move a world, use Pause → Export world file.
- To load one, use Settings → Load a world file on the title screen, or Pause → Import world file
during a game. World files exported from the claude.ai version load here too.
The controls are in the in-game notebook (N) under Controls. The basics:
- WASD to fly;
- 1–4 for the drill, vacuum, build and igniter;
- left and right mouse to use the tool;
- Q/E and R to change what it does;
- F to use things;
- Esc for the menu.
## Develop
You need Node (tested with 22), Python 3, and Playwright for the browser tests and screenshots:
```sh
pip install -r requirements.txt
python3 -m playwright install chromium
```
```sh
python3 build.py # build dist/index.html
python3 test/run_all.py # headless test suites
python3 test/run_all.py --browser # plus the browser tests
python3 tools/shot.py shots/x.png --setup tools/scenes/clear-sky.js # a screenshot
```
The source is small JavaScript files with no dependencies or bundler:
- `src/sim/`: the simulation;
- `src/render/`: drawing;
- `src/ui/`: the browser shell.
`build.py` joins them in the order given in `src/manifest.json`.
## Documents
- `AGENTS.md` / `CLAUDE.md`: how coding agents work on this project.
- `NOTES.md`: the to-do list.
- `docs/PROJECT_MAP.md`: where everything is.
- `docs/DESIGN.md`: what the game is meant to be, and the decisions made.
- `docs/TESTING.md`: tests, screenshots and pitfalls.
- `docs/systems/`: notes on individual systems.
- `docs/history/requests.md`: the owner's requests while the game was built.
- `docs/agent-log.md`: the work log.