Code Monkey home page Code Monkey logo

lifeforms's Introduction

Birdbrain's Lenia renderer

This repository contains my quick and dirty "workspace" to explore the Standard Lenia and Expanded Lenia cellular automata systems. The code is written purely in Rust and uses lenia_ca crate by your's truly to simulate the systems. Since the lenia_ca crate makes heavy use of ndarray crate, then you should also familiarize yourself with that.

It is recommended that instead of using this Lenia renderer, you make your own, as this renderer is extremely unoptimized and rather slow. You can simply use the lenia_ca crate for the backend simulation.

I also created a video, which can be found on YouTube, which displays plenty of animations made with this workspace.

Should you still choose to use and compile this renderer then here are some important bits of information:

  • You should compile by running cargo build --release, and also run the release version with cargo run --release, or do both of them together with cargo build --release && cargo run --release
  • Depending on how "beefy" your cpu is, you may have to reduce const X_SIDE_LEN and const Y_SIDE_LEN. My system has a Ryzen 7 7700X and I could run 720p resolution at 60fps, and 1080p resolution at around 30 to 40, as long as the number of channels and kernels did not exceed the number of physical cores (8 in my case).
  • If you wish to use this code to simulate your own Lenia systems (rather than the auto-generated ones), then the easiest way to do so, is to set rules: Vec<Vec<f64>> equal to Vec::new(), and then change the kernels, growth functions, weights, etc... of the lenia_simulator variable. It is important that you do not press "n", "m" nor "," during the operation of the simulation in that case though, as it would crash the program :)
  • Don't get discouraged if you can't find interesting looking "rulesets" - The interesting stuff happens at a, relatively speaking, narrow ranges of parameters... it needs just the correct amount of stability, but also still be chaotic enough to make the interesting dynamics happen.

Important key bindings (you can change them by modifying them in the match keyboardstate.character match block).

  • "k" - toggles between viewing the kernels or simulation
  • "r" - randomly seeds the simulation board based on constants earlier in the code
  • "s" - toggles continuous simulating
  • "i" - performs a single iteration of the simulation

If using the code unchanged then the following are also important

  • "n" - Changes the currently used rulesets completely
  • "m" - Uses the currently set ruleset as basis and tweaks the ruleset slightly for a slightly different result
  • "," - Permanently tweaks the rulesets slightly from the currently used ruleset

Example screenshots

  1. Orbium unicaudatus - The iconic Lenia glider
  2. Tricircium inversus - An oscillator with 3-fold symmetry
  3. Astrium inversus - An oscillator with 5-fold symmetry
  4. A generic glider arising from a 2-channel & 2-kernel interaction
  5. Lots of multi-channel & multi-kernel interacting "single cell organisms"
  6. An asymmetric glider arising from complex set of channels and kernels.
  7. "Snakes and Parasites"
  8. Tetrahedrome rotans - A 3D rotating oscillator with interesting symmetries (rendered with blender)
  9. A 3D slice of a chaotic oscillator in 4D (rendered with Blender)

lifeforms's People

Contributors

birdbrainengineer avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.