Introduction
Physics simulation plays an important role in modern games. The first generation of games often used simplified math in a physics simulation to accommodate the CPU power at those times. Usually, it relied on the assumption that each frame took approximately the same time to render. This caused some games to run sluggishly or too fast on certain occasions. Another problem that arose from those simplifications was collision detection. The physical movement of an object isn't a continuous process. Instead, physical simulation uses small steps. The fast movement of objects results in larger steps and on certain occasions, the step might be large enough to skip a wall. For instance, you can shoot or run through a wall in some action games.
A good physical engine tries to eliminate most of these problems. This chapter will use the Box2D library for physical simulation in a 2D space.