11 releases (breaking)

0.9.1 Jan 11, 2022
0.9.0 Jul 18, 2021
0.8.1 Nov 28, 2020
0.6.0 Jul 10, 2020

#757 in Game dev

MIT license

98KB
1.5K SLoC

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
    

Dependencies

~0–265KB