[OLPC-Games] Micropolis source code release!

Don Hopkins dhopkins at DonHopkins.com
Thu Jan 10 17:43:00 EST 2008


I've been dragging that cellular automata machine engine code around for 
years, so I cleaned it up to use as a proving application for the tile 
engine.

I was inspired by playing with one of Margolis and Toffoli's CAM-6 
devices, which let you program cellular automata rules in Forth on an 
IBM-PC, and run them in hardware at video rates.
So I read their beautiful Cellular Automata Machine book, which defined 
how the CAM-6 worked, and had a lot of example rules written in Forth.
I studied a copy of the Forth code that was used to program the CAM-6, 
and wrote a compatible CAM-6 simulator in C. (Now rewritten in C++, but 
still with lots of nasty macros.)

I used Mitch Bradley's Sun Forth system to develop and drive the C CAM-6 
library, and to program cellular automata rules (Sun Forth could link in 
and call libraries written in C).
It would run as a batch process and write out a bunch of Sun raster 
files, which I'd later animate and zoom with PostScript in NeWS.
The CAM-6 had a high level language written in Forth for conveniently 
defining cellular automata rules, which it compiled down into rule 
look-up tables, that it loaded into the CAM-6 hardware's rule table memory.
The C++ simulator implements most of the neighborhoods and rule lookup 
table formats supported by the hardware, so you could type in the Forth 
programs published in the book, and run them in software without 
modification (and change them!).
I've rewritten the rule table compiler in Python, which is included in 
MicropolisCore/src/CellEngine/python/cellrulecompiler.py with a few 
example rules.

The C++ code also has a whole bunch of different C++ "hard wired" 
cellular automata rules.
One of the interesting ones is John von Neumann's original 29 state 
cellular automata rule, which is capable of self-replication (given an 
appropriate and enormous initial condition)!
There's some old stuff in there for simulating musical ambient audio 
gasses (which play parameterized sounds when certain particles collide 
or other events happen, kind of like granular synthesis, that lets you 
hear what's going on dynamically in the CA), which could be fixed up to 
call back into Python to play the sounds with csound.

    -Don


Samuel Klein wrote:
> Fantastic.  A separate cellEngine is more than I was hoping for :-)
> Now we need a Micropolis wall in the office with various
> games-in-progress... a fine use for some of the B2s we have around.
> How's the discussion of reworking and opening the city-devlopment
> rules coming?  Have you talked any further with Alan about that?  Some
> class might want to take on a 'Post-modern SimCity' research project
> for the spring term now that it's possible to easily play with those
> variables.
>
> SJ
>
>   


More information about the Games mailing list