Install Asset
Install via Godot
To maintain one source of truth, Godot Asset Library is just a mirror of the old asset library so you can download directly on Godot via the integrated asset library browser
Quick Information
Description WormBrain is a Godot plugin that adds a worm to your 2D scene, one whose movement is driven by a simulation of the C. elegans neural connectome. C. elegans is a tiny nematode whose complete neural wiring has been mapped and published: 302 neurons, roughly 4,000 synaptic connections. WormBrain uses that wiring to decide how the worm moves: where it steers, when it speeds up, when it reverses. The result is something that navigates, forages, and reacts, not because it was scripted to, but because the network says so. It is closer to a playground than a simulation. Based on https://github.com/heyseth/worm-sim by Seth Miller. --- Quick Start 1. Copy addons/worm_brain_plugin into your project's addons folder. 2. Enable the plugin under Project → Project Settings → Plugins. 3. Add a WormNode to any 2D scene and run the project. Explore the Inspector to customize the worm's body shape, sensors, speed, and hunger behavior. The node also emits signals you can listen to: food detection, nose touch, hunger state so your own code can react to what the worm experiences. --- Notes / Limitations - Collision is advisory. When the worm touches an Area2D, it receives a neural signal, but there is no hard physics boundary. If the neural output says keep going, it will. To contain the worm inside your level, set limiting_area in the Inspector (default: Rect2(50, 50, 1000, 1000)). - Eating. The worm eats any Area2D belonging to the worm_food group when it overlaps it. Removing the eaten food from the scene is handled by your code. - Not scientifically accurate. The connectome data is real, but the mapping from neural activity to on-screen movement involves significant simplification. This is an interactive experiment, not a research tool.
Worm Brain Plugin
A custom node for creating AI-powered worms in Godot Engine.
brain.gd and weights.gd use real mapping taken from a C. elegans worm brain (it has only 302 neurons), enabling you to simulate it in your game.
Heavily based on this project: Simulate the C. elegans worm brain on your browser.
Drag WormNode to your scene and enjoy.
Note: Does not handle collision well, so you need to limit where it can go using an editor property.
Features
- Customizable worm behavior and segments
- Dynamic segment creation
- Real worm brain simulation
Installation
- Download the plugin from the Godot Asset Library or clone the repository.
- Copy the
addons/worm_ai_pluginfolder into your project'saddonsdirectory (if not done automatically by Godot). - Enable the plugin in
Project > Project Settings > Plugins.
Quick Usage
- Add the
WormNodeto your scene. - Customize the worm's properties in the inspector.
- The worm will "collide" with any
Area2D, and will eat any that is part of the groupworm_food. - This worm is stubborn, so a wall is a mere suggestion to it. If you want to contain the worm, make sure to decrease the limiting rect in the inspector.
Worm parameters
limitingArea # Global area where the worm can move
segment_count = 20
segment_distance = 10
max_scale = 1.0 # The maximum scale of the worm's girth
min_scale = 0.3 # The minimum scale of the worm's girth
front_rate = 0.2 # Rate of girth increase at the front
back_rate = 0.4 # Rate of girth decrease at the back
hungry_worm = true
time_until_hungry_again = 2
time_scaling_factor = 1.0
wormBrainDelay = 0.0 # Controls the simulation speed
Communicating with the Brain
For these that want to play with the plugin code
worm.gd controls the interface of the brain with the game world.
brain.gd powers the brain using the weights configured in weights.gd.
You can stimulate neurons with specific functions by enabling and disabling some flags on the brain, causing these neurons to be continuously stimulated while on:
stimulateHungerNeurons
stimulateNoseTouchNeuronsLeft
stimulateNoseTouchNeuronsRight
stimulateFoodSenseNeuronsLeft
stimulateFoodSenseNeuronsRight
stimulatePheromonSenseNeuronsLeft
stimulatePheromonSenseNeuronsRight
stimulateChemicalsSenseNeuronsRight
stimulateChemicalsSenseNeuronsLeft
stimulateTemperatureSenseNeuronsRight
stimulateTemperatureSenseNeuronsLeft
stimulateOdorRepelantSenseNeuronsRight
stimulateOdorRepelantSenseNeuronsLeft
The worm has 4 sensors (CollisionArea2D), 2 for each side. They all are part of the same sensor group; the worm knows to ignore these.
2 big ones represent smell sense, and 2 others represent touch. Collisions with these sensors activate the corresponding neurons.
License
This project is licensed under the MIT License.
Acknowledgements
This project is heavily based (it is basically a port to Godot) on the worm-sim made by Seth Miller.
Huge thanks to him for sharing that online.
Description
WormBrain is a Godot plugin that adds a worm to your 2D scene, one whose movement is driven by a simulation of the C.
elegans neural connectome. C. elegans is a tiny nematode whose complete neural wiring has been mapped and published:
302 neurons, roughly 4,000 synaptic connections. WormBrain uses that wiring to decide how the worm moves: where it
steers, when it speeds up, when it reverses.
The result is something that navigates, forages, and reacts, not because it was scripted to, but because the network
says so. It is closer to a playground than a simulation.
Based on https://github.com/heyseth/worm-sim by Seth Miller.
---
Quick Start
1. Copy addons/worm_brain_plugin into your project's addons folder.
2. Enable the plugin under Project → Project Settings → Plugins.
3. Add a WormNode to any 2D scene and run the project.
Explore the Inspector to customize the worm's body shape, sensors, speed, and hunger behavior. The node also emits
signals you can listen to: food detection, nose touch, hunger state so your own code can react to what the worm
experiences.
---
Notes / Limitations
- Collision is advisory. When the worm touches an Area2D, it receives a neural signal, but there is no hard physics
boundary. If the neural output says keep going, it will. To contain the worm inside your level, set limiting_area in
the Inspector (default: Rect2(50, 50, 1000, 1000)).
- Eating. The worm eats any Area2D belonging to the worm_food group when it overlaps it. Removing the eaten food from
the scene is handled by your code.
- Not scientifically accurate. The connectome data is real, but the mapping from neural activity to on-screen movement
involves significant simplification. This is an interactive experiment, not a research tool.
Reviews
Quick Information
Description WormBrain is a Godot plugin that adds a worm to your 2D scene, one whose movement is driven by a simulation of the C. elegans neural connectome. C. elegans is a tiny nematode whose complete neural wiring has been mapped and published: 302 neurons, roughly 4,000 synaptic connections. WormBrain uses that wiring to decide how the worm moves: where it steers, when it speeds up, when it reverses. The result is something that navigates, forages, and reacts, not because it was scripted to, but because the network says so. It is closer to a playground than a simulation. Based on https://github.com/heyseth/worm-sim by Seth Miller. --- Quick Start 1. Copy addons/worm_brain_plugin into your project's addons folder. 2. Enable the plugin under Project → Project Settings → Plugins. 3. Add a WormNode to any 2D scene and run the project. Explore the Inspector to customize the worm's body shape, sensors, speed, and hunger behavior. The node also emits signals you can listen to: food detection, nose touch, hunger state so your own code can react to what the worm experiences. --- Notes / Limitations - Collision is advisory. When the worm touches an Area2D, it receives a neural signal, but there is no hard physics boundary. If the neural output says keep going, it will. To contain the worm inside your level, set limiting_area in the Inspector (default: Rect2(50, 50, 1000, 1000)). - Eating. The worm eats any Area2D belonging to the worm_food group when it overlaps it. Removing the eaten food from the scene is handled by your code. - Not scientifically accurate. The connectome data is real, but the mapping from neural activity to on-screen movement involves significant simplification. This is an interactive experiment, not a research tool.