PUBLIC REPOSITORY
By Batty 251 (@batty-251) · Licence: MIT · 1 published version · 19 files · 80 KB of source · Last published 2026-09-27
A public project on CodeRook. Browse it at https://coderook.com/batty-251/3d-game-project-claude.
A low-poly 3D colony-management RTS that runs in your browser, built with Three.js.
Grow a medieval settlement, manage wood / stone / food / gold, and survive ever-stronger bandit raids.
Public project on CodeRook: <https://coderook.com/batty-251/3d-game-project-claude> —
release v1.0 can be browsed or downloaded from there. Licensed MIT.
Double-click Play.bat. It downloads Three.js into vendor/ the first time (it uses the curl
that ships with Windows), starts a small local web server with the built-in PowerShell, and opens the
game in your default browser. Closing that window stops the server.
If the game does not appear, open <http://localhost:8765/> yourself. If port 8765 is already in use,
edit PORT at the top of Play.bat (and the port in the printed URL).
There is nothing else to install. The game must be served over http:// (not opened as a file://
path) because it uses ES modules.
| Input | Action |
|---|---|
W A S D / arrows / screen edge | Move the camera |
Q / E | Rotate the camera |
| Mouse wheel | Zoom |
| Left-click / drag a box | Select villagers, guards or buildings |
| Double-click a unit | Select all units of that type on screen |
| Right-click | Gather, build, move, or attack |
Ctrl + right-click | Attack-move |
1–8 | Pick a building to place |
| Right-click while placing | Cancel placement |
Esc | Cancel placement / clear selection |
Delete | Cancel the selected construction site (refunds) |
H | Select all idle villagers |
Space | Pause / resume |
1x button | Cycle game speed (1× / 2× / 3×) |
Click a building to open its panel: train villagers or guards, queue units, set a rally point by
right-clicking the ground, or trade goods at the Market.
H puts idle villagers back to work.| # | Building | Cost | Notes |
|---|---|---|---|
| 1 | House | 30 wood | +5 population cap |
| 2 | Farm | 40 wood | Endless food, up to 2 workers each |
| 3 | Lumber Mill | 60 wood | Wood drop-off — build it in the forest |
| 4 | Stone Quarry | 60 wood, 10 stone | Stone and gold drop-off |
| 5 | Market | 100 wood, 50 stone | Sell goods for gold, plus a little trade income |
| 6 | Barracks | 120 wood, 60 stone | Trains Guards |
| 7 | Watchtower | 50 wood, 80 stone, 10 gold | Shoots arrows at bandits automatically |
| 8 | Wall | 6 stone | 2×2 footprint, blocks raiders |
Select villagers and right-click a site to build it faster — several villagers work together. You can
also right-click a damaged building to repair it.
The first raid arrives 5 minutes in, then roughly every 3 minutes, and each one is bigger and tougher
than the last (they scale with the raid number). Bandits come from a random edge of the map, attack
guards and villagers on sight and head for your buildings, prioritising the Town Hall. Bandits can
cross the bridges, so block the crossings with Walls and Watchtowers. A few villagers can also be
sent to fight, but Guards are far better. If the Town Hall is destroyed you lose.
Raid timing is shown at the top of the screen; watch it before expanding far from home.
Play.bat launcher: fetch Three.js, start server, open browser
server.ps1 tiny static web server (PowerShell, no dependencies)
index.html page and HUD markup
css/style.css HUD styling
vendor/ three.module.js (downloaded on first run)
js/config.js tunable constants and all building/unit definitions
js/state.js shared game state, resource helpers, grid helpers
js/models.js low-poly meshes generated in code (no art assets)
js/world.js terrain, water, bridges, resource nodes, A* pathfinding
js/camera.js RTS camera
js/units.js villagers / guards / bandits: states, movement, combat
js/buildings.js placement, construction, training, towers, arrows
js/raids.js food upkeep and bandit waves
js/input.js selection, box-select, commands, build placement
js/ui.js resource bar, build menu, selection panel, minimap
js/main.js renderer, lighting, day/night cycle, main loopTuning is centralised in js/config.js — resource amounts, gather rates, building costs and HP,
raid timings and day length are all there.
PUBLIC REPOSITORY