Monday, November 10, 2008

physics2d games

Still playing with cellular automota in phys2d -

Take some gravity-less balls. (Colours don't mean anything)

Now imagine each gives off a chemical trace-

Make the cells move towards the field. This is kinda-like gravity simulation (but gravity with history). There's also some jiggle in there - "brownian motion" to keep things moving. The cells look about 3x their radius in each of the 4 compass directions to figure out where to go. If they look less than their diameter away, they don't really do much :(

Adding some field decay back in and tweaking some values, gives us patterns that build themselves a potential hole to stay in and start spinning (gravity! there's even a cog arrangement in there). These guys are good at chasing one another, but can just follow their own track again and again (ants?). Notice they also often just join pairs and go for a spin. There's no friction on the movement (just bounds) so they keep going once they start (I think it's a property of the physics system)

The patterns that they stop in are nicely organic and might be useful in the future...

This is more fun than game of life stuff :) Apologies for youtube's awful video compression...Code here, (tis messy & you'll need phys2d)

The balls in this one can only see blue

Here's coloured gravity ;) each cell emits a field that is 3x more attractive to cells of the same colour than different colours:

Code here (still messy)
(this has 200 circles, and is reaching the limits of what Phy2D can do in real time). This next one switches of the red's attraction to it's own field, and increases blue and green's atrraction. And we get some really nice emergent behaviour - the reds form a cell wall around blue and green :)

No comments:

Post a Comment