Introduction to Game Physics with Box2D

Book description

Written by a pioneer of game development in academia, Introduction to Game Physics with Box2D covers the theory and practice of 2D game physics in a relaxed and entertaining yet instructional style. It offers a cohesive treatment of the topics and code involved in programming the physics for 2D video games.

Focusing on writing elementary game physics code, the first half of the book helps you grasp the challenges of programming game physics from scratch, without libraries or outside help. It examines the mathematical foundation of game physics and illustrates how it is applied in practice through coding examples. The second half of the book shows you how to use Box2D, a popular open source 2D game physics engine. A companion website provides supplementary material, including source code and videos.

This book helps you become a capable 2D game physics programmer through its presentation of both the theory and applications of 2D game physics. After reading the book and experimenting with the code samples, you will understand the basics of 2D game physics and know how to use Box2D to make a 2D physics-based game.

Table of contents

  1. Cover
  2. Half Title
  3. Title
  4. Copyright
  5. Dedication
  6. Contents
  7. Preface
  8. 1 Read Me First
    1. 1.1 Why Does This Book Exist?
    2. 1.2 Preconditions
    3. 1.3 Postconditions
    4. 1.4 Programming Style
    5. 1.5 Supplementary Material
  9. I Introduction to Game Physics
    1. 2 Mathematics for Game Physics
      1. 2.1 Geometry and Linear Algebra
      2. 2.2 Reflections on Reflection
      3. 2.3 Digital Calculus
      4. 2.4 Relaxation
      5. 2.5 Exercises
    2. 3 A Rigid Body Physics Game
      1. 3.1 The Eight-Ball Pool End Game
      2. 3.2 Code Run-Through
      3. 3.3 Render World
      4. 3.4 Object World
      5. 3.5 Objects
      6. 3.6 Exercises
    3. 4 A Soft Body Physics Toy
      1. 4.1 Particles
      2. 4.2 Springs
      3. 4.3 Soft Bodies
      4. 4.4 Ragdoll Physics
      5. 4.5 Exercises
  10. II Game Physics with Box2D
    1. 5 Getting Started
      1. 5.1 Download and Set Up Box2D
      2. 5.2 Overview of Box2D
      3. 5.3 Units
      4. 5.4 Our First Box2D App
      5. 5.5 Exercises
    2. 6 A Tale of Three Modules
      1. 6.1 The Common Module
      2. 6.2 The Math Library
      3. 6.3 The Collision Module
      4. 6.4 Shapes
      5. 6.5 The Dynamics Module
      6. 6.6 Joints
      7. 6.7 Exercises
    3. 7 The Cannon Game
      1. 7.1 The Platform and the Tower
      2. 7.2 The Heads-Up Display
      3. 7.3 The Object World
      4. 7.4 The Cannon Object
      5. 7.5 The Frame Loop and the Keyboard Handler
      6. 7.6 Son et Lumière
      7. 7.7 Exercises
    4. 8 The Collision Module
      1. 8.1 Contacts and Manifolds
      2. 8.2 Contact Listeners
      3. 8.3 AABBs
      4. 8.4 Dynamic Trees
      5. 8.5 Exercises
  11. III Appendices
    1. A For Math Geeks Only
    2. B The Blacke Arte of Program Debugging
      1. B.1 The Debug printf
      2. B.2 Zen and the Art of Debugging
    3. C There Are, in Fact, Dumb Questions
      1. C.1 Lies of π
      2. C.2 Quis Custodiet Ipsos Auditores?
    4. D Bullet Physics
      1. D.1 Getting Started
      2. D.2 The Dynamics World
      3. D.3 Adding Objects
      4. D.4 Rigid Body Dynamics
      5. D.5 Motion States
      6. D.6 Render Frames and Physics Frames
  12. Bibliography
  13. Index

Product information

  • Title: Introduction to Game Physics with Box2D
  • Author(s): Ian Parberry
  • Release date: September 2017
  • Publisher(s): CRC Press
  • ISBN: 9781315360614