7.5. Preserving your physics

As a rule, once you have a cCritter::move that gives you a visually convincing simulation of some reasonably accurate physics, you shouldn’t override it at all. If you ignore this rule, you run the risk of developing a game that runs great on your home machine, but which behaves badly when you bring the program in for a classroom demo – or, if you’re working alone, when you try and show it off at a conference or at a friend’s house. The critters may seem to be barely moving at all – or flying around the screen like neutrinos.

All the careful work in calculating a real time dt and passing it to your critters is going to make no difference if you make the cCritter::move(dt) method a virtual method and override it with ...

Get Software Engineering and Computer Games now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.