Mimicking Playstyle by Adapting Parameterized Behavior Trees in RTS Games

Andrzej Kozik,Tomasz Machalewski,Mariusz Marek,Adrian Ochmann
DOI: https://doi.org/10.48550/arXiv.2111.12144
2021-11-24
Abstract:The discovery of Behavior Trees (BTs) impacted the field of Artificial Intelligence (AI) in games, by providing flexible and natural representation of non-player characters (NPCs) logic, manageable by game-designers. Nevertheless, increased pressure on ever better NPCs AI-agents forced complexity of handcrafted BTs to became barely-tractable and error-prone. On the other hand, while many just-launched on-line games suffer from player-shortage, the existence of AI with a broad-range of capabilities could increase players retention. Therefore, to handle above challenges, recent trends in the field focused on automatic creation of AI-agents: from deep- and reinforcementlearning techniques to combinatorial (constrained) optimization and evolution of BTs. In this paper, we present a novel approach to semi-automatic construction of AI-agents, that mimic and generalize given human gameplays by adapting and tuning of expert-created BT under a developed similarity metric between source and BT gameplays. To this end, we formulated mixed discrete-continuous optimization problem, in which topological and functional changes of the BT are reflected in numerical variables, and constructed a dedicated hybrid-metaheuristic. The performance of presented approach was verified experimentally in a prototype real-time strategy game. Carried out experiments confirmed efficiency and perspectives of presented approach, which is going to be applied in a commercial game.
Artificial Intelligence
What problem does this paper attempt to address?
### What problems does this paper attempt to solve? This paper aims to solve the problems of construction and optimization of artificial intelligence (AI) agents for non - player characters (NPCs) in real - time strategy (RTS) games. Specifically, it attempts to solve the following key problems: 1. **Complexity and error - proneness of hand - designed behavior trees**: - As the demand for higher - quality NPC AI increases, hand - designed behavior trees (BTs) become overly complex and error - prone, unless created by experienced AI engineers. 2. **The problem of low player retention rate**: - Many newly launched online games face challenges due to a lack of sufficient players. Introducing AI with extensive experience and capabilities can improve the player retention rate. 3. **The need for automatic creation of AI agents**: - Recent trends focus on automatically generating AI agents through methods such as deep learning, reinforcement learning, combinatorial optimization, and behavior tree evolution. However, these methods usually require a large amount of resources and training data. 4. **Imitating and generalizing human game styles**: - Researchers hope to develop an AI agent that can imitate and generalize a given human gameplay, making the AI's performance in the game more natural and diverse. To this end, the authors propose a novel semi - automatic method for constructing AI agents by adjusting and optimizing behavior trees created by experts. They formulate this problem as a mixed discrete - continuous optimization problem and construct a dedicated hybrid meta - heuristic algorithm. The experimental results verify the effectiveness and promise of this method, and they plan to apply it to commercial games. ### Main contributions 1. **Proposed a novel semi - automatic method for constructing AI agents**: - By adjusting and optimizing behavior trees created by experts, the AI can imitate and generalize a given human gameplay. 2. **Constructed a complete AI - based NPC**: - This NPC can handle the complexity of the game and compete with human opponents, especially in real - time strategy games, where this AI needs to manage multiple units simultaneously and dynamically update strategies according to the map situation. ### Method overview - **Behavior Trees (BTs)**: Used to represent the hierarchical structure of NPC logic, including task nodes and control - flow nodes. - **Adaptive Behavior Trees (ABT)**: Control the topological and functional changes of behavior trees by parameterizing nodes. - **Similarity measure**: Used to evaluate the similarity between source gameplay and behavior - tree gameplay. - **Optimization problem**: Use a hybrid meta - heuristic algorithm to find the optimal parameter configuration so that the generated AI agent is as close as possible to the human player's game style. This method is particularly suitable for small game development teams and can generate different AI instances with moderate effort without consuming as many resources as other methods. In addition, the generated AI instances are easy to interpret, facilitating understanding and adjustment.