So I kind of lost interest in programming for a while, but I can say that, at least for now, I am back(maybe?).
Anyways, I decided to make Conway's Game of Life, but with some modifications. So I originally meant to create a two player game in which each player either would try to snuff out the other or have more of "their own" cells or something along those lines after a certain time limit. However, I have completely changed my direction(might still try making a two player game) when I started to mess around with the physics of game of life.
If you don't know how the game works, I will just quote Wikipedia, as I am bad at explaining things:
QuoteThe universe of the Game of Life is an infinite two-dimensional orthogonal grid of square cells, each of which is in one of two possible states, alive or dead, or "populated" or "unpopulated" (the difference may seem minor, except when viewing it as an early model of human/urban behaviour simulation or how one views a blank space on a grid). Every cell interacts with its eight neighbours, which are the cells that are horizontally, vertically, or diagonally adjacent. At each step in time, the following transitions occur:
Any live cell with fewer than two live neighbours dies, as if caused by underpopulation.
Any live cell with two or three live neighbours lives on to the next generation.
Any live cell with more than three live neighbours dies, as if by overpopulation.
Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.
The initial pattern constitutes the seed of the system. The first generation is created by applying the above rules simultaneously to every cell in the seed—births and deaths occur simultaneously, and the discrete moment at which this happens is sometimes called a tick (in other words, each generation is a pure function of the preceding one). The rules continue to be applied repeatedly to create further generations.
So, as I said, I decided to mess around with the rules a little bit. I decided to change the amount of living cells required to create a living cell, and I decided to change the amount of cells that a living cell can live with. Then I decided to add some color. The color is added by checking how many alive cells are near the cell BEFORE reproduction. I know this is weird, as it means that it is kind of outdated, and I am not sure whether adding color after reproduction will look better, but I am lazy to do that :P.
Anyways, the two attachments show the initial configuration for a system where the a cell can spawn if there are exactly 2 living cells next to it, and a cell can die if there are less than 2 or more that 6 living cells beside it. The color scheme is inverted to what I've generally seen, with dead cells being black, but I think this looks better. The initial configuration does have red lines, which signify walls, but I disabled walls for this game, so imagine them as nonexistent.
EDIT: I think this looks cool, despite a lot of quality being lost after conversions(obs record to mp4, then to mpeg in ffmpeg, then to gif in virtualdub): http://gph.is/2kYk3k3. This was done with the same + configuration, but cells come alive if there are 2-6 adjacent cells, and, as before, they stay alive with 2-6 adjacent cells.
SECOND EDIT: Added some more pictures that I think look pretty cool.
Nice work! I made a Conway game for the prime but it was slow due to a bad algorithm xD
what did you do? My code is pretty slow at resolutions of 800x800 cells. I rendered the shown images at 399x399, and the framerate is probably like 10-20. Still ok, but not super smooth.
well, if I remember right, I used two matrices and had the first be the base (1st generation), and I iterated through the first matrix, checking every index with the 8 adjacent squares and determining if it should live or die and then storing that to the same index on the 2nd matrix, alive or dead (1 or 0), and then finally setting the 1st matrix equal to the 2nd, clearing the second and repeat. I haven't come up with anything as simple that works faster (I haven't given it much though tbh tho) so I think you would have to make a pretty complicated algorithm to accomplish it faster, I will give it some thought though ;). Good luck!
That's essentially what I do, except I also record the number alive so I can set the colors for each square. Also I record state and playerState, but that is unimportant for my current program right now; I plan to use state, although playerState is only going to be used for a two player game.
Also I have decided to export my code as a java file, attached below. Just unzip the file, and it should have a settings folder and a jar. No readme yet, cause I am lazy, but one will probably be made soon. I do have some notes in the settings.txt file though, so that should help you.
And here is the source(yeah ik I could do something with github but I havent used it for so long and I don't feel like spending time learning how it works again):
EDIT: I think I may have uploaded an outdated version that didn't work, so I just reuploaded the LYFE.zip attachment.
Processing eh? You can put it online at openprocessing.org and send us the link :)
Isnt processingjs the same syntax? (I haven't done processing in a while so i wouldnt know)
This looks fun to mess around with, judging by how cool the generated pictures look like. :)
I'm gonna download this when I'm home
Tell me what you come up with! I haven't spent much time with this myself, but I already think that I've generated some cool images, despite really just learning about conway's game of life. I am going to try a black and white walrii as the initial configuration and see what it generates.
EDIT: Nothing too cool with a walrii :(.
Yeah my idea was to try with a Walrii but only if I could import one since it would take a while to draw while I'm busy :P. But I might try with a few of my older sprites.
Nice progress, I how the multi player turns out well ;).