1st Edition

Introduction to Game Physics with Box2D

By Ian Parberry Copyright 2013
    275 Pages 305 B/W Illustrations
    by CRC Press

    275 Pages
    by CRC Press

    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.

    Read Me First
    Why Does This Book Exist?
    Preconditions
    Postconditions
    Programming Style
    Supplementary Material

    I Introduction to Game Physics
    Mathematics for Game Physics
    Geometry and Linear Algebra
    Reflections on Reflection
    Digital Calculus
    Relaxation

    A Rigid Body Physics Game
    The 8-Ball Pool End Game
    Code Run-Through
    Render World
    Object World
    Objects

    A Soft Body Physics Toy
    Particles
    Springs
    Soft Bodies
    Ragdoll Physics

    II Game Physics with Box2D
    Getting Started
    Download and Set Up Box2D
    Overview of Box2D
    Units
    Our First Box2D App

    A Tale of Three Modules
    The Common Module
    The Math Library
    The Collision Module
    Shapes
    The Dynamics Module
    Joints

    The Cannon Game
    The Platform and the Tower
    The Heads-Up Display
    The Object World
    The Cannon Object
    The Frame Loop and the Keyboard Handler
    Son et Lumière

    The Collision Module
    Contacts and Manifolds
    Contact Listeners
    AABBs
    Dynamic Trees

    III Appendices
    For Math Geeks Only

    The Blacke Arte of Program Debugging
    The Debug printf
    Zen and the Art of Debugging

    There Are, In Fact, Dumb Questions
    Lies of π
    Quis Custodiet Ipsos Auditores?

    Bullet Physics
    Getting Started
    The Dynamics World
    Adding Objects
    Rigid Body Dynamics
    Motion States
    Render Frames and Physics Frames

    Bibliography

    Index

    Exercises appear at the end of each chapter.

    Biography

    Ian Parberry is a professor in the Department of Computer Science and Engineering at the University of North Texas. He is also the secretary of the Society for the Advancement of the Science of Digital Games. A pioneer of game development in academia, Dr. Parberry is the author of seven books and more than 70 articles on a wide range of computing subjects, including algorithms, complexity theory, parallel computing, neural networks, and game development. In 2010, The Princeton Review ranked his undergraduate game development program in the top 50 in North America. More than 60 professional game developers are alumni of his game development classes, including Jason West, co-founder of the Call of Duty franchise.