ConwayTree: Life in 3D
ConwayTree is an attempt to explore 3D structures formed by generations of Conway's Life cellular automaton (with time as the third axis). I used the Minecraft clone by Michael Fogleman as 3D engine.
First of all, make sure you have the latest 2.x python installed. Then clone (or download) this repository and try to run the script. The script requires pyglet multimedia library. If it is missing on your computer, try to install it with the following command:
pip install pyglet
Note: Some Mac users may need to build pyglet from source code due to problems with the stable version of pyglet on latest 64-bit Intel Macs. The known solution for this situation is:
- Download the latest snapshot of the pyglet sources (right now the latest version is 1.2alpha)
- Build and install it according the official instructions:
sudo python setup.py install
Please note you'll need superuser privileges.
The simplest way to try ConwayTree is to type
python conway_tree.py command in your favorite console. This will bring up a ConwayTree instance with famous R-pentomino pattern as a seed (generation zero pattern laying on the ground level of visible 3D environment).
H key to get help on controls.
You can give the filename of prefab pattern as a parameter for the script to start with some different seed pattern:
python conway_tree.py patterns/cow.cells
mouseto look around
Ito invert the mouse Y-axis
ESCto unlock the mouse cursor
W``A``S``Dto move around
TABto turn fly mode on/off (default=on)
SPACEto jump (while not flying)
Eto strafe vertically (while flying)
Zto compute the next Life generation
Xto run/pause automatic computing of Life generations
Rsometimes is helpful against visual glitches
Lto show/hide the statistics bar
Hto show/hide the information about control keys
Pattern file format
The current version of ConwayTree supports simplest ASCII plain text:
.(period) character means a dead (or absent) cell
- any other symbol means an alive one
- the right alignment of a pattern is not necessary
E.g. R-pentomino pattern can be specified like this:
.XX XX .X
The frame saving mode could be activated using the special run parameter
save_frames (it must be the last parameter in any case). In the frame saving mode ConwayTree creates (if necessary) folder
frames and saves each frame it produces during the run, one by one. This mode was made especially for making video movies of evolving Life structures.
Each frame file uses the JPG format and has a name like "frame_XXXXXXXX.jpg", where XXXXXXXX is the number of the given frame.
By default, the blocks forming the Conway Life tree are covered with one of the two prepackaged textures.
texture.png is the solid one, while
texture.png_transparent demonstrates the transparency trick. Just replace the
texture.png with the
texture.png_transparent file to take a look on it. You can also play and change the file with textures by yourself.
- Some troubles are known on Mac with the default version of the pyglet library -- check the 'Installation' section for the solution.
- Some glitches are possible while visualizing huge structures with many living cells. The reason for that is the way the original Michael Fogleman's queue processing routine works: it rejects tail of queue whenever the desired FPS is lost. If you really need glitch-free rendering (for movie capturing, for example), you could replace the
self.model.process_entire_queue(). It should remove the glitches, at a cost of significant slow-down.