> ## Content Index
> Fetch the complete content index at: https://devlog.bujingames.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Moondog, day 2 (16 Oct): slopes, ledges, and measuring the right thing
- URL: https://devlog.bujingames.com/moondog-day-2-16-oct-slopes-ledges-and-measuring-the-right-thing/
- Published: 2026-10-17T04:00:00.000Z
- Updated: 2026-12-01T19:49:13.000Z
- Description: 24 commits, still mostly movement. Yesterday's fixes made walking on flat ground smooth. Today was slopes, edges, a real network link, and making sure the numbers I measure actually mean something.
- Author: Jin
- Tags: moondog, devlog

24 commits, still mostly movement. Yesterday's fixes made walking on flat ground smooth. Today was slopes, edges, a real network link, and making sure the numbers I measure actually mean something.

## Correction that understands latency

Testing against a server with a real round trip (about 126 ms) showed that both deadzones assumed a snapshot is one tick old. Over a real link it's nearly five ticks old. I now measure how stale the snapshots are and size the horizontal and vertical allowances from that, plus the correction rate.

On slopes, every bit of height the server was "behind" looked like vertical drift. I now compare height above the terrain rather than raw height. That cut vertical corrections by roughly twentyfold.

Edges were a separate case. Walking off a ledge, the client steps off first and the server follows a round trip later. For a moment one side thinks it's airborne and the other is still on the floor, and the client was "correcting" a grounded player upward toward a position its own physics hadn't reached yet. The server now sends whether it's on the floor, and vertical correction only fires when both sides agree.

## Measuring the simulation, not the network

The divergence probe had been comparing the server's position with where the client is *now*. Those are two different moments, so at walking speed the probe read 1.5 m before any physics disagreement at all. It was measuring the network. Now each input carries a sequence number, and the client keeps where it was when it applied that input. A snapshot echoing input N is compared against the prediction for input N: same moment, same inputs.

## A dead end worth writing down

I tried queueing client inputs on the server and applying exactly one per physics tick, so both sides would step in lockstep. It didn't pay for itself, so I wrote down why and took it back out. I also added a "stop" scenario to the probe, because every existing scenario held its input for the whole run and never caught the lurch you get when you let go of a key.

## Controllers and quality of life

- Gamepad support with no setup, plus a settings screen for rebinding and look sensitivity. (First version inverted vertical look on pads, because the stick value was flipped twice.)
- Saved positions and spawns are clamped to somewhere you can actually stand. A character saved at the map origin was spawning inside the terrain and couldn't move.
- A server started without terrain data now refuses to look healthy. Before, it came up fine and everyone just fell through the world.
- When the server goes away, the client returns you to the login screen instead of leaving you in a frozen world with a captured mouse.
- A rejected token now says plainly what's wrong instead of sending you after a key-rotation problem that doesn't exist.