some ideas on projecto

Hey all,

First: Here’s the latest version of the ecosystem: It’s With evolution now.

This is a list of what seem to be the main areas of work for our project, and possible ways that we could go about doing them. These are just my ideas of what we can do, and there’s much more that needs to be discussed.- so if you think of anything else that we need, or a better way to go about something – write it up. Also, when we get around to splitting up the workload next week… have a think of what you’d be most interested in doing. Maybe once we establish the main fields of work, we could create a separate thread for each topic, so whenever someone has an idea, they can post it up in the relevant section. Anyway, on we go:

SHORT VERSION!

Random Map Generator: Creates a random map, with water, grass, elevation, rain, etc…

Animal Generator: Create animals with unique genes and body, based on the letter inputs and selected values.

Genetic Evaluation System: Allows animals to interact, reproduce, evolve, and evaluates sleep, food etc..

AI Strategy Algorithm: Uses a neural network to determine where the animal should move to survive.

AI Movement Algorithm: Uses a genetic algorithm to learn the most effective way to physically move its limbs.

Physics Engine: Physically moves the animal based on its movement algorithm and the terrain it’s in.

Rendering/GUI: Renders everything with a sweet visual style and provides a GUI with playing options.

The way I see this working is you open up the program, you set your play options, and you press play. A new map is generated based on some letters that you type/copy in. New species are also generated based on what inputs you give it.

Then, at any point, you can create a new animal by typing in some letters to determine the body structure, and dragging value sliders to determine factors such as, warm blooded/cold blooded, or fast in water/fast on land. The animal generator then looks at your animal requirements (eg: herbivore vs carnivore) and it looks at your letters.. and it creates a body for you that it thinks will suit your specified needs.

This animal then gets placed into the world, and can start interacting with its environment. It will soon be able to reproduce with other animals of the same species, and its children will be ever so slightly different – thus allowing for evolution. As time goes on, it will gradually get hungry and thirsty, so the AI will have to kick in and decide where to go.

The first AI will decide where this creature goes, based on the creatures needs. Hungry? Go to food. Feeling healthy? Maybe try make love. Its goal is to survive and replicate. That is how the animal wins the game – living long enough to make babies. Over time, the AI will learn where to go.

Once the first AI decides where to go, the next AI must determine how to get there. It must learn – though trial and error – the best way to move its body so that it can move along the ground, or swim through the water.

The physics engine will determine the success of this AI’s attempts, as this here is where all the body mechanics, vector forces, friction, momentum gravity etc, will take place. It will do its calculations, and determine a new position for the animal to be in.

Finally, all of this can be rendered with a whole bunch of lovely looking, impressive graphics. The user will also have the option to pause time, fast forward, scroll around the place, zoom, etc… The finished product will be a sweet virtual world that can be appreciated on every level. Be it frame by frame, watching the creatures learning to walk and interacting with each other, or in mega fast forward – where entire species evolve to adapt to their ever changing environment. Sweet sweetness.
LONNNNNG VERSION! In a good way.

Random Map Generator (creating the environment): Input: Strings of characters from a website, keyboard, or maybe just a randomly generated bunch of letters.

Process: An algorithm that uses this data to create an elevation map that has water, grass, trees, mountain ranges etc… We could go a step further by thinking more longterm, and include rainfall, seasons, a day-night cycle, water levels, temperature, cloud motion, etc… this wouldn’t be too difficult, considering that I’ve got it in my program already. Basically, the more complexity we can add, the better. We don’t want to go overboard, and we shouldn’t waste time we could put into other areas – but the more complex our environment, the better. The more factors that the AI has to consider, the more impressive its decision will be. There’s nothing impressive about a cow eating grass & water all day, every day, for its whole life. But it IS impressive seeing packs of animals migrating across vast mountain ranges, due to the long lasting drought brought on by the change in seasons.

Output: An object that contains all the data above that constantly updates itself. One idea I had on the way home today was that we create a massive grid of squares (or better yet, hexagons) and save them into a massive array. We’d assign to each square a height value and a texture. Example: 12m above water level, grass texture. The animals can then quickly access the relevant terrain that it’s standing on through a simple equation using it’s current x & y coordinates. Another way we could go about doing this is the circle method I’m using in the ecosystem program now. We shouldn’t though, because it’s shit. 🙂 The problem is that it looks crappy, and it’s harder to access data. At the moment, each animal has to scan through every water/grass object to see if it’s standing on it. If we had a grid of squares though, you wouldn’t need any complex for-loop.. just a simple equation.

Having elevation would be really cool, because we could have rains increasing the water levels, and consequently, have these rising water levels flood into new areas and create rivers and stuff. If we wanted to go a little over the top.. we could even add in erosion. That’d be sweet, because you’d get a dynamic map that changed over time due to the rain fall. It wouldn’t be hard to do either.

Animal Generator (creating the animal):

Input: A bunch of letters from a keyboard / text document. Maybe some specifically selected values chosen with a sliding bar by the user (such as attack/stamina, or herbivore/carnivore). This is a cool idea, because people can play the game, typing in combinations of letters and numbers, and try and figure out what combinations will produce what kind of animals. This gives the player a chance to show off their skills in pattern recognition and whatnot, allowing them to try create the most bad-arse carnivore possible; or perhaps the smallest, most ninjaesque, food efficient herbivore.

Process: An algorithm that takes the input string and creates a muscle/skeletal structure using the letters. One thing we’re going to have to decide is if the skeletal structure should be fixed or not. As in, can an animal rearrange itself? Or must it learn to adapt to the body that it’s been given. Also, will the animal start with a random skeletal arrangement, or will it be specifically generated? Personally I think it’d be better if it was generated to suit the needs specified by the user (speed, omnivore), and then fixed. The reasons for this are:

It places more of a challenge on the movement AI, as it must not only learn to adapt to its environment, but also to its own body, rather than having the ability to change it.

It places a greater importance on the processes of reproduction and evolution within our ecosystem – as in, only when a new baby is formed through crossover & mutation can its structure be reorganised. This would be cool because we’d get to see that this animal’s descendants adapting to their environment through natural selection.

Also, it’s more realistic if it’s fixed – animals in the real world can’t relocate the position of their limbs, they must learn how to use them instead. Of course, text monsters don’t exist in the real world, either.

Finally, and most importantly – it will speed up the game. If all this section does is randomly chuck the letters together, there’s a pretty high chance that the animals won’t work at all, and that they’ll look like crap. The animal’s movement AI will then have to learn how to start walking with a poorly designed body, and probably won’t get anywhere until it’s rearranged its body in a way that makes sense. This will take time, and if the animal hasn’t already died of starvation by the time it’s finally made itself a leg to move with – the person who created the animal will have probably walked off out of boredom. Furthermore, people who create new animals would probably be more pleased to see a creature that looks like it’s already got legs or a tail.

If, on the other hand, we create a complex algorithm that creates creatures based on the user inputs, then the AI’s learning process should be much faster, as it’ll have a well designed body to work with. Someone who says they want a creature with a waterSpeed of 0.9 & a landSpeed of 0.1 might get a creature that strings all the letters together into one long line, like an eel or a snake – whereas they might’ve got a creature with legs and arms had they put in different requirements.

Of course… we could always make an algorithm that generates a well designed starting body, and then ALSO give the animal the ability to modify itself as well. This might be a nice way to go, however I still think it’d be better to leave the structural mutation up to the evolution algorithm. Let everyone know what you think about this one, because it’ll play a largish role on how the game turns out. I don’t mind too much if the animal can change itself mid-game, there are pros and cons for both – but I certainly think that we’ll need an algorithm to give the animal a nice starting body. And this algorithm will have to be pretty complex to do this, and will need a lot of work.

Output: A new animal object with its own skeletal structure (hopefully well designed) and set of genes & attributes to be used by the other parts of the program.

Genetic Evaluation System (the interaction between the animals, the environment, and each other):

Input: Information about the animals, and about their position in the map

Process: This part is sort of like what I’ve got so far. It’ll be where the animals interact. It’ll have the evaluation bars for health / food / water / sleep / sex for each animal. It’ll have the location of each animal, and it’ll update their evaluation states. Currently, all the bars keep getting worse (except injury, which regenerates), and they get better when the animal is standing on food / water / resting, whatever… The animals also have a sex bar which goes up (and impregnates the female when it reaches the top) provided that they’re with someone of the same species. Your species is determined by the difference between the two animal’s genes. If all the genes are close enough (determined by a variable I’ve called speciesThreshold), then you can mate.

Eg: If two animals meet with genes A(0.45, 0.72, 0.01) & B(0.43, 0.71, 0.04), and the speciesThreshold is 0.05, then they can mate. If you set the speciesThreshold to 0.02 however, they can’t mate because the third genes are 0.03 apart.

Anyway, this process allows for a species to evolve and split up. Through crossover and mutation, some animals that may have had the same grandparents may no longer be able to mate, as they have become genetically incompatible through mutation. This is how evolution works in the real world, so I think it’s a good way to do things. This will have to be modified however, to include the animal’s structural data, which includes the letters and their arrangement.

Hopefully we’ll get to see really cool stuff happening here, like two creatures mating, the female gives birth a few hours/months later, and the new child is some sort of combination between the two, or perhaps has mutated slightly into a new design.

Output: Information that the various AI’s have access to – such as map position, elevation, each animals needs, and the things that the animal is allowed to know (what’s within its line of sight, for example)

AI Strategy Algorithm (deciding WHERE the animal moves):

Input: The animal’s needs and its surrounding environment. We’re going to have to decide what information the animals have access to. The player will also have an input here with the mouse/keyboard and will be able to override the AI’s decision if they want. We should make sure that the human and the AI have access to the same information, and only the same information. So if we give the human player a fog of war, then we must also limit the inputs provided to the AI to the surrounding area, as well.

As far as the evaluation bars go, I think that an animal should know how hungry it is – but it shouldn’t know WHAT kinds of food they need to eat. You are born with a feeling for hunger, but not the knowledge for what foods will satisfy that hunger (disregarding instincts). I think this should have to be learnt by both the human player and the AI, through trial/error or observation.

Furthermore, how much information can we access about the other animals? Can you tell how injured they are? Perhaps. You might be able to see them bleeding/limping. But can you tell how hungry they are? Probably not.

Process: A system that uses the inputs and some sort of memory to determine where to go. I’m assuming that a neural network will be best for this, but not knowing much about it yet I have no real thoughts on the topic. The goal of the AI will be to keep its body alive, of course, along with trying to reproduce.

Maybe this will be how you win the game – survive as long as possible and have as many kids as you can. If you want to compete with the AI, you would manually move the mouse and deciding where to go. If you were competing with other people (such as at the exhibition), you’d simply type in your string ‘poocow’, leave the strategy to the AI, and see if your creature lives longer than someone else’s. Not much skill, but still worth a laugh. Or.. I guess if you really had a lot of spare time on your hands, you could set the game up over a LAN and go head to head – typing in a bunch of letters AND moving the mouse around! What a night!

Output: A simple x & y coordinate, which would be the target for the animal to move towards. And maybe a few commands too, like ‘attack’ or ‘rest’ if we decide they’re necessary.

AI Movement Algorithm (deciding HOW the animal moves):

Input: The animal’s target destination, the terrain the animal is walking along, the animal’s letter structure, and perhaps some other variables, like how tired the animal is.

Process: The other AI decided where to walk… this AI decides how to get there. It’s the algorithm that develops the motion of the animal. I guess it’ll be a genetic algorithm, and will constantly try to improve itself through trial and error. It will have a memory for both walking & swimming, so if the input terrain is water, it’ll switch to swimming mode, and if it’s land, it’ll switch to walking/crawling mode. We might even get so complex as to include elevation data and whatnot, so that if the map is really rocky & steep, it might even develop a climbing mode (this might depend on if we approach it with a top view or side view). It could also take into account the tiredness value of the animal, and that will determine the rate at which it can move it’s letters about the place.

Output: A bunch of muscle/spring contractions for the animal’s structure, based on what the genetic algorithm has learnt so far.

Physics Engine (moving the animal):

Input: The terrain where the animal is standing, along with the animal’s current structural position, status, and motion.

Process: Here’s where the animal will actually interact with the terrain. If the animal is in water, it’ll be like Rob’s water vortex thing. If on land, it’ll be something that we make for land. If we go side on, it’ll have to have gravity and stuff. If we go top down, it might have to have friction points which can pull the animal along the ground, like a crab. Anyway, this is where the calculations will take place. There might be quite a bit of work here to figure out a nice land-based motion system.

Output: A new x & y coordinate for the animal, along with it’s updated structural position.

Rendering/GUI (the finished project):

Input: Everything that needs to be rendered, mouse & keyboard stuff

Process: It’d be really cool if our whole project was wrapped up with a really nice artistic style. Not only would we have all these great systems running in the background, but we’d have something nice to look at, as well. It’d be the icing on the cake. We might want to have nice rain effects whenever it’s raining, little splashes in the water, beautiful blood splatter whenever something gets killed, etc… We could have a really sweet looking map with all sorts of nice procedural textures, or even textures generated by the character inputs. Imagine Yonas’s thing.. but better! Of course, maybe we could go a completely different style and have everything made out of letters, including the environment. Either way, it’d be good if it had a really solid visual style. It’ll have to be really optimised, however, because we’ll want most of the computer power to go towards all the other stuff going on in the background.

We’ll also want to have a menu/GUI thing going as well. This GUI should allow the user to input new strings of data, but it should also have scrolling/zooming/fastfowarding, etc… also, on the menu screen we might want to have the ability to turn on/off some of the functions above. The proper version will use everything, of course.. but if someone wanted to, they could disable certain aspects to allow other aspects to run faster. If they just wanted to watch an animal learn how to walk, they might disable all the map updates, evolution stuff, health bars, etc.. and just leave the physics engine and the movement AI on. Or.. someone might just want to see their species evolve over time, in which case they may turn off the physics engine and the movment AI.. and leave on the genetics/map updates, etc.. anyway, there’s quite a bit of work here to wrap the whole thing up, I think.

Output: The sexiest project in all the land.

All done!

Ben.

4 Responses to “some ideas on projecto”

  1. rob says:

    Wow! There’s a lot of stuff in there Ben!!! Nice work thinking this through.

    Regarding the Animal Generator: You might want to use letters to create the initial bodies and then have evolution adapt them during the game by changing the structural attributes of the letters, rather than the arrangement, e.g., have evolution change the lengths of the building blocks from which the letters are composed, distorting the letter shapes in the process. You might also want to think about whether each letter could come with some sort of specialiased controller that would allow a Genetic Algorithm or Neural Network learn how to use the letter more quickly, e.g., a letter ‘E’ used as legs might be configured as a set of masses and springs that have been configured to move in a leg-like way when given a input signal (e.g., a sine wave) the job of the GA/NN would be to learn the correct input signal to achieve the type of motion that is necessary for the creature that it is part of. This should be simpler than trying to learn how to control all of the individual elements of all of the letters at once.

  2. Jack says:

    Hey Ben, maybe you can edit this entry to make the font size the same as the rest of the blog, so it doesn’t seem as overwhelming to read.

    And great job thinking it through.

  3. Jack says:

    also, it would nice to use the “split post with more” feature.

  4. Igor says:

    Done and done.

Leave a Reply

You must be logged in to post a comment.