Summary
In this chapter, we explored collision detection and created a two-tier collision detection for the application. We started by discussing the shortcomings of a naive solution, then we explored spatial partitioning methods and model simplifications to lower the number of checks we have to do until we are quite sure which instances really have some collisions. Finally, we implemented a quadtree with bounding boxes and bounding spheres to find out which instances collide.
In the next chapter, we will create “real” non-player characters (NPCs) and let the instances come to life by adding configurable behavior. We will start by exploring the nature of behavior trees and their relation to the decision-making of NPCs, and we will implement code to support behavior trees for our instances. As the last step, we will look at the interaction between models as a specialized set of the general behavior.