Skip to content

caelwarner/SlimeSimulation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Slime Simulation

This is a slime simulation heavily inspired by Sebastian Lague's video, written in Rust. This simulation is made up of hundreds of thousands of individual agents (1,000,000 by default) which all individually move around the canvas. Each agent has three sensors, one directly in front, one to the left, and the other to the right. The use these sensors to look for the other agents which they then move towards. Despite this simple rule, complex behaviours emerge creating intricate patterns.

To be able to update 1,000,000 (or more) agents over 100 times per second compute shaders are used, which get run on the GPU. The GPU is great for handling simple but heavily parallelized tasks. When using 1,000,000 agents at 144 updates per second on a 2560 x 1440 canvas, my Nvidia RTX 3060Ti is at ~40% usage.

Usage

Either download the Windows executable in releases section, or clone the repository and compile the source code with Cargo, then simply run the executable. On the first run a TOML config file will be generated in the same directory. This config file allows the configuration of the window size and the underlying texture (canvas) size.

Images

Here are some examples of the simulation.

About

Slime Simulation using GPU Compute Shaders

Resources

Stars

Watchers

Forks