Cellua has been discontinued in favor of NDCell.
There are a vast number of cellular automaton simulators already, but very few support rules with an arbitrary number of states and transitions. Golly is the most popular, and is very fast with Conway's Game of Life and similar automata, but has measley 3D and large-neighborhood support. Additionally, all rules must be defined in Golly's own ruletable format; while this works well for some rules, it is incredibily tedious and inefficient for others. Due to the lack of other modern, configurable cellular automaton simulators, CA communities tend to focus their efforts on creating and exploring only those automata that Golly is capable of simulating.
Cellua aims to resolve this problem by providing a Lua- and Python-extensible cellular automaton simulator, supporting both 2D and 3D rules specified by Lua transition functions.
- Python is easy. I already know it. Everyone knows it, or can learn it in a week!
- Numpy is blazingly fast and easy-to-use. I take every opportunity I can to use it.
- Wide range of 3D rendering opportunities, from high-level premade engines to low-level OpenGL bindings. If rendering performance becomes an issue in Cellua, I can just switch to a lower-level rendering library.
- Lua is easy. I already know it. Everyone knows it, or can learn it in a day!
- I can sandbox it.
- Lupa uses LuaJIT2, which is fast. Much faster than Python, at least.
- Custom ruletable formats are limiting, annoying to parse, and annoying to write.
- People write ruletable generators for Golly. If your rule definition language is Turing-complete, you can use the same system for rule definition and rule generation.
In the future, I plan to distribute binaries of stable versions using PyInstaller. Once Cellua is ready, you'll find those on the releases page. For now, see Development to build the program from source.
There's nothing to use right now.
These instructions assume that you are using Linux, but the process is similar on other operating systems.
There are three options for installing Cellua:
- Lua 5.2+ — Easy to install, has all features, runs somewhat slow
- LuaJIT — Slightly more complicated to install, missing a few features, runs fast
- LuaJIT with compat for Lua 5.2 — Tricky to install, has all features, runs fast
There are still instructions for all of these processes, and if you run into issues compiling on *nix I'm happy to help. If you're using Windows, I'd recommend sticking to the first option since that's simplest.
When I make binary releases, I'll use the third option (LuaJIT with 5.2+ compatibility).
- Install Python 3.7 or later.
- Download the repository:
git clone https://github.com/HactarCE/Cellua.git && cd Cellua
. - Set up a virtualenv:
python -m venv .env.lua53 && source .env.lua53/bin/activate
- Install Cellua:
pip install '.[dev]'
.
Warning: Using LuaJIT not compiled with -DLUAJIT_ENABLE_LUA52COMPAT
will prevent access to certain features (e.g. #pattern
and pairs(pattern)
). Because of this, using LuaJIT without -DLUAJIT_ENABLE_LUA52COMPAT
is not officially supported. See Install with 5.2-compatible LuaJIT.
To improve performance (or for testing purposes), build Lupa using LuaJIT:
- Install Python 3.7 or later.
- Download the repository:
git clone https://github.com/HactarCE/Cellua.git && cd cellua
. - Set up a virtualenv:
python -m venv .env.luajit205 && source .env.luajit205/bin/activate
- Install Cython, which is required in order to build Lupa with LuaJIT:
pip install Cython
. - Download and install Lupa elsewhere:
cd .. && git clone https://github.com/scoder/lupa.git && cd lupa && pip install .
. - Return to the original Cellua folder and install Cellua:
cd .. && pip install '.[dev]'
.
While technically this doesn't give full Lua 5.2 compatibility, it's enough for now.
- Install Python 3.7 or later.
- Download the repository:
git clone https://github.com/HactarCE/Cellua.git && cd cellua
. - Set up a virtualenv:
python -m venv .env.luajit205 && source .env.luajit205/bin/activate
- Install Cython, which is required in order to build Lupa with LuaJIT:
pip install Cython
. - Download the Lupa repository:
git clone https://github.com/scoder/lupa.git && cd lupa
. - Download LuaJIT:
git clone https://github.com/LuaJIT/LuaJIT && cd LuaJIT
. (Do this inside of thelupa
folder.) - Compile LuaJIT with Lua 5.2 compatibility:
make clean && make XCFLAGS=-DLUAJIT_ENABLE_LUA52COMPAT CFLAGS=-fPIC
. - Compile Lupa:
cd .. && make clean && make
. - Install Lupa:
pip install .
- Return to the original Cellua folder and install Cellua:
cd .. && pip install '.[dev]'
.
Run pytest
to run all tests.
- Install Cellua:
pip install '.[dev, build]'
. - Run the build script:
./build.sh
.
- Lua transition function can manipulate global state using closures.
Most of these are not yet implemented. Not everything on this list will be implemented; (?)
denotes those that are difficult, questionable, or at least low-priority, but anything on this list may be changed or removed.
- Toggle mouse capture
- First-person movement
- Vertical lock to axis X, Y, Z, or none (?)
- I.e. yaw/pitch Euler angle control vs. free space rotation
- Adjustable movement speed
- "Rotate around point" movement (?)
- Teleport to origin (?)
- Vertical lock to axis X, Y, Z, or none (?)
- 2D "layer" view (?)
- Cursor
- Cursor positioning modes:
- First nonzero cell
- Distance-based
- Adjustable cursor distance
- Hybrid (default)
- Adjacent to nonzero cell face
- Adjacent to nonzero cell face/edge/vertex
- Cursor positioning modes:
- Basic controls
- Place/remove cells
- Pick cell with middle click
- Undo/redo
- Step/Run/"Run for X gens"/Stop
- Step/Run/"Run for X gens" backwards for reversible automata (?)
- Set generation count
- Reset to start
- XYZ compass (corner of screen? cursor?)
- Show info about cell at cursor
- Current state
- Next state
- Previous state(s?) (?)
- Initial state
- Show neighborhood
- Select cells
- Shrink/expand/move/rotate rectangular selection
- Copy & paste
- Paste modes (like Golly)
- Rotate when pasting
- Shrink/expand/move/rotate cells (tile pattern when expanding)
- Arbitrary selection (?)
- Select by cell type (?)
- Ellipsoid (?)
- Combine prisms/ellipsoids (?)
- Optimized cubic rendering
- Render limit (fog?)
- Colors
- Defined per side of cube (?)
- Defined per state in rule
- Adjustable during runtime (?)
- Textures on cube (?)
- Sphere rendering
- Adjustable poly count / quality
- Arbitrary 3D models (?)
- Defined per state in rule (?)
- Adjustable during runtime (?)
- Shrink models
- Partial transparency (?)
- Text labels
- Grid visualization
- Edges / vertices
- Near cursor
- Near cells
- On cell faces
- Everywhere
- Hide cells
- Looped universes (how? convenient fog?)
- Render everything in the looped universe, including cursor
- Custom background color/skybox
- Debug
- Show chunk boundaries
- Basic controls (see Editor)
- Recenter pattern
- Save/load
- Arbitrary state count / cell size
- 1 bit (2 states)
- 8 bits (<=256 states)
- 16 bits (<=65536 states) (?)
- 32 bits (<=2^32 states) (?)
- 64 bits (<=2^64 states)
- Lua table (?)
- Arbitrary dimension count
- 1D
- 2D
- 3D
- 4D+ (?)
- Time axis expressed as spatial dimension (?)
- Lua transition function
- Neighborhoods
- Arbitrary range
- Arbitrary bitmask
- Symmetries (?)
- Rotation
- Rotation + reflection
- X/Y/Z reflection
- Rotation (180)
- Rotation (180) + X/Y/Z reflection
- Rotation (180) + reflection
- Rotation (180) + two axes (?)
- Rotation (90) around only one axis (?), with or without reflections (?)
- Diagonal reflections (?)
- Other?
- User defined (?)
- Error handling
- Absolute time/space position dependency (?)
- e.g.
B0
emulation (temporal parity) - e.g. Margolus neighborhood (spatiotemporal parity for X/Y)
- e.g.
- Special support for time-reversable automata (?)
- Neighborhoods
- Bounded grids
- For each axis:
- Infinite
- Finite
- Loop
- Reflect perpendicular axis #1
- Reflect perpendicular axis #2
- ???
- Presets: infinite space, finite space, hypertorus
- For each axis:
- Alternate tessellations (?)
- Sphere packing
- Rhombic dodecahedral (equivalent to checkerboard cubes)
- Arbitrary 2D extruded (?)
- Optimizations
- Multithreading (?)
- Do not simulate cells with no nonzero neighbors
- Verify that transition obeys this rule (?)
- Result caching (?)
- HashLife (?)
For transition function features, see Simulator.
- Basic information
- Simulation information
- Logging / display info to user
- Error handling
- GUI support (?)
- Keybind support (?)
- File save/load (how?)
These are things that Cellua will probably never support. Lua extensions may try to emulate them, however.
- "
B0
" rules (where a cell with no live neighbors becomes live) - Infinite grids with nonzero default state