CellShades

Spill some deliciously nutricious liquid onto the screen and watch the greedy little cells emerge, consume and build clusters for the sharing of energy. Then, for extra credit, put on your lab-coat and toy around with the parameters of your virtual petri-dish.

Source code: cellShades
Built with Processing


To view this content, you need to install Java from java.com

About CellShades
CellShades is derived from the concept of cellular automata, showing how complex behaviour of organic appearance can emerge from a simple set of rules. Using the mouse, the user spills liquid onto a virtual petri-dish. If the amount of liquid on any position on the grid remains above a certain level for a prolonged time, cells will emerge there. These cells will move and consume liquid to harvest energy according to a set of parameters which you may change and toy around with.
The intensity of the liquid on the grid is visualized by a color gradient from orange to purple.

The Rules
1. The liquid provides energy for cells. If on any point on the grid, the amount of liquid exceeds a minimum level for a certain length of time, a new cell is spawned, depleting some of the liquid at its position (this process is accelerated by the presence of neighboring cells).
2. Cells continuously require energy to survive. If a cell's energy level sinks below a threshold value, the cell dies and reintroduces some liquid at its position.
3. Cells can produce their required energy from the liquid on their position on the grid and the neighboring points. Cells deplete some of the liquid on their position of the grid each turn.
4. If a neighboring point on the grid promises more energy, a cell will always move there, given that the new position is currently free and unclaimed by cells with lower energy levels.
5. Cells have a connective tendency. The presence of neighboring cells (depending on their respective energy levels) is perceived by the cell in the same way as the presence of liquid.

Controls
To use your customized parameters for Cellshades, put in valid parameters into all textfields and click Apply changes. The screen will not be emptied upon doing this, so you might want to reset the screen afterwards to get a clear idea of what your parameters do.

What do the parameters mean?
Liquid Parameters
The decay and spread parameters define how the liquid you spill on the grid spreads out and transpires over time.
The algorithm for this process is quite simple: The amount of liquid on each point on the grid is represented by a value between 0 and 1, visualized by a color gradient. For each turn, the intensity of the liquid on each point will be decay times its previous intensity plus spread times the intensity on the neighboring points. The balance between decay and spread is rather delicate, good balance often being found only several decimals after the comma. Values that are too high will result in a single drop of liquid filling the screen in a matter of seconds, values that are too low will make the liquid transpire before cells can consume it. It's usually good advice to play with these parameters after you develop a feel for how the others influence the program.

Cellspawn Properties
If the amount of liquid on a point on the grid remains above a specified level (the cellspawn threshold) for a certain amount of time, a new cell emerges on the point (this process is accelerated by the presence of neighboring cells). Some of the liquid on the point in question is being depleted in the process, depending on cellspawn cost. Cellspawn thresholds should not be too high, as medium to low decay rates will otherwise make the liquid transpire too fast for new cells to form. The cellspawn cost can be any number between zero and one, which the amount of liquid will be multiplied with upon spawning of a new cell. In other words: A cellspawn threshold of 0.2 means that the liquid level on a point must be over 0.2 for a certain length of time to spawn a new cell and a cellspawn cost of 0.5 will deplete half of the liquid there when a new cell emerges.

Cell-death Properties
Cells die when their energy-level sinks below a value specified in cell-death threshold, turning into liquid. The amount of liquid a dying cell reintroduces to the grid is specified in liquification. A high liquification value (range from 0 to 1) can perpetuate the whole process, as more than enough liquid will be set free by dying cells so that the user will never have to spill any more. The cell-death threshold (0 to 1 also) should be set low as cells usually don't maintain energies along the upper two thirds of the scale for a prolonged time.

Energy Consumption Parameters
Cells receive their energy from the liquid on their point on the grid, as well as from the neighboring points. Additionally, neighboring cells can also add to the amount of energy a cell can harvest. If the cells share energy Checkbox is on, a cell will receive energy from neighboring cells by their collected energy levels times the connective tendency. Otherwise, the connective tendency will only be used to evaluate cells' next positions. You can set the connective tendency to a typical value of between 0 or 1 or try higher values to make your cells tend more towards building clusters. The amount of liquid the cell consumes at its position on the grid each turn is determined by the liquid depletion parameter. Range and handling of liquid depletion are similar to those of cellspawn cost.

tinkering with codetools and docsscrapbookabout