Box2D Forums

It is currently Fri May 24, 2013 5:28 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Sun Jun 17, 2012 2:47 pm 
Offline

Joined: Mon Apr 19, 2010 5:35 am
Posts: 4
Hi everyone,

I have problem, that I can't solve for about one week now...
I have swf with box2d platform game. Stage size is about 500x400. Runs perfect, performance is ok.
When I load this swf to flas website, with size about 1000 x 800 it slows down extremely..:(
The game runs extremely slow, takes about 85% CPU... Please help, what could be the solution for this?


Top
 Profile  
 
PostPosted: Sun Jun 17, 2012 6:24 pm 
Offline

Joined: Sun Oct 25, 2009 3:28 am
Posts: 242
Unless you're using Box2D's debug draw, I don't think the lag is caused by Box2D. How is the screen being drawn? Do you move sprites around, or is it being redrawn every frame? What is the scale mode of the stage?

To check if it's Box2D's fault, you should use flash.utils.getTimer() before and after the world.Step(), get the difference between the values, and trace it. Something like this:

Code:
var beforeStep:int = flash.utils.getTimer(); //this is in milliseconds
world.Step(dt,velIter,posIter);
trace("step duration: " + (flash.utils.getTimer() - beforeStep));


If the traced time is higher than your fixed time step that you use to update the world, then it may be a problem that's related to the physics side of Box2D (the bodies, the fixtures, the collisions, or something). If you're using Box2D's debug draw, you should try to do the same thing as above and see if the drawing takes a long time.


Top
 Profile  
 
PostPosted: Mon Jun 18, 2012 7:34 am 
Offline

Joined: Mon Apr 19, 2010 5:35 am
Posts: 4
Thank you for your reply. I will try, page is full screen, and I thought it can cause the problem. But I noticed, that whenever I load game to swf with bigger stage, it always slows down :/.


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

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: Exabot [Bot] and 3 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® Forum Software © phpBB Group