Gaming comes to Titanium, Introducing the Box2D module!

The failure of business shown by global network connection in hand of businessman is broken


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!


  1. 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.

  2. […] Gaming comes to Titanium, Introducing the Box2D module! « Appcelerator Developer Center.   No Comments […]

  3. 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?

  4. […] Appcelerator の Developer Blog にBox2Dを使用したゲームのサンプルがあったので設定してみることに Gaming comes to Titanium […]

  5. 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?

  6. 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.

  7. 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…

  8. 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.