Box2D Integration on Google Code
by Michael Woerister · in Torque Game Builder · 01/23/2009 (6:27 am) · 144 replies
Hi all,
as you may or may not know I created a wrapper for Box2D that let's you use it in TGB through script and behaviors. I wrote my bachelor thesis on this topic and now that it got approved I'd like to share the code with the community.
So here is my question to Garage Games: Is it OK if I put code and thesis up on Google Code (or Sourceforge)? It obviously contains some references to TGB's C++ code base and I don't want break the EULA. But having a public Subversion repository there would make it way easier to maintain the resource.
A few bits of information on the wrapper:
- It requires TGB Pro because Box2D is written in C++.
- It does not silently replace TGB's internal physics engine. It has to be used explicitly.
- It allows for binding t2dSceneObjects to Box2D bodies and shapes.
- I tried to make it as usable as possible in the time I had but it's not for sissies ;)
- It's a good idea to read the thesis to get an overview.
So, what do you say?
-Michael
as you may or may not know I created a wrapper for Box2D that let's you use it in TGB through script and behaviors. I wrote my bachelor thesis on this topic and now that it got approved I'd like to share the code with the community.
So here is my question to Garage Games: Is it OK if I put code and thesis up on Google Code (or Sourceforge)? It obviously contains some references to TGB's C++ code base and I don't want break the EULA. But having a public Subversion repository there would make it way easier to maintain the resource.
A few bits of information on the wrapper:
- It requires TGB Pro because Box2D is written in C++.
- It does not silently replace TGB's internal physics engine. It has to be used explicitly.
- It allows for binding t2dSceneObjects to Box2D bodies and shapes.
- I tried to make it as usable as possible in the time I had but it's not for sissies ;)
- It's a good idea to read the thesis to get an overview.
So, what do you say?
-Michael
#2
I attempted rigid body simulation a while back but I couldn't sufficiently test due to some TGB bugs and I moved on. Never got back to it and after I heard about people making great progress integrating other engines I really wanted to see them.
I'm for this! Good work!
01/26/2009 (3:18 am)
Michael, I remember the physics thread where you and Melv were talking about Box2d integration. I was excited to know how your Box2d integration went and I'd be excited to see it / use it.I attempted rigid body simulation a while back but I couldn't sufficiently test due to some TGB bugs and I moved on. Never got back to it and after I heard about people making great progress integrating other engines I really wanted to see them.
I'm for this! Good work!
#3
01/26/2009 (3:38 am)
Wow, this is awesome!
#4
Good to see some interest in this. I am still waiting for a response from GG. In the meantime could you guys keep an eye on some boxes for me? Thanks.
-Michael
01/26/2009 (4:35 am)
Hey folks!Good to see some interest in this. I am still waiting for a response from GG. In the meantime could you guys keep an eye on some boxes for me? Thanks.
-Michael
#5
01/26/2009 (6:50 am)
As per the licensing, I would not recommend putting any TGB code on any publicly accessible server. That doesn't mean that you cannot host a resource here or create a patch file for merging into a vanilla TGB build. The beauty of the patch file is that it would not need to include TGB's source; only references to it. I would love to see this and am sure that Melv and Michael Perry would as well.
#6
- There are a few classes that derive from SimObject.
- There are obviously #include statements for some TGB header files.
But everything is contained in whole new source and header files.
There are only 3 exception that I know of:
1) I describe how to fix a one-line bug in t2dSceneGraph.cc
2) I describe how to modify TGB's tick rate by changing one constant in iTickable.cc
3) I describe how to disable Torque's memory manager but that's already available publicly here: www.garagegames.com/community/resources/view/6790
The source code of the resource consists of 25 files and is roughly 100 pages long if printed out. I don't want to post that as a plain text resource. Yet resources on the site here don't even support attaching files anymore. Couldn't GG provide SVN repositories for selected resources? Or a least bring back file attachments?
-Michael
01/28/2009 (1:06 am)
The resource does only include references to TGB source:- There are a few classes that derive from SimObject.
- There are obviously #include statements for some TGB header files.
But everything is contained in whole new source and header files.
There are only 3 exception that I know of:
1) I describe how to fix a one-line bug in t2dSceneGraph.cc
2) I describe how to modify TGB's tick rate by changing one constant in iTickable.cc
3) I describe how to disable Torque's memory manager but that's already available publicly here: www.garagegames.com/community/resources/view/6790
The source code of the resource consists of 25 files and is roughly 100 pages long if printed out. I don't want to post that as a plain text resource. Yet resources on the site here don't even support attaching files anymore. Couldn't GG provide SVN repositories for selected resources? Or a least bring back file attachments?
-Michael
#7
We have internal SVN's, but managing the CVS repos back in the day was a horrendous process that confused the 90-percentile, sadly. SVN, while more friendly with tools like TortoiseSVN, still confuses a lot of people.
The resources that used to have files associated with them have them back, but currently adding files to resources requires it to be housed externally and linked.
01/28/2009 (6:55 am)
Sounds great since it is all references. A readme should get the rest of the information in a place where people can get it in. Make sure to post the bug fix on the private forum. That way I can get it in my report and Melv and Philip can get ahold of it.We have internal SVN's, but managing the CVS repos back in the day was a horrendous process that confused the 90-percentile, sadly. SVN, while more friendly with tools like TortoiseSVN, still confuses a lot of people.
The resources that used to have files associated with them have them back, but currently adding files to resources requires it to be housed externally and linked.
#8
the original bug report can be found here:
www.garagegames.com/community/forums/viewthread/76427
01/28/2009 (7:26 am)
David,the original bug report can be found here:
www.garagegames.com/community/forums/viewthread/76427
Quote:Is that a "Yes, you can put it on Google Code"?
Sounds great since it is all references.
#9
-nic
01/29/2009 (2:50 pm)
Um, SWEET! Me likey. Now since you are working outside of torque.. I'm guessing you rewrote part of the engine? Also are you using the internal collision system? I'm guessing you are. If not let me know... one thing about collision in TGB I'm not fond of is the Convex shapes requirement. It stifles my innovation often. I'm sure it's done as a function of collision algorithm speed, or maybe it's just really hard to program complex collision shapes... so does it support concave collision shapes?-nic
#10
I do not touch TGB's collision system in any way, it still can be used in parallel with Box2D inside the same scene. This can make sense if you are using triggers for example.
Here is a temporary link to the thesis:
Integrating.Box2D.into.TGB.Michael.Woerister.pdf
Please read the chapters "Motivation" and "Project Goals" to get an idea of what the integration can do and what it can't do.
-Michael
01/30/2009 (1:58 am)
I did not rewrite TGB in any way. My goal was just to make all of Box2D's features available in TGB. This includes being able to have multiple collision shapes per body (which is essentially the same as concave collision shapes).I do not touch TGB's collision system in any way, it still can be used in parallel with Box2D inside the same scene. This can make sense if you are using triggers for example.
Here is a temporary link to the thesis:
Integrating.Box2D.into.TGB.Michael.Woerister.pdf
Please read the chapters "Motivation" and "Project Goals" to get an idea of what the integration can do and what it can't do.
-Michael
#11
Does it work with the last 2.0.2 version of Box2D ?
For TGB Pro owner, where can we find the resources to try your integration ?
I'm dying to play with Box2d inside TGB...
Thanks
02/04/2009 (6:09 am)
What's the current status of that Wrapper ?Does it work with the last 2.0.2 version of Box2D ?
For TGB Pro owner, where can we find the resources to try your integration ?
I'm dying to play with Box2d inside TGB...
Thanks
#12
The 2.0.1 part of the wrapper is stable and has been used in one project since. Not all parts of it have been thoroughly tested but I'm willing to provide bug fixes for any reported errors.
I am still waiting for some official reaction from GarageGames whether I can put the wrapper on some open source platform (since resources on this site don't allow for file attachments anymore).
Please guys, I am trying to provide something here that increases the market value of your product. Completely free of charge. Could you please at least say 'yes' or 'no'?
02/04/2009 (7:26 am)
The wrapper is uses Box2D 2.0.1 - which is the latest version of Box2D I can find. Last time I checked there were only minor additions in Box2D's svn repository on Sourceforge. It shouldn't be very hard to update the wrapper to support these.The 2.0.1 part of the wrapper is stable and has been used in one project since. Not all parts of it have been thoroughly tested but I'm willing to provide bug fixes for any reported errors.
I am still waiting for some official reaction from GarageGames whether I can put the wrapper on some open source platform (since resources on this site don't allow for file attachments anymore).
Please guys, I am trying to provide something here that increases the market value of your product. Completely free of charge. Could you please at least say 'yes' or 'no'?
#13
Melv.
02/04/2009 (8:02 am)
I've sent you an email separately. I'll get you an answer on this ASAP.Melv.
#14
The answer on the hill is quite simply that as long as source files from TGB are not uploaded (references by #includes are okay) then you're good to go.
If you have any other specific questions then please email me and I'll turn you an answer around pretty quickly.
Melv.
02/04/2009 (11:12 am)
Michael,The answer on the hill is quite simply that as long as source files from TGB are not uploaded (references by #includes are okay) then you're good to go.
If you have any other specific questions then please email me and I'll turn you an answer around pretty quickly.
Melv.
#15
I'll set up a project page on Google Code first thing tomorrow morning.
-Michael
02/04/2009 (11:33 am)
That's great news! Thanks, Melv.I'll set up a project page on Google Code first thing tomorrow morning.
-Michael
#16
code.google.com/p/tgb-box2d-integration/
The latest code can be found in the repository. At the moment the code targets Box2D 2.0.1. This is the latest downloadable package of Box2D.
There are quite a few changes in Box2D's repository that are not supported by the wrapper. I will probably not keep the wrapper up-to-date with all minor changes of Box2D but I plan to update the wrapper as soon as there is a new major version of Box2D.
I created a branch in the repository called "2.0.1". This branch will always target version 2.0.1 of Box2D, even when the wrapper in "trunk" has moved on to newer versions of Box2D. This branch will also receive bug fixes. So if you plan to use Box2D 2.0.1 and stick with it, it's best to check-out this branch instead of trunk.
The readme.txt file contains installation instruction. I've successfully compiled the resource with Visual Studio 2005 Professional, Visual Studio 2008 Professional, and Visual C++ 2008 Express. I don't have a Mac so I can't test it there.
You can take a look at the sample code and the "Setting up an example scene" chapter of the thesis to get an idea of how to use the whole thing. I will probably write a small FAQ later that covers the most common scenarios. If you have any specific questions just post here on the forums I'll try to answer them.
Please create a report on the project's issue tracker if you discover a bug.
-Michael
02/06/2009 (5:00 am)
I've set up the project on Google Code. It can be found here:code.google.com/p/tgb-box2d-integration/
The latest code can be found in the repository. At the moment the code targets Box2D 2.0.1. This is the latest downloadable package of Box2D.
There are quite a few changes in Box2D's repository that are not supported by the wrapper. I will probably not keep the wrapper up-to-date with all minor changes of Box2D but I plan to update the wrapper as soon as there is a new major version of Box2D.
I created a branch in the repository called "2.0.1". This branch will always target version 2.0.1 of Box2D, even when the wrapper in "trunk" has moved on to newer versions of Box2D. This branch will also receive bug fixes. So if you plan to use Box2D 2.0.1 and stick with it, it's best to check-out this branch instead of trunk.
The readme.txt file contains installation instruction. I've successfully compiled the resource with Visual Studio 2005 Professional, Visual Studio 2008 Professional, and Visual C++ 2008 Express. I don't have a Mac so I can't test it there.
You can take a look at the sample code and the "Setting up an example scene" chapter of the thesis to get an idea of how to use the whole thing. I will probably write a small FAQ later that covers the most common scenarios. If you have any specific questions just post here on the forums I'll try to answer them.
Please create a report on the project's issue tracker if you discover a bug.
-Michael
#17
I tried out your demo and downloaded the paper. The demo is a blast to toy with and is rock solid! Very impressive and congratulations on your thesis.
I plan on going through the doc's this weekend. Thanks for sharing!
ps... I noticed some oddness when dragging outside of the window when a block was selected. It's not really a physics issue, but I'll report it if you're interested.
Patrick
02/06/2009 (7:54 am)
Michael,I tried out your demo and downloaded the paper. The demo is a blast to toy with and is rock solid! Very impressive and congratulations on your thesis.
I plan on going through the doc's this weekend. Thanks for sharing!
ps... I noticed some oddness when dragging outside of the window when a block was selected. It's not really a physics issue, but I'll report it if you're interested.
Patrick
#18
Michael, i'm unfamiliar w/ google code;
does it have an area for discussion,
and if so would you prefer discussion to happen here or on GC ?
in particular,
i'm looking at pyramid.t2d and it strikes me that it's a little bit of a bummer that each t2dShapeVector needs an explicit mountID. is that a feature of T2D or something introduced by the B2D integration ? hm, i don't see it in a very quick perusal of the source, so maybe it's a T2D thing.
02/06/2009 (10:11 am)
very very nice.Michael, i'm unfamiliar w/ google code;
does it have an area for discussion,
and if so would you prefer discussion to happen here or on GC ?
in particular,
i'm looking at pyramid.t2d and it strikes me that it's a little bit of a bummer that each t2dShapeVector needs an explicit mountID. is that a feature of T2D or something introduced by the B2D integration ? hm, i don't see it in a very quick perusal of the source, so maybe it's a T2D thing.
#19
02/06/2009 (10:19 am)
ah, n/m, i see that it runs just fine without mountIDs at all.
#20
02/06/2009 (11:30 am)
Quote:No, that's not so important. It's a problem with the testbed and mouse callbacks, not the wrapper itself. I might fix that some time but that's pretty low priority.
ps... I noticed some oddness when dragging outside of the window when a block was selected. It's not really a physics issue, but I'll report it if you're interested.
Quote:Google Code only provides the issue tracker and the subversion repository. So please use the forums here at GG.
...would you prefer discussion to happen here or on GC ?
Quote:Yeah, that's just something that TGB does.
ah, n/m, i see that it runs just fine without mountIDs at all.
Torque Owner Kevin James
Actually, this is TOTALLY AWESOME! I love you. I definitely think that GG will require you to post the code in the private forums, unless perhaps they are willing to preview what you what to post to Google.
This is pretty much my wildest dreams come true.
You da man.