Box2D Forums

It is currently Tue Jul 22, 2014 12:18 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 51 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next
Author Message
PostPosted: Tue Apr 08, 2008 6:36 am 
Offline

Joined: Sun Nov 25, 2007 1:43 pm
Posts: 36
Yes, I understood that there is logic error after my own exploration. I fixed this.

It's a pity, but I failed to test MCSV2008 build.
Code:
Traceback (most recent call last):
  File "E:\tttt\test_framework.py", line 3, in <module>
    import Box2D2
  File "E:\tttt\Box2D2.py", line 6, in <module>
    import _Box2D2
ImportError: DLL load failed: This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem.

EDIT: I've downloaded VC2008 redist and after that it worked. Result was the same as for mingw build.

Also I found that the problem is not only in performance. Simulation is not as accurate as in c++ program. When I load Pyramid test in testbed with same options (enablePositionCorrection, enableWarmStarting, enableTOI, deltaT = 1/60.0, iterations = 10) it all objects begin to sleep very soon, but in python they move slightly and pyramid falls (look at the screenshot).


Attachments:
test_framework.zip [2.02 KiB]
Downloaded 5657 times
bad_pyramid.png
bad_pyramid.png [ 29.44 KiB | Viewed 5831 times ]
Top
 Profile  
 
PostPosted: Tue Apr 08, 2008 9:24 am 
Offline
Site Admin

Joined: Thu Sep 06, 2007 12:34 am
Posts: 2946
This might the bug with needing to have a contact listener for warm starting to work. This is fixed in SVN.


Top
 Profile  
 
PostPosted: Wed Apr 09, 2008 1:11 am 
Offline

Joined: Sun Nov 25, 2007 1:43 pm
Posts: 36
Erin Catto wrote:
This might the bug with needing to have a contact listener for warm starting to work. This is fixed in SVN.

Yes. I added contact listener and it worked.


Attachments:
test_framework.zip [1.97 KiB]
Downloaded 4591 times
Top
 Profile  
 
PostPosted: Mon Apr 14, 2008 3:47 am 
Offline

Joined: Sun Nov 25, 2007 1:43 pm
Posts: 36
I updated my python mini TestBed.
Now it can draw everything. Also test can react on keyboard input. And test is in seperate module from framework. For now only one test at one time is supported, it should be located in 'mytest.py' file.
I'm going to improve it, but this version is already usable.


Attachments:
test_framework.zip [2.8 KiB]
Downloaded 3558 times
Top
 Profile  
 
PostPosted: Thu Apr 17, 2008 4:41 am 
Offline

Joined: Mon Feb 18, 2008 12:30 am
Posts: 88
Nice work, roman_m. Looking good. :)

Here's the first version of the wrapper for 2.0.1:

Python Bindings 2.0.1r1 --
Usage here on the wiki: http://www.box2d.org/wiki/index.php?tit ... ith_Python
Download here: http://pybox2d.googlepages.com/

As it mentions on the page, let me know if any of you see a difference with the MSVC version -- perhaps the changes Erin made to the solution sped it up a bit? If not, the MinGW builds are faster and more convenient for me, so I'll stop making the MSVC builds.


Top
 Profile  
 
PostPosted: Tue Apr 22, 2008 4:39 am 
Offline

Joined: Sun Nov 25, 2007 1:43 pm
Posts: 36
I do not see any difference between mingw and MSVC build.
Performance is still bad.

In new release SetListener does not work. May be this is because of changes in box2d itself, but then, there is an error in wiki.
Also something changed with s_enablePositionCorrection, s_enableWarmStarting, s_enableTOI.

I quick updated test framework to work with new release. No other changes were made.


Attachments:
test_framework.zip [2.8 KiB]
Downloaded 3697 times
Top
 Profile  
 
PostPosted: Tue Apr 22, 2008 5:34 am 
Offline

Joined: Mon Feb 18, 2008 12:30 am
Posts: 88
Sorry, I didn't update the wiki as completely as I should have. These changes should have been apparent if you read the Box2D 2.0.1 updates, however.

SetListener is now Set*Listener (for the contact listener, SetContactListener).
Look a bit further and you'll see that the previously static variables (s_enableTOI/etc) have now become these functions:

Code:
   /// Enable/disable warm starting. For testing.
   void SetWarmStarting(bool flag) { m_warmStarting = flag; }

   /// Enable/disable position correction. For testing.
   void SetPositionCorrection(bool flag) { m_positionCorrection = flag; }

   /// Enable/disable continuous physics. For testing.
   void SetContinuousPhysics(bool flag) { m_continuousPhysics = flag; }

So, world.SetWarmStarting(True) and so on instead of your cvars.s_enableWarmStarting = True .

In my own tests, the python code hasn't been terribly slow. It's perfectly usable, in my opinion.


Top
 Profile  
 
PostPosted: Wed Apr 23, 2008 1:28 am 
Offline

Joined: Thu Mar 13, 2008 9:27 am
Posts: 30
hey,

here python code is actually running quite quick -- even on "lower performance machines" like the olpc xo laptop with 433 mhz and 256 mb ram.
see for example speed tests on the xo laptop and the elements project.

best,
- chris


Top
 Profile  
 
PostPosted: Wed Apr 23, 2008 6:01 am 
Offline

Joined: Sun Nov 25, 2007 1:43 pm
Posts: 36
kne wrote:
In my own tests, the python code hasn't been terribly slow. It's perfectly usable, in my opinion.

May be the slowdown is because of DebugDraw and it's callbacks... I'll try to implement drawing without debugdraw.


Top
 Profile  
 
PostPosted: Wed Apr 30, 2008 1:10 am 
Offline

Joined: Mon Feb 18, 2008 12:30 am
Posts: 88
In case you haven't seen it yet, I've ported the Box2D testbed and tests to Python:
http://www.box2d.org/forum/viewtopic.php?f=6&t=791 (Game and Applications forum)

There's also what will now be the standard Win32 installer there to make the process easier.
I also moved the homepage to code.google.com and released 2.0.1b2 here:
http://code.google.com/p/pybox2d/


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 51 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next

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® Forum Software © phpBB Group