Game AI Pro | Runtime Compiled C++ chapter |
Sections
- Introduction
- Alternative Approaches
- Runtime Compiled C++
- Runtime Compiled C++ Implementation
- Runtime Compilation in Practice—a Step-by-Step Example
- Runtime Error Recovery
- More Complex Code-State Preservation and Header File Handling
- Code Optimizations for Performance-Critical Code
- Use Case: A Behavior Tree and Blackboard Architecture
- Crytek Case Study
- Future Work
- Conclusion
1. Introduction
Scripting languages have always been a foundation of rapid AI development but with the increasing demands of AI, their performance drawbacks are becoming ever more problematic. On the other hand, traditional C++ development approaches generally lead to lengthy compile and link times, which limit the amount of iteration and testing that programmers can undertake. Though development tools are progressing in this area, developers still need to run the build and load content to see the end result, and edit-and-continue style approaches do not work for all codebases or changes.In this article we demonstrate how the same fast iteration times and error-handling can be achieved using pure C++ through a novel approach, which we call Runtime Compiled C++ (RCC++). RCC++ allows developers to change code while the game is running, and have the code compiled and linked into the game rapidly with state preserved. Programmers can thus get feedback on their changes in seconds rather than minutes or more. The technique has been used in the development of AAA games at Crytek, and gives similar results to Hot Reload as seen in Epic’s Unreal Engine 4. The RCC++ code is available as a permissively licensed open source project on GitHub...