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
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.

Thursday
Aug122010

Windows Phone 7 Pelmanism

image

Spent some of today converting an old XNA version of Pelmanism to run on Windows Phone 7. It was actually very easy, particularly once I started using the gesture support in XNA 4.0 With that I could  just pick up tap events and use them in the program to select matching tiles.

At the moment the game uses 50 different images which I had originally scaled for an Xbox 360. This gave me a game size of 16Mb, which is quite large for Windows Phone game. But it downloaded to the device and ran quite happily. I’ve resized the pictures now and taken 10M off the size.

Next step is to use Flickr images from the new FlickrNet API that makes it easy to pull images onto the phone.

Thursday
Aug122010

How a Programmer Reads your Resume

This is brilliant.  And true.

Wednesday
Aug112010

Unblocking Files from the Internet

image

Sometimes you get a file from the internets, or in an email, which you actually trust. Thing is, Windows doesn’t. This can result in fun and games when you try to use this file or, if it is an archive, files from the archive.

As an example, I downloaded the TouchGestureSample from the Creators Club and I don’t want any messages about un-trusted files in Visual Studio 2010.

Solving this is actually quite easy (and best done before you remove the files from the archive). Right click on the item and then click Unblock to say that you trust this file.

(of course, if you do this with dangerous files it might not have a happy ending)

Tuesday
Aug102010

Getting Diagnostic Output from your Windows Phone programs

Birthday Phone

It is often very useful to find out what your programs are doing. You can put breakpoints into your code, but sometimes you just want print messages. If you are writing Windows Phone apps this is very easy, but it doesn’t use the Console.WriteLine that you might be used to. You can get messages from your Windows Phone program (even when it is running in the device) by using:

System.Diagnostics.Debug.WriteLine ("Your Message Here ");

The output appears in the Output window in Visual Studio 2010  (remember to ask it to show you output from the Debug stream). The best way to control debug output is to use conditional compilation to switch your debug statements on and off:

// Put this at the top of the program to turn debugging on
#define Debug

#ifdef Debug
System.Diagnostics.Debug.WriteLine ("Debug Message Here ");
#endif