semeion

Crates.iosemeion
lib.rssemeion
version0.9.1
sourcesrc
created_at2020-05-25 20:24:33.794778
updated_at2022-01-11 20:52:10.283166
descriptionA generic 2D environment simulator
homepage
repositoryhttps://github.com/gliderkite/semeion
max_upload_size
id245846
size238,837
Marco Conte (gliderkite)

documentation

https://docs.rs/semeion

README

semeion

A 2D environment simulator, that let's you define the behavior and the shape of your entities, while taking care of dispatching events generation after generation.

docs.rs crates.io License: MIT

Overview

For an overview of what you can do, and how you can do it with this library, the best way to start is to read the introductive blog post, or to have a look at the several examples that come with this project. Each of these aims to show a subset of the features set of semeion, while giving an example of how to make the best use of it. While, if you want to have a look at a more complete project that uses semeion as its entity engine, check out formicarium.

Note: if you want to clone this repository without having to download the .gif assets you can do so with:

git clone --single-branch https://github.com/gliderkite/semeion.git

Optional Features

By default, semeion uses an environment engine that schedules all the entity callbacks on the same single thread, therefore no synchronization is required (no user's implemented Entity needs to be sent or shared between threads).

Nevertheless, there may be scenarios in which you are running a simulation that includes a significant number of entities and each of these entity tasks, required to proceed to the next generation, is considerably resource consuming. For these situations, it is possible to gain significant advantage by spawning multiple threads and running the simulation in parallel (profiling your code is always advised before taking final decisions).

At the moment, you can enable this (non additive) feature only at compile time, by specifying the optional feature parallel in your Cargo.toml:

semeion = { version = "0.9", features = ["parallel"] }

The only requirement is that all your entities need to be Send and Sync.

Examples

  • Langton's Ant

    cargo run --release --example langton
    
  • Game of Life

    cargo run --release --example life
    
  • Rule

    cargo run --release --example rule -- 161
    
  • Wireworld

    cargo run --release --example wireworld
    
  • Mandelbrot

    cargo run --release --example mandelbrot --features parallel
    
  • Camera

    cargo run --release --example camera
    
Commit count: 18

cargo fmt