Articles

Help me replace my broken Mac Mini!

Click here to lend your support to: Help me replace my broken mac mini and make a donation at www.pledgie.com !

About this tutorial

Learn about Chipmunk Physics Engine and how to start developing games for the iPhone and other platforms.

Contents

  1. Introduction
  2. Setup
  3. Basic Concepts
  4. Initializing Chipmunk
  5. Defining the ball's body and shapes
  6. Tracking the ball's movements
  7. Defining the floor's body and shapes
  8. Evaluating the results & Conclusion
  9. Download the complete project

Introduction

If you're trying to get into game development for the iPhone, or some other platforms, you might have heard of Chipmunk as a 2D physics engine. Chipmunk is very fast, easy and independent of the graphics engine of your choosing. Personally, I use Cocos2D as a game engine but Chipmunk can be used with everything or even nothing (i.e. no graphics) provided you want to work with 2D physics and rigid bodies.

Chipmunk features are many and flexible, in this article I'll try to teach the basics to a point where you can continue on your own. I'll be using Objective C, C and XCode during the article, and while I won't be using Cocos2d or other game engines for the sake of keeping things simple, it will only be understandable if you at least have some experience with iPhone development.

What will we do and learn during this tutorial?

We'll begin by learning the basics of Chipmunk and by setting up a test project. From there we'll keep extending the project until we achieve the end result, our first complete Chipmunk simulation. Here's a preview of the results:

balls path

Though not an amazing finish, at the end of this tutorial you should have all the basic knowledge to do basic simulations and even apply all concepts of this tutorial to do your first game.

Before we start

If you find a spelling/grammar error, bug in the code or have any other suggestions or improvements, feel free to get in touch with me using my contacts page.

If you find this article useful and enjoy it, consider donating, even a small amount goes a long way to keep the articles up-to-date and to fund new ones. Donating is simple, you can donate using the Paypal's "Donate" button at the right of each article's page or by buying one of my applications.



Donate

If you find this article useful and enjoy it, consider donating, even a small amount goes a long way to keep the articles up-to-date and to fund new ones.