Thought for the Dazed

I've had to give up that Distance Learning course as I was having trouble seeing the teacher.

Flickr
www.flickr.com
RobMiles' items Go to RobMiles' photostream
Twitter
C# Yellow Book

Search entire site
« Jenny’s Abseil | Main | Windows Phone 7 Pelmanism »
Friday
Aug132010

Windows Phone Graphics Speedup with BEPUphysics

 

The folks at BEPU have made a wonderful 3D physics engine for XNA on Windows Phone. You can see it in action  above.

And they’ve now ported it onto Windows Phone. I’ve downloaded the demo software onto my device and initially it ran rather slowly. However, Windows Phone has a lovely trick which makes it unique amongst mobile devices. You can set the display resolution to a lower value and hardware autoscales it to fit the screen of the device.  This is great for two reasons:

  • It means you no longer have to write games to fit a particular screen size
  • You can get a performance hike by rendering to a smaller screen and having it scaled up

You set the resolution that you want in the constructor of your game object in the XNA game. I asked for the lowest resolution:

// Pre-autoscale settings.
graphics.PreferredBackBufferWidth = 240;
graphics.PreferredBackBufferHeight = 400;

I had to do some fiddling with the display to make the buttons work (you can find out more here) but the result was a physics display that looked lovely (and only a tiny bit blurred).

If you want to get your hands on some ready made 3D physics (with very generous licensing terms)  then you should head over to BEPU.

If you want to speed up your XNA game on Windows Phone (or make it future proof as far as resolution is concerned) then you should start using the settings above.

Reader Comments (4)

Could you run the latest Matali Physics for XNA on Windows Phone device and share experiences?
August 16, 2010 | Unregistered Commenterwp7
very useful post, you saved my life :-)
August 19, 2010 | Unregistered CommenterJesús Bosch
Hi. I tried to run the Matali Physics on the phone and it doesn't run. I think you may be using some unmanaged versions of the maths library that work fine on the emulator but not on the device itself.
August 23, 2010 | Registered CommenterRob
Hi, Matali Physics engine and the demo for WP7 are written in fully managed codes and don't use unmanaged elements. I think that the cause of the problem on the real device are security settings for the engine code (code obfuscation) but that, we can check after our tests on real devices. Currently, the engine and the demo were only tested on the WP7 emulator. Thank you for the first test on a real device and posting this comment. Best regards
August 23, 2010 | Unregistered CommenterSlawomir Koziol (Komires)

PostPost a New Comment

Enter your information below to add a new comment.
Author Email (optional):
Author URL (optional):
Post:
 
All HTML will be escaped. Hyperlinks will be created for URLs automatically.