O'Reilly logo

Software Engineering and Computer Games by Rudy Rucker

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

7.4. Implementing forces

The base class cForce::force returns a zero vector, but we have ‘global’ force classes cForceGravity, cForceDrag, and cForceVortex which return non-trivial values. We use them in the Ballworld and Dambuilder games, discussed in Chapter 18: Interesting Worlds. We also have ‘relative’ steering force classes liked cForceObjectSeek, cForceClassEvade, and cForceEvadeBullet.

Figure 7.2 is a class diagram of all the forces we provide with the Pop Framework.

Figure 7.2. Class diagram of the cForce child classes

The idea is that each force(cCritter*) method should return a force that the critter will divide by its mass and add ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required