The project report is finished.
The drawing of the plants has been slightly advanced using a simple algorithm which uses lines to draw what looks like blades of grass which slowly sway. Thus greatly sped up the program and allow for a lot more plants to be drawn and it to still run smoothly. Up until now spheres had been being used and these take up a lot of computational power.
Reptiles can only eat plans within their own height range and there are two tarting populations of plants of two different heights. The reptiles all start with random heights, this is is on order to be able to see an evolution of reptiles to be able to eat plants of a certain height. This has not been tested properly and there is a new problem of now multiple invisible plants which kill the reptiles and in the end cause extinction. Biut tit has been tied up ready to hand in.
At the last minute the deadline was extended until the 8th of May so this will give time to do a little more testing, sort out these errors and proof read the report.
As was stated in the previous post in order for the program to work the reptiles population needed to be sustainable for a number of generations. There were many factors that could have been affecting this so a number of steps were taken.
A spreadsheet was made to get an overview of all of the variables and how they were working together, as in order to be have a population which could be sustained over a number of generations a balance needed to bed struck between the number of plants, the number of reptiles, the flow of energy and all the other affecting factors.
Firstly collision detection was implemented for the reptiles this simply involved overloading the function which detected collision with reptiles and took a plant node as an argument to take a reptile node as an argument. This would allow it to search through the reptile list and check for collision with every other reptile. The reptiles need to check that they are not looking at themselves when checking for collision as they are all in the same list.
It was found that one of the problems was the reptile population was not growing quick enough, this was partly because each reptile was currently only able to have one baby so it was made possible for them to breed a number of times in there lives with a gap after each time.
There were still errors remaining and this was now the main reason the population was growth was becoming stunted. There was the invisible plant which was trapping all the reptiles which was the main problem but also reptiles seemed to sometimes disappear . After much painstaking debugging it was found that some how the initialisation of the root of the plant list was no longer happening after the start population had been implemented. This was meaning it was not drawn with any size but had a position and this was what the reptiles were getting stuck on. The problem with them disappearing was that when a reptile went towards a plant of a different size than itself it would accelerate in the y direction and fly off, so when heading for food or mates the y part of the acceleration vector had to be zeroed.
With these errors fixed it just took some tweaking of the lifespans energy transfer etc… to get a population of reptiles which laste for a number of generations. The next task was to test some simple evolution and finish up the report for hand in.