Box2D Forums

It is currently Thu Oct 30, 2014 11:04 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 88 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9  Next
Author Message
 Post subject: Re: C# port of Box2D.
PostPosted: Mon Aug 04, 2008 12:07 pm 
Offline

Joined: Sat Jun 28, 2008 1:32 pm
Posts: 4
Location: Cambridge, UK
Nikster wrote:
ivailo91 wrote:
I don't know if this is the right place to ask, but...
As I look at the Box2DX source code, I'm just wondering, there are so many functions that accept for example Vector2 parameters. These functions don't actually modify the Vector2's or anything, but yet they don't use the ref keyword. A simple observation can point you that there is significant speedup with ref's even with so simple types...


1) if they don't modify the values why the need for ref ?
2) In my bench tests, using by value is slightly faster over a million iterations, this is OK for Vector2 as the size of it fits in well how the IL works, anything lower than 16-24 bytes (can't remember which) should have no performance difference than by passing by value or ref, I'd like to see proof otherwise to which you came to your conclusions or a citation to your observation, C++ != c# so don't assume they work the same way when passing by ref.

*snip*

EDIT: you can also change from structs to classes if you think it will make a difference.


If you're passing structs around by value, then the values need to be copied (a new struct is created and the values copied across), but if you pass by ref, then a reference to the original struct is passed, meaning that you don't incur the overhead of the copying. I wouldn't make these sorts of changes without actually measuring the performance difference.
Also, prior to the .NET 3.5 SP1 (coming around the corner), methods that took structs as parameters weren't as optimised as they could be (see http://blogs.msdn.com/vancem/archive/20 ... 5-sp1.aspx).


Top
 Profile  
 
 Post subject: Re: C# port of Box2D.
PostPosted: Sat Sep 20, 2008 5:02 pm 
Offline

Joined: Sat Sep 20, 2008 5:00 pm
Posts: 7
First of all, thank you for this port! I just recently found Box2D, and directly thought "it would be great if there were a C# version". And it was! Really glad to find it =)

How complete is this port considered to be?

Thanks!


Top
 Profile  
 
 Post subject: Re: C# port of Box2D.
PostPosted: Tue Oct 07, 2008 2:51 am 
Offline

Joined: Thu Feb 28, 2008 5:20 am
Posts: 24
Hi All! Sorry for the long absence.
I'm very glad to inform that I start updating Box2DX to the latest Box2D version, after I'm planning to perform refactoring and make performance better. Also a few reported issues were fixed (see http://code.google.com/p/box2dx/issues/list?can=1&q=&colspec=ID+Type+Status+Priority+Milestone+Owner+Summary&cells=tiles), and Broadpahse test was enabled in Testbed.

P.S.

Erin, thanks a lot for the Box2D!!! It's amazing physics engine!!! :)
Thanks ALL for interest to my port.


Top
 Profile  
 
 Post subject: Re: C# port of Box2D.
PostPosted: Tue Oct 07, 2008 10:40 am 
Offline

Joined: Mon Sep 17, 2007 4:30 am
Posts: 40
Location: appleton, wi
Great!

Welcome back... I had about given up on you.

I'm running some tests with your engine right now in Silverlight. Good to hear you are going to be updating it again.

-Jeff


Top
 Profile  
 
 Post subject: Re: C# port of Box2D.
PostPosted: Tue Oct 07, 2008 10:47 am 
Offline

Joined: Mon Sep 22, 2008 1:49 pm
Posts: 12
Location: Seattle, WA
Ah, he lives!

I'm working on renderers for WPF and Silverlight. The WPF version is pretty complete (but I still need to port the test bed), and the Silverlight version is coming along. The WPF version is shown here: http://stimulant.io/wp/index.php/2008/1 ... e-surface/

I plan to open-source these, but I'll probably need 2-3 weeks to get things into a releasable state.


Top
 Profile  
 
 Post subject: Re: C# port of Box2D.
PostPosted: Sun Oct 12, 2008 8:22 pm 
Offline

Joined: Mon Sep 22, 2008 1:49 pm
Posts: 12
Location: Seattle, WA
I finished a first version of a Box2d wrapper for Silverlight, and am now moving onto making the testbed for both WPF and Silverlight. I thought I'd update to the latest box2dx rev first, though. I'm noticing a few cases of the "unsafe" keyword being used for pointers in the Broadphase class. This is fine in WPF, but VS will now allow the compilation of unsafe code in a Silverlight project. Is there a way for box2x to provide safe versions of any unsafe methods, and is there a compiler flag or something that would allow the code to compile correctly for Silverlight?


Top
 Profile  
 
 Post subject: Re: C# port of Box2D.
PostPosted: Mon Oct 13, 2008 1:56 am 
Offline

Joined: Thu Feb 28, 2008 5:20 am
Posts: 24
Quote:
Is there a way for box2x to provide safe versions of any unsafe methods, and is there a compiler flag or something that would allow the code to compile correctly for Silverlight?


Hi! Please use ALLOWUNSAFE (in Broadphase.cs) directive for this. Safe and unsafe equivalents of QuerySegment and AddProxyResult methods were tested on new Raycast Test in TestBed.


Top
 Profile  
 
 Post subject: Re: C# port of Box2D.
PostPosted: Wed Oct 15, 2008 7:30 am 
Offline

Joined: Thu Feb 28, 2008 5:20 am
Posts: 24
Updating to Box2D r175 has been finished - r51. Updated demo suite is available here http://box2dx.googlecode.com/files/Box2DX-2.0.1.3-r175-RC-DemoSuite.zip.


Top
 Profile  
 
 Post subject: Re: C# port of Box2D.
PostPosted: Wed Oct 15, 2008 2:59 pm 
Offline

Joined: Mon Sep 17, 2007 4:30 am
Posts: 40
Location: appleton, wi
Hi Ihar,

I just tried to run the new demos behind the link you provided. They would not run for me.

I'm using Vista.

Just thought I'd let you know.


Top
 Profile  
 
 Post subject: Re: C# port of Box2D.
PostPosted: Wed Oct 15, 2008 11:51 pm 
Offline

Joined: Thu Feb 28, 2008 5:20 am
Posts: 24
Thanks a lot! There is problem with drawing text using freetype6. I'm going to fix this ASAP.


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

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


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