Check out our latest project ✨ OpenChapter.io: free ebooks the way its meant to be 📖

Artificial Worm Brain AI

An asset by leparlon
The page banner background of a mountain and forest
Artificial Worm Brain AI image holder but it is empty

Quick Information

0 ratings
Artificial Worm Brain AI icon image
leparlon
Artificial Worm Brain AI

This plugin allows you to drag and drop a artificial worm to your game project. The worms AI is powered by a mapped C. Elegans worm brain. How to use:Enable the plugin, create a 2d scene, add a WormNode into it, Run the project.This is a little more than a conversion from js to GD script (and Godot Node structure) from this project: https://github.com/heyseth/worm-sim Make sure to check the editor properties of the worm and customize it, I struggled a bit to make this work, so it might have issues, please report them. Check the signals the worm broadcasts as well, listen. Notes: - Worm collides with Area2D, I inform the AI that it has collided, but if it wants to go thought, it goes through. Only way to contain the worm is by setting a proper limitingArea on the editor, it is initially hardcoded to Rect (50, 50, 1000, 1000)- Worm "EATS" any Area2D that is part of a group "worm_food". You have to handle removing the food from the scene.

Supported Engine Version
4.2
Version String
1.0.1
License Version
MIT
Support Level
community
Modified Date
1 year ago
Git URL
Issue URL

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

  1. Download the plugin from the Godot Asset Library or clone the repository.
  2. Copy the addons/worm_ai_plugin folder into your project's addons directory (if not done automatically by Godot).
  3. Enable the plugin in Project > Project Settings > Plugins.

Quick Usage

  1. Add the WormNode to your scene.
  2. Customize the worm's properties in the inspector.
  3. The worm will "collide" with any Area2D, and will eat any that is part of the group worm_food.
  4. 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.

This plugin allows you to drag and drop a artificial worm to your game project. The worms AI is powered by a mapped C. Elegans worm brain.

How to use:
Enable the plugin, create a 2d scene, add a WormNode into it, Run the project.

This is a little more than a conversion from js to GD script (and Godot Node structure) from this project: https://github.com/heyseth/worm-sim
Make sure to check the editor properties of the worm and customize it, I struggled a bit to make this work, so it might have issues, please report them.
Check the signals the worm broadcasts as well, listen.

Notes:
- Worm collides with Area2D, I inform the AI that it has collided, but if it wants to go thought, it goes through. Only way to contain the worm is by setting a proper limitingArea on the editor, it is initially hardcoded to Rect (50, 50, 1000, 1000)
- Worm "EATS" any Area2D that is part of a group "worm_food". You have to handle removing the food from the scene.

Reviews

0 ratings

Your Rating

Headline must be at least 3 characters but not more than 50
Review must be at least 5 characters but not more than 500
Please sign in to add a review

Quick Information

0 ratings
Artificial Worm Brain AI icon image
leparlon
Artificial Worm Brain AI

This plugin allows you to drag and drop a artificial worm to your game project. The worms AI is powered by a mapped C. Elegans worm brain. How to use:Enable the plugin, create a 2d scene, add a WormNode into it, Run the project.This is a little more than a conversion from js to GD script (and Godot Node structure) from this project: https://github.com/heyseth/worm-sim Make sure to check the editor properties of the worm and customize it, I struggled a bit to make this work, so it might have issues, please report them. Check the signals the worm broadcasts as well, listen. Notes: - Worm collides with Area2D, I inform the AI that it has collided, but if it wants to go thought, it goes through. Only way to contain the worm is by setting a proper limitingArea on the editor, it is initially hardcoded to Rect (50, 50, 1000, 1000)- Worm "EATS" any Area2D that is part of a group "worm_food". You have to handle removing the food from the scene.

Supported Engine Version
4.2
Version String
1.0.1
License Version
MIT
Support Level
community
Modified Date
1 year ago
Git URL
Issue URL

Open Source

Released under the AGPLv3 license

Plug and Play

Browse assets directly from Godot

Community Driven

Created by developers for developers