Large worlds
Status: agreed with the owner on 2026-11-11; nothing built yet. Drawn up from a review of the terrain and the game server. The decisions are at the end; one detail (where the hand-worked places are) is still open.
Why
Measured on 2026-11-11:
- The map is full. It is 8,192 m × 8,192 m, Terrain3D's whole 32×32 region grid at 256 m regions and 1 m vertex spacing (−4,096 to +4,096 m). 832 of the 1,024 regions hold terrain, 54.5 km² of ground, 673 MB on disk.
- Almost all of it is land. 693 regions have ground at or above sea level. Only 139 are entirely under the sea (118 MB), in a ring one or two regions wide round the island. Trimming seabed would save at most about 17%, so it is not a fix.
- Terrain3D does not stream. Every region is loaded at start and kept, on the client in RAM and on the graphics card as well. Memory grows with world size, not with view distance.
- The server holds it all too. The game server loads every region with
collision_mode = 3(full collision everywhere): about 1.46 GB of RAM with nobody logged in, an estimated 1 GB of it terrain. It only needs heights. Terrain3D's own docs put collision for an 8k map at about 3 GB. - Creatures cost what the world holds, not what players see. The server loops over every creature in about 24 places with no check for a player nearby, and "nearest player" searches are creatures × players.
- Positions are 32-bit floats, including in the state packet. The
wrapped world (
WorldWrap.cs) is already 24 km (±12 km), near where float jitter starts to show (from about ±10–15 km).
Godot as the server is not the problem and stays. The server runs the same
CharacterBody3D movement and the same shared GDScript (Dungeon.gd,
PlotTerrain.gd, Islands.gd) as the client, so both collide with the
same ground.
Where we are heading
- Our own terrain tiles, streamed by the client and read by the server.
This grows out of what
Islands.gdalready does: heightmap files shared by client and server, collision and navigation built from them, two levels of detail. - Client memory follows view distance, not world size. Full detail out to about 2 km (about 16 km², roughly 150 MB), with a coarse overview of the whole world beyond.
- The server holds heights only, building collision just near players.
- Server CPU follows players, not world size. World cells near a player are awake; the rest sleep.
- Sea is free. No tiles, nothing to load or simulate.
- Terrain3D becomes an editing tool only, until our own in-client tools replace it (stage 7).
What each stage buys (estimates)
| After | World size | Limit |
|---|---|---|
| Today | 8.2 km square, 54.5 km² of ground | Terrain3D's grid, all loaded |
| Stages 1–4 | about 30 km across (about 900 km²) | Float precision, about ±15 km |
| Stage 6 | hundreds of km across | Download size and how much land can be made |
Land on disk at 2 m spacing with texture paint is about 1–2 MB per km². A world 100 km across with 10–20% land would be 1,000–2,000 km² of land, roughly 1–4 GB to download. At 1 m spacing everywhere it is about four times that.
Changed 2026-11-12: our own terrain, our own navigation, edited in the client
Agreed with the owner after stage 1. This replaces stages 3–5 and 7 as written below, which are kept for the record.
- Godot's navigation goes. It rebuilds its whole map on any change (23–26
s for 67,000 polygons on the R710) and an island-wide bake of 678,000
polygons kept the server at ~115% CPU for minutes with every path failing.
It cannot serve a 350 km world. Pathfinding becomes our own C#, worked from
the terrain heights as a grid (walkable by slope, not deep water, about 2
m), per tile, only near players, with no world-wide map to rebuild. It
replaces Godot's navigation behind the two helpers built in stage 1
(
TryNavigationPoint,NavPath). Dungeons (their own floors) and houses (blocking squares) come after the basic version. - Our own terrain everywhere. The 256 m tiles (stage 2) are the only copy of the world: the server reads them (heights, collision, navigation), the client streams and draws them. Terrain3D leaves the server and then the client; there is no Terrain3D editing bridge.
- Terrain is edited in the client, live, by GMs (the owner and other GMs), on the running server with players on it: sculpting, and texture painting with layers and blending, and grass. A GM fly mode (no ground snap, no fall, no speed check) to inspect the terrain while editing.
- The same change path serves GM tools and events. Events will deform terrain too, so the server owns one way to change a tile, used by both: check permission (GMs; events are trusted), write the tiles and keep each tile's previous version (roll back a bad edit), rebuild collision at once, rebake navigation for the touched tiles on a background thread and swap it in when ready (creatures use the old meanwhile), and send the changed tiles to nearby players. Players standing on ground that moves are lifted onto it. A per-tile lock stops two GMs editing one tile at once; undo in the editor.
- Seams are no problem. Edits work on the live tiles with their neighbours loaded, so a brush crosses tile edges and a save writes every tile it touched.
- Things on the ground (houses, flattened plots, trees, props, spawners, the dungeon entrance) must not float or sink: ground under plots and buildings is protected, and props are re-seated on the new ground.
Order:
- Our own pathfinding, proven on one tile beside Godot's on today's island: speed and paths compared before anything is built on it.
- Tile format and converter (stage 2): heights, texture layers and blending, grass, carried over from the Terrain3D regions without loss.
- Server on tiles: heights, collision and our own navigation from the tiles; Terrain3D and Godot navigation off the server.
- Client draws tiles: streaming, a ground shader with layered, blended textures, grass.
- GM fly mode, then the editing tools: sculpt, paint, grass, undo, save through the server's tile change path.
- Events that deform terrain, through the same path.
- Bigger than about 30 km (floating origin, double-precision server), as stage 6 below.
Step 1 measured 2026-11-12 (Gameplay/Navigation/GridNav.cs, proof in
ServerMain/GridNavProof.cs, on the R710): the village tile (-256, 0), 129 x
129 heights at 2 m, 76% ground. Grid built in 1 ms; 200 random paths
across it all found, mean 1.7 ms, worst 11 ms, about 536 points searched a
path. Reading the heights through the GDScript terrain wrapper took 269 ms
(goes away when the server reads its own tiles). Godot's map, built from the
island-wide bake (678,133 polygons), never answered in ten minutes, so there
was no comparison. Because a tile's grid builds in about a millisecond,
navigation needs no bake and no cache: the tile's heights are enough; a
start builds every tile in about a second and an edit or event rebuilds its
tile at once.
Roughest tile, 2026-11-12: region (0, -13), corner (0, -3328), the
island's steepest land (slopes: median 42 degrees, a tenth over 65; truly
steep, not noise: averaging over 5 m barely changes them). With the 45
degree rule only 9 of 200 paths were found (191 had no walkable way),
mean 0.66 ms, worst 5.3 ms, found paths 1.89x the straight line: the
pathfinder is fine; the rule breaks the land into patches. Only 18% of its
land joins up at 45 degrees; 92% at 60 degrees, the slope players can
already climb (FloorMaxAngle). The village tile joins 100% either way.
Agreed with the owner: creatures climb what players climb, 60 degrees
(GridNav takes FloorMaxAngle). Rerun at 60: roughest tile 168 of 200
paths found (the 32 others end off the 92% that joins: about what two random
points on that land give), mean 4.1 ms, worst 17 ms, about 3,400 points
searched a path, paths 1.59x the straight line; village tile unchanged, 200
of 200, mean 1.6 ms. These are random pairs up to 256 m apart; wander paths
are much shorter. Faster search (precomputed joins between tiles, jump
point search) can come when a measurement asks for it.
Texture model, agreed 2026-11-12: Terrain3D's (up to 32 textures; a base, an overlay and a blend per spot; the slope autoshader), so today's painting carries over exactly and Terrain3D's MIT shader can be reused.
Step 2 built 2026-11-12 (Gameplay/Terrain/TileFile.cs,
ServerMain/TileStore.cs, TerrainProbe.export_region). A tile file
(tile_<x>_<z>.mdt, one per 256 m Terrain3D region) holds the height,
control and color maps exactly as Terrain3D holds them (format, size, raw
bytes: heights float32 at 1 m, control uint32 in Terrain3D's bit layout,
color RGBA8) and the grass and plant instances (mesh, transform from the
tile's corner, color), zlib-compressed behind a small header that keeps the
source region file's time. Store (agreed): on the R710 outside git,
~/ssdone/moondog-world/tiles, mounted in the dev game server as /world
(MOONDOG_TILE_DIR). Backed up nightly at 03:30 (yarrbeard crontab) by
scripts/backup_tiles.sh to ~/moondog-tile-backups on the R710's system
disk (another physical disk; the others are 93–100% full): one folder per
night, unchanged files hard-linked to the night before, 14 nights kept,
log in backup.log there. At each start, before
the dungeons cut their entrances and plots are flattened, every region whose
file changed is converted and read back. First run: 832 regions, 186 MB
(Terrain3D's region files are 673 MB), 289 instances, 23 s, all read back
identical; three tiles checked independently against the region files on
the PC were identical to the bit. Next start: 832 unchanged, 84 ms. Until
the editing tools exist Terrain3D stays where the terrain is authored and
the tiles follow it; once tiles are the world's own copy the converter is
switched off.
Step 3a built 2026-11-12 (Gameplay/Terrain/TileWorld.cs,
ServerMain/TileWorldProof.cs). The server loads every tile at start (832
in 3.4 s) and holds only heights and a one-bit hole mask (about 260 KB a
tile; the paint stays in the files). 10,000 random points against
Terrain3D: bilinear blending matches at 9,997 (the two triangle splits
only about half), about 1 µs a height. The 3 others are all within 1 cm of
a point's far corner, where Terrain3D's get_height answers with the near
corner's height (a rounding quirk in Terrain3D, up to 0.93 m on steep
ground); ours is the true blend. Collision does not use that lookup.
Step 3b built 2026-11-12 (ServerMain/TileCollision.cs). The ground's
collision is one HeightMapShape3D a tile, built as Terrain3D builds its own
in FULL mode (257 points a side, the far edge from the neighbours, holes NaN,
its data order and quarter turn). The server's own changes to the ground
are made to the tiles too, with Terrain3D's arithmetic in double precision:
the dungeon cut (35 points lowered, 77 holed) and flattened plots (applied
and removed with the plot rows). The shapes start on a spare layer; 20 s
after start a proof fires rays straight down at 10,000 random points, every
plot and the dungeon cut, against them and against Terrain3D's collision
(moved to another spare layer so houses, furniture and ships on layer 1 are
not hit). All 15,518 rays met the same ground (worst 0.0000 m), so the
tiles took the terrain's layer and Terrain3D's collision was switched off.
The surfaces being identical, the client (still on Terrain3D) and the server
collide the same. If a proof ever fails, Terrain3D's collision stays and
the log names where they differ. Server memory 3.3 GB with both loaded,
until Terrain3D comes off (3e). The proof is tried again every 15 s (up to six
times) while one side has no ground at all yet: once, with a faster start,
it ran before a set of shapes was in physics (every ray that met both
agreed).
Step 3c-1 built 2026-11-12 (Gameplay/Navigation/SurfaceNav.cs,
ServerMain/SurfaceNavHost.cs). Our own pathfinding on the surface: ground
heights every 2 m per 256 m tile, filled from the tiles (with the dungeon
cut) and the mesh islands (937 tiles, 105 of them with island ground, 2.3 s
at start), refilled where a plot changes the ground; steps walkable up to
the players' 60 degrees; A* only in a window round a path's ends (the box
plus 32 m, at most 600 points a side), so cost follows the path, not the
world. TryNavigationPoint and NavPath use it everywhere but near a
dungeon. The island-wide Godot bake and the islands' Godot navigation are
gone; Godot's navigation is left with the dungeon alone (5,324 polygons).
Measured with a test player by the horses: wander paths 217 ok / 1 failed,
then 203 / 2; path lookup 0.15 ms (Godot's 2.4 ms); server CPU 13–25%
(was ~115% while Godot built its map); memory 2.3 GB (was 3.3). The
collision proof's 15,518 rays make one 2.4 s run in the first minute after
a start, before anyone can log in.
Step 3c-2 built 2026-11-12 (Gameplay/Navigation/DungeonNav.cs,
ServerMain/DungeonNavHost.cs, ServerMain/NavRouting.cs). Agreed with the
owner: a layered grid per dungeon, every 0.5 m, each column holding every
floor a body can stand on, so stairs join the levels by themselves; paths
between the surface and a dungeon go through its entrance (2 m before it on
the surface, 4 m past it on the landing). Godot's navigation is gone from
the server: its regions and the entrance link are freed at start and
nothing calls NavigationServer3D. First tried by rays down the dungeon's
collision: they cannot tell the solid earth between levels from open air
(1.4 million floors, ceiling tops among them, 143–182 s, freezing the
server). The grid is laid down instead from the walkable polygons
tools/dungeon/build.py bakes from the Blender models, read as plain data
(5,324 polygons: 1.45 million floors, 616,000 reachable from the entrance,
1.5 s at start, no cache needed). Searches keep to 64 m round their ends.
Live, a test player by a Beetle on the first level: it woke and wandered;
wander paths (dungeon and surface) 300 ok / 1 failed; path lookup 0.6 ms on
average, long dungeon paths up to about 100 ms; server 12.6% CPU, 2.2 GB.
Random pairs 60 m apart across the map often lie on different levels with
the stairs far round (56 of 200 within the window); a two-level search
(rooms, then steps) would make long dungeon paths cheap if needed.
Step 3d built 2026-11-12: the stealth system's tall-grass cover comes from the tiles' grass instances (mesh asset 1, placed with Terrain3D's instancer brush; 156 m² on the island), the same squares as Terrain3D's to the last one. The owner notes the grass they see is mostly the painted ground texture; cover could follow the paint later (the tiles keep it).
Step 3e built 2026-11-12: Terrain3D is off the server. Main.tscn has
no Terrain3D node. At start the converter reads the region files' times
itself and loads Terrain3D (collision off) only when a region changed since
its tile was made, converts those and frees it (agreed: loaded only to
convert). Ground height, has-ground, floor height (a dungeon's own floor
near one, through Dungeon.floor_at) and plot height come from the tiles and
the islands' heights in C# (ServerMain/TileGround.cs); plots are flattened
in the tiles only; the tile collision is the ground from the start. The
proofs against Terrain3D from steps 1, 3a and 3b and the dead Godot
navigation bake are removed (their results are recorded above). A start:
tiles up to date 0.6 s, 832 tiles and 2 islands loaded 3.5 s, collision
2.5 s, surface navigation 2.4 s, dungeon navigation 1.4 s. Checked live:
the surface and dungeon wake checks pass, no falls through the ground,
wander paths 533 ok / 4 failed; server memory 1.22–1.40 GB (1.46 GB this
morning with Terrain3D, 3.3 GB with both loaded). Step 3 is done.
Step 4 agreed 2026-11-12: our own renderer, built in stages (plain ground and collision first, then painting, distance detail, grass); tiles delivered by the portal over HTTP and cached on the client.
Step 4a built: the portal serves the tiles read-only (TilesController.cs:
GET /api/tiles lists each tile's stamp and size, GET /api/tiles/x/z
returns one), mounted from ~/ssdone/moondog-world in the dev compose.
Step 4b built and seen in game 2026-11-12 (godot_client/scripts/terrain/:
TileFile.gd, TileStream.gd, TileTerrain.gd;
materials/tile_terrain.gdshader; terrain_textures.json). The client
downloads new or changed tiles from the portal into user://tiles (186 MB
the first time, nearest first) and draws the tiles within 2 km as one mesh
each, a point every 1/2/4/8 m by distance, with skirts; the 3x3 tiles round
the camera get collision built exactly as the server's. Heights, the
dungeon cut and flattened plots are laid over the tiles as on the server.
The shader ports Terrain3D 1.0's texture blending (autoshader, base /
overlay / blend with height blending, colour map; MIT) and includes the
weather; left out for now: detiling, cliff projection, dual scaling, macro
variation. Terrain3D is gone from World.tscn; World, Network,
HousingSystem and Weather use the tiles. The painted texture use across the
island: autoshader on 73% of points (texture 1 Rock on slopes, 0 Leafy Grass
on the flat), Beach Sand (16) painted along the coast, blends on 1.2%.
Checked headless (the client in the server container): no script errors;
figure-eight walk on a slope, client and server a median 0.14 m apart, 7 cm
in height at the end. First runs in the owner's editor found three
faults, each fixed: the player fell on a first run before the tile under
them had downloaded (the local player is now held still until
TileTerrain.ground_ready); the ground was black (the texture tints went in
as a PackedColorArray, which a vec4[] uniform does not take, so they
stayed zero); and the sea's mesh had no tangents (3,643 warnings a session;
WaterSurfaces.gd now gives it normals and tangents). The textured ground,
rock on the slopes and the coast now draw. Not done: the tree models' stale
texture UIDs (1,153 warnings) need a reimport in the owner's editor.
Grass instances drawn 2026-11-12 (agreed with the owner: the placed ones
only, as before; no scattering from the paint). Each tile's instances are
one MultiMesh, drawn as Terrain3D drew its mesh assets (World.tscn before
4b): a generated card of two 1 x 1 m quads crossed, centred on the instance
(Terrain3D's 0.5 m height offset is already in the stored transforms,
scaled with the instance), Tall Grass with tall_grass.png, alpha scissor,
backlight, fading 96-128 m, no shadows. All 289 instances on the island are
Tall Grass, in 2 tiles; checked headless, every card's foot is on the
ground (0.000 m).
Far terrain drawn 2026-11-12 (agreed with the owner: light tiles from the client's cache; a server-made overview file waits for a world too big for the client to hold every tile). Beyond the full tiles' 2 km, out to the camera's far plane (4 km at most), every cached tile is drawn light: a point every 16 m with skirts, built on the worker threads, its own heights only (no plots, dungeon cut or holes, all smaller than a 16 m step), the same ground shader with its control map cut to every 4th point (64 x 64) and the colour map to match; nothing else of the tile is kept. A full tile replaces a light one as it comes within 2 km and the light one goes only once the full one is drawn, and the other way round. The wanted tiles are worked out again only after the camera moves 16 m (some 1,100 places out to 4 km). Measured at the vardo (R710, headless): within about 8 s all 832 tiles are drawn, 247 full and 585 light, for about 46 MB more; a far tile's heights match its file at every point; moving the view 2.5 km left no tile undrawn in any frame and none drawn twice, worst frame 48 ms.
Step 4b: stutter and sliding after a teleport, fixed 2026-11-12. The
owner saw heavy hitching and sliding after teleporting to Anyxa's vardo
(15.8, 6.8, -52.7). Measured with Time.get_ticks_usec in the headless
client on the R710 (niced, so slower than a PC): every tile's mesh and
collision were worked out point by point in GDScript on the main thread,
one 1 m tile's mesh 380 ms and its collision 240 ms. The teleport froze the
client for 5.7 s, then the coarser tiles hitched it 80-200 ms every 0.2 s for
about 20 s. Now (TileTerrain.gd) tile files are read, and meshes and
collision built, on the WorkerThreadPool, three at a time, the player's tile
and the nearest first; each build makes the tile's grid once, with plots and
the dungeon cut applied only inside their rectangles; only putting the
finished mesh and shape into the scene is on the main thread, up to 4 ms a
frame. Old shapes stay until new ones replace them. Checked against the old
code on 10 tiles round the vardo, with and without plots and a dungeon cut:
the collision data and mesh arrays are identical. After the teleport the
terrain's own work in any one frame is now at most 14 ms (R710). A tile downloaded later now also
rebuilds the tiles whose far edge it is, and the far corner with a corner
tile but no east tile now reads as the server does.
The sliding came from the hitches, not from the ground: idle at the vardo,
client and server agree to 0.2 mm before and after the fix. In the long
frames the client ran fewer physics steps than the server, fell behind, and
was then pulled to the server's place after stopping. The wander probe at
the vardo before the fix: 37 corrections, the client 0.7-0.9 m off while
walking and drawn back about 4 cm a packet for over a second after
stopping, p95 1.24 m. After: 10 corrections of 12-35 cm, p95 0.15 m; stop
ends at rest 10 cm apart, under the 12 cm deadzone, with no corrections
firing.
The last long frame on arriving, 3.2 s, was the static entity list (1,876
at the vardo), not the terrain, and is fixed too (WorldEntityManager.gd).
2.6 s of it was ResourceLoader.load run 1,807 times: a PackedScene nobody
holds is freed when the call that loaded it returns, so every tree read its
scene from disk again. Scenes are now kept once loaded. The rest was
instancing everything in one frame. New static entities are now built for at
most 4 ms in the update and then 4 ms a frame, nearest the camera first, with
their scenes read up to 4 ms a frame; once built, an entity's update runs
again so collision, props, colour and wood reach its model. A new creature
whose model is not loaded yet appears with a later broadcast. Loading on
ResourceLoader's threads was tried and dropped: in the headless client it
corrupted the renderer's resource tables and crashed it. Now the static list
takes 149 ms on arrival (85 ms of it parsing its 0.8 MB of JSON), the queue
is empty about 14 s after login, and the worst frame it causes is 56 ms
(one large model loading), all on the R710.
Step 5 begun 2026-11-12: GM fly mode built (agreed with the owner:
@fly in chat; through everything; 15 m/s, 60 sprinting; creatures leave
you alone while flying). @fly, @fly on, @fly off, GMs and Admins on
foot (ServerChat.cs TryFlyCommand). The server moves the body where the
keys say, Space up and the dive key down, with no MoveAndSlide, gravity,
water, fall recovery or boarding ships (Movement.cs ProcessFlying); aggro
goes off as with @aggro off and is put back on landing, which sets you on
the ground below (or above). ReceiveFlying tells the client, which flies
its prediction the same way (Player.gd _fly) and corrects it against its
own prediction for the same input (Network.gd _reconcile_flying), since at
60 m/s a snapshot a round trip old is metres behind. Tested headless with
Teleadmin01: 60 m/s straight through the hills for 1.2 km, then landed on the
ground at 34 m, client and server within 0.1 m afterwards; a figure-eight at
15 m/s apart by 0.33 m typically (p95 0.52 m, 1-2 physics ticks of travel),
5% of packets nudged, none snapped.
Step 5: sculpting in the game built 2026-11-12 (agreed with the owner:
sculpt first, painting and grass as later stages; the Terrain3D converter
switched off; Ctrl+Z undo plus a .prev file per tile; plots and their
rings protected, things on moved ground moved with it). The tiles are now
the world's only copy: the start-up converter runs only with
MOONDOG_CONVERT_REGIONS=1, as a changed region file would overwrite edits
made in the game. The GM panel's Terrain tab (scripts/gm/GmTerrainTab.gd)
picks Raise, Lower, Smooth or Flatten, size (1-32 m) and strength; Sculpt
hides the panel and a ring follows the aim (GMToolsManager sculpt mode):
holding the attack button sends a sample every 0.1 s, [ and ] size the
brush, Ctrl+Z undoes your last stroke, Escape stops. The server
(ServerMain/TerrainEdit.cs) is the one way the ground changes, for events
later too: brushes work on the tiles as their files hold them (the ground in
memory carries the dungeon cut and plots, which must not reach the files),
the ground is worked out again with the dungeons' lowered rectangles,
collision rebuilt, every client sent the changed rectangle
(ReceiveTerrainPatch, laid into its tiles by TileTerrain.apply_patch), and
players lifted onto risen ground. At a stroke's end navigation is refilled
for its tiles and nodes, props, NPCs, stations and packs on moved ground are
moved with it (a world reload, as a GM move). Each GM's last 50 strokes can
be undone. Tiles are written 5 s after the last edit (and at shutdown) on a
background thread, the file there before this run's first write kept as
.prev, the stamp bumped so clients download the tile again at their next
login. Tested headless with Teleadmin01 on open ground at (-140, -60): a 6 m
raise at strength 2 for 10 samples lifted the centre exactly 2.000 m and
4 m out 0.617 m (the brush's falloff), nothing at 10 m; the client got it
live; undo put every point back; the tile saved after each, and after the
undo its maps were identical to the original byte for byte (the original
file was then put back). Not yet tried: the panel and ring in the owner's
editor, flatten and smooth, things moved with the ground, and lifting
players. A tile a client has not loaded keeps its cached file until the
next login.
Step 5: painting in the game built 2026-11-12 (agreed with the owner:
Paint, Spray and Auto brushes plus a colour Tint; textures picked from
swatches of the textures themselves). The Terrain tab's brush list goes on
from the sculpting brushes; a grid of the 17 terrain textures and a colour
picker sit under it. On the server (TerrainEdit.cs ClientTerrainPaint),
on the tiles' files as kept, in Terrain3D's control word: Paint puts the
texture down as the base in the brush's inner part (where its falloff is
above 0.3), turning the autoshader off there and fading the blend; Spray
blends the texture in as the overlay (or, sprayed with the base texture,
blends the overlay out); Auto on/off sets the autoshader bit; Tint pulls
the colour map's RGB toward the colour, leaving its alpha (roughness).
Clients get ReceiveTerrainPaint (control words and RGBA8) and
TileTerrain.apply_paint updates the tile's control and colour textures.
Undo puts the paint back too; saving writes the control and colour maps,
the colour map's smaller mip levels rebuilt from its top level. Tested
headless with Teleadmin01 at (-140, -60): Paint set Dirt as the base with
the autoshader off; Spray at strength 2 brought Coastal Sand in fully at
the centre and to 80/255 four metres out; Auto on set the bit back; Tint
made the centre exactly the colour picked (#339933, roughness kept); four
undos put every point back, and the tile saved after them was identical
to the original byte for byte, mip levels included (the original file was
then put back). Not yet tried in the owner's editor: the swatches, the
picker and how the paint looks. The stroke counts in the GM action log
counted only heights until the next server restart.
Step 5: grass placement in the game built 2026-11-12 (agreed with the
owner: Grass and Clear grass brushes, Tall Grass only for now, other plants
needing their own models later; sculpting moves grass with the ground). The
Terrain tab has the two brushes and a density slider (0.05-4 a square
metre). On the server (TerrainEdit.cs ClientTerrainGrass), in the tiles'
instance lists: Grass fills the ring toward the density, half the shortfall
a sample (at most 400 a sample, 20,000 a tile), each instance as Terrain3D's
instancer made them (random spot and turn, size 0.9-1.3, its origin half its
size above the ground); Clear grass takes every instance in the ring; plots
are left alone. The stealth cover is worked out again after each change.
Each touched tile's whole list goes to clients (ReceiveTerrainGrass,
redrawn by TileTerrain.apply_grass) at most every 0.3 s while a stroke goes
on and at its end; saving writes the lists; undo restores them. Sculpted
ground stands its grass on the new surface. Tested headless with
Teleadmin01 at (-140, -60): a 5 m Grass stroke at 1 a square metre grew 77
instances (about 79 wanted), all drawn on the client, every foot on the
ground; raising the ground under them by up to 1 m left every foot on the
new ground (0.0000 m off); Clear took all 77; @senses there said "in tall
grass" after growing and not after clearing; undoing put the tile's 236
instances back, and the saved tile was identical to the original byte for
byte (put back after both runs).
Step 5 finished 2026-11-12 (agreed with the owner: whoever is working a
tile holds it; Hole and Fill hole brushes). A GM working a tile holds it
while their strokes touch it and for 3 s after: another GM's brush or undo
there does nothing and they are told who is working. Hole and Fill hole set
Terrain3D's hole bit in the brush's inner part; the ground, its collision and
navigation follow, and a dungeon's own holes are never filled. When a tile
is saved every client is told (ReceiveTileChanged) and fetches it
(TileStream.fetch): a tile it already changed live stays as it is (its
collision stays under anyone on it) and only its light far version is redone
from the new file; other tiles are read again, so nobody needs a new login.
Tested headless with two clients at (-140, -60), Teleadmin01 and Bench01
(given the GM role for the test, then put back to Tester with a fresh
token): a raise of 2.8 m lifted Teleadmin01, standing there, onto the new
ground; a test table placed 4 m from the centre went up 1.58 m with the
ground and back to its 28.75 m on undo, then was deleted; Hole made the
ground there read as none and Fill hole brought it back; Bench01's brush
while Teleadmin01 worked was refused with the message and changed nothing,
and once Teleadmin01 had stopped it worked and its undo put the colour back;
after each save the client fetched the tile and kept it; the tile matched
the original byte for byte after the undos (put back). Not done in step 5:
plants other than Tall Grass (they need their own models), and the owner
trying the tools in the editor.
Step 6: terrain events built 2026-11-12 (agreed with the owner: crater,
earthquake, landslide and sinkhole; each permanent or healing as the GM
chooses; set off by GM chat command or Anyxa, creatures and spells later;
plots protected as with brushes; healing eases back over the last tenth of
its time; quakes shake and stagger but do not harm; sounds picked by the
owner from Freesound). ServerMain/TerrainEvents.cs: an event works out the
ground it will make, lays its paint, clears its grass, then shapes the
ground toward it in steps through the brushes' path, so collision,
navigation, clients, lifting players, moving things and saving all come
with it; its tiles are held while it works. A healing event stays as made
for the time given, then eases back over the last tenth of it (at least
5 s) to the ground, paint and grass it found; healing events are kept in
terrain_events.json beside the tiles and carry on after a restart. The
shapes: a crater (a bowl a third as deep as its radius, a raised rim to 1.6
times it, blasted ground); a sinkhole (a steep pit, its floor a hole, a new
cave mouth); a landslide (on a slope only: the ground sinks over an
ellipse and the same volume comes to rest as a mud fan downhill); an
earthquake (a jagged fault through the spot, a crack, one side pushed up,
the other dropped a little), shaking for 10 s: clients shake the camera by
distance (Network.quake_shake_at) and players inside move at half speed,
server and client alike. Commands @crater, @sinkhole, @landslide,
@quake <size> [minutes to heal] [x z] (craters and sinkholes in front of
you without x z, the others where you stand), and Anyxa's terrain_event
tool. Tested headless with Teleadmin01 at (-140, -60), each healing after
30 s: the crater (8 m) went 2.8 m deep; the sinkhole (6 m) 6.8 m deep with a
hole at its floor; the landslide (15 m) moved 274 m3 down the slope, the
same 274 m3 coming to rest in its fan; the quake (30 m) opened a crack and
ridge up to 1.16 m and slowed the player standing in it to half speed while
it shook, full speed after; every one healed back to the old ground at all
1,369 points checked, and the tile was identical to the original byte for
byte afterwards (put back). Events cost the server 0.3-0.6% of a core.
Sounds (picked for the owner, who will say if one is wrong; all CC0 from
Freesound, made mono and level-matched by tools/audio/import_sfx.py): an
earthquake rumbles with 199803 by TheMinkman, a landslide slides with 810962
by Logicogonist, a crater hits with 536803 by egomassive, and a sinkhole falls
in with the dungeon's rockfall three times as it opens. ReceiveTerrainEvent
tells every client of an event (it replaced the quake-only message), and each
plays its sound where it is, carrying 150 m or eight times its size;
checked headless, every event's sound played from its bank.
Overlapping events fixed 2026-11-12. The sound test made a crater, a sinkhole and a quake close together and the healed tile no longer matched: a quake begun over a crater had taken the crater's bowl for the ground it found, so healing after the crater put the bowl back. Now each event keeps, at each point, what other changes (other events, GM brushes) have added there since it began, and always writes its own value plus that: other changes stay, and ground nothing else touched comes back exactly. Paint goes back only where it is still the event's (and is handed on to a later event that took it for the ground it found); grass puts back only the plants the event took. Tested: a crater healing after 20 s with a quake over it healing after 40 s; with the crater healed the quake's crack stayed on the old ground, and with both healed every point was back and the tile identical to the original byte for byte. Not yet: creatures' and spells' craters, and the camera shake seen with a real renderer.
Step 7 measured first 2026-11-12 (agreed with the owner: measure what
breaks before building; the world stays 24 km, a wider one only for tests).
A test-only wider wrap: the server reads test_world_size.txt beside the
tiles, the client MOONDOG_TEST_WORLD_SIZE; without them nothing changes.
With the wrap at 350 km the probe client swam out at sea (no land out there)
for 30 s, both sides single precision as now:
| Where | Divergence p50 / p95 | Corrections | Distance swum in 30 s |
|---|---|---|---|
| (5, 5) km | 0.002 / 0.23 m | 9 of 898 | 57.0 m |
| (25, 25) km | 0.033 / 0.14 m | 12 of 899 | 57.4 m |
| (100, 100) km | 0.031 / 0.20 m | 10 of 897 | 54.0 m |
| (170, 170) km | 0.004 / 0.04 m | 3 of 900 | 54.0 m |
Client and server stay in step even at 170 km: both round the same way, so they agree. But past about 65 km the rounding is coarse enough to change movement itself: a 32-bit float resolves 8 mm from 65 km and 16 mm from 131 km, against a swimming step of about 3 cm and a walking step of 8 cm a tick, and the swimmer went 5% less far there. Not yet measured: walking and physics on ground that far out (there is no land there).
The view, measured on the owner's PC with a real renderer
(tools/large_worlds/shimmer_test.gd, run with the game's project and
-s; no server): a camera slides sideways at 0.5 m/s past small boxes
2.5 m and 0.6 m away, every frame is read back from the GPU and each box's
centre found to a fraction of a pixel; the scatter about a straight line is
the shimmer (0.2 px is the box's edges crossing pixels).
| Scene at | Box at 2.5 m: rms (worst) | Box at 0.6 m: rms (worst) | Camera drift |
|---|---|---|---|
| 0 km | 0.20 (0.45) px | 0.18 (0.40) px | 0.86 px/frame |
| 5 km | 0.20 (0.47) px | 0.19 (0.42) px | 0.86 |
| 25 km | 0.18 (0.38) px | 0.19 (0.39) px | 0.81 |
| 65 km | 0.18 (0.38) px | 0.19 (0.44) px | 0.81 |
| 100 km | 0.19 (0.45) px | 0.19 (0.44) px | 0.81 |
| 170 km | 0.19 (0.41) px | 1.06 (6.43) px | 1.61 |
Drawing itself holds to 100 km; what goes wrong far out is the positions. A 32-bit position at 170 km moves only in 1.6 cm steps, so a camera meant to slide 0.8 cm a frame jumped unevenly at twice the speed and anything held close jumped up to 6 px; from 25 km its slide was already rounded 6% short, as the swimmer's was. One cause, then, on both sides: positions kept in 32-bit floats, felt from about 65 km and plain by 130 km.
Step 7 decided 2026-11-12: double-precision builds on both sides (the
owner's choice, over a moving origin on the client): the game server and the
owner's editor will both run Godot built from source with precision=double,
mono enabled. Built on the R710 in its own container at low priority
(tools/godot_double/, the Linux build and the Windows editor cross-compiled
with MinGW); then the server's C# moves to 64-bit positions, the network
carries positions at full precision, the server image switches to the new
build and the owner's editor to the new one.
Terrain3D retired 2026-11-12 (agreed: its native add-on cannot load in a
double-precision engine, and the tiles are the only copy of the terrain).
Removed from both projects with its plugin and extension entries, its
loading in Bootstrap.gd, the resources World.tscn still carried, the
Terrain3D code in Dungeon.gd, PlotTerrain.gd (only RING is left) and
TerrainProbe.gd, the region converter (TileStore.cs) and four Terrain3D
check scripts. The 832 region files (673 MB) left the project for
W:\Moondogbackend\terrain3d_retired on the owner's PC (and git history);
map_data/sea_mask.bin, the sea's shape, stays. Checked on the R710: the
server starts with its dungeon, islands, sea and cover as before ("Terrain3D
not loaded"), and a headless client wanders the vardo with no script errors.
Still naming Terrain3D, not run since: scripts/check_housing.py,
scripts/check_spawn_mountains*.gd and scripts/build_client.py's export
check.
Step 7 built 2026-11-12: double precision on both sides.
- The builds (
tools/godot_double/, run in the containermoondog-godot-builderon the R710, output in~/godot-double-build): Godot 4.7.2-stable withprecision=double, mono. The Linux editor, its C# assemblies and the GodotSharp NuGet packages took about 30 minutes; the Windows editor, cross-compiled with MinGW (no Direct3D 12), about 45 more. The Windows build needs only Windows' own DLLs. - The server's C# builds against those packages (
GodotFloat64;nuget.configmaps Godot's packages to the local build only, since they carry the same version numbers as the official ones). Positions are 64-bit throughout: sessions, entities, creatures, movement, the world wrap, tiles and islands, dungeon navigation, terrain edits and events, furniture, stables, ships, carts, pets, wishes, GM placement and teleports. RPCs that bring a position from a client take doubles. Angles, speeds and 0–1 weights stay 32-bit, and offsets taken in 64 bits from a nearby centre are made 32-bit only once they are small. Surface navigation keeps 32-bit points: they are whole multiples of its 2 m grid, which 32 bits hold exactly out to 16,000 km. The replay log writes round-trip numbers. - Saved positions: migration
DoublePositionswidens every saved world position to double precision (characters, world entities, furniture, stables, wells, inscriptions, karma log, pets' homes, wishes, water bodies, weather regions). Places in a ship's frame and heights stay 32-bit. - The state packet, version 5 (
StateCodec.cs,Network.gd _decode_state): the header carries an origin, the corner of the client's 256 m square as two f64s; every other row's x and z are 32-bit offsets from it, written per client (rows aboard a ship stay in her frame); the client's own row carries its place as three f64s for reconciliation. 28 bytes more a packet (16 in the header, 12 in the own row), nothing per row. - Height-map collision: a
HeightMapShape3D'smap_datais a 64-bit array in a double build and refuses a 32-bit one, even untyped.Islands.gdandTileTerrain.gdhand itreal_heights(), which converts only in a double build (about 1 ms a tile, on the worker). - The server image (
docker/Dockerfile.game-server): the .NET 10 SDK (the LTS; .NET 8's support ended 2026-11-10, the owner chose the LTS) on Ubuntu 24.04, whose glibc the engine needs (Debian 12's is too old), with the double build's Linux editor, GodotSharp and packages from the build contextgodot-double(composeadditional_contexts,~/godot-double-build). The server project targetsnet10.0. The image's contract check sees the server's subfolders again; it had copied only top-level files and failed since the ServerMain split. The export stage (a production stack) exports with the double Linux template from the same build context. The dev stack does not use that stage. - The owner's editor:
W:\Godot\double\godot.windows.editor.double.x86_64.mono.exe(with itsGodotSharpfolder beside it); the single-precision editor inW:\Godotis unchanged. Openinggodot_client/project.godotin it re-imports the project once. - Export templates (built later the same day, about 1 h 40 m for all
four): Linux and Windows, release and debug,
precision=double, mono, packed bybuild.shinto~/godot-double-build/templates/4.7.2.stable.mono.doubleand installed on the owner's PC in%APPDATA%\Godot\export_templates\4.7.2.stable.mono.double, where the double editor looks for them. Checked: the server, exported with the Linux template inside the game-server container from a copy, reports4.7.2.stable.mono.doubleand carries the double GodotSharp; the PC test copy of the client, exported for Windows with the double editor (a Windows preset added for the test only;godot_clienthas only Linux/X11), boots headless as the double build and runs without errors.
Step 7 measured again 2026-11-12, double precision. Server, as above,
with the test wrap at 350 km (test_world_size.txt, removed afterwards; the
world is 24 km again). The probe client (the same engine, headless in the
game-server container) swam 30 s at sea:
| Where | Divergence p50 / p95 | Distance swum in 30 s | Before (32-bit) |
|---|---|---|---|
| (5, 5) km | 0.036 / 0.10 m | 57.39 m | 57.0 m |
| (25, 25) km | 0.006 / 0.036 m | 57.59 m | 57.4 m |
| (100, 100) km | 0.034 / 0.067 m | 57.59 m | 54.0 m |
| (170, 170) km | 0.006 / 0.081 m | 57.52 m | 54.0 m |
A swimmer now goes as far at 170 km as near home. At the island the probe walked 10 s on the new packet with p50 0.19 / p95 0.26 m (uphill).
The view, tools/large_worlds/shimmer_test.gd on the owner's PC with the
double editor (the PC test copy of the client):
| Scene at | Box at 2.5 m: rms (worst) | Box at 0.6 m: rms (worst) | Camera drift |
|---|---|---|---|
| 0 to 170 km, every offset | 0.20 (0.45) px | 0.18 (0.40) px | 0.86 px/frame |
The same at every offset, where the 32-bit build jumped up to 6.4 px at 170 km and slid at 1.61 px a frame.
The server keeps only the ground near what needs it (built
2026-11-12, agreed with the owner). ServerMain/TileStreaming.cs. At
start the server only lists the tile files (TileWorld.Index, 47 ms for
832, where loading them all took 3.4 s). A tile is held:
- within 1 km of a player;
- within 256 m of something awake with no player near: pets, GM events' creatures, killing stones whose seal is broken, and ships (sailed every physics step wherever they are; an anchor's cable reads the seabed under her each step);
- while it has unsaved GM edits, a GM's lock, a stroke in progress, or a terrain event (from its shaping until it has healed).
A held tile is set up: its collision shape, its surface navigation and its
tall-grass cover. Nothing needing it for 2 minutes, it is dropped, with any
copy kept for editing once it is saved. A height asked anywhere else loads
that tile's heights at once (TileWorld.Demand), so no height is ever
missing because of streaming; such a tile goes after the same 2 minutes.
The tile under each player is checked every frame, and if it is not set up
(someone just arrived) everything within 150 m is set up at once; the rest
follow four times a second, nearest first, about 12 ms a pass. Dropping
takes at most 4 ms a pass, the rest waiting for the next.
Each tile's ground is worked out the same way every time it loads: the
file's heights (or this run's unsaved edits), the dungeons' cut, then
every plot in id order with PlotTerrain.flatten's arithmetic. Removing a
plot works its tiles out again without it, instead of putting back saved
heights. A tile's collision reads its east and south neighbours' first row,
so their heights are loaded before it is built; it is built once, and left
alone when they come or go, as their ground has not changed. Tall grass is
counted per square, as a square near a tile's edge can be covered from both
sides, and each tile's squares are kept so letting it go is exact.
Checked on the R710: with nobody on, the server holds the ground round the four pets only (9 tiles, 7 set up) and settles at about 0.6 GB (1.72 GB before, holding all 832 tiles). One player in the village holds 69 tiles set up, plus about 20 neighbours' heights. The probe client walked 14 s from outside plot 81 across its edge ring onto the flat, and the server's ground matched the client's (p50 0.06-0.08 m, p95 0.17 m apart, heights within 5 mm, ending at the plot's height); a walk on a slope beside it gave p50 0.00 / p95 0.08 m. Two minutes after the probe left, its 81 tiles were let go, back to the pets' 9.
Costs on the R710's Xeon L5520, on the main thread: reading a tile and baking its ground about 3.7 ms; setting one up about 13 ms on average including any loads, 23 ms at most; the most spent on tiles in any frame 31 ms (one player arriving), dropping at most 3 ms a pass. A first version dropped 62 tiles in one 336 ms pass and rebuilt four collision shapes for every tile set up; both fixed.
Tiles made ready on a worker thread (built 2026-11-12).
ServerMain/TileWorker.cs. A worker thread reads the file, bakes in the
dungeons' cut and a copy of the plot list taken when the tile was asked
for, and works out its surface grid and tall-grass squares. The main
thread takes the finished tile and sets it up once the neighbours its
collision reads are there too, leaving it only the collision shape and
putting the grid and squares in place. Work done against an older plot
list, or on a tile changed or loaded another way meanwhile (each tile
counts its changes), is thrown away and asked for again. Up to 32 tiles
wait for the worker at once. Tiles within 150 m of a player who has just
arrived, heights asked for anywhere, and tiles with unsaved edits are still
loaded on the main thread at once.
Measured the same way (probe into plot 81, then let go): 73 tiles made ready on the worker, 5.5 ms each there; on the main thread a set-up now costs 4.4 ms on average, 8 ms at most (collision 4.2 ms, paths 0.1, grass under 0.1), where it was 13 ms and 23 ms; the most spent on tiles in a frame 18-24 ms (arrival), was 31 ms. Only one or two tiles a minute are still read on the main thread. The collision shape (Jolt building its height field) is now nearly all the main thread's cost.
Two tiles were still read on the main thread every two minutes with nobody on. A temporary log of who asked found the ships: an anchored ship's cable reads the seabed under her every physics step, and those tiles, loaded only on demand, were let go after two minutes and read straight back. Ships now hold the ground round them like pets; with nobody on the server holds 19 tiles (pets and ships) and reads none after start.
Clients download only the tiles near the player (built 2026-11-12).
Until now each client asked the portal for every tile and downloaded all of
them, which a generated world of tens of thousands of tiles would make
gigabytes. Now the portal lists the tiles within r metres of a point
(GET api/tiles?x=&z=&r=; the plain list stays for older clients) and
keeps each tile's header until its file changes. The client
(TileStream.gd) asks for the tiles within 4.5 km of the player and camera
(it draws out to 4 km), again whenever they move 1 km from where it last
asked, and downloads the missing and changed ones nearest first. The player
is held still over a tile the portal named that has not arrived yet; a tile
not named in the listed area is open sea. With the portal out of reach the
cache is all there is, as before, and it asks again every 30 s. Checked: the
portal gives 32 tiles within 600 m of home's middle and 832 unasked; the
probe client, its cache emptied, downloaded the tiles round it and walked
260 m (p50 0.05 / p95 0.13 m from the server).
The generated land itself is in World generator.
Future direction (owner, 2026-11-12): regions of cells on their own
threads. The grids are plain C# and read-only once built, and each
search keeps its own state (DungeonNav.Search; SurfaceNav to follow), so
pathfinding can run on many threads. Groups of awake cells far apart are
natural units to run in parallel. Still in the way: the server's one big
lock, creature code calling Godot (physics rays, GDScript) that must run on
the main thread, and anything crossing between areas (chases, fights,
trades), which needs a hand-over step between ticks. Further on, the same
split can become separate server processes (WorldWrap's world edges).
Stages
Each stage is its own commit (or several), tested before the next starts.
Stage 1: sleeping world cells (server)
Independent of the terrain work. It pays off on today's map as content grows.
- Divide the world into cells (about 256 m). A cell within a set distance of any player is awake; the rest sleep.
- Sleeping creatures are skipped by the per-tick loops, or get a cheap tick every few seconds (heal, drift home).
- Spawners with no player near keep their creatures as plain records and spawn them when a player arrives.
- A cell grid for "nearest player" and "what is around me" lookups, in place of scanning every creature or player.
- Agreed with the owner 2026-11-12: creatures wake within 500 m of a player (view range is 310 m); one that falls asleep away from home is put back near its spawner, calm (no target, no threat, idle); spawners with no player within 500 m do not refill until one comes; with no player near, only GM events and marches, the killing stones, pets and creatures leaving at their hours' end keep running.
- Measure first: per-creature cost per tick today, so the gain is known.
- Baseline, measured 2026-11-12 (R710,
STEPSlog line, three one-minute windows, 133 creatures, 4 pets, no players logged in): the creature AI step takes about 30 ms per run, ten runs a second, so about 30% of a CPU core, roughly 0.23 ms per creature per run. Worst run 97–274 ms. Every other step together is about 5% (state broadcast 4.8%, 1.6 ms per run, even with no one to send to). - Where the creature AI time goes (same conditions, timers inside the step): wandering about 15–17% of a core (about 0.16 ms per wandering creature per run, worst single call 29–42 ms, likely navigation-mesh queries on the 43,771-polygon island mesh; timed separately from the next run); standing walkers back on the ground after the loop about 10%, most of it calls into the GDScript terrain wrapper (floor height and has-ground, about 50,000 calls a minute each at 40–50 µs); birds about 2%; sensing players about 0.1%. Fixing the prey scan (hunters checked every creature) made no measurable difference with today's few hunters.
- Built 2026-11-12 (
ServerMain/WorldCells.cs, on thelarge-worldsbranch): with nobody online, creature AI fell from about 28% of a core to 0.08–0.16% (0.09–0.17 ms per run), all steps together from about 33% to 5%, and the container from about 39% CPU to about 12%. The state broadcast (4.5%, 1.5 ms per run with no one to send to) is now the largest step. - Wake checked 2026-11-12 (
scripts/check_sleeping_cells.py): a test player stood by a horse; the client was sent it and it wandered (up to 15 m) while the player was there. In that window, with one player, creature AI was about 14% of a core. Navigation queries are now the cost: closest-point about 5 ms and path about 6 ms per call on the 43,771-polygon island mesh. Waking an area made every sleeper ask for a path on the same tick, one run of 838 ms; waking was spread over 1–7 s, but the rerun still saw 865 ms. A second visit in the same server run saw 103 ms. Keeping every creature awake for 15 s after a start did not help (822 ms) and was taken out. Timestamped logs then showed the cause: within 750 ms of the player arriving about 45 creatures each made their first move about 14 ms apart, every one asking the navigation mesh for a path in the same run. (The 1–7 s spread was set only on creatures that had AI state when they fell asleep; ones asleep since start had none.) A woken creature now stands still for a random 0–6 s before its first move, unless a player is within 60 m of it. Rechecked: the worst run on arrival fell from 822–865 ms to 262 ms (the creatures within 60 m still wake together, at about 14 ms of navigation each). The rest waits on cheaper navigation queries. - Navigation cells, built 2026-11-12 (
ServerMain/NavCells.cs). Godot answers every navigation query by checking every polygon of every enabled region (no spatial index). At start every navigation region (world, islands, dungeons; 67,327 polygons) is cut into the 256 m cells along its baked polygons, with no rebake; only cells within about 770 m of a player or a GM event's creatures are on. The nearest-point lookup is the server's own, over the triangles within 21 m (the furthest a point it accepts can be). With a test player near: path lookups 6.3 ms to 0.5–0.7 ms, nearest point 5 ms to 0.16 ms, creature AI 14% to 2.6–3.6% of a core, worst run 262 ms to about 55 ms; every sampled nearest point (23 of 23, 27 of 27) matched Godot's. - Seams are not a problem; switching cells is. Wander paths failed as often within one cell as across an edge (50 ok / 273 failed within, 6 / 27 across), so seams are fine. The failures were Godot rebuilding its navigation map after cells are switched: it takes 23–26 s on the R710 (67,327 polygons), and until then the cells just switched on are not in the map, so every path from them comes back empty. Over a three-minute visit: first minute 13 ok / 346 failed, then 226 / 2 and 220 / 0. Each switch also costs that rebuild in the background.
- Fixed 2026-11-12: every cell stays on (agreed with the owner), so the
map is built once at start and never rebuilt as players move. Each path
lookup (wander, steering, birds, pets) goes through
NavPath, which asks Godot with only the cells round its two ends included (the whole map near a dungeon's entrance link, or for a path spanning more than 6 cells). Measured with a test player near: wander paths 143 ok / 1 failed in the first minute, then 213 / 0; path lookup 2.4–2.5 ms (6.3 ms on the whole map); nearest point 0.15 ms; creature AI 3.4–5.4% of a core. Nothing changes navigation while the server runs today (houses, plots and furniture never did); when something does, only that cell's mesh needs swapping, and creatures keep using the old map during Godot's rebuild. - The server's world navigation mesh covers only about 1.5 × 1.2 km
round the village (baked 2026-10-30,
world_navigation.tres): creatures elsewhere on the island have no navigation. Rebake for the whole island, best with the tiles of stage 2. Still to do: cheaper navigation queries (smaller meshes per tile with stage 2–3, or caching), and the player-cell grid for the other nearest-player lookups.
Stage 2: the tile format and converter
- One tile = one square of ground: heights, the texture-paint (control) map, the colour map and grass instances, in the same layout Terrain3D uses, so moving data between them is a straight copy.
- A converter writes today's 832 regions into tiles without loss, read the
same way
scripts/coast_taper.pyreads regions (no headless Godot import). - Fold the mesh islands (
godot_client/islands) into the same tiles. - A coarse overview file of the whole world for far distance and for the editing map.
Stage 3: server off Terrain3D
- Replace
TerrainProbe.gd's Terrain3D calls with a tile reader: ground height, normal, has-ground, plot flattening, cover cells for Stealth. - Build
HeightMapShape3Dcollision for tiles near players and drop it when they leave. It is the same faceted surface Terrain3D builds now, so movement still matches the client. - Remove Terrain3D from
Main.tscn,sync_terrain.pyand the server image. - Dungeons and islands keep their own collision as today.
- Expected: server RAM well under 500 MB idle (to be measured).
Stage 4: client streaming terrain
- Load tiles near the player, drop them as they fall out of range; the overview mesh beyond.
- Ground shader with texture blending and seamless distance detail. Terrain3D is MIT-licensed, so its shader and level-of-detail approach can be reused rather than written from nothing.
- Grass and plants scattered per tile from the instance data.
- Replace the Terrain3D node in
World.tscnand its users inWorld.gd,Network.gd,Player.gd,PlotTerrain.gd,Dungeon.gd,Islands.gd,HousingSystem.gd,Footsteps.gd,Weather.gd,terrain_grid.gdand the check scripts. - Prediction keeps building collision for the tiles around the player, as it already does near an island.
Stage 5: editing through Terrain3D (the bridge)
- An editor panel shows the overview map of the whole world.
- Pick an area (for example 4 km × 4 km). Its tiles are copied into a scratch Terrain3D scene, centred on (0, 0) however far out the area is, plus a locked strip of its neighbours so edges match.
- Sculpt, paint and place grass with Terrain3D's brushes as now.
- Save writes the area back into the tiles, blending the outermost few metres into the neighbours; the scratch scene is thrown away.
- The graphics card only ever holds the open area, lighter than editing today's map.
- Big shapes (coasts, ranges, rivers) come from generator scripts working on the whole world at low detail, as the island scripts do. Brushes are for local work.
Stage 6: bigger than about 30 km
- Network positions as tile number plus offset inside the tile (small and exact), which also makes wrapping a tile number modulo the world's width.
- Client: a floating origin. The scene is drawn relative to an origin near the player, shifted by whole amounts when the player is more than about 1–2 km from it. Everything that remembers a world position must follow the shift: particles, interpolation buffers, tweens, the predicted body, sounds, and shaders that read world position (water, wind, terrain).
- Server: a double-precision Godot build (
precision=double). It is official and documented but has no downloads, so the Docker build compiles the engine, templates and C# assemblies (--precision=double; watch NuGet caching). Godot's built-in Jolt switches to double positions in such a build. Test movement, physics and navigation before committing. - Grow
Sea.WorldSizeand the wrap with it.
Stage 7, later: in-client sculpting and painting
- GM brushes in the game client: raise, lower, smooth, flatten, paint, grass. They work on the live tiles through the server, which saves them, rebuilds collision and sends the change to nearby players.
- Needs undo, a lock so two GMs do not edit one tile at once, and a permission check.
- Replaces the Terrain3D bridge once it covers what the brushes do. After that Terrain3D leaves the project entirely.
PlotTerrain.gd(plot flattening) is already a live terrain edit shared by client and server: a starting point.
Why later, not now. Stages 2–4 replace the storage and drawing of the terrain; stage 7 replaces how it is made. Doing both at once means nothing works until both do. Terrain3D's brushes work today and the bridge is a straight copy, so little is thrown away when stage 7 lands. The tile format is chosen so the in-client tools can edit it directly.
Order
1 can start at any time. 2 → 3 → 4 in order; 3 can ship before 4 because the client keeps Terrain3D until 4 is done. In that gap the tiles are made from the regions by the converter, so any terrain edit means running the converter again before the server sees it, or the two sides disagree. 5 is needed before any new terrain editing after 4. 6 is required (the world is about 350 km across). 7 later.
Risks
- Seams. Tile edges must match exactly in height and normals, on both sides, or players catch on them and the server and client disagree.
- Client and server must agree. Every stage keeps one source for ground height and collision, shared by both, as today.
- Making the land. A big world cannot be sculpted by hand by one person. It needs a generator, with hand work only where players gather.
- Double-precision build. Less used than the normal build; a failed test leaves the server on server cells instead (much more code).
Target: hundreds of km, a quarter land
Answered by the owner on 2026-11-11: the world is hundreds of km across, sea included, with about a quarter of it land. The working width, about 350 km, follows from the crossing time below. What that means, worked for two smaller widths:
| 200 km | 300 km | |
|---|---|---|
| Whole world | 40,000 km² | 90,000 km² |
| Land (a quarter) | 10,000 km² | 22,500 km² |
| Land data at 2 m spacing | about 10–20 GB | about 22–45 GB |
| Land data at 1 m spacing | about 40–80 GB | about 90–180 GB |
| Today's home island, for scale | about 185 of them | about 410 of them |
| Crossing at 8 m/s (today's best ship) | about 7 hours | about 10.5 hours |
What follows from it:
- Stage 6 is required: a floating origin on the client and a double-precision server.
- No player downloads the whole world. Tiles are sent from the server (or a plain file server) as the player approaches and cached on their disk. A 256 m tile at 2 m spacing is about 200 KB raw, perhaps 60–100 KB compressed. Walking with a 2 km view radius brings in a new row of about 16 tiles every 50 s or so, about 30 KB/s; sailing at 8 m/s about 50 KB/s.
- The server streams too. Heights for 22,500 km² at 2 m spacing are about 22 GB, too much to hold, so the server loads tiles near players from disk, as the client does.
- The world is generated, with hand work where players gather. At a few hundred home islands' worth of land, a generator makes the base (coasts, ranges, rivers, biomes) and its output is stored as tiles; villages, roads, dungeon entrances and landmarks are worked by hand through the bridge (stage 5) or later in-client tools (stage 7).
- Mixed detail. Generated land at 2 m spacing, 1 m only in tiles that are worked by hand. That keeps the data near the 2 m column above.
- Tiles leave git. Tens of GB cannot live in the repository (today's 673 MB of regions already do). They need their own store on the R710 with its own backup. Paid Git LFS is out.
- Travel time: half a day or more. Answered by the owner on 2026-11-11: crossing the world by ship should take half a day or more. At today's best ship (8 m/s), 12 hours is about 345 km, so the working width is about 350 km (a lower bound; faster ships would mean a wider world for the same crossing). At 350 km: 122,500 km² in all, about 30,600 km² of land, about 31–61 GB at 2 m spacing (120–245 GB at 1 m), about 560 home islands' worth of land.
- World edges.
WorldWrapalready allows an edge to lead to a neighbouring server's square one day; at this size that may be how the load is split when one server is not enough.
Decisions
- Width: answered, about 350 km (half a day or more to cross at 8 m/s).
- Detail: agreed 2026-11-11, 2 m between height points for generated land, 1 m in tiles worked by hand.
- View distance: agreed 2026-11-11, full-detail ground out to 2 km round the player (about 16 km², roughly 40–150 MB), the coarse overview beyond.
- Tile size: agreed 2026-11-11, 256 m, the same as today's Terrain3D regions, so the converter and the editing bridge are straight copies. About 470,000 land tiles at 350 km; they can be packed into bundle files if the count is a problem.
- How land is made: agreed 2026-11-11, our own generator script in
Python (like the island scripts and
scripts/coast_taper.py), writing tiles directly and rerunnable when its rules change. It makes the base: coasts, ranges, rivers, kinds of country. Hand work only where players gather. Still to settle: where the hand-worked places are. - Stage 7 timing: agreed 2026-11-11, later, as proposed. The Terrain3D bridge (stage 5) covers hand editing until then.