Appcelerator Blog

The Leading Resource for All Things Mobile

Gaming comes to Titanium, Introducing the Box2D module!

0 Flares 0 Flares ×


The community has long been asking “Can I build games like angry birds or <insert any game title here> with titanium” and for some situations there were ways to make it work, but it always involved a lot of hacks.

We know game development is important to many developers, and so we wanted to bring better game development to you.

It is our great pleasure to introduce to you the new open source Box2d Module for Titanium Mobile!

Let me outline what this module is, and what it is not…

First of all, this is an open source, 100% free module, this means that any Titanium developer has access to both the compiled module, as well as the source to make changes (and in turn, submit pull requests to give back to the community).

Another point to note is that the module does not currently support all of the Box2D APIs, it does however support what we consider to be the core elements such as bodies (square and round), collision detection, gravity, static and dynamic bodies, revolute joints and motors and more!

This is a native Obj-C module, this means native speeds, this also however means that this module is currently iOS only, we do have plans however to build an Android version of the module down the road.

We have uploaded the module source, as well as a pre-compiled version in zip format to our open source modules repo

So with the release of this new open source Box2D module, we thought it would be nice to show you a little bit of what it can do!

To demo this new module, we decided it would be fun to build a pinball game, that we now call TiBall.

Screen Shot 2011-09-07 at 10.36.31 AM.png

This open source game will show how to use the majority of the APIs currently available in the module, and will continue to be developed as an example app by Appcelerator.

So how do you get started?

  1. Download the games source files here
  2. Download the new Box2D module here
  3. Now you have 2 options, you can build the module from source if you desire to make any changes, or use the included compiled module in the zip directory named, to use the pre-built module, simple unzip the file. You should now have a folder called modules. Inside that folder there will be another folder called iphone. Inside the iphone folder there should be another folder called ti.box2d. Copy the ti.box2d folder to your /Library/Application Support/Titanium/modules directory. (note that it is in the root Library, not the one based off of the users folder) If there is not an iphone folder already inside the modules folder, create it.
  4. Now, simply import the TiBall game into Titanium Studio and run it in the iOS simulator
  5. The first screen of the game will provide you with instructions on how to play, as well as a button to start a new game.

We here at Appcelerator are very excited to release this module, this game,to  see what the community can do with it, and create using it!

0 Flares Twitter 0 Facebook 0 Google+ 0 LinkedIn 0 Email -- 0 Flares ×


  1. Vinc

    Awsome. Keep the good work on.

  2. Sweet. I will be playing with this over the next week or so to see what it can do.

  3. Very good work, guys! Congratulations! Thanks to make it open source.

  4. Great! thank you, guys!

  5. Dave Waller

    This is great news. I’ve been using Box2d a lot already with the cocos2d framework for iOS and have been able to create some fairly interesting results. And I know Box2d has been big in the Flash world for a while now so it looks to be a fairly solid inclusion into the Titanium platform.

  6. Congratulations, very good module and very good new business line for us 😉

  7. Sweet. This will make it much easier for me to get into game development on iOS.

  8. Sharry

    Great work guys. I’ll do a feature about this over at Titanium & games is the way forward

  9. Step 4 is very vague to new users. See here for the same app.js:

    I have done everything as above but am getting an error:
    [DEBUG] Detecting modules in /Library/Application Support/Titanium/modules
    [DEBUG] Detected module for iphone: ti.box2d 0.9 @ /Library/Application Support/Titanium/modules/iphone/box2d/mobile/ios
    [DEBUG] Looking for Titanium Module id: ti.box2d, version: 0.9, platform:
    [ERROR] Third-party module: ti.box2d/0.9 missing library at /Library/Application Support/Titanium/modules/iphone/box2d/mobile/ios/libti.box2d.a
    [ERROR] Error: Traceback (most recent call last):
    File “/Library/Application Support/Titanium/mobilesdk/osx/1.7.2/iphone/”, line 638, in main
    SystemExit: 1

    Do we have to build this ourselves for this to run?

  10. This is incredible news. Games on Titanium – you’ve made my day!.

  11. This is awesome! I can’t wait to get something out there! See you at CODESTRONG!

  12. dude, that’s sooooo awesome…alas, i’m on a pc, and until it’s available for android, i’ll still have to use the flash version. you mentioned there are plans to get this android capable, is there a goal date in mind?

  13. Nishanth

    Really great job dude. I like it very much.

  14. David

    I hope the android one comes soon. The more I look at Appcelerator the more I like it, a box2D android module would seal the deal for me.

  15. Regis Zaleman

    Great module – as far as I can tell. I would benefit greatly from better documentation (links to the C lib. documentation, which is of no use for many of us), at least give us a complete API description…

  16. Regis Zaleman

    Some stuff I found out that might help others:
    * if people are still struggling with installing the module, what made it work for me was to rebuilt the project. To do so, I went to the top bar in Titanium Studio and chose Project > Clearn , and then did a re-build. Now I still have questions about the correct location of the module, as I had copied it to both my user Library folder and my root Library folder… I guess I just have to delete one of them, rebuild my project clean and see if it still works.
    * Also, during the installing process, I could not find my root Library folder on OSX Lion, because it is set as a hidden file by default. To reveal it, you can open the Terminal application and type “chflags nohidden /Library” (without the quotes)

Comments are closed.

Sign up for updates!

Become a mobile leader. Take the first step to scale mobile innovation throughout your enterprise.
Get in touch
computer and tablet showing Appcelerator software
Start free, grow from there.
0 Flares Twitter 0 Facebook 0 Google+ 0 LinkedIn 0 Email -- 0 Flares ×