batty-251/3d-game-project-claude

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.

Versions

Files in the latest version

README

Hearthhold

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.

How to play

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.

Controls

InputAction
W A S D / arrows / screen edgeMove the camera
Q / ERotate the camera
Mouse wheelZoom
Left-click / drag a boxSelect villagers, guards or buildings
Double-click a unitSelect all units of that type on screen
Right-clickGather, build, move, or attack
Ctrl + right-clickAttack-move
1–8Pick a building to place
Right-click while placingCancel placement
EscCancel placement / clear selection
DeleteCancel the selected construction site (refunds)
HSelect all idle villagers
SpacePause / resume
1x buttonCycle 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.

The economy

Buildings

#BuildingCostNotes
1House30 wood+5 population cap
2Farm40 woodEndless food, up to 2 workers each
3Lumber Mill60 woodWood drop-off — build it in the forest
4Stone Quarry60 wood, 10 stoneStone and gold drop-off
5Market100 wood, 50 stoneSell goods for gold, plus a little trade income
6Barracks120 wood, 60 stoneTrains Guards
7Watchtower50 wood, 80 stone, 10 goldShoots arrows at bandits automatically
8Wall6 stone2×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.

Raids

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.

Project layout

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 loop

Tuning is centralised in js/config.js — resource amounts, gather rates, building costs and HP,
raid timings and day length are all there.

PUBLIC REPOSITORY

Opening batty-251/3d-game-project-claude…

Loading the public version history and verified file tree.