Topic: Making wild animals reproducible
hessenfarmer |
Posted at: 2020-02-24, 15:35
I already thought I suggested that. I'll make my mind about a good testscenario in the meantime. Sorry for the complaints. Top Quote |
Nordfriese |
Posted at: 2020-02-24, 16:30
Did you? Sorry, must have overlooked it Compiler is running now. In the meantime I'd appreciate a list for each animal with
Top Quote |
JanO |
Posted at: 2020-02-24, 17:54
I think it might be easier (or more efficient) to not give each critter a list of what other critters it can consume, but solve this via numbers. Simply give each critter a number related to its size, rabbits are 1 and buffaloes are 10, same for carnivores. If a carnivore meets a herbivore, it can kill it, if h < c+1 (carnivores kill bigger herbivores from time to time, even if they don't eat them completely). Carnivores can kill other carnivores, if they are smaller. Maybe probability of preying can generally be calculated from the difference in size.
You know what? This could be further developed into a non-military warfare ability at least for barbarians. Is this desired? I mean, we talk about widelands being an economic simulation with only a little bit of soldiers... Edited: 2020-02-24, 18:48
Top Quote |
Nordfriese |
Posted at: 2020-02-24, 18:51
I have uploaded a branch now: https://github.com/Noordfrees/widelands/tree/clevercritters The parameters still need tweaking, after fifteen minutes the map is densely populated with carnivores. For now I hardcoded the prey scheme of every carnivore into the init.lua. I think I'll change it according to JanO's suggestion P.S. I don't strictly separate carnivores and herbivores – it is perfectly legal to create an omnivore that eats fields as well as animals. Only carnivores that like to eat their own species are forbidden (though this is not a coding necessity…). IMHO it should also be allowed for carnivores to eat much bigger animals though with a very low success rate (perhaps make the probability a 1/(x+m) function shifted so that smaller animals are much more likely?) Top Quote |
JanO |
Posted at: 2020-02-24, 19:16
Good you mention the omnivores yourself - otherwise I had brought them up later Top Quote |
Nordfriese |
Posted at: 2020-02-24, 19:35
Okay, so I summarize the model:
This would be more difficult, I'd prefer to keep this implementation lightweight
Will do so. What exactly should this dependence be – carnivores like crowds, herbivores like solitude, omnivores unaffected?
Yes. I'm not 100% sure if this will work as I intend but I'll try
I don't really understand, could you explain? Edited: 2020-02-24, 19:38
Top Quote |
JanO |
Posted at: 2020-02-24, 20:36
Nice
We must be careful here, I guess. Imagine a couple of Ps on the field. Maybe they should ally up as well. Also if two carnivore species show up on one field (imagine lions and hyenas), what happens? Suggestion: As long as there are any Ps, all Cs ally up (species independent, if your current implementation handles that without problems, otherwise the function might be triggered by each carnivore species after each other). If there is no herbivore on the field, carnivores start fighting (should have lower probability to kill each other)
That's ok. As you observed, your first implementations seems to favour carnivores anyway.
I thought the other way round Think of sheep, cows, antilopes, horses... and of almost any other carnivore except lions, hyenas or wolves.
Consider making it size-dependent, too, please
Sure Edited: 2020-02-24, 20:39
Top Quote |
Nordfriese |
Posted at: 2020-02-24, 21:14
I like this idea a lot, but this would be a significant impact on game mechanics and might mess up tribe balance which would have to be carefully checked…
Carnivores are defined as
they don't – their selection range is currently hardcoded as
Okay, can be implemented easily For the hunting success chance, I implemented a sigmoid curve now. If the combined strength of all animals is equal to the prey's size, the success rate is 50%. If the difference between combined strength and prey size is at least preysize², the chance is 100%. For all other values from -preysize² to max it is interpolated sigmoid with the following completely intuitive and not at all performance-hungry (the latter I'm testing currently… – EDIT: yes, it really has no measurable impact on performance ) function:
which produces pretty reasonable chances:
Wow, you really thought this through Will implement as you said, except that species-dependent behaviour would be overkill imho. Let's have only the three classes herbivores, carnivores, and others.
If it works, this will be easy then Edited: 2020-02-24, 21:15
Top Quote |
Nordfriese |
Posted at: 2020-02-24, 21:22
The birth control system also needs an enhancement, after ten to fifteen minutes the map is getting very crowded… By the way here attached is the map I use for testing Top Quote |
Nordfriese |
Posted at: 2020-02-24, 21:24
FYI Edited: 2020-02-24, 21:27
Top Quote |