Skip to main content
A talking character is ordinary code around a WebSocket, and can be tested like ordinary code. Both game SDKs come with a mock server that speaks the agent protocol inside the test’s own process: your test plays the part of Lokutor, says what the player said and what the character answers, and checks what your game did. It costs nothing and runs in CI.

What to point at it

Any non-empty string is a valid key for it. On a machine with no sound card set simulate_audio_device = true on a Godot LokutorAgent: the voice is consumed in real time without being played, so states and lip sync run as they would in the game. In Unity, test the conversation through LokutorSession, which is LokutorAgent without the engine, and read its Playback as a sound card would. Turn the microphone off, and give the character a voice to hear with feed_microphone / FeedMicrophone (SendMicrophone on the session) if the test is about that.

A test

A player buys a sword: the agent is told about the action, the action runs, the character is told what happened, and it answers.

The messages you need

Every reply has a generation, one more than the last. Audio is 16-bit PCM, 44.1 kHz, mono, in base64 (send_audio and Audio16 do it). The whole protocol is in WebSocket protocol.

What is worth testing

  • Every action, with arguments that make no sense: an item that does not exist, a negative price, a missing field.
  • That the action and the facts (set_context) agree after it.
  • The connection lost in the middle of a reply, and no credential at all. Both happen to players.
  • An interruption while an action is running.
  • The whole scene, from opening to closing, without a person: your tests and your trailer can use the same script.
What a mock server cannot tell you is whether the character is any good. For that, talk to it.

The SDKs’ own tests

They use the same servers, and are the longest examples there are: