Taos Engine · Agent Tutorials

Agent Tutorials

Agent Tutorials

A step-by-step series for the Taos Engine agents module — GPU agent-based modeling (NetLogo / AgentScript-style turtles + patches + links) built on top of the particle system. Each tutorial is short, runnable, and builds on the one before it.

These tutorials are written for someone who already knows AgentScript (or NetLogo): each one maps the concept you know onto the Taos Engine way of doing it. The big shift is that Taos Engine is declarative and GPU-parallel — you don't write an imperative turtles.ask(t => …) callback that runs on the CPU each tick; you declare a per-agent step program once and it compiles to a compute shader that runs for the whole population in parallel. That trades arbitrary-JS-per-turtle flexibility for ~1000× the agent count at interactive frame rates.

These tutorials are the guided path; the Agents module guide is the reference. Read the Quick-Start Guide first if you've never touched the engine — everything here assumes you know Engine, GameObject, and Camera from "Hello, Cube".

Runnable code. Every tutorial below has a working, build-verified entry in the standalone project standalone/agent_tutorials/ — one page per tutorial, plus a ▶ live launcher. cd standalone/agent_tutorials && npm install && npm run dev, then open the launcher. Each tutorial is a single self-contained file: it runs its model through runAgentModel — the engine's one-call agent harness (taos/agents/agent_app.js, which wires the engine, camera, render stack, and frame loop) — so the file spends its lines on the model. Each tutorial page also has a "▶ Live demo" link at the top.

The path#

#TutorialYou'll learnAgentScript analog
1Hello, AgentsA complete app: turtles wandering on a torus, rendered as arrows.the "hello world" snippet
2Turtle Verbs & the Step Programforward/turn/face/towards/distance, edge topologies, and how the GPU step replaces ask.Turtle methods + Snippets
3Patches & StigmergyThe diffusing/evaporating grid: sense, deposit, diffuse, importDataSet — the slime-mold model.Patches + Diffuse / SlimeMold
4Neighbors & FlockingThe spatial hash + in-radius queries; a flock hand-written from neighborCenter + neighborSeparation.inRadius / Flocking
5State & BreedsPer-agent state in color.a, and N named breeds with their own behavior.breeds
6Births & DeathsGPU reproduction (hatch/die) via a free-list — a Lotka-Volterra cycle.hatch / die / Wolf-Sheep
7LinksA force-directed graph: spring links untangle a community network.links / Network
8Measurement & PlotsRead agent / patch state back to the CPU; a live population plot.model plots / exportDataSet
9Defining Your Own ModelThe AgentModelConfig spec end-to-end — build NetLogo "Termites" from scratch.writing a new model

Reference#

These aren't steps in the linear path — read them when relevant.

#TutorialYou'll learn
10Agents on the GlobeThe AgentScript Leaflet/MapLibre equivalent — a herd walking real streamed terrain (keyless).
11Runoff on Real Terrain3D agents governed by the terrain — gradient flow + a born→flow→die lifecycle: rain runs down a real watershed (keyless).

Conventions in these tutorials#