Page 1 of 2
Life
Posted: Wed Nov 02, 2011 1:49 pm
by IMP1
This is my rendition of
Conway's Game of Life.
If you don't know anything about it, and don't want to follow the link I provided, it's basically a zero-player game. Which means that after you set the initial conditions, there's not really anything for you to do but sit back and watch what happens.
It's meant to be a kind of celluar automation. There's basically a grid and each square on the grid is either 'alive' or 'dead'. They have certain criteria as when to be born, when to die, and when to survive.
I realise it's not the most fun thing to play, but you can get some weird and cool results.
Controls:
Left click with mouse to create a block, right click to destroy one.
Space to pause
Up/Down to change speed by 0.1
PageUp/PageDown to change speed by 1
Home/End to floor/ceiling speed
Things to add:
- Looping the grid, maybe having it optional
- Allowing user to change birth and survival criteria
- Allowing user to change size of grid and grid squares
- Pretty colours!
- Maybe a button for advancing forwards one tick
- If I'm really ambitious, maybe going backwards... Probably won't happen though
Suggestions for improving at all would be nice
Re: Life
Posted: Wed Nov 02, 2011 4:10 pm
by Robin
Nice.
Page up/down change speed really fast, and up and down are quite fast as well. Maybe change them to 10 or 1 "times" per second, rather than 1 or 0.1 "times" per frame?
And going backwards in time is not possible, at least calculating it. If you store each generation, you can go backwards, but that has as disadvantage that it takes up quite a bit of memory.
Re: Life
Posted: Wed Nov 02, 2011 4:40 pm
by kikito
This is very nicely timed. I'll be doing a game of life in a code retreat next December. I don't think I'll finish it (the point is practicing TDD, not finishing the game)
Robin wrote:And going backwards in time is not possible, at least calculating it. If you store each generation, you can go backwards, but that has as disadvantage that it takes up quite a bit of memory.
Umm you could try compressing the past, I guess. There's lots of repetition in that information. Maybe storing a diff instead of the whole raster or something.
Re: Life
Posted: Tue Nov 08, 2011 2:55 pm
by sebast
In case somebody is interested, I made a simple Conway game of life too.
Computation is done in GPU through the use of Canvas and PixelEffects.
Re: Life
Posted: Tue Nov 08, 2011 9:12 pm
by miko
sebast wrote:In case somebody is interested, I made a simple Conway game of life too.
Yeah, everyone makes its own...
http://love2d.org/forums/viewtopic.php?f=4&t=2858
sebast wrote:Computation is done in GPU through the use of Canvas and PixelEffects.
Which version of love do I need? Does it depend on opengl implementation/graphic card? Because it does not compile for me
Code: Select all
Error: main.lua:64: Cannot compile shader:
0:7(1): error: syntax error, unexpected EXTENSION, expecting $end
Re: Life
Posted: Tue Nov 08, 2011 10:07 pm
by sebast
woops, I didn't realize it required some extension...
the "random" code used EXT_gpu_shader4
http://www.opengl.org/registry/specs/EX ... hader4.txt (nvidia > geforce 8)
I removed this part so initialization is even less random (it wasn't at all... anyway)
you still need love 0.8 for Canvas and PixelEffects
Re: Life
Posted: Tue Nov 08, 2011 10:31 pm
by TechnoCat
sebast wrote:In case somebody is interested, I made a simple Conway game of life too.
Computation is done in GPU through the use of Canvas and PixelEffects.
GPGPU, nice.
Re: Life
Posted: Tue Nov 08, 2011 10:38 pm
by miko
sebast wrote:woops, I didn't realize it required some extension...
the "random" code used EXT_gpu_shader4
http://www.opengl.org/registry/specs/EX ... hader4.txt (nvidia > geforce 8)
I removed this part so initialization is even less random (it wasn't at all... anyway)
you still need love 0.8 for Canvas and PixelEffects
Now this is better. I do get a "night sky" view at the first frame, but then the screen gets blanked (black) and nothing changes (except the fps counter).
Re: Life
Posted: Tue Nov 08, 2011 11:06 pm
by sebast
Damn, I though it was a good idea to remove all thoses calls to logger to remove extra dependencies... *facepalm*
It seems that the initialization code populates the screen with not enough living cells. It needs a clean random generation code.
I added a fallback mapPixel call for initialization (which is slow), but it still needs a clean and compatible GLSL code
Thank you for this feedback by the way.
Re: Life
Posted: Tue Nov 08, 2011 11:48 pm
by miko
sebast wrote:Damn, I though it was a good idea to remove all thoses calls to logger to remove extra dependencies... *facepalm*
It seems that the initialization code populates the screen with not enough living cells. It needs a clean random generation code.
I added a fallback mapPixel call for initialization (which is slow), but it still needs a clean and compatible GLSL code
Thank you for this feedback by the way.
Works better yet! I get the "night sky" view all the time. But it is static (i.e., nothing changes except fps), so I would call it "death" or "agony" rather than "life"...