-
Notifications
You must be signed in to change notification settings - Fork 0
Chances are you've seen Conway's Game of Life. SmoothLife is an attempt to generalize Conway's game of life to a continuous domain.

Lets start with Conway's game of life. We'll begin by defining the 'inner neighborhood' M, and the 'outer neighborhood' N. Next, let's define
m = M
n = ΣN.
We can write the Game of Life update rule as a function L(n,m) such that:
L(n,m) = 0 ; n < 2
L(n,m) = 0 ; n > 3
L(n,m) = 1 ; m = 1, 1 < n < 4
L(n,m) = 1 ; m = 1, n = 3
Smoothlife uses a circular neighborhood over a field of continuous values. The 'inner neighborhood' becomes a circle, and the 'outer neighborhood' becomes a ring. The neighborhoods can now be any size, so we'll also introduce normalization constants (inner_sum and outer_sum) to keep n and m in the range of [0, 1].

inner_sum = The area of the inner circle
outer_sum = The area of the outer ring
m = ΣM / inner_sum
n = ΣN / outer_sum
Our update rule will be a continuous function S(n,m) : [0,1] x [0,1] -> [0,1]. There are many possible options for this function which yield widely different results, this is an open space for exploration.
The first three parameters here define the neighborhood kernels.
float inner_radius; // radius of the inner neighborhood M.
float outer_radius; // radius of the outer neighborhood N.
float border; // Border width for anti-aliasing (typically 1)

The remaining parameters control the transition function. The plot below shows the values of an example transition function over all possible inputs m and n.

float b1, b2; // The 'birth' interval
float d1, d2; // The 'death' interval
float alphan; // Smoothing width in the direction of the n axis.
float alpham; // Smoothing width in the direction of the m axis.
float dt; // timestep per iteration