My new project: petri dish

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
togFox
Party member
Posts: 770
Joined: Sat Jan 30, 2021 9:46 am
Location: Brisbane, Oztralia

My new project: petri dish

Post by togFox »

I'm hoping you guys can give me some ideas on my next project. :)

I'd like more practice developing ECS projects (with Concord) so I'm going to try mashing my passion for ECS + machine learning into a microbe simulator thingy where objects (germs) move around a petri-dish and grow and evolve and die and reborn. Objects will have components that define their behaviour, such as:
- eyes (vision)
- legs (motion)
- nose (smell)

etc and these objects need to survive inside the kill or be killed petri dish. Some objects can move fast. Some slow. Some can see. Some eat live prey. Some scavage dead prey. Objects start with basic or random abilities and evolve over time. Evolutions in the correct direction makes them stronger. Evolutions in the wrong direction see them as fodder. Over a period of time you can see dominant 'species' take their place at the top of the food chain.

It won't be a game exactly but an evolution simulator that allows me to practice ECS libraries. Probably 2D top-down bunch of dots and squares moving about the screen either chasing or fleeing.

A machine-learning aspect can be incorporated (I've done ML before) and perhaps individuals will learn before they die and impart there cleverness to their offspring - should they last that long.

Anyway - there are some thoughts on a page.

Any ideas on what sort of components (properties) these objects might have? For example, if they have "mobility" then they can move. What would govern where they move and how fast? Should moving require energy? Does eating prey create energy that permits movement? Maybe they can flee hunters - if they have that property to detect hunters, and they can flee at increased rates if they have energy. Those that are effective at collecting energy have a greater chance of survival and creating spawn etc.

I guess this is more science than game. Let me know if this sounds interesting and have some ideas. :)
Current project:
https://togfox.itch.io/backyard-gridiron-manager
American football manager/sim game - build and manage a roster and win season after season
User avatar
togFox
Party member
Posts: 770
Joined: Sat Jan 30, 2021 9:46 am
Location: Brisbane, Oztralia

Re: My new project: petri dish

Post by togFox »

So here is a fundamental example:

I want to draw an object (entity) on the screen. It is a round circle and the challenge presents itself immediately:

- what is the x/y of the centre? (I'll make it random)

- what is the radius?

It would make sense for my entity to have different sizes and therefore different masses. Does that mean they move at different speeds and consume different amounts of energy? Or move at different speeds assuming the SAME consumption of energy? And if they consume energy, can different sources give different energy and could they be absorbed at different conversion rates?

And then how do I keep that balanced? Or should I not try and let Darwin determine how the Petri dish evolves?

This can theoretically get very complex but it should be manageable with ECS because that's the point of ECS. :)
Current project:
https://togfox.itch.io/backyard-gridiron-manager
American football manager/sim game - build and manage a roster and win season after season
User avatar
Gunroar:Cannon()
Party member
Posts: 1085
Joined: Thu Dec 10, 2020 1:57 am

Re: My new project: petri dish

Post by Gunroar:Cannon() »

I say that there should be a way to make it evolve ... faster rather than a slow (and more realistic) evolution. But that's just impatient me :P . Speaking of Imps there was this from a while back
viewtopic.php?f=14&t=90403
The risk I took was calculated,
but man, am I bad at math.

-How to be saved and born again :huh:
User avatar
pgimeno
Party member
Posts: 3544
Joined: Sun Oct 18, 2015 2:58 pm

Re: My new project: petri dish

Post by pgimeno »

Reminds me of a project I made some time ago, based on an article by A. K. Dewdney. It's in Javascript; you can see it running here but the text is in Spanish, sorry: http://orden-y-concierto.blogspot.com/2 ... ucion.html

Since it's in Spanish, here's a summary in English. The grid is hexagonal and toroidal. There are two types of beings: bacteria and protozoa. Bacteria are reproduced by spontaneous generation at random at a fixed rate; think specks of dust falling on a surface. Protozoa eat bacteria, but not other protozoa, and they reproduce by bipartition; there's no spontaneous generation of them save for the initial population, but they need a minimum age and energy to reproduce. When energy reaches zero, they die, and they also die from ageing. They are able to move in all six directions. Each protozoan has a gene pool of 7 genes; genes only affect direction of movement. Six of the genes are dedicated to directions: each gene determines the probability that the protozoan will turn by that much (relative to its current moving direction). That is, there's a gene for the probability to move forward, two for the probability to turn 60°, two for the probability to turn 120° and one for the probability to turn 180°. There's an additional gene for the probability to turn towards the light; the light is a point around which the frequency of appearance of bacteria is much higher than in the rest of the surface. You can think of it as a sense of smell instead of light, if you prefer. The gene pool is in the form of signed integers; they apply their probability exponentially, relative to the sum of all probabilities of all genes. Each time a protozoan reproduces, the offspring gets a random mutation (an increase or decrease of a random gene by 1).

That's about all there is to it. A graph at the bottom plots the population of bacteria and protozoa. If you try to run the simulation with a seed value ("Semilla aleatoria") of 4 and hit "(Re)Comenzar" ("(Re)Start"), you'll see speciation. One set of protozoa tends to go forward a lot, thus encountering new bacteria continuously (if they stay within a limited zone, they will exhaust the bacteria in that zone and die, so it's advantageous to change zone continuously, i.e. to move straight for as long as possible). I call those "runners". There's also another set that specializes in going to the light and eating from the zone of high bacteria rate; I call those "moths".

Maybe some aspect of that simulation inspires you :)
User avatar
togFox
Party member
Posts: 770
Joined: Sat Jan 30, 2021 9:46 am
Location: Brisbane, Oztralia

Re: My new project: petri dish

Post by togFox »

Great posts both!! I really like the way Pixi presents critters but I'm not sure that's within my ability. I also intend on using the physics engine to control bumps and contacts so I'll need to think about that too.

pgimeno: that website was insightful - and the description useful. Thank you! I started googling this subject and there are MANY versions of this done over the years.

I want my entities will have things like vision and hearing meaning other entities will need size and 'noise'. Not really suitable to a petri dish so I might move up the chain of evolution a little bit. Maybe "bugs" of two kinds - those that eat plant matter and those that eat other bugs. IDK. Will think some more!
Current project:
https://togfox.itch.io/backyard-gridiron-manager
American football manager/sim game - build and manage a roster and win season after season
Post Reply

Who is online

Users browsing this forum: No registered users and 59 guests