Thrive Game Development
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Thrive Game Development

Development of the evolution game Thrive.
 
HomeHome  PortalPortal  Latest imagesLatest images  SearchSearch  RegisterRegister  Log inLog in  
Welcome new and returning members!
If you're new, read around a bit before you post: the odds are we've already covered your suggestion.
If you want to join the development team, sign up and tell us why.
ADMIN is pleased to note that this marquee has finally been updated.
ADMIN reminds you that the Devblog is REQUIRED reading.
Currently: The Microbe Stage GUI is under heavy development
Log in
Username:
Password:
Log in automatically: 
:: I forgot my password
Quick Links
Website
/r/thrive
GitHub
FAQs
Wiki
New Posts
Search
 
 

Display results as :
 
Rechercher Advanced Search
Statistics
We have 1675 registered users
The newest registered user is dejo123

Our users have posted a total of 30851 messages in 1411 subjects
Who is online?
In total there are 5 users online :: 0 Registered, 0 Hidden and 5 Guests

None

Most users ever online was 443 on Sun Mar 17, 2013 5:41 pm
Latest topics
» THIS FORUM IS NOW OBSOLETE
Population dynamics - Page 3 Emptyby NickTheNick Sat Sep 26, 2015 10:26 pm

» To all the people who come here looking for thrive.
Population dynamics - Page 3 Emptyby NickTheNick Sat Sep 26, 2015 10:22 pm

» Build Error Code::Blocks / CMake
Population dynamics - Page 3 Emptyby crovea Tue Jul 28, 2015 5:28 pm

» Hello! I can translate in japanese
Population dynamics - Page 3 Emptyby tjwhale Thu Jul 02, 2015 7:23 pm

» On Leave (Offline thread)
Population dynamics - Page 3 Emptyby NickTheNick Wed Jul 01, 2015 12:20 am

» Devblog #14: A Brave New Forum
Population dynamics - Page 3 Emptyby NickTheNick Mon Jun 29, 2015 4:49 am

» Application for Programmer
Population dynamics - Page 3 Emptyby crovea Fri Jun 26, 2015 11:14 am

» Re-Reapplication
Population dynamics - Page 3 Emptyby The Creator Thu Jun 25, 2015 10:57 pm

» Application (programming)
Population dynamics - Page 3 Emptyby crovea Tue Jun 23, 2015 8:00 am

» Achieving Sapience
Population dynamics - Page 3 Emptyby MitochondriaBox Sun Jun 21, 2015 7:03 pm

» Microbe Stage GDD
Population dynamics - Page 3 Emptyby tjwhale Sat Jun 20, 2015 3:44 pm

» Application for Programmer/ Theorist
Population dynamics - Page 3 Emptyby tjwhale Wed Jun 17, 2015 9:56 am

» Application for a 3D Modeler.
Population dynamics - Page 3 Emptyby Kaiju4u Wed Jun 10, 2015 11:16 am

» Presentation
Population dynamics - Page 3 Emptyby Othithu Tue Jun 02, 2015 10:38 am

» Application of Sorts
Population dynamics - Page 3 Emptyby crovea Sun May 31, 2015 5:06 pm

» want to contribute
Population dynamics - Page 3 Emptyby Renzope Sun May 31, 2015 12:58 pm

» Music List Thread (Post New Themes Here)
Population dynamics - Page 3 Emptyby Oliveriver Thu May 28, 2015 1:06 pm

» Application: English-Spanish translator
Population dynamics - Page 3 Emptyby Renzope Tue May 26, 2015 1:53 pm

» Want to be promoter or project manager
Population dynamics - Page 3 Emptyby TheBudderBros Sun May 24, 2015 9:00 pm

» A new round of Forum Revamps!
Population dynamics - Page 3 Emptyby Oliveriver Wed May 20, 2015 11:32 am


 

 Population dynamics

Go down 
+10
untrustedlife
hypoxanthine
scorpion268
Daniferrito
gdt1320
Rorsten594
The Uteen
~sciocont
Mysterious_Calligrapher
Seregon
14 posters
Go to page : Previous  1, 2, 3, 4  Next
AuthorMessage
~sciocont
Overall Team Lead
~sciocont


Posts : 3406
Reputation : 138
Join date : 2010-07-06

Population dynamics - Page 3 Empty
PostSubject: Re: Population dynamics   Population dynamics - Page 3 EmptyFri May 24, 2013 5:46 pm

Daniferrito wrote:
Seems good to me. Hill climbers always have that problem, no matter how hard you try, they get stuck with local maximums. But evolution does as well, for example sharks found their local maximum many million years ago and havent changed much since. Evolution is a hill-climber as well.
This is an excellent point- evolution doesn't make perfect organisms, it just makes them "pretty good". If the environment stays essentially the same (as is the case with sharks) there is little selection pressure and the actual changes in evolution start becoming less and less distinct. This is also the case with crocodiles, mice, etc. But the shark is probably the best example.
Back to top Go down
Seregon
Regular



Posts : 263
Reputation : 37
Join date : 2011-08-10
Location : UK

Population dynamics - Page 3 Empty
PostSubject: Evolution Compounds Population Dynamics Seregon   Population dynamics - Page 3 EmptySat May 25, 2013 1:02 am

Ok, I'm not sure anyones realised this, but a lot of the discussion on the last page has been had before, on the first two pages of this thread. The idea being discussed is slightly (and only slightly) different, but the problems are the same. I've watched you circle some of the solutions, but also create more problems, so I'll try and fix some of them. As a bonus, I'll even try to include that pseudo code hypo's so desperate for.

Systems
We're discussing multiple different systems here, they all interlink, but I think theres been some confusion about which ones we're discussing here and how they all relate:
Population dynamics - controls the number of individuals of each species in each location. That's pretty much it, but it ties into pretty much every other system below, making it seem far more complicated than that. It monitors/processes birth/death rates, transfer of compounds between species (predation), migration between regions etc.
Climate - controls temperature and light levels (among others) across the planet, which is fed into the population dynamics. Light levels affect the available energy, temperature may affect metabolism, but also survival chances.
Auto-evo - what we really seem to be discussing here, despite it not being an auto-evo thread (even if it is very closely linked). Auto-evo selects which species get to mutate, and decides which mutations to apply. That's it, details later.
Compound system - controls what compounds have what uses, which can be converted to eachother, etc. It's also the target of most mutations, either by making a process more efficient (by making an organelle better), or enabling a new one, or developing a new compound (toxin). Conceptually the connectiong between the compound system and pop-dyn/auto-evo is the simplest; technically it's probably the most complicated, I'll see if I have time to get into it here or not.

Stages of auto-evo
This has been mentioned here, but I'll mention it again to make the following clearer:
1 - The player plays for a while, auto-evo is basically idle, though we may pre- or post-process stuff from other generations
2 - A generation ends, either becuase the player reproduces and opens the editor window, or a certain amount of time passes, and we do an auto-evo step in the background
3 - Auto-evo is passed a list of all species populations and their current states
4 - It selects which of those species get to mutate. As discussed here, this could be one species, many species, or even all or none of them. The probability of each species getting to mutate is seperate, and dependant on multiple factors including their population size, selection pressure (i.e.: how unfit they currently are), reproduction rate etc. If the mutation of another species had a particular impact on a species in the last round (someone gave an example of a predator evolving and it's prey not getting a chance), the affected species gets a much improved chance this round. As the discussion here centers around how to select mutations, I'm going to ignore this step and assume that every species gets to mutate every generation for this post.
5 - We take the information about how each species performed last round and decide which mutation is best for it now. In some circumstances it may get to pick multiple mutations, but again for simplicity when explaining I'll assume it only gets one. This is what we're discussing here, so details later.
6 - All the mutations are applied. By doing this after step 5, the order in which species mutate this step has no effect on what they decide to do.
7 - We generate new meshes and animations as needed, and load back into the game.

Apart from the generation of new meshes and animations, all of this is computationally very cheap, and can be done in the background, with biomes the player isn't currently observing being processed while they're playing.

A note regarding 4 - some of the factors for picking who gets to mutate may now be used (in the microbe concept we're discussing in the other thread) to decide how many MP each species gets to work with, so we need to double check this and make sure we're not using the same factors.

Selecting a mutation
Dani's post was a pretty good explanation of the current system, except in one detail - how we calculate fitness. This has been our problem from the start, and we've made several attempts at solving it, and come pretty close. The solution (I hope - there's no way of knowing for sure until we actually test it) is what was discussed on the first page of this thread, and pretty much just been discussed again on the last page or two, with a few alterations.

I'm going to go over a few of the suggestions since my last post yesterday, some are pretty good, but others have flaws which haven't been pointed out yet.

I'll start with Calli's post last night and work from there. I'm going to ignore whatever questions were left unanswered up to that point, becuase whatever answers hypo was after, you didn't do a very good job of asking the right questions - probably why it keeps looking like we're not reading half your posts, becuase we're simply not seeing whatever question or point you think was implied.

hypoxanthine wrote:
1) creature chosen for mutation by whatever method you like
2) random genome parameter selected to mutate
3) random increase or decrease of this parameter
4) depending on the genome parameter modified, increase or decrease one of the population parameters for the species (say were using Seregon's split-parameter version of Lotka-Volterra, if the speed of travel is increased by lengthening of legs, which youd test by doing just one quick simulation to measure running speed, then youd increase one of the parameters that make up the overall efficiency of predator-prey-encounter conversion to predator-individuals, like the probability of hunt success)
5) run population dynamics
6) land player on planet
7) probability of creature appearance based on number from population dynamics (in some way i havnt decided on, also based on area of biome and another pop. parameter of distribution)
Here we're just applying a completely random mutation (3-4) and seeing what happens. Yes, we update the pop-dyn (4) so that it will have some effect on population levels, but theres no actual selection going on. That is, unless you expect pop-dyn itself to take care of that selection, which it isn't really designed to. Yes, poor mutations will lead to a loss of population, but that loss of population doesn't really feed back into what mutation is chosen, you'll just get loads of very random species, most of which will die out.
We'll eventually get a good species by blind luck, but we're missing most of the aspects that make genetic algorithms effective - species don't mate with eachother, they don't reproduce asexually to produce new species (except when sub-populations speciate, but that doesn't help here). Effectively this is an GA with no interaction between agents, also known as blind trial & error.

hypoxanthine wrote:
1) select rand species to mutate
2) select rand popdyn parameter and increase by small rand amount
3) each popdyn parameter change has a genomic interpretation. if you split the parameters up more, youll eventually get things like 'speed, stealth, etc.' so if you'd just increased the speed popdyn parameter for example, this would change the leg randomly, then run a simulation to determine if speed had increased and then hill-climb until it actually has. stealth? no simulation needed here probably - hill-climb to a set colour for the particular biome (simplistic i know). you can imagine what else there would be.

This is close, but backwards and a little poorly defined. What your saying is that we first pick a random pop-dyn parameter to mutate, then pick a random associated genome/phenome trait to mutate to achieve that mutation, and then test to see whether that genome mutation actually achieved the desired pop-dyn mutation... that seems like a hell of a lot of work compared to the exact opposite:

1 - select species
2 - select a genome trait to mutate
3 - test what effect this has on the pop-dyn parameters, and what affect this has (I'll get to this later in the post) on species fitness
4 - if it's positive, accept the mutation.

Ideally, I'd extend this to trying every possible genome mutation (or atleast a large subset), and picking the most favorable one. That is your hill-climbing algorithm: pick the best possible mutation at every step. How feasible this is depends on the size of the genome and the computation expense of testing fitness, neither of which we're sure of right now, but I'm fairly confident that this is atleast feasible.

hypoxanthine wrote:
imagine a predator mutates and is now much better at hunting. unless the great random mutates the prey in time, theres a significant danger of extinction
I mentioned this in step 4 of the auto-evo process above. When species get mutated is an entirely seperate issue to how they get mutated, so we'd have this problem regardless of the system. Except that we have a solution, discussed in the thread linked in 4 above.

hypoxanthine wrote:
a good fix for this might be to weight the probabilities of mutation for a species by its current population count (smaller population => greater selection pressures => mutants are selected for more strongly on an agent level => mutant allele frequency increases much more quickly on population level => so on population level, increase the mutation rate
Pretty good, and similair to whats discussed in the linked thread in 4.

hypoxanthine wrote:
how is this preference decided for each predator
Prey preference should be an evolvable trait. I think Scio mentioned that we will have a food web for each biome, so we know who is capable of predating on who, all we need to know then is to what degree each predation actually takes place. This is partially preference, partially both predator and preys abilities to detect and avoid/find/chase/kill eachother, and partially availability (the higher the population densities of both predator and prey, the higher the rate of 'collisions' between them, and the higher the interaction rate, regardless of whatever else either species does to modify that rate). The degree to which each predation actually occurs, and how succesful it is, affects the fitness of both parties, and that degree therefore also decides how much of an impact that particular interaction has on each parties fitness, and how important mutations affecting that interaction are.

~sciocont wrote:
We're not idiots.
QFT

~sciocont wrote:
In this way, instead of changing the form of an organism and figuring out the downstream effects, we change the properties of the organism and then mutate the form to reflect that. It gives us a lot more control over the form of the organism and thus an extra layer of insulation against the "ugly creatures" problem.
As nice as this sounds, doing it simply isn't trivial. If we're incapable of figuring out the downstream effects of changing an organism (as suggested here and elsewhere), how do we go about changing those downstream properties, then going back and finding modifications which have the desired effect? The latter is only possible if the former is, and the former is a lot less contorted.

~sciocont wrote:
One interpretation of your popdyn parameter change is to simply boost the population (in the next generation) of the individual selected for mutation by some multiplier (5% or something, we can tinker with it based on the orgs population as a fraction of the community (biome) population) and then find a parameter change that might increase population by that amount. One problem I see with this is that, unless we have many different popdyn parameters for each species, mutations will be more or less arbitrary. Of course, if we're modeling every meaningful two-species interaction, then we need only add the multiplier to one of these parameters and then we have a more specific needed mutation.
I'm interpreting this as "boost a species fitness by an arbitraty value, and then find a mutation which would justify this boost", and it has the same issues as mentioned above. The problem of not having many pop-dyn parameters really is a problem, and we can't expect to have meaniingful or interesting auto-evo with the very few parameters used earlier on in this thread. I mentioned as much then, but only said that we'd need more than 7. We will need a lot more than that, representing things as specific as organism speed, mass, metabolic rate etc. I'll get back to this idea later.

hypoxanthine wrote:
1. select a random organism to mutate
2. randomly mutate two organs (or other) in said organism (these can either harm or benefit organism, it does not matter, the only required part to this is at least one be beneficial.
3. run simulator with both mutations added multiple times.
4. take results and put successes out of a whole of the simulation. (delete if success is 0 out of total and restart, unless of course you wish to keep it for an extinction)
5.depending on how they do in said simulation will determine the overall population change.
6. back in the environment the results will be reflected by how the population changes.
Apart from mutating two traits/organs at a time (why?), I really don't see how this is at all different to what Dani explained on the previous page - you do a random mutation, test if it's benificial, accept or reject it. The only real addition is that the performance in the fitness tests now translates to a population boost (is this a boost to population, growth rate, or what? you don't specify). Simple as that may be, the net effect is that our population simulations no longer obey the conservation of energy. If we give species arbitrary boosts to growth rates, we're giving them energy which they're not obtaining from a source (predation/consumption of another species or photo/chemosynthesis). We could attempt to balance this arbitrary change somehow, but that gets complicated.

Daniferrito wrote:
Actually, i dont think selecting a random parameted to addjust would suffice. Modifying any part of an organism has usually more than one parameter affected, which usually is the energy it takes to create a new creature (as it either became more or less complex or big) and another parameter depending on the specific part.
Good point - another reason we can't choose one pop-dyn parameter to mutate, then look for a genome mutation to achieve that, there would be too many side effects, some of which may make an apparently positive mutation negative overall.

hypoxanthine wrote:
if your worried about then why not have associated populome (bugger this im coining this term now) changes for each genome change
Getting warmer...

hypoxanthine wrote:
instead of having just one genomic interpretation of a populome change, have more than one associated genome change.

e.g. populome change: speed increased => out of possible genome changes for this event: longer legs selected (then sim to ensure this actually does increase speed). => genome change: more energy required for movement etc.
...but your still working backwards.

~sciocont wrote:
This should mean that the data for the organism's abilities is stored separately from the data used for its physical model and AI behavior
Do you mean abilities as in speed, strength etc., which are effectively the result of it's physical genome (leg length, muscle mass etc.)? If so, yes, there should be three layers of data:
1 - the genome, which is mutated by auto-evo. We have no way of assessing how fit a genome is without looking further.
2 - the abilities, or phenome (phenome in a different sense to how i was using it yesterday), which are the result of the genome. These are the result of either mini-simulations, or calculations.
3 - the pop-dyn parameters, which are influenced by a species abilities. It's only from these, and their effect on r, that we can actually calculate fitness.

hypoxanthine wrote:
so, as weve discussed, its effectively a hill-climbing algorithm. that immediately gives us a problem because hill-climbers are greedy, so they tend to get stuck
Yes, hill climbers get stuck, that's the advantage of GA's/simulated annealling/swarm sims etc. Simulated annealing may help, but all that really does is allow negative mutations at a small random chance. We already do this by having genetic drift - a small random change in a random trait. Also, I think your suggesting running this at every generation, effectively attempting multiple mutations until we either find a good one or give up and accept a bad one. If we allow this to go on too long, it would be simpler and a lot more efficient to simply try all mutations and pick the best one, or with small random chance pick a bad one.

Also, I really don't see the problem if it gets stuck. If the system finds a very effective genome (e.g.: a shark), why shouldn't that species survive unchanged for a very long time? The problem is if every species does that, and we end up with a static ecosystem, but given that this would require the environment to be static too, it shouldn't really happen. With a seasonal climate, long term climate change, catastrophes, and whatever changes the player makes, there should always be something for the AI species to adapt to, so they should become stationary. The simulations on the first page show that even in a trivially simple system, adding seasonality can delay stabilisation from a few 'months' to hundreds of 'years'.

Finally, if a species gets stuck in a local maximum, it may be unable to adapt to long term changes in its environment. If it doesn't get out of that maximum and find a better one before it's too late, that maximum may get to a point where it can't sustain the population, and it goes extinct. Tbh that's just realistic, species ussually go extinct becuase they're unable to adapt.

Pieces of the puzzle
Right, now I'm hoping to show how we've already solved most of these issues before. A lot of this comes from the various auto-evo threads, and a lot is relatively new developments from various discussions I've had with Scio and Calli (both on this thread, elsewhere on the forum and off it) and a lot of thinking over the past few months. I really wasn't ready to present this yet, partially becuase theres a lot of more basic things I need to introduce first (which I will briefly do here), and partially becuase there are still some issues I haven't had time to fix (which I'll point out, so we can hopefully work on solving them). First, back to the seperate pieces, from the bottom up:

Dynamic systems
Each organism is a collection of compounds, which are managed by the compound system. Organisms gain compounds from their environment, and other organisms, they process them internally using organelles or other processes, and they excrete waste compounds back into the environment. Some compounds are necessary for survival, others are harmful, an organisms basic aim in life is to have the right mix of compounds available to allow it to survive and reproduce.

At the population level, species can be represented as the number of individuals in an area, and the average compound contents of it's individual organisms. The compound system again manages these compounds, but the population is managed by population dynamics, which takes information from the compound system. If a population has insufficient access to a particular compound (e.g.: sugar), all it's members will suffer and the population as a whole will suffer starvation, reducing birth rates and possibly increasing mortality.

In addition to information from the compound system (the internal processes affecting a species' members), population dynamics also takes information from external processes, including predation, other interactions (e.g.: symbioses, competition) and environmental drivers (e.g.: light and temperature levels). All of these factors have some effect on a species ability to survive and reproduce, but it's far from sufficient to simply talk about birth and death rates, we need to differentiate (in the non-mathematical sense) these parameters into more specific parts, e.g.:
  • Species A mortality due to predation by species B
  • Species B energy/compound gain due to predation of species A
  • Species C (a plant) energy gain due to photosynthesis
  • Species A mortality due to exposure to envionmental hazard (toxin, extreme temperatures etc.)
  • Energy expended by species B when searching for prey
  • Energy expended by species A/B during a predation encounter (the chase/fight)
  • Energy expenditure required for species A to reproduce


This list is far from complete, and deciding all the necessary parameters and related equations won't be easy. This, along with a similair list of 'abilities' I'll mention later, are the two key issues we need to overcome to make this work. They're certainly not impossible though, just hard work.

Now we have something which is far more than a simple logistic equation or predator-prey model. It incudes those two things, but also many more factors, in calculating population levels. This appears overcomplicated for this purpose, but that's not the point. Knowing the population level of each species in each location is a side effect of the population dynamics system, what we actually want is a way of calculating species fitness. The simplest measure of fitness is r, or (b-d) as explained on the first page of this thread. It's pretty clear that it won't be any where near that simple with the parameter list above, but calculating it will be just as simple to the computer.

Data
Now the other half of the puzzle. Each species has a genome, all members of a species in a particular location/biome (a population) share the same genome. Populations of the same species in seperate locations may differ slightly, and may eventually speciate if they're seperated for too long, but speciation and spatial dynamics (migration) are beyond the scope of this discussion. This genome controls the placement and number of organelles and limbs, the efficiency and size of those organelles, the efficiency of processes not associated to any organelle, the compounds available to the organism.

Derived from this information, and the definitions of each genome, compound, process and what each can do, is the organism/species' phenome. This phenome record the abilities of the organism. For example, if the genome specifies 3 mitochondria with an efficiency of x%, and the mitochondria definition says at that it can produce 1mol ATP per second at 100% efficiency, then the phenome records the ability to produce ATP from sugar at a maximum rate of 3*x moles of ATP per second (depending on the availability of oxygen + sugar). If the organism has the appropriate organelle (golgi apparatus + vesicles?), and the ability to produce a particular toxin, then the phenome records the ability to produce that toxin at a rate dependent on the efficiency of the golgi, and at a strength dependent on the level of the toxin. The phenome will also have a value for the organisms maximum speed, dependent on the types of motion available (flagella, cilia, pseudopodal), their number and efficiency, as well as the size and mass of the cell. Again these are examples from an incomplete list.

We also have a budget of mutation points, or genetic diversity, to spend on mutations. How exactly these will work is still being discuss in another thread, so I'll just assume they're limited, and that they may be split into seperate pools for different types of mutation.

Finally we have data both from the envionment and the Population Dynamics system: the number of each population, the density (dependant on the area of each location), acidity, temperature, light, environmental compound reserves etc.

Calculating population
Now we have all the pieces we need to calculate population. The population dynamics equations use the environmental, population and compound level data (variables), and each species' phenome (parameters) are combined to calculate a species reproduction and mortality rates, and therefore the change in its population for the next generation. An example:
From populations, we know the density of species A (predator) and B (prey), and therefore how often they are likely to meet eachother. From species A's phenome we know how likely it is to detect B upon meeting it, as well as how capable it will be of chasing B down. Combining this with B's phenome telling us how well it can escape or fight A off, and some other details from each phenome, we can calculate the chance of a meeting resulting in an individual of B being succesfully brought down. We also calculate how much energy this hunting process (succesful or not) costs each species, each species loses this much energy regardless. We then multiply the encounter chance by the chance of a succesful kill to find an overall predation rate. Population B loses members, and their embodied energy and compounds at that predation rate. Population A gains some of those energy and compounds at a rate depending on their digestion efficiency and their ability to defend the kill and consume it before being chased off. What doesn't get eaten by A is returned to the environment as a carcass, which may be decomposed or scavanged, whatever material isn't digested by A is returned as faeces. This is only one interaction between two species, there will be many more between both species and the environment.

All of this information is fed back into the next generation as changes to species populations, their compound reserves, and the environment - some of the data in the previous section.

Auto-evo
Finally we come to the question of mutations. Everything else about auto-evo is pretty irrelevant at this point - we've picked a species, possibly becuase of a mutation to another species, possibly at random; we may or may not also apply a completely random 'genetic drift' mutation - all we're worried about here is picking the best possible mutation given all the information we have.


  1. What we do is pick a set of traits in the genome, this may be small or may include all traits depending on how computationally intensive this all turns out to be.
  2. For each one we then increase and/or decrease it as far as our mutation budget allows(for some upgrades we simply can't afford, we stop here and move on to another trait). We also consider one genome where no mutation takes place.
  3. We then calculate the resulting phenome for each such possible change.
  4. We calculate the predicted population growth rate in the next generation for each phenome.
  5. Whichever change results in the greatest population growth provides the best fitness boost, so we choose that mutation. If all growth rates are negative, we choose the least negative. These population growth 'estimates' are calculated exactly as in the previous section, and include input from interactions with other species and the environment. Phenomes for other species are kept at that set at the last generation, so all species have the same information about eachother.


Steps 3 and 4 are the difficult bit. Wherever possible we need to find equations for these calculations, and I'm fairly confident that we can do this for most if not all situations. Where we can't, we resort to the mini-simulations discussed in the previous few posts, but that should be a last resort.

If your wondering, steps 2 and 5 are the hill climbing parts; in 2 you choose a few possible directions, then in 5 you find out which of those directions is uphill. I have just realised that this is a very naive hill climbing system, and we might be able to reduce the number of mutations we need to test drastically by choosing a better one (Nelder-Mead comes to mind). However, I need to think this over some more, and even if we can't I'm really not that worried.

At this point all that's left is to make the chosen changes to the genome and update the phenome. Once all mutations for this generation are done we calculate population growth rates for each species via standard population dynamics and update all the population levels, along with compound levels in species and those in the environment. The last step is to create any new meshes and animations needed, then go back to gameplay.

Summary
I'm not sure if there's much more to say. I've probably made a few mistakes here, it's gone 5am and I've been writing this since before midnight, so I'll try and clear up anything obvious tomorrow. I also mentioned at the start that I was far from ready to present this, so not everything is as well developed as I'd like.

I should also point out that while there are bits of this which would be difficult to program, theres nothing here which I couldn't program (and I'm definately not the best programmer here), and an aweful lot of it is similair to the sort of stuff I do every day, so it's certainly possible. I can provide much more detailed program flow and pseudo code when needed, but that really isn't a priority right now.

Again, a lot of whats been discussed here the past few days is similair to this. Also, of all the criticism the various ideas have recieved, the only truely valid one I can see is that this is really rather complicated. To that I can only say that I can't think of a simpler system which will produce similair or better results for a reasonable amount of computation (and thats not for lack of trying). Also, while the whole system is definately complex, the individual components are actually very simple, and even the ways they interact are fairly simple too.

A few points on computation
I run these sorts of simulations and computations almost daily, and I know we can run probably hundreds of thousands of them per second. Given the few complicating factors (these equations are a fair bit more complicated, they'll be running in c++ which is a lot faster than what I use, we need to run a game at the same time) I'm pretty confident that computation isn't going to be an issue, so long as we don't resort to too many mini-sims.

In addition to this, we won't be running this in anywhere near realtime. Auto-evo only needs to run on each location maybe once every 2 minutes, if that? Locations not observable by the player can be run even less frequently, and be done in the background while they're playing, so that only the observable location needs to be run while the player is in the editor.

The biggest computational workload to auto-evo will still be the generation of any new meshes or animations, and this only really needs to be done for the observable location. Other locations can have these generated as and when needed as the player moves around.



Finally, this wasn't supposed to be a rant, sorry if some of it came accross that way. What it's supposed to be is a summary of most of the relevant concepts we've discussed on various parts of this forum about auto evo and population dynamics. A lot of this was discussed and practically decided in the first 2 pages of this thread, I've just filled in the blanks from what I've been thinking about over the past several months.

tl;dr - I wasn't BSing.


Last edited by Seregon on Sat May 25, 2013 4:10 pm; edited 1 time in total
Back to top Go down
~sciocont
Overall Team Lead
~sciocont


Posts : 3406
Reputation : 138
Join date : 2010-07-06

Population dynamics - Page 3 Empty
PostSubject: Re: Population dynamics   Population dynamics - Page 3 EmptySat May 25, 2013 2:43 pm

That was probably the best post ever written here. I only have a few things to comment on.

Seregon wrote:
Whichever change results in the greatest population growth provides the best fitness boost, so we choose that mutation. If all growth rates are negative, we choose the least negative.
We don't even necessarily need to pick the best one. It makes no difference whether we do or not computing-wise, but I think after some testing we'll have to decide how efficient we want evolution to be, meaning how well it solves fitness problems. The efficiency of NPC auto-evo could even provide a sort of difficulty level for the player.
Seregon wrote:
Also, I really don't see the problem if it gets stuck. If the system finds a very effective genome (e.g.: a shark), why should that species survive unchanged for a very long time? The problem is if every species does that, and we end up with a static ecosystem, but given that this would require the environment to be static too, it shouldn't really happen.
I absolutely agree.
Quote :
In addition to this, we won't be running this in anywhere near realtime. Auto-evo only needs to run on each location maybe once every 2 minutes, if that?
From past discussion, I believe we were thinking of anywhere from 10 to 30 minutes for a generation, I'll have to find the thread, we were discussing in-game time. Here it is.
Back to top Go down
Seregon
Regular



Posts : 263
Reputation : 37
Join date : 2011-08-10
Location : UK

Population dynamics - Page 3 Empty
PostSubject: Re: Population dynamics   Population dynamics - Page 3 EmptySat May 25, 2013 4:20 pm

Thanks scio, I agree on your points too - there's no nead for auto-evo to choose the best possible mutation, but having the option to is a good starting point for tweaking. Linking efficiency to difficulty might be interesting too...

I think I confused the auto-evo generation length with the population dynamics step length. Having auto-evo happen less often is even better computation wise, anything over 2 minutes is doable, 10-30 minutes is plenty. We'll probably want to update population dynamics and compound levels more often, maybe twice a minute, but computationally that's much cheaper than an auto-evo step. Also, I'm not sure I've ever seen that thread, will have to have a look over it.
Back to top Go down
hypoxanthine
Newcomer
hypoxanthine


Posts : 25
Reputation : 0
Join date : 2013-05-21
Age : 29

Population dynamics - Page 3 Empty
PostSubject: Re: Population dynamics   Population dynamics - Page 3 EmptySat May 25, 2013 6:03 pm

Well, OP delivered.

blown away, everything explained. definitely one of the most informative posts on this forum, (if any are more informative they are also by you too i think). using population growth immediately afterwards looks like the most true-to-life measure of fitness, i like that. my only confusion is about the mutation budget. im sorry if this has already been in another thread, but would this just be the number of mutation/hill-climbing/whatever optimization algorithm iterations allowed for a creature to attain its maximum fitness before the algorithm cuts out?

Back to top Go down
Seregon
Regular



Posts : 263
Reputation : 37
Join date : 2011-08-10
Location : UK

Population dynamics - Page 3 Empty
PostSubject: Re: Population dynamics   Population dynamics - Page 3 EmptySat May 25, 2013 7:17 pm

Mutation points are being discussed here.

The way they're spent is that each mutation has an associated cost. What exactly this will be hasn't been decided, but it will be something like:
- 1 MP gets you an x% increase in your overall metabolic rate
- you can add a new organelle/limb for 50 MP
- upgrading your mitochondion organelle to level 2 (if we have levels) costs 5MP

So depending on the MP available, you may be able to upgrade some traits more than others, which should be taken into account when chosing what to mutate.

The number of iterations auto-evo goes through when decided a mutation will either be set/balanced by us, or controlled by the code in an effort to keep computational expense reasonable, it probably won't be influenced by any ingame value.
Back to top Go down
Karthas077
Newcomer



Posts : 6
Reputation : 1
Join date : 2013-12-04

Population dynamics - Page 3 Empty
PostSubject: Re: Population dynamics   Population dynamics - Page 3 EmptyWed Dec 04, 2013 4:23 pm

Going back to the topic of actual population dynamics, I have a question for Seregon: is there a particular reason you're using the Lotka - Volterra predator prey model?

They're only accurate if you have good α or β values. Further, it looks like you either made a mistake or over-simplified your equations.

(For clarity I'm going to use your variables)

You said, "(x * y) is the encounter rate between the species, i.e.: how many times (per year) you can expect two individuals to meet. 'a' is the efficiency with which these predations are converted into more predator population"

However in the traditional Lotka-Volterra model, entire term "(a*x*y)" is the rate at which the predators kill prey. The variable a is set to quantify not only the relative frequency of meeting but also the rate of success of predation events. It's units are 'predator kills per predator per prey'.


Returning to my actual question, determining a good 'a' value to model the rate of predator kills is not a simple matter. Much of it is done through experimental analysis, something which can't be done for the dynamic predators and prey of Thrive.

After spending a few minutes slogging through my browser history, I found an article I read about modeling predator prey interactions off of collision theory. It claims to be more robust than Lotka-Volterra (In fact the article specifically mentions the 'shortcomings' of Lotka-Volterra as it pertains to more complex predator prey relationships.)

In it, it gives a series of relatively simple equations that model prey survival as a function of time using the size of the shared habitat, the movement patterns of both predator and prey, the speed at which both predator and prey move, and the "predator prey encounter distance" (A value that could easily be determined based on the camouflage and size of the prey as well as the evolved perception of the predator (smell, vision, etc.)).

The study seems to be well documented and supported by not only it's data but by sound mathematics grounded in Kinetics.


scoicont said you were working on a PhD in theoretical ecology, so forgive me if I'm just extremely naive, but your explanations did not line up with what I remember learning, and upon in depth study of the wiki article that /you/ linked to, I am unable to find cohesion between what the article describes and what you try to explain in your early post.

PS: I tried to link the article, but I'm too new here so just Google "Mean free-path length theory of predator–prey interactions". It's kind of a dense read, but if I managed to make any sense of it, you shouldn't have a ton of trouble.

EDIT by Seregon, a link to the paper


Last edited by Seregon on Wed Dec 04, 2013 5:11 pm; edited 1 time in total (Reason for editing : added link)
Back to top Go down
Seregon
Regular



Posts : 263
Reputation : 37
Join date : 2011-08-10
Location : UK

Population dynamics - Page 3 Empty
PostSubject: Re: Population dynamics   Population dynamics - Page 3 EmptyWed Dec 04, 2013 5:14 pm

Hi Karthas, and welcome to the team.  I'm afraid I was in a bit of a rush when I wrote some of the earlier posts in this thread (I was eager to move onto developing the models for use in Thrive).  As a result, my explanations of Lotka-Volterra were from memory, and may have been a little inaccurate.  All I had really intended was to use that model as a very basic example of a two species population model, with the simplest possible interactions (birth, death and predation).  I should also admit that at the time I didn't actually read the wiki article I linked.

As you say, Lotka-Volterra is far too simplistic for our needs, and what I meant when I said 'a few modifications beyond the classical Lotka-Volterra model' was not to simply calculate a & b, but expand them to account for all the factors which influence birth and death rates, such that the population growth rates for each species are the sum of many different factors.

Your explanation of predation rate is a good example of one such factor.  I had actually developed a similar model last year, but never got round to posting it (I will definitely check out the article you linked though, as having a published model to go off is good) accounting for predator and prey densities, detection ranges, chase speeds and stamina, though I hadn't managed to incorporate movement behaviours.

Also a note on encounter rates.  When x and y are variables representing the density of individuals of a species, then x * y is a good first estimate of the rate of encounters between individuals of different species, assuming that individuals are uniformly distributed, move randomly, and detect each other within an area A such that (x = x' * A) is the relationship between the number of individuals (x') of a species and their calculated density (x).  That's a few assumptions which aren't realistic, and models like the one you linked attempt to relax those assumptions.

That's, unfortunately, all I have time for right now.  If your not satisfied with this reply, or you have any more issues with anything in this thread, I would be very happy to discuss it further.  I will be rather busy for the next week though, and thought it was better to post a quick reply now, than make you wait that long for a detailed one.
Back to top Go down
Karthas077
Newcomer



Posts : 6
Reputation : 1
Join date : 2013-12-04

Population dynamics - Page 3 Empty
PostSubject: Re: Population dynamics   Population dynamics - Page 3 EmptyWed Dec 04, 2013 5:52 pm

Thank you for the quick response. I'd be interested in discussing this with you more further, as I'm in the process of coding an abstracted population simulation, and while I've begun implementing the functions I mentioned earlier, I'd prefer it if they more closely related to what was going into the game.
Back to top Go down
Seregon
Regular



Posts : 263
Reputation : 37
Join date : 2011-08-10
Location : UK

Population dynamics - Page 3 Empty
PostSubject: Re: Population dynamics   Population dynamics - Page 3 EmptyWed Dec 04, 2013 6:09 pm

I'll be checking on this thread when I can, so if you go ahead an post what you have already, and what your working on, I'll get back to you when I have some time. I may split this off into a new thread if needed too.

After next week I'll either have a lot more free time, or none at all, but I'll try to make some time then to go over all the work I did on this last year, and get some more of it written up for you.
Back to top Go down
{~}
Newcomer



Posts : 5
Reputation : 0
Join date : 2014-08-24

Population dynamics - Page 3 Empty
PostSubject: Re: Population dynamics   Population dynamics - Page 3 EmptyFri Oct 17, 2014 1:18 am

This is a prototype formula for Encounter rate:

The encounter rate of two distinct species of mobile organisms in a section of a biome for which: n= the volume of the space around an organism such that it encounters to organisms of the other species in that space, and v=the volume of the section of the ecosystem, and p[1] is the population distribution of the first species of organism, and p[2] is the population distribution of the second species of organism, r[1]=The distance that a member of species 1 roams during the time interval, r[2]=The distance that a member of species 2 roams during the time interval is:

Is
(p[1]p[2]n^(2/3))(r[1]+r[2])
v

camouflage and sensory organs could determine what n is. p[1] and p[2] and r[1] and r[2] would be evolve-able behaviors of species 1 and species 2.
Back to top Go down
tjwhale
Theorist
tjwhale


Posts : 87
Reputation : 26
Join date : 2014-09-07

Population dynamics - Page 3 Empty
PostSubject: Re: Population dynamics   Population dynamics - Page 3 EmptyFri Oct 17, 2014 5:20 am

{~} wrote:
This is a prototype formula for Encounter rate:

The encounter rate of two distinct species of mobile organisms in a section of a biome for which: n= the volume of the space around an organism such that it encounters to organisms of the other species in that space, and v=the volume of the section of the ecosystem, and p[1] is the population distribution of the first species of organism, and p[2] is the population distribution of the second species of organism, r[1]=The distance that a member of species 1 roams during the time interval,  r[2]=The distance that a member of species 2 roams during the time interval is:

Is
(p[1]p[2]n^(2/3))(r[1]+r[2])
v

camouflage and sensory organs could determine what n is. p[1] and p[2] and r[1] and r[2] would be evolve-able behaviors of species 1 and species 2.

Nice formula, is it from a book or is it your own? It seems reasonable on first glance.

Seregon's got a big post coming about the compound system / population dynamics and we are getting to the point where we need to think about predation.

Other interesting questions include

1) How do you model fighting? We need to know what percentage of these encounters are successful.

2) How do you model the amount of compounds transferred per successful encounter? Is it a simple parameter or does it depend on the prey in some way? Can I make my species "hard to eat" in the hopes of starving my predators.

3) How is this limited? For example it isn't possible for one lion to eat 100,000 gazelles in one day, even if the equations say it should, how do you limit how many it can eat? maybe take a function of your formula above.

Anyway some of these questions will be hard to consider until you see Seregon's post (he's got some good stuff and it may take a while) and you can see how things are structured. Keep thinking about it! All ideas welcome.
Back to top Go down
{~}
Newcomer



Posts : 5
Reputation : 0
Join date : 2014-08-24

Population dynamics - Page 3 Empty
PostSubject: Re: Population dynamics   Population dynamics - Page 3 EmptySat Oct 18, 2014 9:34 am

yes, It is my own formula.

1) I don't know that yet. This is about your question: https://thrivegame.canadaboard.net/t156-hunting-and-fighting.

2) Predators can eat some tissues more effectively than other tissues, so we should list their efficiencies separately.
Example:
Predator 1
Efficiency for bone: 0
Efficiency for ligaments: 0
Efficiency for fat: .5
Efficiency for muscle: .75
Predator 1 wouldn’t get any nutrients from bone or ligaments. Predator 1 would only get half of the nutrients in the fat of its prey. Predator 1 would get three fourths of the nutrients in the fat of its prey.
This predator would starve if its prey is mostly bone and ligaments.

3) I thought that predators wouldn't hunt again right after they hunted (they are too tired or they are too full, but I didn't yet put this in a formula.




Back to top Go down
tjwhale
Theorist
tjwhale


Posts : 87
Reputation : 26
Join date : 2014-09-07

Population dynamics - Page 3 Empty
PostSubject: Re: Population dynamics   Population dynamics - Page 3 EmptySat Oct 18, 2014 11:45 am



Have a look at Functional Response on wikipedia. I think this is probably a good way of modelling predator satiation.
Back to top Go down
moopli
Developer
moopli


Posts : 318
Reputation : 56
Join date : 2013-09-30
Age : 29
Location : hanging from the chandelier

Population dynamics - Page 3 Empty
PostSubject: Re: Population dynamics   Population dynamics - Page 3 EmptySat Oct 18, 2014 2:02 pm

That's perfect -- feed in the encounter equation to a functional response equation and we get the frequency of feeding attempts. Next step is to figure out whether an attempt is successful, and I'm currently approaching that case-by-case.

Stealth (ie, stealthy predators catching victims unawares), I assume, we can model the same way we'd find the encounter volume n. Not a solved problem, but we avoid adding new parameters at least.

I'm currently trying to model the dynamics of a chase; trying to figure out what variables affect a successful catch. Not much luck yet getting sims to spit out anything I can make a suitable equation for.

Fights are a whole 'nother ball game, of course.

{~} wrote:
This is about your question: https://thrivegame.canadaboard.net/t156-hunting-and-fighting
Not in the slightest, actually -- this is about controlling the player creature, and even on that barely came up with anything of consequence.


EDIT: Some more details on my simulation:

  • Predator and prey start close to one another, if they're ever within a small enough distance of each other the trial is a success.
  • Their paths are based on fBm, with prey tending to run straight away from predator, and predator tending to run straight to prey.
  • Predator and prey are described by 3 parameters each:
  • Speed: how fast they go
  • Twitchiness: for the prey, how likely it will change heading drastically
  • Lookahead: for the predator, how likely it will aim ahead of where the prey is going
  • Endurance: how far either is willing to run


Edit: Some thoughts on cooperation -- considering the way many cooperative hunters hunt, tiring out their prey by taking turns; it seems like cooperative hunting serves as an endurance multiplier, at least.

Edit: Added a max distance as a failure condition, now the results are much more interesting. Previously, a predator with more endurance than its prey would almost certainly succeed, even if the prey is faster. Now we reduce the endurance successes to cases where the predator is perceptive enough to track where the prey has gone (like a human hunter-gatherer would).
Back to top Go down
tjwhale
Theorist
tjwhale


Posts : 87
Reputation : 26
Join date : 2014-09-07

Population dynamics - Page 3 Empty
PostSubject: Re: Population dynamics   Population dynamics - Page 3 EmptySun Oct 19, 2014 10:15 am

moopli wrote:
Fights are a whole 'nother ball game, of course.

One idea I had for fighting is to make "fight" into a compound. I've talked to Seregon about it a bit but we didn't make any decisions (also we should get him involved with this kind of discussion as this really is his wheelhouse).

Basically your species burns energy (ATP, sugar, whatever it is) to make "fight" in the same way as it would for any other compound and then fight drains away over time. What this represents is the difference between a hedgehog and a cat. A hedgehog has a lot of defensive tools but very little "fight" (it will curl into a ball) but cats only have claws and teeth but loads of "fight" which lets them hunt very efficiently. What "fight" really costs you is just energy.

When you are calculating predation (and it looks like the compound system / pop dynamics will be heavily averaged over many encounters) the fight component is just the amount of tools your species has multiplied by how much "fight"it has in it's pool at that time.

"Movement" can work the same (you burn energy to make it as a compound, it drains away over time) (we could even have 2 types, sprint energy and sustainable travel) and even things like "intelligence" or your "lookahead" could be modelled like that.

Then auto-evo can adjust the amount of fight and movement you are making (maybe it's better to be a galapagos turtle than a bull, you save so much energy) and we can use those numbers in calculations of combat, chases etc.

But as I say Seregon is going to do a big post about where we've got on the compound system / population dynamics and when we can plug all this into that. It could be a while (as life is busy and it's a big post) and he is a brilliant guy and well worth waiting for!
Back to top Go down
Sponsored content





Population dynamics - Page 3 Empty
PostSubject: Re: Population dynamics   Population dynamics - Page 3 Empty

Back to top Go down
 
Population dynamics
Back to top 
Page 3 of 4Go to page : Previous  1, 2, 3, 4  Next
 Similar topics
-
» Population dynamics prototype
» Natural Population Growth Simulation/Prototype

Permissions in this forum:You cannot reply to topics in this forum
Thrive Game Development :: Development :: Design :: Evolution-
Jump to: