Magnetic Cells

If you're making a game, you can post about it here.
Forum rules
If you want to post a topic, you have to post some progress to show you are working on the game. Screenies or Video.

Magnetic Cells

Postby Blablob » April 18th, 2014, 4:42 am

Play here.

The other day I was just messing around with some code, trying to experiment with objects that copy themselves over and over again. So I got this simple system working where these "cells" will double every 5/6 of a second and then shoot off in a random direction at a random speed. What I found remarkable about this is that a certain pattern will eventually appear if you can get enough cells to spawn; the cells will seem to pull each other together just before they spawn again.

Here's what it looks like:

Image

Like I said, the speed and directions are completely random, and yet the pattern still exists. Strange but intriguing. Try for yourself. If the earlier cells disappear, just refresh the page.

If you want to know why this happens, read on:
Spoiler: show
The speeds can only be defined as integers from -5 to 4. Meanwhile, the directions are based on the x and y speeds that the cell is defined with. So while they are random, each cell only has 100 possible directions/speeds it can travel, which means that at any given point (in this case, every 5/6 of a second), there are only 100 possible positions that a cell can be at. Not too remarkable anymore, is it? Still, it's pretty cool to discover these kinds of things.
User avatar
Blablob
Content for Contempt

 
Posts: 3108
Joined: September 6th, 2009, 3:38 pm
Location: That way

Credit To Team

Thumbs Up given: 67 times
Thumbs Up received: 229 times

Return to Game Showcase