Guide

Connect your engine

One socket, one feed out, two commands in. About two hours for a first character if your engine can already move an actor to a point and make it say a line.

1 Open the socket

lw dev runs the brain. Your engine connects to ws://localhost:8765 and exchanges JSON messages, one per line. Engines that cannot hold a socket (Papyrus) use the HTTP-shim pattern instead: see Wire.

2 Send the state feed, 3 to 10 times a second

{ "type": "state", "tab": "my-game", "world": "my-game",
  "player": { "x": 0.0, "z": 0.0, "armed": false },
  "npcs": [ { "i": 0, "name": "Hulda", "x": 8.0, "z": 4.0, "handle": 1000, "armed": false, "activeExpert": "idle" } ] }

world must equal the manifest's world. i is the slot commands come back on; handle is your stable id so renames never lose a mind. Optional fields (place tags, identity, objects) are in Wire.

3 Execute two commands

Move: loadScenario names an engine action in modes[].expert and a target. Keep executing it until the next one for that slot, and report it back as activeExpert.

{ "cmd": "loadScenario", "npc": 0, "name": "Hulda", "handle": 1000,
  "target": "guard", "modes": [ { "cond": "default", "expert": "navigate-to", "target": "guard" } ] }

Speak: say carries a line already decided; render it, do not filter it.

{ "cmd": "say", "npc": 0, "name": "Hulda", "text": "Guard. I've been robbed." }

4 Bind the eight movements

engine actionyour engine does
approachwalk to speaking distance of the target, face it
navigate-towalk to the target or point, stop
followstay within a few units as the target moves
guardhold position, keep eyes on the target
evademove away fast
retreatback off a few steps, hold
confrontclose to arm's length, square up, hold
sayspeak the line, no movement

That is every reflex and every shipped plan. sit, eat, lean, lead are bodies you add when a level lists the verb.

5 Check the manifest against your adapter

python -m pipeline.verb_manifest --check lw.manifest.json --executes approach,navigate-to,follow,guard,evade,retreat,confront,say

One line back: every verb executable, or CANNOT execute here: sit (sit). Bind the action; never edit the brain.

Reference clients to copy

Next: Tell characters what happened.