Sample Project - Conway's Game of Life

436 views
Skip to first unread message

Mathieu

unread,
Aug 17, 2017, 1:00:06 PM8/17/17
to ligh...@googlegroups.com
Here's a little project showing how to use implement the rules of the Conway's game of life. This is a good example using the shader mode. See the notes for the grids for more details.
Conway - Game of Life 02.ljp

Carl Dickson

unread,
Aug 17, 2017, 1:45:43 PM8/17/17
to Lightjams
Cool, I didn't know the shader could do this sort of stuff.

Here are a lot more versions of it;

Im going to give these a go

Carl Dickson

unread,
Aug 17, 2017, 4:50:32 PM8/17/17
to Lightjams
Here is the one I did based on life but a bit different...

Carl


life.ljp

Mathieu

unread,
Aug 17, 2017, 7:57:55 PM8/17/17
to ligh...@googlegroups.com
Nice! I was doing some testing with it and one interesting effect is when the sources actually move. The shader does cool a trail effect.

The fade in/out times have a really big impact on the result. A fade out of 0.1s. give a trai, but 0.2s. fill the whole grid with a kind of maze. Playing with the grid sped is also very interesting.
life02.ljp

Carl Dickson

unread,
Aug 17, 2017, 8:18:48 PM8/17/17
to Lightjams
Cool, now I want to make it work well with sound

Thanks

Mathieu

unread,
Aug 17, 2017, 8:55:12 PM8/17/17
to ligh...@googlegroups.com
I've linked the range of the sources to the music beats and also the grid's speed. You can add more balls by copy/pasting the blue source. They all go at different speed since they're randomly initialized when the grid is activated with a formula like this for the x and y: organic(latch(grid.onactivated, rand(5,20)))
life-meta-balls.ljp

Carl Dickson

unread,
Aug 17, 2017, 9:15:49 PM8/17/17
to Lightjams
Thanks, I'll try some stuff over the weekend and post it if it looks good.

On Friday, August 18, 2017 at 12:55:12 PM UTC+12, Mathieu wrote:
I've linked the range of the sources to the music beats and also the grid's speed. It's the overall beats, so it might work better with just the low beats on some music.

Carl Dickson

unread,
Aug 18, 2017, 2:05:24 AM8/18/17
to Lightjams
I came up with this in my break at work...could have potential...


life2.ljp

Mathieu

unread,
Aug 18, 2017, 9:22:03 AM8/18/17
to ligh...@googlegroups.com
Another one on a 100x24 RGB panel. It's linked to the low music beats of the first music input. 

A timer is used to avoid the simulation to be refresh rate dependent. Also, just as an example, the life formula is now using a temporary variable to store the sum of all neighbors. I think that's what you were looking for when you asked for the inBetween function since you wanted to avoid computing the sum twice. The formula is now:

if(!recall(1), /*not the time to update the simulation*/ last, /*put in a temp memory the sum of all neighbors*/ mem(0,(grid.powerat(x-1,y)+grid.powerat(x+1,y)+grid.powerat(x,y-1)+grid.powerat(x,y+1)+(grid.powerat(x-1,y-1)+grid.powerat(x+1,y+1)+grid.powerat(x-1,y+1)+grid.powerat(x+1,y-1)))/8)*0 + /*now the activation logic*/ (recall(0) >= 18.75 & recall(0) <=37.5))

(I'm adding the isBetween function in the next beta)

Another source is putting the result of a timer in the memory 1.
life-meta-balls-rgb-02.ljp

Carl Dickson

unread,
Aug 18, 2017, 8:08:42 PM8/18/17
to Lightjams
Ahh I didn't think of doing it like that, so much to learn!!!

You should make a repository of all of the project files you post here so its easy to find them, im constantly on the look out for them. They are a great way to learn LJ.

Mathieu

unread,
Aug 25, 2017, 11:34:27 AM8/25/17
to ligh...@googlegroups.com
Finally, a 3rd version using the new isBetween function.
life-meta-balls-rgb-03.ljp

Carl Dickson

unread,
Aug 25, 2017, 10:25:54 PM8/25/17
to Lightjams
That makes the code cleaner... thanks!
Reply all
Reply to author
Forward
0 new messages