Skip to content

BehaviorLLM 0.7.1 — play against the machine

Latest

Choose a tag to compare

@faelion faelion released this 20 Oct 14:56

BehaviorLLM lets Unity characters and game systems choose from actions you define, using a local model. 0.7.1 adds two samples where you play against the machine, makes LiquidAI d1 a third faster, and changes how a decision model handles an interrupt. Nothing is breaking.

Two new samples: you against the machine

Dodgeball and ArenaBrawler give a decision model the controls rather than a list of behaviours. The machine presses a virtual gamepad six to seven times a second with LiquidAI d1: it fetches balls, backs off behind its throwing line, charges throws ahead of you, catches and dodges; or it jabs, hooks, blocks and rolls in a lit arena with motion-captured fighters.

  • Each machine is told everything its human opponent's interface shows, cooldowns included.
  • Dodgeball offers Catch only when a catch pressed now would land in time, and Dodge only when the ball will hit. On 160 generated situations that took its share of good answers from 0.64 to 0.94. Giving it coordinates instead of relative sentences was measured and rejected (0.47).
  • Both have a reaction-delay slider, a scripted autopilot for your side (T), a CSV of every match, and unit-tested simulation cores.
  • They need the Input System and uGUI. Build them from BehaviorLLM > Samples.

Faster d1

After a character's first decision, the client primes the server with the part of its prompt that never changes, so later decisions resume from there instead of rereading it. The answers are unchanged: the same choice in 423 of 424 recorded situations.

Before After
Median over 424 recorded situations 181 ms 117 ms
StealthGuard, played 167 ms 117 ms
PrisonYard, eight characters 216 ms, 152 decisions a minute 183 ms, 160 decisions a minute

One machine (RX 6650 XT 8 GB, Vulkan, llama-server b11630). It is controlled by decisionPrefixHead on the model config, set on the shipped d1 preset; leave it empty to turn priming off.

Interrupts under the Decision Model paradigm

llama-server finishes reading a decision even when the request is cancelled, so cancelling made the fresh request wait behind it. An interrupt now lets the answer in flight finish, discards it, and asks again at once: in Dodgeball the answer to a throw went from about 370 ms to 200–270 ms. DecisionMakerConfig.decisionModelInterrupt chooses between DiscardAnswer (the default) and CancelRequest, which ArenaBrawler keeps.

Install

In Window > Package Manager > + > Add package from git URL…:

https://github.com/faelion/BehaviorLLM.git#v0.7.1

The README's new Try it section walks from there to a running sample in four steps, with a screenshot of each: install the samples' packages (AI Navigation, Input System, uGUI), download LiquidAI d1 3B in BehaviorLLM > Model Manager (it installs llama-server with it), build a sample from BehaviorLLM > Samples, and press Play.

Validation

Installed from git into a new Unity 6000.3.1f1 project: the package alone compiles clean; with the samples' packages all four build menus produce working scenes; the package's tests pass there (EditMode 179/179, PlayMode 186/186); and all four samples played with d1. That test also found two documentation gaps, both fixed in this release: Dodgeball and ArenaBrawler need uGUI, and an installed package's scenes are built into Assets/BehaviorLLMSamples/ rather than opened from Packages/.

Full list in the changelog.