PDF995, Job 98

5 downloads 44763 Views 78KB Size Report
implementation and allowing the developers to focus their attention on the creative ..... and cell phone games to network software and high availability systems) ...
PROTOTYPING A SIMPLE LAYERED ARTIFICIAL INTELLIGENCE ENGINE FOR COMPUTER GAMES Börje Karlsson Informatics Center (CIn) Pernambuco Federal University (UFPE) Av. Prof. Luiz Freire, s/n, CIn/CCEN/UFPE, Cidade Universitária, Recife, Pernambuco, Brazil 50740-540 E-mail: [email protected]

KEYWORDS

AI, AI engine, computer games, software architecture.

ABSTRACT This work presents the chosen approach for the prototyping of an Artificial Intelligence Engine designed to provide support for the implementation of AI functionalities in computer games, streamlining this implementation and allowing the developers to focus their attention on the creative side of the game.

INTRODUCTION As the market of digital entertainment products (especially digital games) grows, these products get more and more complex and their users present higher and higher expectations, requiring quality and believability in the character behaviours. Because of these facts, artificial intelligence (AI) functionalities are no longer held in a secondary level during development. Despite of this, AI applied to computer games development, remains a complex domain and relatively unexplored. A great source of solutions and techniques for the creation of such realistic and interesting environments and characters is the academic community (Laird and Lent 2000). With the ever growing necessity of AI functionalities and the fact that some techniques are already in use in game development, supporting tools were created in order to help with these tasks but these tools presented little flexibility. Without a certain level of support, a developer will spend a great part of his time struggling with lowlevel details or re-implementation of common functionalities. It is believed that the next big step in the quality of AI game techniques depends on the creation of AI middleware, to alleviate developers and allow them to concentrate on creative tasks related to AI. In the following sections this work presents some commercial and academic approaches to the creation of AI engines and game AI related functionalities that were studied in order to try to identify issues, good ideas and solutions. Then, it presents the ongoing prototype implementation and some conclusions from the effort.

AI ENGINES In other computer games development areas, such as computer graphics, networking and physics modeling, it is already a common practice to use pieces of software that help the developers with tasks related to these areas, allowing them to focus on the creative side of the game. This is only recently started to be seen in the AI segment of game development. An AI engine is basically a set of software components that provides services for the game engines for performing the AI functions in a computer game. Usually also called Artificial Intelligence Middleware, AI engines handle the process of producing the desired behaviours of the agents present in the game world. Traditionally, computer games developers use a small set of techniques over and over again in the implementation of artificial intelligence functionalities in games, specially Finite State Machines (FSMs) that are basically a set of states and transitions between these states, used to represent some kinds of behaviours, and the A* algorithm used for calculating paths. But even with the small set of techniques used, current games achieve pretty good results. The processor time available for calculations related to the AI module is usually very short, and so, its tasks can not be very CPU intense. That’s why lots of computer game software utilize simple approaches as FSMs (where the transitions between states usually reflect some game world events); decision trees, as is the case of the AI.implant (BGT 2003) engine; or rule-based systems (RBSs), which are more flexible than a purely stimuliresponse approach, the standard procedure for implementing behaviour until very recently (Nareyek 2000a), for they allow objects to incorporate a internal state, making it possible to achieve longer term goals and FSMs and simple RBSs are as fast as implementing the stimuli-response approaches. However, the limitations of the FSM approach in the design of intelligent agents are well known, they are limited specially by combinatorial explosions (as the environment complexity grows, so grows the states and transitions sets in order to allow responses to every possible case and situation on the environment) and by the potential repetitive behaviours, because the FSMs have a fixed set of states and transitions, if the same situation

happens twice, the behaviour will be the same both times. These limitations were “attacked” with the creation of hierarchic FSMs (HFSMs), a extension to traditional FSMs that allows the creation of composite states which contain, inside themselves, other states and transitions; and the creation of Fuzzy FSMs (FuFSM) that add characteristics of fuzzy logic to FSMs in order to lower the previsibility of actions. All of this being supported by the creation of visual editors that help the creation and maintenance of theirs state diagrams. Regarding RBSs, they present some advantages; they correspond to the way people usually think about knowledge, are very expressive and allow the modeling of complex behaviors, model the knowledge in a modular way, are easy to write and are much more concise than FSMs. However, RBSs may have a large memory footprint, require a lot of processing power and even in some situations become extremely difficult to debug. SimBionic (Fu and Houlette 2002) presents an approach that fits somewhere in between FSMs and RBSs, by providing a framework for defining objects that display behavior within the game world. This framework is very state-oriented, supporting the creation of complex hierarchical state systems. These techniques are somehow powerful but also have limitations. Alternatives motivated by academic research produced a rich variety of approaches for the creation of interesting and plausible intelligent agents. But unfortunately, this approaches tend to be very “heavyweight”, as deliberative systems, that have goals, a world model e can plan several steps necessary to achieve the goals, but are heavy and slow; or hybrid systems that calculate the planning beforehand and make use of rules in the lower levels (during runtime), but because of this precalculation of the plan, do not present good responses in highly dynamic worlds (as is the case with most computer game worlds). Games developers need a solution in between simple FSMs and complex cognitive models. First of all, it is necessary to avoid too frequent updates, and to rely in an event based model. In second place, the new solution needs to present a variety of reactions but still being verisimilar. Third, the solution must provide a simple framework on which it may be possible to create highly customized new solutions; this framework shall also allow for scalable development. A possible approach would be to make use of “anytime planners” (Nareyek 2000b), planners that can improve the plan after each iteration, if there is little CPU time available, the system still manages to be reactive, and the plan gets to be refined if there is a bigger slice of available processor time, and also where the plan can be updated in case changes occur in the game world. Or, representational planning techniques (Martin 2003) to be used as a layer above the artificial intelligence mechanisms already in place, that explicitly handle the world representations in order to be able to choose the best behaviours for a given situation. But unfortunately, approaches to planning are seldom known/used in computer games development.

Some approaches use inference engines to “conclude” what is the best course of action, one such example of inference engine, initially used in military simulations, is the Soar (Laird et al. 1987) architecture which combines the reactivity of stimuli-response systems with the context sensitive behaviours found in systems that use FSMs or scripting. In Soar, the knowledge is represented as a hierarchy of operators. Each level in this hierarchy represents a more specific decision level in the intelligent agent behaviour. The top level operators represent the agent goals and behaviour modes, the second level operators represent high level tactics used to achieve the goals specified in the higher level. And the lower level operators represent the steps (or sub-steps) necessary for the agent to implement and execute the tactics. Another approach is the biologic/ evolutionary one (Donnart et al. 1999) that originated DirectIA (Masa 2002), a package that provides support for the creation of agents, with behaviours ranging from basic reactions to deep world state analysis. DirectIA is an agent-centric tool, which “mimics” how and why a character makes a decision. Using a motivational model, its mechanism handles stimuli, emotion, states, motivations, behaviours and actions. In this system, motivations that compete until it is decide which one must be applied to the situation, given the internal and external states, resulting in an emergent behaviour. The intelligent agents can weight tradeoffs and present behaviours not specifically programmed by the game developers. Some other issues must be taken into account when analyzing AI engines. (Laird and Lent 1999) states clearly that a knowledge base containing goals, tactics and behaviours independent of a specific game is its most important feature. And (Leonard 2003) states the extreme value of a good set of sensors in order to improve the player experience. Also, one can not forget the use of machine learning techniques integrated into the AI engine in order to obtain new behaviours (Ding 1999).

THE PROTOTYPE The chosen AI engine prototype development approach was a bottom-up approach where by implementing lower level functions and combining them, the final solution could emerge and also a prototype would be ready sooner. Some of the decisions made were inspired by Renderware AI (Pontevia and Williams 2002), an AI middleware that presents a layered design (architectural, services, agents and decision layers). The agents layer being a set of behaviours that can be instantiated by a game character; Renderware AI offers a set of C++ classes and FSMs that the developers can extend and tweak to create their own agents. Another influence was Pensor (Pensor 2002a, Pensor 2002b), which is composed of a set of re-combinable algorithms and techniques; planners, path-finders, a decision module using FSMs and rules, a perception module and an infra-structure module that provides support for resource managing. The implemented AI engine prototype was organized in three macro layers, Service, Behaviour and Cognitive.

The Service layer, handles low-level implementation details (Rabin 2001, Rabin 2000) to guarantee a good system performance as well as freeing the game developer from this burden (as for example: using event handling instead of polling; execute the AI procedures with the lowest possible frequency to lower CPU load; make use of as much pre-processing as possible, allowing for the separation of decision support data from the level design itself, and improving efficiency in decision making). The Behaviour Layer is a “evolving” layer, currently using FSMs for they present good results in modeling simple behaviours and are a tool familiar to game developers and a simple set of “motivational rules” that allow the selection of the behaviour to be executed next. And the Cognitive layer is still not implemented but is currently under research. Most of the current implementation decisions relate to low-level details and the engine’s API is still going through a lot of changes. The prototype is currently being developed and tested against a set of simple games and a famous first person shooter (FPS), where a developer needs only write some glue-code to begin using it.

CONCLUSION In its current stage, the AI engine already provided many insights into the creation of such a tool. As the higher layer are improved/implemented many more issues will be studied, especially higher level AI issues, probably requiring a huge re-modeling of the engine. Also, it already can be used as an educational tool to help implement IA functionalities in computer games. Much more thought will have to be dedicated (and currently is being dedicated) to the question of standardizing AI interfaces in computer games. Shall they be in source code form? In form of an ontology? Following the AUML (Bauer 2001)? Because of these issues, the International Game Developers Association has set up the AI Interface Standards Committee to develop such interface standards, the initiative being a joint effort of game developers, middleware representatives and academics (Nareyek et al. 2003). Even with these issues still open and other problems found, AI in games will have a growing priority in the development process. Even a little explored field in game development and with just a few techniques in use, AI already showed that can bring great advances in gameplay.

REFERENCES Bauer, B. 2001, “UML Class Diagrams: Revisited in the Context of Agent-Based Systems”, pp.1-8. Proceedings of Agent-Oriented Software Engineering (AOSE) 2001, Agents 2001, Montreal, Canada. BGT. 2003, “AI.implant for Games”, Whitepaper, BGT BioGraphic Technologies, Montreal Canada. Ding, Z. 1999, “Designing AI Engines with Built-in Machine Learning Capabilities”. In Proceedings of the Game Developers Conference, San Jose, USA. Donnart, J., Jakobi, N., Kodjabachian, J., Meyer, C., Meyer, A., Trullier, O. 1999, “Industrial Applications of Biomimetic

Adaptative Systems”. Proceedings of HCP'99 - Human Centered Processes. ENST Bretagne Pub, Brest, France. Fu, D. and Houlette, R. 2002, “Putting AI in Entertainment: An AI Authoring Tool for Simulation and Games”, IEEE Intelligent Systems, Vol. 17, No. 4, pp. 81-84. Laird, J. E., van Lent, M. 2000, “Human-level AI’s Killer Application: Interactive Computer Games”, Proceedings of AAAI 2000, pp. 1171-1178, Austin, USA. Laird, J., van Lent, M. 1999, “Developing an Artificial Intelligence Engine”. In Proceedings of the Game Developers Conference, San Jose, USA. Laird, J. E., Newell, A., and Rosenbloom, P. S. 1987, “Soar: An architecture for general intelligence”. Artificial Intelligence, 33(1): 1-64. Leonard, T. 2003, “Building AI Sensory Systems”. In Proceedings of the Game Developers Conference, San Jose, USA. Martin, C. 2003, “Representational AI Planning Techniques”, In Proceedings of the Game Developers Conference, San Jose, USA. Masa. 2002, “Direct IA Datasheet”, Whitepaper, The Masa Group, Paris, France. Nareyek, A. 2000, “Intelligent Agents for Computer Games”, In Proceedings of the 2nd International Conference on Computers and Games, pp 414-422, Japan. Nareyek, A. 2000. “Open World Planning as SCSP”. In Papers from the AAAI-2000 Workshop on Constraints and AI Planning, Technical Report, WS-00-02, 35-46. AAAI Press, Menlo Park, California, USA. Nareyek, A., Knafla, B., Fu, D., Long, D., Reed, C., El Rhalibi, A. and Stephens, N. (eds). 2003, “The 2003 Report of the IGDA's Artificial Intelligence Interface Standards Committee”. International Game Developers Association. Pensor. 2002, “Path planning to massive worlds”, Pensor whitepaper series, wp-2002-5-1, Mindlathe Ltd., Coventry, United Kingdom. Pensor. 2002, “Decision inertia an AI stability”, Pensor whitepaper series, wp-2002-4-2, Mindlathe Ltd., Coventry, United Kingdom. Pontevia, P. and Williams, G. 2002, “AI Middleware, A Powerful New Multi-Platform Approach For Game Development: Introducing RenderWare AI, powered by Kynogon”, Whitepaper, Criterion Software Inc., Austin, USA. Rabin, S. 2000, “Designing a General Robust AI Engine”. In Game Programming Gems, Charles River Media. Rabin, S. 2001, “Strategies for Optimizing AI”. In Game Programming Gems 2, Charles River Media.

AUTHOR BIOGRAPHY BÖRJE KARLSSON is a Student Researcher at Centro de Informática (CIn), Universidade Federal de Pernambuco (UFPE) in the field of Artificial Intelligence and is currently working in projects at CIn/UFPE and C.E.S.A.R with Motorola, related to development and testing for mobile devices. Börje has about 8 years of experience in development for several platforms (from PC and cell phone games to network software and high availability systems) and works published about game development, AI in games, development for mobile devices and network data analysis. Börje has a BSc in CS and is finishing a specialization in Software Engineering both at CIn/UFPE. He is also member of the IGDA AI Interface Standards Committee.