Box2D Forums

It is currently Mon Sep 06, 2010 10:16 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Box2D Symbian
PostPosted: Sat Feb 23, 2008 10:56 am 
Offline

Joined: Wed Oct 24, 2007 12:14 pm
Posts: 38
As a project for school I ported Box2D to Symbian and created a simple demo.
I recorded a video: http://www.n-joy.cz/#/video/box2d-symbian/r5wyddh3ievp14lf/
At first I wanted to create some vehicle demo, but I was not able to make it stable and fast...

It runs at 25Hz, 10 iterations. One simulation step takes 15ms when using fixed-point numbers and 25ms when using floats. So, it is definitely usable for Symbian phones.
However, it is still a lot slower then my (very simple and stupid) J2ME engine, but resulting simulation is far better :)

The porting was pretty straightforward thanks to Erin's good work. It helped a lot that he didn't use STL. Now it is enough to simply copy all the sources into the folder and it compiles and runs on emulator:)

BUT. Because Symbian on AMR processors doesn't support global data (and it means also static variables in classes and functions), I had to do a lot dirty things into the source code to make it work :(
I enclosed the changes into
//SYMBIAN
...
//~SYMBIAN
marks, so maybe there could be some automated way to make some kind of patch.
Or maybe Erin could rewrite his code that he does not use static and global data anymore :D

I also made some changed regarding fixed-point numbers, these are marked with
(already in patch by 0xtob)
//HARDWIRE
...
//~HARDWIRE
and
(new changes)
//HARDWIRE2
...
//~HARDWIRE2


You can download it here (project for Carbide C++): http://www.hardwire.cz/download/B2Test_Symb.zip


Top
 Profile  
 
 Post subject: Re: Box2D Symbian
PostPosted: Sat Feb 23, 2008 12:14 pm 
Online
Site Admin

Joined: Thu Sep 06, 2007 12:34 am
Posts: 2226
Cool! I'm guessing the main issue is the contact registers. This shouldn't be too hard to make non-global.

Unfortunately I can't support the Symbian port in the main tree. Otherwise there would be an explosion of platform specific stuff: Symbian, DS, GP-32, etc.


Top
 Profile  
 
 Post subject: Re: Box2D Symbian
PostPosted: Sat Feb 23, 2008 1:52 pm 
Offline

Joined: Wed Oct 24, 2007 12:14 pm
Posts: 38
Erin Catto wrote:
Cool! I'm guessing the main issue is the contact registers. This shouldn't be too hard to make non-global.

Not at all, I avoided contact register by simply creating few functions with switch statements which return the same things as are in the registers.
The biggest problem were two static variabiles in b2World, s_enablePositionCorrection and s_enableWarmStarting because I had to give it as a parameter to each function which used it.
And also ZERO vector and identity matrix caused some troubles because when I used fixed-numbers I emulated them by Fixed class...and even when the ZERO vector was constant instance of the Fixed class it was still global data :/

Erin Catto wrote:
Unfortunately I can't support the Symbian port in the main tree. Otherwise there would be an explosion of platform specific stuff: Symbian, DS, GP-32, etc.

I see, but all what has to be done to make it work is not to use static and global variables :)
But I certainly know you have many other things in your TODO list :)

BTW it is really very well written, I expected much much bigger troubles!


Top
 Profile  
 
 Post subject: Re: Box2D Symbian
PostPosted: Sat Feb 23, 2008 3:05 pm 
Online
Site Admin

Joined: Thu Sep 06, 2007 12:34 am
Posts: 2226
Quote:
I see, but all what has to be done to make it work is not to use static and global variables


Ok, I added this to the TODO list.

If you'd like to tackle this after 2.0 comes out, I'll accept a patch.


Top
 Profile  
 
 Post subject: Re: Box2D Symbian
PostPosted: Mon Apr 06, 2009 2:06 pm 
Offline

Joined: Mon Apr 06, 2009 2:03 pm
Posts: 1
Well, I just got around to doing a port of this nice-looking library with your latest version to S60 5.0.

The nice part is it just compiles and runs (on the emulator) with no problems. It took me about 20 minutes to generate the Symbian project machinery and port the helloworld executable. I think I should be OK for static variables now too, the rules have relaxed a little on this platform in recent years.

Does anyone know how I can tell if the output from helloworld is correct?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group