Rob at Mix 11 in Las Vegas

MIX11_BB_I'mSpeakingAt_2

For those of you lucky enough to be going to Mix this year, I’ll be joining you as well.  I’m giving a session on Tuesday 12th of April at 11:30 am in Breakers D. The subject is “XNA Game Studio for Fun, Profit, Danger, Excitement and Windows Phone 7 Games”. There will be all new content, but all old jokes.

I’m also doing a booth session in the Windows Phone Booth (good name that) at 2:00 pm on the same day. Feel free to drop by and say hi. I’ll even sign copies of my book that you’ve bought….

Mega Open Day

Audience
This is some of the audience for our mega Open Day. Great turn out.

It is scary how fast time goes by. We are running towards the end of the  Open Days for this academic year. We are going out with a bang though, the turnout for today’s event was huge. This placed a certain amount of strain on the rooms that we have. We didn’t actually make the design lab bulge, but we came close. Thanks to everyone who came along, hope you had an interesting and enjoyable time with us.

Book Handover

As usual we gave away a copy of my book as a price, here is Warren handing it over. Note that we have now got some copies of the latest version (in all the shops now).

Find out if you are using the Windows Phone Emulator

It is often useful in a Windows Phone program for the code to know whether or not it is running on a real device.  It is actually easy to do this:

  1. Add Microsoft.Phone to the references to your project if it is not already there.
  2. Put the following line at the top of your program.
    using Microsoft.Devices;
  3. You can now write code like this:
    if (Microsoft.Devices.Environment.DeviceType ==
                                                                               DeviceType.Device)
    {
        // we are running on the real phone
    }

You can use DeviceType.Emulator in the test to see if you are running on the emulator.

Some Windows Phones Contain NASA Chips

ChipVersion

Sadly, my phone just contains ordinary chips…. such is life.

It turns out that your Windows Phone 7 device might be worth a lot more than you think, if it contains custom, radiation hardened memory chips, mistakenly installed when it was built.  Apparently, because the part numbers of the memory chips only differ by an H (for hardened) production plants put the highly valuable devices into a number of Windows Phone devices when they were made.

Ivan Felfrit, NASA spokesman, is saying that these chips were originally destined for the next generation of Mars Rovers, Spirit II and Opportunity IV. “We need several sets urgently” he said earlier today, “We have to test the programs on genuine hardware and we also need the devices for endurance testing”. NASA are happy to give you a replacement phone and 10,000 dollars if you have a device with these components inside. They have advanced surface mount labs where they can remove them and install them in Mars Rover prototypes.

To find out if your phone has the chips in it, just to to Settings->About and touch “More Information”. You should see the screen above. If the Chip SOC version is set to 0:36.2.0 you have the NASA chips. Mine above only has 0.36.2.6, which is the standard devices. Either chip works fine, it is just that the NASA ones are worth more, and might be going to Mars. If you think you might have the NASA chips, send an email to i.felfrit@wp7formars.com and he will get right back to you.

30 Minutes in Paris

I went to Paris today. For half an hour. That’s the time it takes a person to sprint from terminal 2C to terminal 2F, jump the security queue and collapse exhausted on seat 10A of the flight out. The lady at the Air Bulgaria desk in Sofia expressed surprise that I was flying from Sofia to Amsterdam today, what with there being no flights in that direction. Fortunately the airline computers were equal to this, and had me going to Paris first, and then to Amsterdam, and then a six hour wait and then a flight back to Hull.

Lovely.

Fortunately I managed to sprint across the airport and made it  just in time. The rest of the journey passed without incident, although Schipol airport is not actually the most inspiring place to spend the best part of a working day.

The whole trip was worth it though. I’ve met some splendid folks and had a great time. I know it is very dangerous to extrapolate a whole race and culture just from the few people from there you happen to meet (I dread to think what would happen if folks started thinking all English people were like me) but I really liked the Bulgarians I met up with (and I saw quite  a few when we were “Speed dating” on Tuesday). They don’t suffer fools gladly. If you ask a confirming question (which I am wont to do), for example “So that means the Airport Shuttle will be leaving at 5:00 am?” they will look at you as if you are an idiot, bearing in mind they have just told you this. Actually, thinking about it, it was a rather idiotic question though…

Bulgarians also seem to have an earnest seriousness when you first meet them, but this quickly turns to riotous humour – which is great.

Nice Beer

We went out for a meal last night. Great food and the beer was really nice but we had to have several glasses just to make sure..

Coffee Stand

Sofia airport coffee at 5:45 am..

Windows Phone at MS Days

Windows Phone Audience

Did my second session of the day on Windows Phone. This is some of the audience before the start. Thanks for being another great audience folks.  Everything worked, in some cases eventually. My “party piece du-jour” was to start the program on the device rather than the emulator. I did it pretty much every time, in the end the people watching were spotting it before I did.

I got a question about Windows Phone Marketplace during the talk and I said I’d follow up on these pages. As I understand it this is as much a legal as a technical issue, in terms of how the law works in Bulgaria. At the moment you have to go through another publisher I’m afraid, which means people like http://appamundi.com/Publishing/ or http://www.yallaapps.com/.

You can find all the content from the lecture, including slides and demos, here.

After I’d finished I had a wander round and took some pictures of the conference.

Speakers Room

Who knows what goes on behind these doors….

Banner

Nice Banner

Windows Phone Banner

Windows Phone, Bulgarian style

Movie Showings

The conference is being held in a huge cinema multiplex. If you hurry you might make one of the 10:00 showings..

Lights

Nice Lights

Fun at Microsoft Days

Sofia Badge

Got my conference badge this morning, along with a very fancy pin which marks me out as a speaker at the conference. I got in and got set up and then went and watched one of the keynote sessions. The first part was in Bulgarian, which was pretty much lost on me I’m afraid, but the main talk was by Mingfei Yan, who talked about the cloud and how it is going to change everything. I reckon all of our students should see this, lots of food for thought about the way that computing is going.

Mingfei Car Juggling

At one point she showed some augmented reality, where a 3D car model was streamed down onto a marker on a piece of paper. Great fun.

Then it was time for my Micro Framework session.

Micro Framework Audience

Everything worked and I had a great audience. This is some of them as the room filled up. Some great questions and a round of applause at the end. Although it was probably for the robot.

I’ve put all the resources for the talk here.

On now to experts lounge and then the Windows Phone talk.

Hello Bulgaria

Staircase

Flew out to Sofia today to give some sessions at Microsoft Days 2011. The journey out was complicated slightly by a two hour delay on the  flight from Amsterdam to Sofia. They didn’t actually announce “The flight is being held up while we put the seat in front of Rob into the ‘permanently reclined’ position” but I think that is probably what happened.

Anyhoo, I made it in the nick of time for our trip to a local university Damien Caro and myself met up with a bunch of students and, once we managed to make our laptops talk to the projector, we had a great time. I gave a demonstration of my silly robot and a Windows Phone game involving cheese. Damien talked about the Cloud which is going to change our lives.

Students2

I took a picture just as everyone was leaving. Thanks for being a great audience folks.

Opening Up

Starting the speed dating

Then. straight after our lecture, it was time to head off to a trendy city centre bar for some ‘speed dating’ with journalists. This was one of the most intense things I’ve ever done. We had five minutes with each person and we were shouting introductions, questions and answers over each other. Great fun, although I ended up a little hoarse by the end.

Awesome Handbag

One journalist had this amazing handbag.

Sofia Night

After that it was time to head back to the hotel and make sure that my little robot knows his lines for tomorrow.

Three Thing Game Judging Videos

Platform Expo

If you want to see what the teams came up with at the end of the game event, and how well students can function after sleep deprivation and lots of caffeine and sugar, then they are all now available on youtube. Just search for threethinggame These videos are in High Definition, as I’m sure you will spot.

We had Paul Ross from Criterion Games here today (they are the studio behind titles such as Burnout) to give a talk on game development and chat with our students. This was the cue for lots of scrambling for Windows Phone devices so that some of our team members could show him the things they had made during the competition. By all accounts he was very impressed, which is nice.

Anyone who missed out on taking part in the competition this time round needn’t worry. Three Thing Game will be back next semester.

Three Thing Game Judging at Platform Expo

Three Thing Game Finals
Yours truly with “To Be Confirmed”, whose take on “Warrior Koalas on Mars” got them a Windows Phone each. Good work guys. Now put it in the Windows Phone Marketplace.

We put 60 or so bleary eyed students on a double decker bus and drove them down to Platform Expo for the judging.

Three Thing Game Finals

They must be judges, they’ve got clipboards…

All the group watched the judging videos (which will be online soon) and asked a bunch of questions about the entries.  At noon we announced the winners. The students then had an hour or so to explore the expo (or collapse somewhere) and then the trusty bus brought them back to campus.

Every team stayed the course this time, and we had playable content from all of them. Some of the teams did amazing things with some truly tricky starting points and they stuck to their subjects really well. I’m terrifically impressed with all the students, who served as ambassadors for the university at every level. We even had a bunch of volunteers who had given up a chunk of their Sunday to come and demonstrate the 3DS to people at the expo.

Jon and I did talks about 3D displays and Kinect that were well received and well attended (although I’m not sure how coherent we were only having had 3 hours sleep in the last 36).

Great fun, if exhausting. I’ve put a load of pictures up on Flickr (search for the tag threethinggame) and I’ll be uploading the judging videos on Monday.

Three Thing Game Team Videos

I’ve been round all the teams and done brief videos of how they are getting on:

Awesome Source

Bi Winning
Blank
Bottled Games
Brayshaw’s Bandits

CMYK
E for idiots
Fez Productions
Fresh Pot
Left 4 Dev
Pixel Bomb
So Fear
To Be Confirmed
Troll
Two and a Half Life

I’ve also put captions on the pictures on Flickr..

http://www.flickr.com/search/?q=threethinggame

I’ll do this all again later tonight, and see what progress we’ve made.

Three Thing Game Gets Going

Three Thing Games Teams

These are the teams at the start of the competition. I’ll do another of everyone at the end…..

Three Thing Game Prizes

Awesome prizes, I think this explains the good turnout.

We’ve launched the game development competition today. We have over 60 students involved.  They are all busily in the development phase of their games at the moment, just a few hours left now…..

If you want to see what they are up to we have a variety of webcam feeds for you to choose from:

http://www.ustream.tv/channel/twenty-four-hour-game-dev

http://www.ustream.tv/channel/24-hour-game-dev

http://www.ustream.tv/channel/fresh-pot

I’m putting regular picture updates on Flickr and there will be videos later when I’ve been round and chatted to all the teams. And everyone is tweeting as well. The tag threethinggame will get you where you want to be.

Pex for Windows Phone 7

image

I write programs for fun. Seriously. I’ve got games at home still in the box because I’d rather fiddle with some C# on Windows Phone than try to kill demons/drive cars/fly spaceships etc etc.

Pex is a great way to play games while you write programs. I’ve played with the web version before and now I can do that on my phone too. You can download Pex4fun and play along too. If you have any interest in brushing up your C# smarts in a fun (and portable) way then get this on your phone. It’s free too.

Using Vectors to Position Draw actions in XNA

I did a session yesterday for Three Thing Game (work progressing nicely) about positioning objects in XNA using vectors. I said I’d post the content, and here it is.

The basis of the chat was that for maximum object drawing satisfaction you should use vectors to position objects you want to draw  on the screen. I then had all kinds of fun with Visual Studio IntelliSense (bless its cotton socks) trying to be “helpful” as I filled in the more complicated draw calls.

The simplest version of XNA drawing uses a Rectangle to specify the position and size of the item to be drawn. This works well, but it does have some disadvantages, the most notable of which is that you can’t rotate sprites when you draw them this way. Another significant problem is that the position of a rectangle is specified by an integer value, which means that if you want to make something which changing in position by less than one pixel per update (which is often the case) then you can’t just use a rectangle to record its position.  Vectors contain floating point values, which give you much more precise object positioning.

So, my vector powered sprite starts off as two things:

Texture2D logo;
Vector2 logoPosition;

The logo gives the image I want to draw, and the logoPosition says where. I can use a very simple drawing call to draw using this if I like:

spriteBatch.Draw(logo, logoPosition, Color.Red);

This draws the logo using a red light at the position held in the vector. The position is given as the top left hand corner of the texture, so this call works very like the use of a Rectangle to position the texture, where the X and Y properties of the Rectangle give the position of the top left hand corner of the object.  The difference is that with this draw operation the texture is always drawn full size. If you use a Rectangle you can give width and height values that will get XNA to scale and transform your texture when it is drawn. If you want to do this kind of thing you have to use the monster version of Draw, which lets you specify all kinds of fun stuff:

spriteBatch.Draw(
    logo,           // Texture
    logoPosition,   // Position
    null,           // Source area in texture to draw
                    // null for all of it
    Color.Blue,    // draw colour
    logoRotation,   // rotation angle
    new Vector2(logo.Width / 2.0f, logo.Height / 2.0f),
                    // origin of the draw
    1,              // scale value
    SpriteEffects.None, // can flip the sprite
    0);             //  layerdepth

 

This version of Draw lets you do pretty much anything. You still give it a texture and a position but you also give it a whole heap more. We can look at some of these:

Source Area: this is the region of the source texture you want to draw. This lets you have a single sheet of sprites and then pull the particular one you want to draw from that sheet. Alternatively you can have a huge map texture and then just display part of it. If you put null there this means the entire texture is used as the source,  which is what I’ve done.

Rotation Angle: this is really nice. You can rotate your sprites when you draw them. The angle is given in radians - which means that the value 2 * pi (6.28 or so) is a complete revolution.

Origin of the Draw: OK. This bit is fiddly. The origin is given in coordinates relative to the source texture (i.e. if the texture is 100 pixels square the value 50,50 would mean the centre of the sprite). I do a simple sum to get this centre position in my example. This is the point at which the draw and rotation behaviours will act. This means that if you do both draw operations with the position vector holding the same value you get an effect like the one you see below:

image

The red logo is being drawn with the vector giving the top left hand corner of the draw operation. The blue logo is being drawn with the origin set to the middle of the texture as shown above.  To make things even more interesting I’ve rotated the logo a bit. Having  a draw action that works on the middle of the sprite is actually very useful if you want to centre draws around things like touch positions. The thing to remember is that the units for this value are relative to the texture, not the drawing coordinates.

Scale Value: This scales the draw. If you want to stretch the image in X or Y there is another version of Draw where this is given as a vector where you can express different X and Y scale values.

Sprite Effects: You can flip or mirror the sprite with this.

Layer Depth: Normally XNA will layer things in the order they are drawn, in other words new draws will lay on top of older ones. If you want to control the layering of your drawing you can set a layer depth for a draw action.  A depth of 0 means the front and 1 means the back. If you use the simple version of spriteBatch.Begin() these depth values are ignored, they only have an effect if you select an appropriate SpriteSortMode value.

Three Thing Game Gets Started

Audience1

Left hand of the audience

Audience2

Right hand of the audience.

We kick started our “Three Thing Game” game development competition today.  Everyone seemed quite happy, at least until they got their “things”. You can see all the teams and what they ended up with, over at www.threethinggame.com

The students will be showing off the results of their “Red Eye 24 Hour Development Phase” at Platform Expo on Sunday. Come down to the KC Stadium and find out what kind of results you get from “sleep deprived programming”.  The winning team will all get shiny new Windows Phone 7 devices, I just hope they are awake enough to notice they have won.

An Open Blog Post to Adobe and HP

image
This will not print correctly.

I am not normally given to ranting. I consider myself quite a balanced soul really, and where computers are concerned I usually have enough good nature and technical skill to deal with most problems that come my way. But some things are just beyond the pale. I would like to think that to think that computers generally help to make people’s lives easier and when I find something that is so crass, stupid and ignorant as this I feel I have to write something.

The problem is a simple one. I have a brand new copy of Photoshop Elements 9, a recent model HP printer (C7280) and a desire to take a picture out of the former and print it on the latter. So that it fills an A4 page. And appears on the paper as it does on the screen. This does not happen. It does not even seem to be possible. I can get close, but the picture is always cropped or scaled so that it doesn’t fit. I was printing pictures with my Amiga around 20 years ago with fewer problems then I’m having now. I had the same trouble with an older version of Photoshop and in my ignorance I assumed that they would have fixed this by now because someone would have got back to them during their extensive testing to tell them they had made a product that was fundamentally useless in this respect.

I’ve just wasted two pages of expensive paper, and a lot of expensive ink, printing the wrong thing in the wrong place. The reason I wasted the second page was that I asked the printer driver to show me the page before it printed and it ignored me.

Photoshop will let me print collages, albums and all kinds of stuff I don’t want. The HP printer is clever enough to tell me that the ink has run out in a cartridge before it actually has. This technology is state of the art, and it stinks. I’m now reduced to carefully scaling printouts wrong so that they print out right. There is probably a fundamental setting that I’ve missed somewhere that could be adjusted to make all this work, but I’ve not found it yet.  And if there is, why isn’t it set on by default?

Anyone like me who has been unlucky enough to invest in these useless products has my sympathy and an apology on behalf of those of us who have been promoting computers as a way to make things easier.