I made a lot of changes and forgot to post devlogsā¦. I also realized that I have been forgetting to update the github repo as I work⦠oopsies! š
=======
This oneās gonna be a long one! I tried making it so only the males could look for mates or produce offspring (Fun Fact: I made it so the males were the oneās who had the babies, just like seahorses!), I added a large breed timeout so that they couldnāt just breed again and again right away, and lots and lots of other ways to reduce the population spikes, but none of them really worked. So instead I introduced a way to quickly kill of large groups so that they wouldnāt fill the whole grid. Disease!
=======
To kinda replicate what happens irl when populations of a species get too dense, I added a sickness that targets and kills any of the creatures it comes into contact with. I did not think to get a picture of them for some reason š¤¦āāļø but they work very similar to the pixel creatures, except that there is no hunger or thirst factors, they are lime green, and I actually put the effort into giving them a function to assess the surrounding pixels and determine if there is something of interest in that area. If they find something they want to get closer to, namely creatures they want to contaminate, then they will start heading in that direction.
=======
The disease helped keep the population lower, but it still let the creatures reproduce too quickly so I also put a cap on how high the population will get before going temporarily infertile. They were still hitting the threshold for infertility very quickly and the population rarely if ever got low enough to fully eliminate the disease.
=======
I was kinda tired of wrestling with the crazy overbreeding bugs by now, so I moved on to some other bugs and fine tuning. I gave the creatures the ability to assess their surroundings, just like the disease cells, and get up close to food, water, and eligible mates instead of just completing their respective interactions from a long distance. In doing so I ended up scrapping my initial attempt at a āsearchā function so that I could optimize my code a bit. I screwed it up so bad that the creatures didnāt even spawn anymore! I tried fixing a few things, but could not for the life of me figure out how to fix the glaring frontend issues. I had ChatGPT take a look at my code, and it pointed out about a gazillion different errors it found. After fixing those up, I got the creatures back and my code working again. The population spikes were a bit better too because one of the errors it pointed out was that I was only checking whether the malesā breed timeout was finished, not the femalesā, so they could immediately breed with the next male they came across. Adding a cool down to the females helped a ton, plus I made the cooldown drop by 0.5 per second instead of 1 per second. I also added a visual representation of the stats into the HTML page so that users can see the population evolve instead of just taking my word for it lol. All I think it needs now is an option to speed up the simulation since it is pretty slow and can get very boring very quickly.
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.