More on the ecosystem idea:

Hey all,

I just added what I’ve done so far – it’s right here: VersionAA

This is a more recent version: ecothingAB

I’ve been thinking a bit more about the ecosystem idea. It seems good, it provides us with a lot of scope & freedom, and it would give us a great opportunity to code some really complex AI – but we didn’t really go into the specifics of it too much. So here are my thinkings on some of the more specific aspects of what we could do. They’re mostly just off the top of my head, so bear with me.. but if anything, this should help you come up with some ideas of your own.

The Questions (to drive our work):

“Can a human play as well as the AI?”

How to test the question:

We create a virtual world – our ecosystem. It has randomly generated terrain, and randomly generated species. By randomly generated species, I mean they have a random amount of hitpoints, and a random attack value, along with a random speed, and random needs, etc.. Within these species, there are of course individual animals. These animals can mate, and they can die. They are born into the world, and must learn how to survive. How do animals survive? Well, that’s where the evaluators come in – just like in a genetic algorithm. Animals need sleep, they need food, they need water.. we’ll create as many evaluators as we like (the more we make, the more complex the system). The idea is try to create enough realistic evaluators and environmental factors to create a fragile, yet sustainable ecosystem. Why do we want this? Because it provides a challenge to both the AI and to the player. The overall idea is that eventually, the AI will learn how to live – but when the player takes control of an animal, will the human be able to learn what to do? Will we know where to go? Will we get as good an evaluation as the AI will? That’s what we’re here to find out.

Anyway. Each animal will operate on a daily system. The day begins in the morning, say 6AM. If we were to make every frame equal a minute of time, then a full day will take 60*24, or 1440 frames. So doing this, the animal will have 1440 frames to live its day as efficiently as possible. At the end of the day, the animals performance that day will be evaluated, and through our brilliant AI coding, it will recognise patterns and hopefully improve itself so it performs better the next day. Then the cycle repeats itself. Each day, every 1440 frames, all the animals in our virtual ecosystem will compare their results to before, and ‘learn’ how to survive. (of course, if we run the simulation in the background/fastforward, it’ll be much faster than 1440 frames.. it’ll just be 1440 loops in a giant for-loop or something).

How is the animal evaluated?

Through its desires.. through its needs. An animal doesn’t necessarily know that it’s a herbivore, but it DOES know that it’s hungry. It is up to the animal/AI/human player to experiment and discover what satisfies its hunger. So far I’ve thought of 5 main evaluators. All of these evaluators are negative, so the idea is to get them as low as possible by the end of the day. A score of 0 in each category would be the perfect day:

Hunger

Thirst

Tiredness

Loneliness

Injuries

As you can see.. getting a 0 in each category is good. If you have 0 injuries, no hunger or thirst, no loneliness and no tiredness, you’re doing pretty damn well for yourself! Throughout the day, the values for these ratings will slowly increase. You naturally get hungry, and you naturally get more and more tired. The only exception is the injuries value, which will gradually decrease, this is due to your wounds slowly healing themselves. So while there are all these gradual changes going on, it’s up to the animal to bring all these values down as low as possible. While hunger gradually creeps up, it rapidly goes down when you eat.

So to cure hunger, you stand near some grass(if herbivore), or a dead animal (if carnivore).

To cure thirst, you stand near water.

To cure tiredness, you stand in your cave/shade (not quite sure about this one yet, we could just have a Boolean ‘sleep’ value, but it seems more elegant & simple if everything is done simply through your position.. so the AI only has to output an x & a y value. Of course, we can get more advanced than this if need by)

To cure loneliness, you stand near other members of your species. (this should be really cool, cause we’ll get flocking and packs, etc..)

Injuries naturally cure themselves.. however, what you must do for injuries is make sure that you don’t get killed by another animal. This isn’t going to be the easiest task, considering someone is always going to want to eat you.. or you’re going to want to eat others.. eitherway, you’ll be fighting and losing hitpoints. Obviously, a SMART animal will only hunt those animals that are weaker than them.. OR.. maybe they’ll get together with other members of their pack to gang up on a massive creature with heaps of food in it. Lots of exciting things could happen 😀

Then we can do stuff like, if any either injuries, hunger, or thirst reach maximum.. then you die. You’ve died of starvation or been killed. The higher your tiredness, the less attack you do, thus you’re worse at defending yourself/hunting, and thus you’ll suffer in both the injuries & the hunger categories. If you never come in contact with others.. like if you accidently get lost (I think we should use a fog of war), then while you won’t necessarily die.. you’ll become increasingly unhappy, you’ll never be able to produce offspring, and chances are you will die anyway, because you’ll be all alone. So anyway, there are many other things we can do… such as the need for sunlight/warmth, or the desire to protect your family… but those 5 should be fine for starters. The way I vision we’ll be keeping track of all this data is through a massive array of values (just like in a genetic algorithm).

So that there is the basic day by day model. You have 1440 frames (or whatever we decide), to satisfy all 5+ of your desires as well as possible. This means finding a way to get sufficient amounts of water, food, sleep, & social contact without getting yourself killed. Each day the AI will ‘learn’ a little bit more, through memory, trial & error, observation, and maybe even communication. Eventually, after enough generations, assuming the AI has not died yet, it should be able to survive, and it should know what to do. It should know that it’s better to go to the watering hole in the morning, rather than at night… because maybe there’s a pack of very aggressive animals that always come out late at night, and it must avoid them. The interesting thing would be to see if a human player can perform as well as the AI. How quickly do we learn? Would it be in our best interest to follow the pack, like a baby would do? Or are we humans smart enough to figure it out on our own. The thing is, we’ll start off not knowing what we are. No baby is taught what it needs to do to survive.. it only FEELS its desires. So the human player won’t be told that it’s a herbivore/carnivore… we’ll just see the rising hunger bar, and have to figure out what needs to be done. We might try go to the grassy field, but realize that it’s not doing anything because we’re a carnivore and need protein to satisfy our hunger. So then we head off to try and hunt something, but we won’t have any idea what animals we can kill, and what animals will kill us. There’ll be a lot of learning to do.. anyway, it might be quite interesting.

Now.. I know that’s a lot of writing.. but this isn’t really all that complicated. All of this is basically just a framework for us to work within. Once we got the initial system working (shouldn’t take too long to create a random map/species generator).. then we’ve basically got the rest of the semester to focus on the AI, and add new elements/evaluators, etc. However.. there are a few other cool things we could do:

Evolution:While this program would be focused on the day by day learning of the AI.. it wouldn’t be hard at all to create evolution. As animals are going to die on a daily basis anyway (as they get hunted, die of old age), we’re going to need to be creating new animals to replace them. It would not be difficult at all to create a 2nd genetic algorithm, that actually deals with.. well, genetics :D. This would simply combine the genes of the 2 mating animals, and produce a baby with crossover/mutation. In this way, we’ll see species evolving and adapting to their environment. If we created a large enough map, and had enough computer power/time.. we might even see new species forming out of old species, branching off from eachother. That’d be cool.

Weather Patterns/ Seasons:We could have our AI learning not only to adapt to weather on a daily basis.. but also have actual climate shifts. Not hard to do at all.. just every 365 generations is a new year. This could produce all sorts of interesting effects, such a flooding, bush fires, hell.. even bring on an iceage! Or tectonic shift if we wanna go hardcore. Eitherway.. that’s probably a little over the top, but still.. it goes to show how much scope we have with this. Remember.. the more complex the ecosystem.. the more fragile it is, and thus, the greater the challenge it is for the AI/human to survive. There’s no fun if the only evaluator you have is the desire to eat grass, and you just so happen to be a cow-like creature with no predators. All you’d have to do is stand in a meadow. But if you’ve got to satisfy all of your needs in order to survive, then not only is it more of a game for the player.. but it also provides us with a greater challenge to show off an experiment with a more robust and uber AI. We’ll also get to see awesome events, such as territorial battles, migration, etc..

Communication:I’ll stop soon.. but this is one more really interesting thing that we could do that relates to communication within species. All of our animals will have 2 strings of ‘DNA’.. one will be actual DNA, which doesn’t change, but gets used & mutates when reproducing. The other will represent what our animal has learnt. This one does change, but it doesn’t get passed on when reproducing. After each day, the AI will improve upon this code to get through its day better. This is knowledge. However, knowledge doesn’t get passed on through your genes, contrary to what people once thought hundreds of years ago. You have to learn knowledge. Now, as humans we can simply pick up a book and learn whatever we want, because we’ve got writing. But many animals can’t communicate as effectively as we can. The point I’m getting at is this: what if we were to create 2 species that were exactly the same. Same health, speed, attack. Same desire for food, sleep, sex. Same life expectancy, same pregnancy duration, etc.. the exact same DNA code. The only difference is; that we give one species the ability to communicate and share knowledge, and not the other. As in, while one species only passes on its DNA code, and the baby must learn everything from scratch – the other species passes on the DNA code AND the knowledge code, meaning the baby starts off right where it’s parents were, and keeps growing. What would happen? Would there be a difference in success between the two species? After 100 generations (note, not 1440 frame days.. actual baby making generations), would one species have a greater population than the other? It’d be very interesting..

Anyway, I’m stopping now. That’s basically how I vision a nice ecosystem to work. Factors in the environment will affect the desires/needs of our animals, and this will drive them to behave in a manner that most effectively satisfies their needs. Thus, they learn. How we go about making them learn is where the real challenge lies, and where I imagine the bulk of our work will go. Which is good.

The game will be playable, and hopefully challenging & fun. But if the user wants, they can entirely overlook the whole playing element, and view the program purely as a simulation. A simulation where not only do creatures observe, interact and learn day by day– but also migrate with the seasons, wage wars of territorial dominance, and given long enough, actually evolve to adapt to their ever-changing environment! Sweet sweetness.

Anyway, lemme know what you think. These are just a bunch of ideas, and I’ve got more specific things to talk about, but just let me know how you like it so far, or if it’s given you any ideas of your own.

Btw, I’ve started coding up a prototypish framework already, which I’ll put up soon, to give you an idea of what I mean.

Later dudes,

Ben

One Response to “More on the ecosystem idea:”

  1. Igor says:

    Also edited this one just to make everything neater/more organised.

Leave a Reply

You must be logged in to post a comment.