BIOME 2 is a small .NET 8 cellular simulation and visualization project. It models layered cell worlds with configurable species and rule-driven behavior. The project includes a rules file loader, a simulation engine, and OpenGL-based rendering with an ImGui UI.
- Rule-driven cellular simulation loaded from plain text rule files (Users of BIOME will be familiar with the language).
- Multiple species can be defined with any number of rules governing their state.
- Layered world model (discrete layers) with cross-layer interactions.
- Support for different grid topologies (rectangular, disk)
- OpenGL renderer and ImGui tools for inspection and placement
- .NET 8 SDK
- A system with OpenGL support (for graphics)
- Recommended IDE: Visual Studio or VS Code with C# extension
From the repository root:
- Restore and build:
dotnet build - Run:
dotnet run --project "BIOME 2.csproj"
Or open the solution in Visual Studio and run the BIOME 2 project.
Rules files are plain text with four sections separated by %%:
-
Settings (key = value). Recognized keys include:
WIDTH = 150: sets world horizontal widthHEIGHT = 150: sets world vertical heightSHAPE = SPIRAL: sets world shape to "Spiral" mode, shaped like a disk. Exclude this or useRECTto use normal rectangular grid.PAUSE: pauses the simulation upon load, useful if the user needs to provide some sort of inputEDGES: sets edge behavior; options includeBORDER,WRAP,WRAPX,WRAPY, andINFINITE(default isBORDER)
-
Species (one-per-line:
- Format:
name = {r,g,b}where r, g, & b are 0-255 color values - Example:
GRASS = {0,150,0}
- Format:
-
Layers (one-per-line)
- Format:
DISCRETE layerName. Layers are discrete grids that can hold species. - Example:
DISCRETE GROUND
- Format:
-
Rules (one-per-line)
- Basic form:
(coordLimits) layer:originSpecies +/- reactants -> newSpecies * probabilitylayeris optional; if omitted, the rule applies to the first layer.originSpeciesis the species being transformed.reactantsare conditions that must be met for the rule to apply. A given reactant has two modes: Neighbor Count and Layer.- When in Neighbor Count mode, the reactant specifies how many neighboring cells of a certain species must be present.
- Example:
2TREE+means there must be at least 2 or more neighboring TREE cells. - Example:
3WATER-means there must be at most 3 neighboring WATER cells. - Example:
0FIREmeans there must be no neighboring FIRE cells.
- Example:
- When in Layer mode, the reactant specifies a certain species presence/absence in the same cell on another layer.
- Example:
AIR:WINDmeans the AIR layer must have WIND species present in the same cell. - The preceding sign
+or-indicates presence or absence should be checked for, respectively. - Example:
- AIR:STILLmeans the AIR layer must NOT have STILL species present in the same cell.
- Example:
- When in Neighbor Count mode, the reactant specifies how many neighboring cells of a certain species must be present.
newSpeciesis the species that the originSpecies will become if the rule's reactants are all true.probabilityis an optional decimal value (double) between 0 and 1 indicating the chance of the transformation occurring when the rule conditions are met. Is assumed to be 1 when omitted.coordLimitsmay be parenthesized in a prefix like(x1:x2,y1:y2)or0:60(which only applies to x-axis, for backwards compatibility)- Example:
(10:50,20:80) GRASS + 1PIXIEDUST -> PIXIEDUST*0.1means the rule only applies to cells with x-coordinates 10-50 and y-coordinates 20-80.
- Example:
- Example:
GROUND:GRASS + 1TREE + AIR:OXYGEN -> TREE*0.05means that in the GROUND layer, a GRASS cell with at least 1 neighboring TREE cell has a 5% chance to become a TREE. - See
FileLoading/RulesLoader.csfor the authoritative parsing behavior
- Basic form:
Example rules file:
WIDTH = 200
HEIGHT = 200
SHAPE = SPIRAL
%%
GRASS = {0,150,0}
TREE = {0,80,0}
FIRE = {255,0,0}
%%
DISCRETE GROUND
%%
GROUND:GRASS + 1TREE -> TREE*0.05
GROUND:GRASS + 1FIRE+ -> FIRE*0.1
GROUND:TREE + 1FIRE+ -> FIRE*0.1
GROUND:FIRE -> GRASS
FileLoading— rules parsing and modelsSimulation— rule application and simulation controllerWorld— grid implementations, layers and stateGraphics— OpenGL renderer, shaders, UI windowsInput/App— input handling and application bootstrap
- Feel free to fork the repository, create a branch, and open a PR
- run
dotnet buildbefore submitting
- If rendering fails, update your OpenGL drivers
- For rules parsing errors, check the console logs; the loader reports line numbers and positions
- Check the
Issuestab for known problems
See LICENSE in the repository root (if present).