Hello from DevDays 2010

Base Camp in the Tech Days 2010 Speakers Lounge
Setting up for Geek Night tonight. I just love those groovy chairs. Yes, that is a Windows Phone on the desk. And a robot…

It turns out that writing code in airports at 5:00 am actually works sometimes. I was able to get a new version of my program working and even find the source of all my hardware troubles. A dodgy network cable……

My first session is at 3:05 this afternoon, if you are at DevDays 2010 in the Netherlands then feel free to drop along and see more demos than you could shake a stick at…

For those of you not at the conference, I’ll be putting all the sample code and the presentation up on here later today.

Some Days Nothing Works

Daffs

I spent a big chunk of today making things not work. It was as if the god of “Things Not Working” decided to pay me a special visit. It was all really annoying, in that the emulations all worked fine, but the real thing failed in the strangest of ways.  In the end I was reduced to opening the fridge door and watching the light come on, just because I wanted to see some hardware that did the right thing…..

Windows Phone Imagine Cup Competition

logo

Oh to be young again. Students writing XNA or Sliverlight programs (including ones in the First Year at Hull who are turning out very good looking games for their coursework) can now take part in a development competition which is part of the Imagine Cup. The closing date is 24th May, which gives you plenty of time to work up something special. All the entrants who make it to the World Finals in Poland will get a Windows Phone. Lucky people.

Find out more here:

I wonder if they want any help with the judging….

Cletus Clay Rocks

4463053968
Cletus Clay, in the flesh at Platform 2010

Yesterday at Hull Platform 2010 we had a really good talk from Sarah Web who told us all about Cletus Clay, a new videogame which is being made using “Claymation” animation. This looks absolutely fantastic, with lots of down home humour and cow abducting aliens. You can find out all about Cletus, and even discover how to build some of the game characters yourself at http://www.cletusclay.com/

I am definitely going to get a copy of this game when it comes out…

Hull Platform 2010 Fun and Games

Did a talk today at Hull Platform 2010. This was the first of what will be an annual event bringing together game developers and expertise.

4462282531
This picture was taken during my presentation. I hope I wasn’t going too fast for everyone…

4462268483
Jon Purdy hits the stage

4462266513
Two minutes into Darren’s presentation….

I had great fun and you were all a wonderful audience. I also got to judge the two competitions that they ran, which was also very interesting, with a high standard of entries. During my talk I said I’d put some resources up on the network for you, as it takes a long time to write these down. So, here they all are.

You can get my presentation, along with the XNA games that I showed during the talk, here:

https://static.squarespace.com/static/5019271be4b0807297e8f404/52c5bcfce4b0c4bcc9121347/52c5bd02e4b0c4bcc9123749/1269541761004/Rob%20Miles%20at%20Platform%202010.zip

To compile and run your C# game programs you will need a development environment. This is where you write the code and run it. You can get free versions of the Microsoft Visual Studio tool for the Windows PC  from:

http://www.microsoft.com/express/

If you want to write C# programs you just go for the C# version of Visual Studio. It takes a while to download, but it is worth waiting for…

If you want to write games you can then add the XNA framework which provides a set of resources for both 2D and 3D games. The framework is currently at version 3.1. You add this to your installation of Visual Studio and you can get the framework from:

http://creators.xna.com/en-US/downloads

If you are a student (and have an Athens account to prove it) you can get free copies of the professional versions of Visual Studio (and lots of other free stuff too) from Microsoft Dreamspark:

http://www.dreamspark.com/

I’ve written a Microsoft Press book which teaches programming using XNA games. You can buy it from Amazon here. You can also obtain a free PDF download of this from the Microsoft Faculty Site here:

http://www.facultyresourcecenter.com/curriculum/pfv.aspx?ID=8119

There is no need to actually sign up for faculty resource membership, you can skip that step. However, if you are a teacher or lecturer you can sign up for membership and get all kinds of good stuff, including an entire programming course based on the book content. The process is a bit of a faff (you have to send them something to prove you are a proper teacher) but it is well worth the effort as you get some valuable resources including free XNA Creators Club membership. This makes it possible for your students to put their games up on the Xbox Indie games site for anyone to download and play via Xbox Live.

If you want a free copy of our C# text book (the same one we teach our students from) you can download it in PDF form from:

http://www.csharpcourse.com

I’ve recorded a bunch of screencasts that cover how to get started writing XNA games. The episodes are available from Thirteen One, which is a Hull based gaming magazine. You can find all the screencasts up to now in my index at VerySillyGames:

http://verysillygames.com/Screencasts

If you want advice on getting started in the games (or any other) business you might find it useful to talk to the Enterprise Centre at the Univesity:

http://www.hull.ac.uk/enterprise

 

SoundEffects in Windows Phone Silverlight

Buildings

Silverlight in Windows Phone is a great place to write games. I’m having to pick up a whole bunch of new skills but I reckon that it is well worth the effort. One piece of effort that I’ve had to put in is on playing sounds. It turns out that you use the SoundEffect class from XNA to get the sounds out of your games.

The first step is to add the XNA libraries to your game. Open up the References tab in your project and add the Microsoft.XNA.Framework reference.

Now add a couple of using statements to your program to make the XNA classes easier to get hold of:

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;

The sound you want to play has to be added to your project. You don’t use the Content Manager in Silverlight though, as there isn’t one.  Instead you add the item as content. Make sure that the build action for the resource is set to Content. As with old school XNA, a SoundEffect can be wav file. I just dropped a beep file into the root level:

image

You can also see here that I’ve loaded the framework. Now I can load the SoundEffect in my game:

SoundEffect beep =
             SoundEffect.FromStream(TitleContainer.OpenStream("beep.wav"));

The static FromSteam method will fetch the effect from a stream. The TitleContainer object fills in for the Content Manager in XNA. If you want to put your sounds into a folder you can, but you must give the path (separated using the / character)

image

Sounds folder as part of the project

SoundEffect beep =
   
SoundEffect.FromStream(TitleContainer.OpenStream("Sounds/beep.wav"));

Now I can play my beep sound in the usual way:

beep.Play();

This is the boring form of the Play method call. You can also control the volume, pitch and left-right panning of the sound as well:

beep.Play(
    0.5f,   // half volume
    1.00f,   // one octave higher (-1 is 1 octave lower)
    -1.0f); // on the left (+1 is the right)

Actually, I’ve noticed what might be a problem here. The documentation says that the pitch value goes from –1 (one octave lower) to 1 (one octave higher). This used to work fine when I used XNA 3.1.  When I go for pitches greater than 0.6 I get really weird sounds. I’m not sure why this is, but I’m trying to find out.

Windows Phone Accelerometer Support in XNA

Signs

There is no native XNA support for the accelerometer in Windows Phone. It seems to have been moved into a different sensors class. I hope it doesn’t stay there. The accelerometer support in the Zune HD is fantastically easy to use and well in keeping with the other inputs.

I’ve written a tiny wrapper class that implements the accelerometer using the new sensor interface, but I really think this should really be put back into XNA, as event driven stuff really doesn’t sit well with the XNA philosophy of polling:

public class AccelerometerState
{
    public Vector3 Acceleration;

    public AccelerometerState()
    {
    }
}

public class Accelerometer
{
    static Accelerometer()
    {
        AccelerometerSensor.Default.ReadingChanged +=
            new EventHandler<AccelerometerReadingAsyncEventArgs>
                     Default_ReadingChanged);
    }

    static AccelerometerState state = new AccelerometerState();

    static void Default_ReadingChanged(object sender,
                                      AccelerometerReadingAsyncEventArgs e)
    {
        state.Acceleration.X = (float)e.Value.Value.X;
        state.Acceleration.Y = (float)e.Value.Value.Y;
        state.Acceleration.Z = (float)e.Value.Value.Z;
    }

    public static AccelerometerState GetState()
    {
        return state;
    }
}

You need to add the Microsoft.Devices.Sensors library to your References to make this work.

While writing this I tried to use keyboard input to simulate the accelerometer, and I found that there is no XNA keyboard support in the emulator, which is fair enough I suppose (although I’d like it really).

It does really weird things in the debugger though, I got all kinds of strange readings if I tried to find out what keys are pressed at a breakpoint when using the immediate mode window.

Of course, I’ve not been able to try this on  a real device (I wish) but if anyone out there does I’d love to know if it works or not.

Windows Phone Resources

TechnoMart

 

If you want to get started on Windows Phone development I strongly recommend that you take a look at the videos from Mix. They are very well presented and easy to view on your PC. There is even an HD version of each one.

http://live.visitmix.com/MIX10/Sessions/CL01 – a good introduction to Windows phone and why it is the way it is

http://live.visitmix.com/MIX10/Sessions/CL13 – a good overview of the windows phone and how you build and deploy applications

http://live.visitmix.com/MIX10/Sessions/CL16

http://live.visitmix.com/MIX10/Sessions/CL17 – these two sessions give a very good introduction to Silverlight development on the phone

http://live.visitmix.com/MIX10/Sessions/CL21 – how to use XNA to build games

http://live.visitmix.com/MIX10/Sessions/CL18 – a nice in-depth description of how the phone works internally

You can get the SDK for Windows Phone here.

You can get the first six chapters of the new book from Charles Petzold on Windows Phone development here.

The forums for Windows Phone developers (which are very well staffed with knowledgeable Microsoft moderators) are here.

There is now a Programming Guide for Windows Phone on MSDN which you can find here.

Orta talks iPhone Development

4440451019

Orta and title slide. Nice hat.

Orta (or Ben Maslen) is graduate from our department who is into iPhone development and other cool stuff. Our student computing society, Hull Com. Soc.  invited him up to Hull to give a talk about what he has been up to.

Very good presentation. Nice to hear some of the things that we go on about during the course coming back at us from an ex-student. Orta made the point that when you start doing something like this that you must actively engage with the developer community, asking questions and helping others. Just writing a game and putting it out there is one thing, but you also have to work at “being out there” to promote both yourself and the things that you have done. 

From what he showed us, he seems to be doing pretty well at it.

Imagine Cup Pressure

4440450921

Christophe and Daniel operating under extreme pressure in my office..

Yesterday night two of our first year students just managed to get their Imagine Cup Game Development entries submitted for round 1 of the competition. This process wasn’t helped by me getting the submission date wrong, and telling them they had more time than there actually was….

Anyhoo, the games are in and now we have to wait to find out if we have made it to round two.

I’ve got a new Windows Phone

4435712539

Unfortunately it’s not real. Like many other facets of my life, it exists only within the mind of my computer. However, it does work, and I can write programs for it using the latest version of Visual Studio.

If you want your own Windows Phone 7 Series device you can head over to here to perform a one stop download that gives you all the tools you need, including Silverlight, XNA and the emulator.

If you are feeling rich (or are a student on Dreamspark) you can even signed up for the Developer experience here.

iPhone Game Development Lecture

4435022966

One of our ex students (I only know him as @orta!) is giving an iPhone development talk in the department on Wed, March 17, 3:15pm in Lecture Theatre A in the Robert Blackburn Building. He has had his iPhone apps published (and even featured in Apple commercials) and so it should be well worth turning up.

Mega Open Day Madness

4432548209

Some of the audience. Captured with the big camera.

We had a really big Open Day today. Really big. We used the big lecture theatre and I had to do my talking bit twice. Because the Open Day was so big.

Great fun though. Two very good audiences, thanks for coming along folks and I hope you found the day worth the trip. I took the proper camera with the wide angle lens, the tripod and the remote release to guarantee the quality of the pictures. Unfortunately I then left the lens on manual focus and so most of the pictures came out a bit blurred….. Oh well, I’ll know for next time.

4432525271

There was even a jazz band in Staff House. Good stuff.