Moondog, day 25 (14 Nov): hunting pauses, and the sound of a ship
19 commits. Half of them went to chasing server pauses down to almost nothing, and the rest to wind, water and the sound of being aboard.
Server pauses
Yesterday's honest stall log had plenty to say. A tour of what it found:
- Tree trunks. A planted tile has thousands of trunks. Colliders are now built only in 32 m cells around players and creatures, a little each frame. Setting up a tile went from about 60 ms to about 10 ms.
- Teleports. After a 37 km teleport, Godot took the jump as motion, so the body's box spanned the whole route and tested every ground tile along it: 1.1 s for one step. A body that moves more than 8 m is now re-placed instead.
- First login. Every one of the server's methods is now compiled on a background thread at start (5,250 in about 2 s). The ground under an arriving player is read by a worker first, and the login's sends go out over several frames.
- Lakes. All 3,500 of them (about 500 KB of JSON) went to every player at login. Now each player gets the ones within 6 km, about 55, and an update after every 2 km travelled.
- Content reload. It used to pause the server for 0.6 to 1 s, mostly from re-reading the rivers on the main thread. Now it's 6 to 15 ms.
The pause measure itself got more honest again: it measures tick start to tick start, because a slow tick could hide inside its own measurement.
Wind that doesn't race
Trees in a storm sat nearly still, then thrashed for a moment, then went still again. The rocking was sin(time * (a + strength)). With time in the thousands of seconds, every small change in the gusting strength made the phase race. Now a fixed calm beat blends into a fixed storm beat, and only how far things move follows the wind. Undergrowth sways with the same wind now, each plant bending from its foot by how stiff it is.
The rivers had the same disease. The ripples scrolled at UV.y - TIME * speed with the speed changing along the river, so after an hour the pattern at the rapids had squeezed into glitter. Now two copies run for 4 s each, half a period apart and crossfaded.
And the sea: in the double-precision engine the camera's world position comes out wrong far from the origin, so every wave faded to nothing and the sea drew flat in a storm while ships still rolled. The mesh is centred under the camera anyway, so the vertex's own position gives the distance.
Plants and trees
- Undergrowth cards seen from behind came out nearly black, because a two-sided material flips the normal on the back face. A small shader keeps it pointing up on both sides.
- Undergrowth now grows on all the generated land, not just the test area. It also waits until the lakes and rivers around a square have loaded, so the same spot always grows the same.
- Far trees had a dark dash flickering over them: the trunk from the square above bled into the one below in the smaller copies of the billboard sheet. The shader now stays half a texel inside its square.
- I redid the windswept larch (sparse flags streaming downwind, not a blob) and the old alder (a full rounded crown with the trunk running up through it).
Ship sounds
Being aboard finally sounds like it: the sea along the hull with her speed, creaks with the wind and speed, and the sails with how much canvas is out, loudest when flogging. They're three CC0 loops from Freesound, each made to loop seamlessly, and eased toward the ship's state and the gusting wind. After a listen in game, they went up 8 dB.