Wednesday, March 11, 2020

Life Game

Previously I posted about a game (really a simulation) that I made several years ago.  I called it the Fish Game.  A few years later I made another very similar simulation that I called "Life Game".

It is similar, but quite a bit more complex, and I think somewhat better written code.  In this version there are three life forms; fish, bugs, and plants.  The fish eat the bugs.  The bugs eat the plants.  The plants gain energy each frame as if they are getting energy from the sun.  Each life form has a fairly large set of properties.  These are copied to the individual life forms as they are created.



When the simulation is running you can modify these properties for the entire species, or the individuals.  In this simulation the offspring are created near the coordinates of the parents.  This creates a nice affect where the plants appear to slowly spread across the game area.

The code is also setup so that it would be easy to add other life forms.  I didn't build that into the simulation.  I think it would be easy to do though, and I may create an updated version at some point.  I'm think of converting the whole thing into a phone app, but we'll see if that happens.

No comments:

Post a Comment

Canvas Paint

Here is another small JS project that I built quite a few years ago.  It was basically just an exploration of the canvas tag, which was some...