The Godot Client
godot_client/ is the game's first-person client. It started as a minimal
movement example and is now the client players use. It has these features:
- WASD movement, mouse look, jump, sprint and riding
- gamepad support with rebindable controls
- ENet connection to the server, with JWT authentication from the login screen, the environment or the command line
- client-side prediction and reconciliation against the server
- a first-person body, with other players drawn in full (Models and Animation)
- windows for character, inventory, pets, carts, quests, NPCs, stations and loot
- melee and bow combat, gathering, refining and crafting (Gameplay)
- chat, which also carries the loot log
- a GM panel for placing things in the world (GM Tools)
- diagnostics for movement and telemetry (Diagnostics)
- headless modes for probes, bots and screenshots (Testing with Bots)
Run it
The client reads its configuration from the process environment, falling back
to a .env file. Copy the example and edit it:
cp godot_client/.env.example godot_client/.env
MOONDOG_PORTAL=http://192.168.0.149:8082
MOONDOG_HOST=192.168.0.149
MOONDOG_PORT=7777
MOONDOG_TOKEN=<jwt from portal> # omit to use the login screen
Then open godot_client/project.godot in the Godot editor and run the scene.
Why a file and not just environment variables
Environment variables alone work when the game is launched from a shell. They
silently do not when it is launched from the Godot editor, which is the
documented way to run this. F5 spawns the game as a child of the editor, and
the editor inherits from whatever launched it — usually explorer.exe, whose
environment was fixed at logon. A variable exported in PowerShell after that
is invisible three processes down.
Nothing errors when this happens. The client uses the shipped public portal and the shipped public game server, authenticates successfully against the public deployment, and then sends a local-server login somewhere it cannot be verified. The only symptom is a signature error from a machine nobody is looking at. A file on disk is read from the same path regardless of who launched the process, so it does not have that fragility.
Precedence is deliberate: the real environment wins, and .env only fills
gaps. A stale file cannot shadow a deliberate override.
Check what was resolved
The client announces its configuration on startup, before connecting:
[client] portal: http://192.168.0.149:8082
[client] game server: 192.168.0.149:7777 (pinned)
[client] config read from res://.env
(pinned) means an explicit setting was found; (default) means the client
is on the shipped public deployment. If a local stack reports (default), the
setting never arrived. The portal line matters just as much — a local portal
that reports 127.0.0.1 for the game server will send clients to their own
loopback rather than to the server, which is a connection failure that points
nowhere near its cause.
MOONDOG_HOST is optional when the portal is configured correctly, because the
portal tells the client where to connect and its answer wins. Set it only to
override that. Whatever the portal reports is what every other client will
also get, so a portal left on its 127.0.0.1 default will misdirect all of
them on a multi-machine setup.
Command-line flags
The token can be overridden on the command line, which is how several clients run side by side:
godot --path godot_client -- --token-file=/tmp/nyx.token
| flag | what it does |
|---|---|
--token=<jwt>, --token-file=<path> | sign in with this token |
--probe=<scenario>, --probe-seconds=<n>, --probe-yaw=<deg> | run a scripted movement probe (Diagnostics) |
--probe-note=<text> | attach a note to the probe's telemetry capture |
--probe-chat=<text> | say one line in chat a second into the run |
--bot | play unattended (Testing with Bots) |
--shots | take the portal's screenshots, then quit (needs a Tester token) |
--telemetry-sink=<url>, --telemetry-key=<key>, --telemetry-check | telemetry overrides (Diagnostics) |
Host and port are not flags. They come from the environment or .env only.
Controls
All of these can be rebound on the settings screen's Controls tab (Escape or
F2), for keyboard and mouse and for gamepad. Bindings are saved to user://.
| action | keyboard/mouse | gamepad |
|---|---|---|
| move | W A S D | left stick |
| look | mouse | right stick |
| jump | Space | A / ✕ |
| sprint | Shift | LB / L1 |
| attack | left mouse button | — |
| draw or sheathe a weapon | Tab | — |
| interact | E | X / □ |
| torch | F | — |
| mount or dismount a pet | R | — |
| chat | Enter | Y / △ |
| character window | C | — |
| inventory | I | — |
| pets | P | — |
| quest journal | L | — |
| GM panel | F12 | — |
| settings | F2 | — |
| close open windows, or open settings | Escape | — |
F1, F3 and F7 are diagnostics, covered in Diagnostics.
F4 is deliberately unbound. Interact used to live there, back when it was
a tester tool beside F1 and F3. It became something players do, so it moved
to E, and F4 is kept free for the next diagnostic.
The gamepad column gives the Xbox name first because that is what Godot's button
indices are named for. The same physical button is X on an Xbox pad and □
(Square) on a PlayStation one, and Y/△ and A/✕ differ the same way. Learn the
position, not the letter.
Look sensitivity defaults to 0.002 for the mouse, with separate horizontal
and vertical rates for the right stick.
Rebinding
Rebinding replaces one half of an action, not the whole thing: a keyboard
capture leaves the controller binding alone and a controller capture leaves the
keyboard one. That is what lets a player with both devices keep both — binding
X to Interact no longer deletes E.
Settings lists the two devices in separate sections, so you can see what each click is about to replace. Rows appear only where that device has something bound, so pad-only actions are not shown under Keyboard. Mouse look is not an action at all — it is raw motion, so it has no row in either section.
A pending capture only accepts the device it was started for. Click the Keyboard row for Interact and press a pad button, and the press is ignored rather than silently binding the other half and leaving the row you clicked unchanged.
Chat opens with Enter and closes with Escape. The declaration in
project.godot once had the wrong keycode — 4194305, which is Escape, where
4194309 was meant. Nothing caught it, because nothing queried the action: a
hardcoded KEY_ENTER branch was doing the real work while the mis-declared
action sat there looking plausible. It only became visible when the action was
made authoritative so that rebinding and the controller button would work at
all — at which point Enter stopped opening chat and Escape started.
The general shape is the same one input_check.gd guards against: a declaration
that is never read is a declaration that can be wrong for as long as you like.
Windows release the cursor
Windows are closed until opened, and pressing the key again closes them.
The GM panel's visibility does not follow the role the server sent — a Player
who presses F12 sees a panel whose buttons the server refuses, so the panel is
a convenience, not a control.
While any window is open the cursor is released, so its buttons can be clicked; it is captured again the moment the last one closes. With the mouse captured a window's buttons cannot be clicked at all, which is exactly the state a player is in the moment they open one.
The camera holds for the same reason. A window open means the cursor is the window's, and the motion that moves it must not also swing the view — the camera turning while the player is trying to aim at a button is disorienting. This is true of the pad's right stick as well as the mouse, and it follows the windows rather than the mode, so the character window can be read while walking.
A menu takes the keyboard
Escape backs out one layer per press: furniture being placed, then every open
window at once, and with nothing left open it opens the settings screen
(Controls, Look and Graphics tabs, with Quit game beside
Close). Another Escape closes settings. While chat, settings or the login
screen is open, gameplay input stops, and nothing but Escape gets through.
This is not only tidiness. Two things follow from it:
- You cannot walk into whatever is in front of you while navigating a menu. Held a direction, opened chat, and without this you kept walking for as long as you typed.
- Typing a message cannot fire gameplay actions. Input state is updated
before the UI consumes a key, so a message beginning with
ewould otherwise toggle the box you were standing next to.
The menu does not pause the game. That is not a stylistic choice:
- Your client sends an input packet every physics frame. That packet is what keeps your session alive, and the server reaps a session that goes quiet for ten seconds. Pausing the tree stops the packets — so a pause menu would log you out.
- Even with networking worked around, the server keeps simulating your body while your client is frozen. You would resume into having fallen, walked or been hit, with no explanation.
So the menu stops input and nothing else. You stand still; the world and everyone in it carry on. For a shared world that is also the only honest version — there is no such thing as pausing someone else's game.
Settings opened from the menu returns to the menu, not to the game.
F3 and F7 are the deliberate exceptions. They stay live in every mode,
including while typing, because they are diagnostics: a tester reporting a
problem mid-sentence should be able to attach a capture.
Pressing interact with nothing in reach
Pressing interact with nothing in reach says "nothing in range to interact with" — a message the network node produces itself, because whether anything is close enough is a question only it can answer.
That sentence is here because the alternative shipped first and crashed. The
message used to be emitted by the input router calling flash_status on the
network node, which does not have that method; the line aborted and the player
got a console error instead. No automated test covered it, because the headless
probe drives the network round-trip directly and the one client test always
placed a box in reach — so walk up to nothing and press the key was the single
untested path, and it was the obvious thing to try.
scripts/check_rpc.py now fails if the client calls a method on the network node
that the network node does not have. It is a heuristic that knows one variable
name, so it is a net rather than proof — but it turns a crash a player reports
into a failed check.
Code layout
The client is split into autoloads, one per system, plus scene scripts for each window and for the player.
| where | what |
|---|---|
scripts/Network.gd | the root Main node: connection, auth, RPC stubs, reconciliation, remote interpolation |
scripts/Player.gd, scripts/PlayerBody.gd | movement simulation, the physics body and the drawn body |
scripts/ClientInput.gd, scripts/InputBindings.gd | input routing, mouse look, diagnostic keys, binding persistence |
autoloads/NetworkManager.gd, GameState.gd, SceneManager.gd | connection state and scene flow |
autoloads/WorldEntityManager.gd | world entities: appearance, models, creature animation, interpolation |
autoloads/CombatSystem.gd, InventorySystem.gd, CraftingSystem.gd | combat, inventory, refining and crafting |
autoloads/NPCInteraction.gd, QuestManager.gd, TradeManager.gd | NPCs, quests, trading |
autoloads/PartySystem.gd, GuildSystem.gd, HousingSystem.gd, EventManager.gd | social systems and world events |
autoloads/ChatManager.gd, HUDManager.gd, UIManager.gd, SettingsManager.gd, InputManager.gd | UI |
autoloads/GMToolsManager.gd, scripts/GmPanel.gd | the GM panel |
autoloads/TelemetryManager.gd | captures and telemetry upload |
scripts/*Panel.gd | one script per window: character, inventory, pets, carts, NPCs, stations, packs |
scripts/MovementProbe.gd, scripts/Bot.gd, scripts/CaptureShots.gd | headless modes: probe, bot, screenshots |
tests/ | headless checks run with godot --headless --script |