F#, State Diagrams and Racing Cars

I went to a session today about F#, which is a functional language. This is a very interesting way to write programs and is now entering the mainstream as part of Visual Studio 2010. Well worth a look.

I also had a wander round the exhibition hall, which is huge.

4108943064

These folks are doing really interesting stuff. They have developed a way to take state diagrams (a nice graphical way of showing the behaviour of a system) and use these to produce code. They can even animate the state diagram and allow you to set breakpoints in the application controlled by it. Great for embedded control, and just about anything controlled by a state machine. Which is just about anything really. Great Stuff.

4108943350

I didn’t have a go, but I really wanted to…

Flushed With Success

After my TechEd session I thought we’d go out and celebrate in style. The style I imagined was a bit strange, in that we’d found out that there was a very strange bar near the hotel which had a rather strong toilet theme.  This theme extended to food served in potties and drink in sample glasses….

4094370193

This is us toasting another good day in Berlin. thanks to Adam for the snap

We were going to have the food too, but our nerve failed and so we went out and got a burger instead.

XNA on Zune Session Fun

I did my final session of this TechEd today. I was on at 5:30, in session slot 13, but in the end pretty much everything worked. Thanks to everyone who came along, I hope you all had a good time and learned something useful. I’ve put the slides and all the demo programs up on Skydrive so feel free to download them and have fun. For some reason I forgot to take a picture of the audience, but then since you all know what you look like anyway I suppose this is not much of a loss…..

You might want to take a look at the other sites which are linked from my post from yesterday.

Student Session Fun

Did my first TechEd 2009 session today. Students and XNA. What could go wrong? Well, fortunately, nothing much as it turned out – except for one of my demos getting a tiny bit stuck.  The audience was great, and I took a picture of them all:

4094369495

On the left….

4094369831

..in the middle..

4094370193

…and on the right

Thanks for being a great audience folks. I hope you enjoyed it.

After my bit we were joined by some other TechEd speakers and we had a really good question and answer session.

If you want to find the links to my stuff, you can find silly games content at www.verysillygames.com

You can find my Yellow Book on C#, and my Orange Book on Java to C# at www.csharpcourse.com

I will be posting the slides for the session, along with all the sample code, on this blog after my session on Wed.

Zune HD Ins and Outs

I’ve been preparing my TechEd sessions today. I’m doing two, one to Microsoft Student Partners (in a couple of hour or so) and one Interactive Session to the general conference. If you are here in Berlin please come along, I’d love to see you.

Since the session is about creating XNA games for the Zune HD not surprisingly I’ve been doing a bit of creating games for the Zune HD. I got my AlbumShaker running really nicely, and I thought I’d try running it on the original Zune players. I wasn’t expecting much, but I was really surprised to find that performance was quite acceptable, with the albums bouncing around the screen most satisfactorily. The program doesn’t seem to mind that it is running on one of the older devices, the game just gets “central” settings from the accelerometer.  I even added some code to read the Zune pad, which emulates a gamepad  thumbstick. This worked fine, except for a couple of issues.

Using the XNA Gamepad to Slow your Zune Game Down

The code for the album shaker makes a bunch of album sprite instances and then calls Draw and Update behaviours on every instance. The first version of my game called the GamePad.GetState method for each of the fifty or so albums on the screen. This did horrible things to performance. For some reason reading the Zunepad is very slow. I assumed that the pad would be read for a a given clock tick, and then that value cached for use in the game. This is not so. I got a huge performance improvement by reading the state once for all the albums and then picking up this value in each album.

Using the XNA Accelerometer to Make your Zune Game wobble

I was so pleased with my speedup on the original Zune I thought I’d do something similar with the accelerometer input, so I changed the game so that it read the accelerometer once and then cached that for use by all the items in that update. This had a really strange effect, where sometimes the items flickered madly about. I’m not sure why this happens, it is as if the GetRotation method on the AccelerometerState object actually corrupts the state in some way.

I only know that if you get a “fresh” reading for each item you want to input the game works fine.  And this doesn’t seem to  slow the game down either, which is nice.

So the moral of this is that it is fine to cache the gamepad settings (and in fact on the Zune this might make your game go faster) but the accelerometer values should not be cached..

TechEd and Mauerfall 2009

TechEd started today. I went to  a very good session on Windows Azure first thing. Then I had to go off and sort out some presentation related bits and bobs, which was a bit of a pain as there were a couple of other sessions I wanted to see. However, once the day’s work was done we headed off the the Brandenburg gate to see the Mauerfall event.

This was a celebration of the 20th anniversary of the fall of the Berlin wall by the toppling of an enormous row of domino-like blocks that stretched for over a kilometre. They had all kinds of heads of state there, a full orchestra and a live appearance by Bon Jovi.

4092689608

The inside of the station

4091925139

The outside of the station

4092690560

A nice view across the river

4092690982

On the way to the gate

4092691326

Waiting by the wall

We found a good spot near the food and drink stands and began to wait. And it started to rain. And rain. After two hours in the rain I found that most of the things I had with me that I thought were waterproof, like my coat and shoes, were not. After three hours in the rain everything was wet. After four hours everything was wet and very cold.  And then it started, We had speeches from the great and the good, music, and the blocks duly fell on cue. It was a great evening, even though I have never been so cold and wet.

Out and About in Berlin

Today we wandered over to the TechEd Conference centre to register.4092686828

This is the front of the centre. Very big. However, the most surprising thing was the sheer scale of everything around this part of Berlin. It must be the conference centre of Europe. All around there are enormous halls set out for these kind of sessions.

Next we ventured into uptown Berlin again. Peter wanted to climb to the top of the Bundestag. So we did.

4092687620

On the way we took in the Sony Centre, which is absolutely huge.

4091923493

On top of the Bundestag they have this amazing glass dome with mirrors inside that reflect down onto the parliament below.  Very impressive.

4091923825

This is the view from the top of the Bundestag at the blocks they are assembling as part of the 20th anniversary celebrations of the end of the Berlin wall.

Tomorrow the conference itself starts properly.

Heading for Berlin

Today I was up at 3:00 am. Not that I’m complaining that much, after all we are going to Berlin for TechEd 2009. We had a nice shiny hire care to drive to Liverpool airport where we would board one of the few direct flights to Berlin. Once we had arrived and unpacked it was time for a stroll. Of course I took the camera.

4086122391

The Russian Embassy

4086117761

Brandenburg Gate

4086871790

I love the colours of the stone in this light.

4086900748

Nice buildings at night.

I’ve put some more pictures on Flickr. I think we are going to like it here..

Project Tuva – Richard Feynman Lectures

If you’ve not heard of Richard Feynman then you are very lucky. It means that you can have the experience of finding out all about him for the first time.

Richard Feynman was a Nobel Prize winning, safe cracking, bongo drum playing, beautiful women painting, atom bomb making genius.  Go and read Surely You’re Joking Mr. Feynman! to discover more.

And now you can get to see the man in action delivering a set of lectures about physics that have been put in the internets by Microsoft at their Project Tuva site. This lets you view the presentations with annotations and additional linkable content. A great way to spend a lunch hour or two.

Dollhouse Sunday

By gum, it really rained today. Far too wet for gardening. Much more sensible to stay indoors, play with the Zune software and watch a couple of episodes of Dollhouse, the new show from the pen of Jos Whedon, who created Buffy.

I’m starting to really like the program a lot. Some people reckoned that the early episodes were a bit weak, but I enjoyed them and it is starting to get very interesting as the characters develop.

The program itself is a sort of cross between Joe 90 and Probe.  “Dolls” or “actives” have their brains filled with the person they need to be to do their assigned job, be it escort, private eye or assassin (but never pool cleaner – or at least not yet). They are then sent out into the field to fulfil their task and then hauled back to be wiped and reused. 

When not at work they live in the Dollhouse of the title as amiable blank slates. Of course things don’t always work quite right, and so there are back stories of NSA investigations and rogue actives and the whole setup has a moral ambiguity which means you are never sure whether or not the Dollhouse itself is a force for good or evil.

The series aired on the Science Fiction channel in the UK, but I don’t think it made it to terrestrial, which is a shame. Fortunately you can pick up season one at a reasonable price,  and I reckon it is well worth the investment.

London Trip

Off to London today. In a brand new train. So new they didn’t have any  cups to dish out the free coffee for the posh people in First Class. Heh heh.

4064932052

Millennium Bridge Handrail

4064936244

View from Tate Modern.

We went off to Foyles, best bookshop in the world:

4064173239

The bad news is that the Computer part of the shop is now the Cookery part of the shop. Then again, perhaps more people need to eat than need to write programs…

The good news is that they had three copies of my book. Go me!

Album Shaker for Zune HD

I’ve been playing with the Zune HD and seeing what you can make it do. The answer would seem to be lots. I’ve just finished a little demo that is an alternative way to find your music. Since XNA gives you access to all your album artwork I thought it would be nice if all the album pictures bounced around the screen and you just touch the one you want to play. Turns out that XNA is a great thing to write this in:

4065001810

This is going to be one of my TechEd demos now, it really does work well.

A prize for anyone who manages to name all the artist and track details.

Fun with MineSweeper

I spent some of today working on the coursework for our First Year programming course. Every year we get our students to create a simple game. Last year it was Battleships. This year it is MineSweeper, a game with a long and honourable history, having been shipped with every version of Windows right up to Windows 7.

One of my rules is that I don’t ask the students to do something that I can’t. At least not in the First Year…

So I spent a happy afternoon putting together a simple version of the game and writing the notes to go with it. I’m so pleased with what I ended up with that I might make a version for the Zune. It is a really nice platform for that kind of thing.

The first part of the lab goes live next week and should be great fun.

TechEd 2009 Test Firing

I’m doing a session at TechEd 2009 in Berlin:

DEV08-IS Writing Games and Exploring the Microsoft Zune HD in XNA 3.1

Wed 11/11 | 17:30-18:45 | Interactive Theatre 2 - Orange

I got that information off the TechEd schedule builder. So it must be true.

As part of the preparation I delivered my first pass of the session this afternoon at Hull to a bunch of students and staff who were nice enough to turn up. Thanks for coming along folks. I’ll put the slides and sample code up on my blog after TechEd.

Idiot

Last week I wanted to take the Tosh tablet home to do some work preparing it for TechEd. But it wouldn’t come off the docking station I keep in my office. The lever kept jamming when I tried to remove the machine.

I cursed this for a while, concocted a theory where something inside had got stuck and put the whole thing, laptop, docking station and all, into a carrier bag and took it all home for repair. I reasoned that I just had to pop the back off, release the offending catch by hand and then all would be well.

The back of the docking station is held on by twelve screws. I undid ten of them and noticed that the back would not come off. So I laboriously refitted all ten and, as I was tightening the last screw, I noticed the remaining two. So I took all the screws out and then discovered that to get the back off the docking station you have to also undo some fittings on the top of it. Which was presently stuck underneath the laptop, which was still securely fixed on.

So I cursed some more and had a cup of tea. As I was taking a sip I noticed a little lever on the side of the docking station that I hadn’t seen before. It had a little padlock drawn next to it.  I moved the lever to the other setting, unlocking the tablet and allowing it to be easily removed.

Idiot.