The whole town of Svrljig, Serbia, street by street, as an open-world game in your browser. Three.js rendering, Rapier physics, no backend.
Try my custom fork of this repo in your browser
I didn't write the code. I described the town, its streets and its people, and AI agents on agentchatham.com built the game from that. I'm a co-founder of Agent Chatham, which I used to run the agents. It is also the easiest way to change it: describe what you want to an AI coding agent and let it make the change. Hand-written pull requests are just as welcome.
npm install && npm run dev(ornpm run build && npm run preview)?q=lowdisables shadows and antialiasing and renders at half resolution for weak GPUs.
Controls: W/S gas/brake-reverse, A/D steer, Space handbrake (drift) / jump on foot, E exit/enter car, Shift run, R reset car, mouse (click to lock) orbit camera, M map (minimap zoom / whole town), N radio station, P go to the party (with 1000 din), T fast time, H hide help.
Pick one of ten characters (src/characters.js), get the Monday SMS, and earn 1000 dinars by Saturday 22:00
(src/story.js). About 100 timed side jobs ( src/missions.js): deliveries and rides, 80% picked up outside the
centre. Knocking people over brings the police (src/police.js). In-car radio with three stations ( src/radio.js).
Progress is saved in localStorage.
Everything runs in the browser. src/main.js loads the baked town (public/svrljig.json, public/terrain.json),
builds the world and runs the game loop; the rest are modules it wires together:
- World:
terrain.js(heightfield),world.js(ground, roads, river, trees, lamps),buildings.jsandshops.js(houses and shopfronts),yards.js,sidewalks.js,custom.js(bridges, pool),church.js,rail.js - Driving and physics:
car.js(player vehicle),carmodels.js,impacts.js(crashes),stream.js(colliders streamed around the player) - Life in town:
traffic.js,parked.js,people.js,human.js,characters.js,police.js,race.js - Game:
story.js(menu, week, ending),missions.js(side jobs),minimap.js,radio.js,sfx.js,editor.js(house editor),i18n.js(English and Serbian texts),inapp.js
Heavy work (plots, fences, parking spots, tree and roof placement) is done offline by the data pipeline below, so the game only reads compact JSON.
- Source data (not needed to run the game, only to rebuild it):
node scripts/fetch_osm.mjs— OpenStreetMap via the Overpass API →data/raw.json,data/rail.json,data/leisure.json(names converted to Latin, contact details dropped). OSM changes over time, so a fresh download will differ a little from the committed one.- Copernicus GLO-30 DEM, two tiles from AWS open data into
data/dem/:
for t in E021 E022; do n=Copernicus_DSM_COG_10_N43_00_${t}_00_DEM
curl -o data/dem/N43_00_${t}_00.tif https://copernicus-dem-30m.s3.amazonaws.com/$n/$n.tif; done
- Sentinel-2 cloudless tiles are downloaded by
scripts/s2_tex.pyitself
node scripts/bake.mjs— OSM (data/raw.json, the raw Overpass response) →public/svrljig.json(buildings, plots, fences; appliesdata/shops.json,data/overrides.jsonanddata/trees_roofs.json). OSM names in Svrljig are in Cyrillic; the bake converts them to Latin (scripts/latin.mjs).uv run --with numpy --with pillow --with tifffile --with imagecodecs --with scipy python scripts/terrain.py— Copernicus GLO-30 DEM (data/dem/, AWS open data) and the hand-madedata/custom.json→public/terrain.jsonuv run --with numpy --with pillow python scripts/s2_tex.py— Sentinel-2 cloudless 2016 tiles (cached indata/s2/) →public/ground_town.jpgandpublic/sat_far.jpguv run --with numpy --with pillow --with scipy python scripts/s2_trees.py— trees by vegetation densitypython3 scripts/roof_colors.py— roof colours from a palettenode scripts/bake.mjsagain, so steps 4–5 (data/trees_roofs.json) are applied with the street clean-up
Houses are generic: storeys, facades and roofs come from OSM and a palette, and about 190 shops and workshops in the centre show only what kind of shop they are (Pekara, Apoteka, Kafana...), not their real names. If you know the town, you can fix that from your own knowledge or your own photos (please do not copy from online maps or street-level imagery):
- Houses: open the game with
?editor(always on innpm run dev), pressK at a house to set storeys, facade and roof, then "Izvezi" and add the result todata/overrides.json. - Shops: add or fix the building in
data/shops.json(keyed by OSM way id, one entry per shop withkind,nameandsign; see the existing entries). Signs name the kind of shop, not the business, and use default colours per kind (green pharmacy, red betting shop, brown kafana...). - Map: missing streets, buildings and land use belong in OpenStreetMap itself; then
node scripts/fetch_osm.mjsand re-bake.
More in CONTRIBUTING.md.
Bugs, ideas and security problems: GitHub issues.
The code is MIT (LICENSE). Data and media keep their own licences; NOTICE lists every file and its
licence, and LICENSES/ has the full texts. In short:
- Map data: © OpenStreetMap contributors, ODbL 1.0.
data/*.jsonandpublic/svrljig.jsonare under ODbL, including the hand-entered additions (shops, custom features, house edits) that are baked into the map. - Terrain: Copernicus GLO-30 DEM, © DLR e.V. 2010-2014 and © Airbus Defence and Space GmbH 2014-2018, provided under COPERNICUS by the European Union and ESA
- Imagery: Sentinel-2 cloudless 2016 by EOX IT Services GmbH (Contains modified Copernicus Sentinel data 2016), CC BY 4.0
- Cars: Sketchfab authors, CC BY 4.0 (
public/cars/CREDITS.txt) - Characters: Quaternius, CC0 (
public/people/CREDITS.txt) - Music: CC BY, CC BY-SA, CC0 and public domain, per track (
public/radio/CREDITS.txt)
A non-commercial fan project. Not affiliated with, endorsed or sponsored by Rockstar Games or Take-Two Interactive, or by any car maker. All names and trademarks belong to their owners.