Wednesday 27 April 2011

Water at last

It took long enough but I managed to fix the line of sight code and get the obstacles working properly. Behaviour is a lot better and creature survival times increased, also fixed the bug that caused creatures to occasionally leave the world.

Added water and thirst, creatures now have two needs instead of one, works using linear logic, but is not realistic. Water locations are stationary, can cause problems depending on obstacle configuration, some set-ups much more survivable than others.

Next step improving the decision making algorithm to handle two needs.

Sunday 10 April 2011

Obstacles

Added obstacles to the world, this has had several effects. The creatures movement seems much more natural because the objects cause more changes of direction, the objects make it more difficult for creatures to survive by obscuring food from view.

There are problems caused by creatures becoming "stuck" inside an obstacle, rectifying this problem is the next step. This addition has taken much longer than originally planned and is beginning to set back other areas of the project, I am hopeful I will be able to fix this sooner rather than later.

Tuesday 29 March 2011

Progress Update

Tried the first attempt with one fuzzy rule, if food is near or hunger is hungry. unusual results: when left to run for an extended period, there are periods of up to a minuit where no creatures would consume food or die.

The reason for this bug was that creatures were eating any food which they moved close enough to which was resulting in them over-eating and getting negative hunger values and then not needing food, added a condition to stop creatures with negative hunger eating, looks much better.

Creature movement patterns appear much more random, next addition will be obstacles, to add line of sight problems when finding food and to help randomise their directions of movement even more.

Aiming to have this done by my progress meeting on Friday.

Tuesday 8 March 2011

V 1.0

The process of implementing the new class driven system is complete which means I can now begin work on some of the fuzzy inference systems which will be used to control when a creature will decide to go and find food.

This version of the code will also serve as V1.0 for the project and will be the beginning of the project version history.

Saturday 5 March 2011

1 step back, 2 steps forward

When I began the process of adding a fuzzy inference system to the basic world I created, I realised that without restructuring the code, implementation was going to get very confusing very fast.

So I am going to begin a new version which should be much more expandable and should allow me to progress faster through the remainder of the project. 

Tuesday 8 February 2011

Progress Update

The basic framework for the world has been implemented, creatures are able to find food and consume it. The code still needs a little bit of organisation and optimisation, but the first step is always daunting and it is good to have something implemented to work onwards from.

Next step: designing the artificial intelligence system

Wednesday 26 January 2011

Final Draft Proposal

Here is a copy of the final draft of my proposal:



Introduction:
Artificial systems which exhibit lifelike behaviors are worthy of investigation on their own rights, whether or not we think that the processes that they mimic have played a role in the development or mechanics of life as we know it to be. Such systems can help us expand our understanding of life as it could be. By allowing us to view the life that has evolved here on Earth in the larger context of possible life, we may begin to derive a truly general theoretical biology capable of making universal statements about life wherever it may be found and whatever it may be made of”. Langton, 1989

As today’s games industry pushes more and more towards realism and immersion within their games, the need for believable AI systems is greater than ever before. Recent advances in gaming hardware – separate GPUs and more powerful processors- allow for games to be rendered in full high definition quality and still have processing power to spare. Before these more powerful machines were commercially available AI was almost always added at the end of the development process and had to use the minimum computational resources. Now that the technology is avaialable, developers are able to include more complex AI techniques which increase the realism of any virtual scene (Bourg & Seemann, 2004). Even the immersion created by the most beautifully detailed scenery can be shattered by predictable or un-realistic AI.

This project aims to explore the possibilities of AI systems for use enhancing virtual worlds for computer games.


Motivation:

One feature of a good computer game is immersion; the drawing of the user into the game world. This immersion can be increased by believable graphics, captivating subject matter and compelling stories. Immersion is when a user playing a game becomes unaware that he is a user playing a game and becomes enthralled solely in the action. Poorly coded AI which exhibits simple or predictable behavior reminds the user that he is playing a game and reduces the immersion which reduces the enjoyment of the game.

Until recently it has not been possible to produce commercial games which contain both modern high quality graphics and complex AI systems due to the hardware restrictions of most home gaming systems. Recent advances in technology have allowed home gaming systems to be manufactured with the capability to render high definition graphics with processing time to spare. Now that these capabilities are available, there is a new area of games development where complex AI systems will be able to help build immersion in a game by displaying believable behavior.

The development of AI systems for games also provides development for AI systems that could be used across all fields of creating intelligent computers. The project goal is to create an Artificially intelligent system that can replicate lifelike wildlife behavior in a simulation. This AI system will pave the way for a whole new side to gaming, where a players character can grow alongside the world around him. Allowing for systems where the game becomes harder as the enemies you face evolve and become stronger in wholly un-predictable ways while you play.





Research Topic:
The first thing that must be established is a definition for the intelligence we are trying to mimic. Princeton define intelligence as "the ability to comprehend; to understand and profit from experience". So to be intelligent, any AI system must be able to evaluate its situation and using its past experience make an "informed" desision on its next action. Storing all the data required for every creature of the system to have a worth-while set of memories would be costly and could become un-managable.
However with AI systems in games the dictionary definition of "intelligence" is not the aim. The aim is to create the appearance of intelligence. This system requires the ability to make decisions in a way that appears to be realistic; in a way that mimics the intelligence we see in the world around us. Fuzzy techniques provide a much more varied set of results than if-then statements from the same simple inputs, and require less implementation than coding each if-then statement individually. The varied nature of the results produced by fuzzy logic processes mimics the randomness found in nature.
This branch of AI is also known as A-Life (artificial-life) and is focussed on creating algorithms and programs that aim to recreate the behavior seen in nature. A-life came about in 1987 when professor C. Langton called other scientists who shared his curiousity about A-life to a workshop, during the workshop the learned that linear systems are incapable of modelling the complex interactions of nature but non-linear models were needed. It became increasingly clear, that linear models simply could not describe natural phenomena.

Research question:

The research question, regarding this research topic, could be summarized thus:

Can a virtual world populated by varied, artificially intelligent, virtual creatures be simulated in real-time and display believable, life-like behavior?

The project results should show the merits and downfalls of different AI techniques when creating realistic wildlife behavior.


Project Methodology:

Research will be done into different AI techniques which could be used in the project. Research will also be conducted into past AI and A-life projects which have been undertaken. According to the research conducted so far fuzzy cognitive maps and flocking systems both could be used together to simulate natural life, further research will identify other techniques which could be added to improve the final system.

To test my hypothesis I will need to implement this AI system and observe its operation, noting factors such as populations and the generations of different species. Also the virtual creatures should behave in a pseudo-random manner; their behavior should not be predictable. If truly un-predictable behavior is achieved we should see varied results between tests, the more variation, the more un-predictable the system.

The decisions of the creatures will be evaluated using fuzzy cognitive maps to provide a realistic pseudo-random pattern of behavior. The fuzzy system will consider the situation of each individual within the simulation and make the appropriate decision based on the individuals motives and environment. Flocking systems will be used to gracefully group similar creatures together, if it is indeed in their nature to travel together.The creatures will need to reproduce, and the ultimate goal of the project would be to simulate sexual-selection to drive evolution. This coupled with an element of hereditary attribute passing should provide a basic model of evolution. To achieve this there has to be some scale of how attractive each potential mate is relative to how strong his genes are.

The implementation will be a two dimensional world rendered using openGL. The creatures will be displayed as simple primitives and text output will be used to monitor appropriate system variables. The world will include deposits of food and water which creatures will need to consume to survive, these will be regenerated periodically. These will be simply displayed as areas of green and blue respectively.

Gantt Chart:

Week:
1
2
3
4
5
6
7
8
9
10
11
12


























Creating 2D world
























Basic creature class
























Fuzzy logic system
























Flocking algorithms
























Different creatures
























Genetics system
























Testing
























Optimisation

























There is more than twelve weeks available for the project, however in anticipation of un-forseen setbacks this schedule leaves room for extra work that may be required during implementation.


Project Evaluation:

The project will be focused on the decisions made by the program and how quickly they can be made. The project will not employ high detail graphics or physics systems as these would reduce available resources and slow down the program. For this reason the graphics used will be simple and the whole scene will be two dimensional. To evaluate the project, statistics from testing the program will be analysed with regard to creature populations and the speed at which the program can run. The speed at which the program runs will be measured in frames per second.





Issues:

During the course of this project, there are potential problems which could arise. If they can be identified early it will make them easier to overcome or avoid altogether.

Using any combination of AI techniques which will use fuzzy logic means that the system will produce random results. Whilst this is the goal of the project, it means that the process of debugging during development becomes difficult as the results could be difficult to predict. This could make finding potential problems in the code much more difficult than when working with linear systems.

The two dimensional simulation may not be able to display enough detail to fully represent the interactions taking place, care will need to be taken to log all the necessary data during run time to fully understand the simulation. With enough data about the factors input into the fuzzy system it will be possible to check effectively if the program is operating correctly.


Resource Requirements:

The project will require the use of a modern computer with a software development environment i.e. Microsoft visual studio. The code will be written in C++ and OpenGL will be used to render the graphics. Access to the internet and appropriate library items will be needed for research.


References and Bibliography:

References:

Bourg & Seemann (2004) AI for game developers [online]
[accessed November 2010]

C. Langton (1989) Artificial life: The proceedings of an Interdisciplinary Workshop on the Synthesis and Simulation of Living Systems, held September, 1987, in Los Alamos, New Mexico: Addison-Wesley Pub. Co

Bibliography:

Van Der Vaart & Verbrugge ( n.d. ) Agent-based Models for Animal Cognition:
A Proposal and Prototype[online] avaialable at < http://www.aamas-conference.org/Proceedings/aamas08/proceedings/pdf/paper/AAMAS08_0555.pdf >[accesed January 2011]

Pfeifer R et al.  (2001).  Artificial Life.  Institute for information technology, University of Zurich. Chapter 1.  [online]  Available at < http://www.ifi.unizh.ch/ailab/teaching/AL01/chap1.doc > [Accessed December 2010]
Carvalho & Tome (n.d.) Rule Based Fuzzy Cognitive Maps: Fuzzy Causal Relations [online] Available at < http://digitais.ist.utl.pt/uke/papers/cimca99rbfcm.pdf >[accessed January 2011]
B. Kosko (1994). Fuzzy thinking : Flamingo