Game Development Community

dev|Pro Game Development Curriculum

Torque 2D Development Blog - Box2D Overview

by Michael Perry · 10/30/2009 (4:45 pm) · 74 comments

static.garagegames.com/static/pg/blogs/jason-hetu/Torque-2D_Development-Blog-Header.png

Welcome to another entry in the Torque 2D Development Blog series. Now that Torque 3D has officially shipped, it's time for Torque 2D to get the spotlight. The last blog about our new 2D engine was posted back in August, discussing integration with Torque 3D's code base. A lot of development has gone on since then, and for this blog really wanted to crank up the "awesome factor."

Torque 3D got a major push with the development of an abstracted physics layer, including an integration with PhysX. Our engine mastermind, Melv May, decided to give Torque 2D similar treatment. This blog is dedicated to his implementation of Box2D in Torque 2D!


/static/pg/blogs/michael-perry/b2d_icon.png

What is Box2D?

From their Wiki, "Box2D is a feature rich 2D rigid body physics engine, written in C++ by Erin Catto. It has been used in many games, including Crayon Physics Deluxe, winner of the 2008 Independent Game Festival Grand Prize." The system was originally developed on Windows using pure C++, and has since been ported to Linux, OS X, and the iPhone. Because of the API's flexible nature, there are integrations for Flash, Java, Python, C#, and Obj-C.


For Torque 2D, we did not opt for a thin Box2D integration with limited exposure to TorqueScript. Quite the contrary, Box2D is a core layer which is deeply interfaced with the rest of the engine. Thanks to this level of implementation, a Torque 2D game can be completely physically driven.

Even the simplest level can be designed and tested using only Box2D physics. The new 2D Physics Model system is what binds your in game objects to the physics system. This model contains all the physics elements you'll ever need such as Bodies, Collision-Shapes, Joints, Render-Actions etc. A Render Action can render anything including static-images, animated-images, particle-effects, text and much more. Render-Actions, like everything else, inherit the new physics capabilities.

Rejoice, for we are not stopping with mere collision and reaction. We are utilizing the full power of Box2D and its many features:

  • Continuous collision detection.
  • Convex polygons and circles.
  • Multiple shapes per body
  • Fast broadphase AABB queries
  • Collision filters
  • Continuous physics with time of impact island solver.
  • Persistent body-joint-contact graph
  • Contact, friction, and restitution
  • Revolute, prismatic, distance, pulley, gear, and mouse joints
  • Joint limits, motors, and friction
  • Momentum decoupled position correction
  • Fairly accurate reaction forces/impulses

The next few blogs will go into greater detail of how the new systems work together with Torque 2D. For now, here is a little something to salivate over.


This is post #5.

Torque 2D development blogs:


Page «Previous 1 2 3 4 Last »
#1
10/30/2009 (4:47 pm)
Oh yeah!

The vid looks awesome and the apocalypse demo looks like fun!


Great job guys!
#2
10/30/2009 (4:48 pm)
Super cool!
Thanks for sharing.
#3
10/30/2009 (4:50 pm)
Must... Have... :)
#4
10/30/2009 (4:51 pm)
Looks fantastic. Lots of ideas brewing thanks to this...
#5
10/30/2009 (4:53 pm)
With the way that TGB was setup before, doing a physics integration was a bit tricky. When I ran Gaslight Studios (and a second time while running Cerulean Games), we looked into it a few times, and almost started a full integration of Box2D ourselves. The main thing that stopped us was the fact that an integration that was valid within our timetable would be a physics layer that sat beside TGB's existing physics - then you would set the world (or individual objects, depending on how we did it), if it would use TGB Physics, or Box2D physics. In the end, we just found it to be too costly to do ourselves at that point in time - especially because we knew that the RIGHT way to do it, would be a full-blown integration, which we didn't have the time or budget to do at that time.

That said... watching the video and reading this blog, and knowing what was needed to be done to integrate Box2D, I'm nothing short of impressed. You guys didn't just knock this out of the park - you took out the freakin' moon as well. Massive congratulations! All of us at Cerulean Games are greatly looking forward to this new functionality!
#6
10/30/2009 (4:55 pm)
Looks great! My interest is definitely perked.
#7
10/30/2009 (5:12 pm)
Hey Melv, let me know if you can spare any awesome. It looks like you have a little extra :)
#8
10/30/2009 (5:23 pm)
Wow, that video is just awesome! Can't wait to get my hands on it. I'm really happy to see that joints/chains (w/e they're called in box2d) integrated.

So is it safe to assume that this will all be real-time networking friendly?
#9
10/30/2009 (5:23 pm)
Aweome, I hope it makes it into iT2d post haste!
#10
10/30/2009 (5:33 pm)
Great work, as always, guys :)

I am busting at the seams with excitement.
#11
10/30/2009 (5:45 pm)
Great physics out of the box - now we can drag and drop to make a game :)
#12
10/30/2009 (5:54 pm)
Thats tight.
#13
10/30/2009 (5:58 pm)
Very cool stuff guys. I love the demo at the end which shows all the samples put into a more practical use. Keep up the awesome work.
#14
10/30/2009 (6:24 pm)
THIS IS AWESOME!!! PROBABLY WE WILL USE IN OUR NEW GAME!!!
#15
10/30/2009 (6:29 pm)
FINALLY !!!!
yesss. this is what put me off using Torque, but box2d is fantastic. Other than torque's lame proprietary scripting language this is a must have now
#16
10/30/2009 (6:34 pm)
that has me sold on getting me a copy of T2D when it is released. That is just pure awesomeness.
#17
10/30/2009 (6:53 pm)
Exciting stuff.
#18
10/30/2009 (7:30 pm)
I'm on-board and very much looking forward to this.

Waiting...waiting...is it done yet?....Waiting...
#19
10/30/2009 (7:31 pm)
Great to see that the physics system that bogged TGB down for a long time is finally going to be scrapped.

yeehaaa :)
#20
10/30/2009 (7:31 pm)
Looks good! Will the iPhone be able to handle it?
Page «Previous 1 2 3 4 Last »