So a good while ago i came across Conway's game of life and decided to try to make it in löve, But failed miserably. The code probably worked in theory, But it was so inefficient it froze löve, I was basically looping through an array like 300 times each frame (hyperbole). But recently i decided to try again, And this time i actually succeeded i think. I'm getting around 40 fps with 2880 cells.
Anyway, If you're not familiar with the game, You can read up on it on the wiki page i linked above because i suck at explaining things.
My implementation has 2880 cells by default, But this can be increased up to 46080 and decreased to 176 with a simple slider, The update rate can also be adjusted.
Controls:
LMB to set cells to "Alive" and RMB to kill them, click and drag possible.
Space toggles the simulation
C clears the grid (kills all cells)
I inverts the grid, (Dead cells become alive and vise versa)
S forces a single world update
and escape closes it.
Default resolution is 1280 x 720, But it has been written to work on most resolutions, meaning the size of the cell grid adjust to the resolution. So if 720p is too big for your monitor, you can change the size in conf.lua and it should still function normally.
Screenshot:
Conway's game of life
Re: Conway's game of life
Neato. Wikipedia also has a schemes for sustaining loops and sustaining spots, along with sustaining moving units, and also for an infinite moving units generator.
- Ranguna259
- Party member
- Posts: 911
- Joined: Tue Jun 18, 2013 10:58 pm
- Location: I'm right next to you
Re: Conway's game of life
This is actualy realy awesome
-
- Prole
- Posts: 1
- Joined: Sat Aug 10, 2013 6:00 pm
Re: Conway's game of life
whats the point all you have to do to get conways game of life is search it up on google and look at the background
https://www.google.com/search?q=conway% ... =firefox-a
https://www.google.com/search?q=conway% ... =firefox-a
Re: Conway's game of life
Well my implementation allows you to click and drag which makes drawing shapes a bit easier.creeper1919 wrote:whats the point all you have to do to get conways game of life is search it up on google and look at the background
https://www.google.com/search?q=conway% ... =firefox-a
But the point was just practice.
Re: Conway's game of life
The ability to add cells while the simulation is running is actually pretty fun. I could see a possible game mechanic there where you need to coax some cells in equilibrium to move across the board to fight some kind of viral infection or something.
----------------------------------------
Sluicer Games
Sluicer Games
Re: Conway's game of life
I made an "object-oriented" game of life using PyGame (before finding Löve). It's OO in the sense that instead of using a grid and functions on that grid, each biome is an object that knows about it is position. Instead of updating the grid, each biome counts its neighbors and either dies or creates offspring, stuff like that. It's incredibly inefficient, but it nicely allows you to click to place/kill biomes, you can pause & resume, zoom the "camera", and even a special surprise that you will see if you play the game for a few minutes.
It just needs PyGame and standard Python libraries to run. You need to run it from the terminal. I don't recommend using it as example code because it was my first attempt at learning PyGame and game hobbying in general.
Note: the forum won't let me upload .py files, so just rename the .txt to .py and run it.
Jean-François
It just needs PyGame and standard Python libraries to run. You need to run it from the terminal. I don't recommend using it as example code because it was my first attempt at learning PyGame and game hobbying in general.
Note: the forum won't let me upload .py files, so just rename the .txt to .py and run it.
Jean-François
- Attachments
-
- lifeproto12.txt
- Rename to *.py and run with python (needs PyGame).
- (30.43 KiB) Downloaded 369 times
Re: Conway's game of life
Thanks for your example!
Updated to 11.3, added features:
Updated to 11.3, added features:
Issue: I don't know how to save the meta function to the table, but not call it.-- added 'r' to random the map
-- map is closed to torus topology
-- resize doesn't delete all dots
-- added GUI to start, clear and random
- Attachments
-
- game_of_life_11.3.love
- (4.26 KiB) Downloaded 327 times
Re: Conway's game of life
Color game of life, for Löve 11.3
Changings:
Added color
Childs become the color of their three parents, random and independently by channel.
Small probability (1%) of mutation for one of three color channels.
"Random" adds new cells, not removes existing.
Changings:
Added color
Childs become the color of their three parents, random and independently by channel.
Small probability (1%) of mutation for one of three color channels.
"Random" adds new cells, not removes existing.
- Attachments
-
- Color-Game-of-Life_1.01.love
- (4.86 KiB) Downloaded 336 times
-
- Prole
- Posts: 2
- Joined: Wed Nov 18, 2020 4:04 am
Re: Conway's game of life
crashed for me with error
Code: Select all
Error
boot.lua:530: conf.lua:2: attempt to index field 'screen' (a nil value)
Traceback
[C]: in function 'error'
[C]: in function 'xpcall'
[C]: in function 'xpcall'
Who is online
Users browsing this forum: No registered users and 0 guests