Updated AI Code

Here’s the latest Code. This is Jacks + Nicks + new AI..

morphemeap.zip

Doesn’t really concern anyone besides Igor. Although it is kinda cool if you wanna look. Hold down the ‘f’ key to see a new colour scheme, where the blue guys are fleeing, and the red guys are attacking. This is using a new fleeing evaluator. Atm for each animal it’s set randomly between 0 and 1, so some animals are mega courageous, others are mega cautious. Eventually though, they’ll learn/evolve appropriately. Until Igor gets the learning system going though, don’t expect much. :p

Anyway, the fleeing is determined by the ‘cautiousness’ value. Which ranges from 0 to 1.

I’ve also put in a flockSpeed value, which also ranges from 0 to 1. Hopefully, different animals will learn to flock at appropriate speeds.. determining how far away they like to explore before returning to food/water.

I’ve put in one other value, maxFoodTravel.. but this one is kinda experimental, and is too complicated to bother explaining.

Anyway, Igor.. I’ve done these 3, because they had to be calculated within the methods themselves. Everything else (when to eat? when to drink?) can be calculated outside, in the determineTarget() method. So when you go about making some sorta system of learning (maybe a genetic algorithm?) where these ‘learning variables’ are altered.. make sure to include the 3 I’ve already done.

I’ve put a whole lot of comments in there to try make my old, experimental, messy code easier to understand. You should be good, but if you’ve got any questions or wanna delve deeper into the methods, just lemme know.

Enjoy! 😀

~Ben

Leave a Reply

You must be logged in to post a comment.