Search:
|
Access:
» Neural networks in gamesRelated categories: Java | Artificial intelligence | Neural networks Maciej GorywodaViewed: 10449 | Article date: 2006-01-18 13:19:01 Artificial neural networks (for the remainder of this article referred to simply as neural networks) are an area of studies in artificial intelligence that aims to imitate the way the human brain works. Neural networks are frequently used as decision-making systems. In this article Maciej will focus on a different application. Neural networks mimic the way the human brain works. Since the brain controls the body, why not use a neural network to control a robot, a probe or some kind of an agent in a simulated environment.
The author graduated from the Warsaw Technical University. He is currently preparing a Ph.D. dissertation on neural networks and works as a game programmer. Contact with the author: mgorywoda@o2.pl
Have you ever thought about the way the human mind works when forced to make a choice under pressure? At times like these we tend to improvise, more or less instinctively rejecting uncertain factors and comparing the remaining ones against our experience, that is our memory of the way we reacted to past situations of this sort and the outcomes our reactions brought. We are basically searching our memory for a reaction that gave favourable result in the past. Of course, remembering a failure might warn us of undesirable reactions, but that knowledge is unlikely to be useful when it comes to making a split-second decision. What we are essentially doing is searching for a behavioural pattern associated with a desired outcome, and once that is found we follow the pattern, even if the current situation differs from the one the existing pattern applies to. The only important consideration is that all other known patterns are even less similar to the current state of affairs. Artificial neural networks (for the remainder of this article referred to simply as neural networks) are an area of studies in artificial intelligence that aims to imitate the way the human brain works. Neural networks are frequently used as decision-making systems. Even given incomplete or imprecise data, a neural network can still arrive at a solution or offer a prediction of the future state of some complex system - tasks that a conventional computer program might not be up to due to inadequate data. This is also why neural networks are often used to implement face or voice recognition, among other things. However, in this article I want to focus on a different application. Neural networks mimic the way the human brain works. Since the brain controls the body, why not use a neural network to control a robot, a probe or some kind of an agent in a simulated environment. As we're dealing with simulated environments, a similar solution could well be used to direct computer opponents in first person perspective games. As already mentioned, a neural network works in a way similar to the human mind's decision-making process. The network takes a simplified description of an agent's situation prepared by a separate data analysis module and tries to find a pattern that best matches the situation. The matching process involves discarding uncertain factors and replacing data not matching any pattern with known information from the past, and the pattern that requires the least number of such operations is considered to be the best-matching one. However, just as some of our own decisions only seem to be good at the time, so a neural network may occasionally arrive at a pattern that requires a minimum number of operations, but is not an optimum solution. In other words, it is possible for a result to be only a local optimum for the problem at hand, rather than a global one. In this article I will present a sample Java implementation of a neural network intended to be used as the control module for a moving object in a computer game. Before we dive in, however, we need to have a quick look at our simulated game environment. Game environmentSimplifying things a bit, implementing a realistic game requires three kinds of objects: a game world complete with physics and terrain representation, static and moveable objects present in the game world and agents to control some of the moveable objects, The game world is made up of a variety of materials, characterised by a variety of properties (for example friction). You can think of the game world as a game board, with the physics (mechanisms constraining object behaviour) providing the game rules. If the game world is a board, then objects are pawns. Some are immobile and can be used as sources of energy or information (for example being picked up, eaten or destroyed in order to provide access to other objects) or simply act as obstacles in moving from A to B. Some objects are mobile, but passive - they can move if they are pushed or pulled, but don't move of their own accord. Finally, some of the mobile objects can be vehicles, equipped with motors to propel them without external intervention and cameras to gather information about their surroundings. An agent controlling the vehicle might process this information and use it to give the vehicle one of the following orders:
The way each of these orders would be interpreted varies depending on the game. If we're writing a shooter such as Quake or PainKiller, moving towards a data source might mean shooting an enemy, while obtaining energy from an energy source would be picking up a first-aid kit or an ammo box. The agent is controlled by a decision-making module, in our case implemented using a neural network. The agent's job is to filter the information obtained from the vehicle's camera, convert it to a suitable input vector and feed that vector into the neural network. The network processes the input data and returns a result, which is then interpreted to formulate an order for the vehicle.
|
|
Copyright C 2006 by Software Developer's Journal. All rights reserved.





SDJ Users:
Shopping Cart









