Author   Back to "Intro to Game Physics with Box2D"

Table of Contents

image

Chapter 1: Read me First

Before we get started, let's take a look at why this book exists, what I expect you to know before you can start reading it, what the stuff inside will be like stylistically, and what you can expect to get out of it if you put a reasonable amount of effort into it.

Part I: Introduction to Game Physics

image

Chapter 2: Mathematics for Game Physics

We start off pedal to the metal by examining the mathematical foundation of game physics and how it can be applied in practice. We'll be doing some Geometry, Linear Algebra, and Calculus. Thanks to René Descartes, we learn that Geometry and Linear Algebra are really the same thing, which is really great news.
image

Chapter 3: A Rigid Body Physics Game

Now we put the concepts learned in Chapter 2 to the test by coding the end game in 8-ball pool.
image

Chapter 4: A Soft Body Physics Toy

Having been introduced to the theory of Verlet integration and Gauss-Seidel relaxation in Chapter 2, we now examine code for a Ball and Spring Toy, which allows you to play with various springy-things and a ragdoll robot named Woodie.

Part II: Game Physics with Box2D

image

Chapter 5: Getting Started

Now we get you started with Box2D by showing you how to download it and integrate it with your game code. After running you quickly through the basic concepts, it demonstrates the process with a quick toy that lets you drop balls and books out of the sky.

image

Chapter 6: A Tale of Three Modules

Box2D is broken up into three basic modules called the Common Module, the Collision Module, and the Dynamics Module. Let's drill down into them in enough detail that we can begin writing a game.
image

Chapter 7: The Cannon Game

The Cannon Game gives the player control of a cannon in a world with a tempting tower of books. The player's job is to knock down the tower in 60 seconds or less by firing cannonballs at it.
image

Chapter 8: The Collision Module

We now drill down a little into the Collision Module, which starts by looking more closely at contacts and contact manifolds before introducing the contact listener, which is an efficient way of having Box2D notify your program about collisions. It finishes with some heavy geek stuff about AABBs and Dynamic Trees.

Part III: Appendices

image

Appendix A: For Math Geeks Only

For the math geeks among you, let's prove the identities
    cos (α + β) = cos α cos β - sin α sin β, and
    sin (α + β) = sin α cos β + cos α sin β
from Chapter 2.
image

Appendix B: The Blacke Arte of Program Debugging

Unfortunately we spend much more time teaching programming than we do teaching debugging skills even though the professional programmer typically spends a large fraction of their time debugging. That tends to make students think that bugs are things to be ashamed of.
image

Appendix C: There are, In Fact, Dumb Questions

I stop answering dumb questions about programming once my students reach a certain level of programming skill. Don't let anybody tell you that there's no such thing as a dumb question. My definition of a dumb question about programming is a question that can be answered by experimenting with code.
image

Appendix D: Bullet Physics

Bullet Physics is a lot more sophisticated than Box2D, but once you start working with it you will find that they have some concepts in common. For example, where Box2D has the Physics World b2World, Bullet Physics has the Dynamics World.

Created April 6, 2012. Written in HTML 4.01 and CSS 3 using vi. Last updated August 16, 2012.

Valid HTML 4.01 Strict Valid CSS!