Give your NPCs a brain that actually learns, instead of a behavior tree you have to hand-tune forever.

Zeri Smol Kit is a small C/C++ library (with ready-to-use Unity and Roblox wrappers) that lets a character learn from reward instead of running a script. Feed it what the character can sense — touch, joint angles, balance, whatever you've got — and it decides what to do next, gets better with practice, and remembers what it learned. No external ML framework, no GPU, no network calls. It's a single header file that compiles in under a second.

The screenshots below are a real training run, not a mockup — a from-scratch agent finding its way through a maze course purely from a reward signal, in the browser demo included in this package.

What works today: the ZeriAgent brain, with the Unity and Roblox wrappers — that's what's driving the demos below, and it's what you should build on if you want something you can drop into a project now.
What's still early: NovaSomatic, the tiny-footprint variant described further down, is a C/C++ prototype only — no Unity or Roblox wrapper for it yet.

What's actually in here

ZeriAgent is the part that ships in Unity and Roblox today: a two-layer spiking neural network trained with actor-critic reinforcement learning (TD error, eligibility traces, reward-modulated plasticity). Give it a state vector and a reward, it gives you an action. It's what's driving the maze-solving and cart-pole-balancing demos.

NovaSomatic is the experimental, C/C++-only sibling — a trie-routed network where weights are never stored, only regenerated on demand from a seed. A trained "lobe" compresses to 44 bytes, so you can have a huge number of them — crowds, swarms, procedurally spawned NPCs — without the memory bill you'd expect. It's not wired into the Unity/Roblox wrappers yet; the C/C++ demos show it off if you want to go poke at it.

Around those two, there's a small toolkit for turning physical game state into something a network can use: a 3D touch-sensor mapper, a vestibular (balance) preprocessor, and a joint-angle normalizer. Basically the boring-but-necessary plumbing between "physics engine" and "neural net input."

Everything is seeded deterministically — an agent named "alice" gets the exact same starting weights whether it's running in C++, Unity, or Roblox. That was a deliberate design choice, not an accident: same seed, same behavior, every platform, every run.

Quick start (Unity)

using ZeriSomatic;
var agent = new ZeriSomaticAgent("npc_bob", 8, 3, 128, 0.1f, 4);
agent.AddReceptor("LeftFoot", "FootL", new Vector3(-0.5f, -1f, 0f), Vector3.down);
agent.BuildSomaticMap();
// in FixedUpdate:
int action = agent.Act(state);
ApplyBalancingTorque(action);
agent.Reinforce(state, action, state, GetReward(), hasFallen);

Quick start (Roblox / Luau)

local ZeriSomatic = require(game.ReplicatedStorage.ZeriSomatic)
local agent = ZeriSomatic.CreateAgent("roblox_pet", 8, 3, 32, 0.5)
game:GetService("RunService").Heartbeat:Connect(function()
    local action = agent:Act(GetCurrentSensorState())
    ApplyNPCAction(action)
    agent:Reinforce(state, action, state, GetReward(), false)
end)

Pure Luau, no external DLL, runs on client or server.

Saving progress, and breeding agents

Weights save and load as a compact delta from the seed baseline, so a save file only stores what an agent actually learned. You can also breed two trained agents together — the offspring inherits a blend of both parents' learned weight deltas, so it starts ahead of a cold-start agent instead of relearning everything from zero. There's also a mutation function if you want to introduce some variation after breeding. All of this is exposed in both the Unity and Roblox wrappers.

What's in the download

  • core/ — the actual headers (zeri_brain.h, zeri_agent.h, zeri_somatic.h, zeri_novasomatic.h, novalm.h). No dependencies, C99/C++11.
  • wrappers/ — the Unity C# script and the Roblox Luau module.
  • demo/ — buildable C/C++ demos: grid navigation, a key-and-door vault solver, cart-pole balancing, sequence prediction. build.bat compiles everything with MSVC or GCC.
  • web/ — the browser playground these GIFs come from. It's a JS port of the same agent logic, meant to be uploaded straight to a store page as a playable demo.

MIT licensed. Use it in free or commercial projects, no attribution required (though it's always appreciated).

Also grabbing steam: a small, rough slice of the core (just the RL brain + a grid demo, MIT licensed) is up on GitHub for free at github.com/ionizedd/Zeri-Somantic while the fuller kit here keeps getting worked on.

How this was built

I made the calls on what it should do; an assistant (Claude) wrote most of the implementation and did the bulk of the debugging, including the reinforcement-learning tuning that got the maze demos actually converging. The full development history — what broke, why, and how it got fixed — is in dev/CHANGELOG.md if you're curious or want to pick up where we left off. The code is heavily commented and kept fully deterministic on purpose, partly so a person can follow the reasoning, and partly so another AI agent working on this later — human-directed or otherwise — has enough context to actually understand what it's touching instead of guessing.

Published 8 days ago
StatusPrototype
CategoryTool
PlatformsHTML5
AuthorParinov
Tagsneural-network, npc, reinforcement-learning, roblox, Unity
AI DisclosureAI Assisted, Code

Download

Download NowName your own price

Click download now to get access to the following files:

zeri-somatic-web-demo.zip 29 kB

Leave a comment

Log in with itch.io to leave a comment.