XNA UK User Group
A helping hand for bedroom coders throughout the land.
Unplanned 5 Hour Xna Game

    As many of you already know, I am working franticly with Seloc on our game SBARG, which we hope will put up a good fight in the DBP competition. And believe it or not I have ANOTHER project on the go called IceCream which I will blog about some other time. If the name intrigues you, join us on IRC channel #xna and ask about IceCream and Milkshake, we'll know what you mean :). 

Because we're so busy I don't have time to blog as much as I'd like to, but I felt I could sanction a few spare minutes to blog about an awesome journey we had last night. So picture the scene, we're discussing all things SBARG, we're very tired from the last few weeks work, as well as a day job, we're often working through the night and on a slacking night it can be 3am before we decide to call it in, so yeah, we're tired, we're hungry and we're not exactly getting much done. So to spice ourselves up we started to chat about our next game, you know, the one after SBARG, we started to look at old Amiga games and Mega Drives games we used to play, it was good just to remind us why we're doing this, for fun, I love games, even the ones that sucked I loved something about them usually. 

Then we got onto a discussion about how quick you can prototype games to get a feel for something, A few hours are usually enough, anything longer probably requires a budget and a lot of planning before deciding to go ahead. I'm going to take credit for this bit that I'm not going to tell you about but I came up with this genius idea for a game, which lead to the discussion about an even simpler game which you should all know called Rock, Paper Scissors. If you don't know what it is check it out here http://en.wikipedia.org/wiki/Rock-paper-scissors. Brilliantly simple game. We only had to discuss it for 2-3 minutes before we realised it HAD to be done, so while Seloc was still talking, I cranked up Visual Studio and started working on the simple mechanics of a Rock, Paper Scissors game. I stupidly made a comment along the lines of, "You make a brew, and ill have this working by the time im finished drinking it" While I didn't get my brew, i had single player Rock, Paper Scissors working in under 20 minutes, So I believe Seloc still owes me a brew, and an extra brew for winning.

I just implemented a simple up/down arrow to choose your selection, the computer randomly selected its choice and after a countdown of 3 seconds the winner would be chosen and displayed on screen. So I turn to my right to show Seloc how amazing I am, and I see he's got a screen up with a fancy rock, a pair of scissors, and a piece of paper. He's only gone and generated some cool artwork for our new game. So we have a quick chat about how ridiculous this was and decided to continue :D we are English after all. So I'm waiting around playing against the computer, and winning.. YES!!! But I want to play against Seloc and beat him. So I decided to consider making it live compatible. At this point, I knew we were crazy, but I had not done any xna networking before so I thought worst case, it's a bit of experience so I gave it a shot. I already knew of the brilliant NetworkState sample on creators so I decided to start with that, remember this is just a prototype so using someone else's already working code saved me tons of time. I initially got a little stuck about what to actually do about networking and what structure to put my code in,
I looked at the Netrumble code to see how they implemented it, and when I say looked, it was a 3 minute glance, its midnight now, I don't have time to read reams of code and luckily, it was really simple. I adopted their method of passing the packettype before the packet data. So I had an enum which contained Timer, GamerScores, GamerSelection, and GameState. For each type of data I wanted to pass I would pass in the relevant enum value first, then the data. For example I would pass the GamerSelection enum then the current selection of the local player. Then each player would read this data, and if it found a GamerSelection value, it would read the next packet and assume it was the other player's selection. This did get a bit fiddly, and I'm quite sure I haven't got it quite right yet, but my networking code, not including the sample im using is about 20 lines of code on top of my existing single player game. Brilliant. So i swap out the AI, for another pad controlled player and gave it a try. Getting Seloc to pull away from his drawing to test it with me was hard work, once he's in the zone, he's in the zone.
 But i persevered and eventually after a few iterations of bug fixing and debugging we had a working game. It was brilliant; stupid, but brilliant. So the only thing left to do was put some more trapping in and get it looking nice. That didn't take too long, by this time Seloc almost had all the art ready, so we imported this and began loosely positioning it on screen. It looked fun; it looked like a game believe it or not. There was merely 2 more things to try. 

  1. Try it on the Xbox:- right click project, create Xbox copy, wait 15 seconds, hit build. Done!!
  2. Try it on Xbox live:- in theory there shouldn't be any code differences right? The sample should have taken care of it for me. Shawn if this was you. Thanks man. Zero code changes.

So I built a ccgame and popped a message in the #xna IRC channel, asking if anyone was willing to play this with me over Xbox live, I didn't have to wait long before Borealis offered his time. Within a few minutes we were in a lobby, and in the game, we were playing Rock Paper Scissors over Xbox live, and it was fun.


There was only one thing for it now, we had to publish it to Creators Club Community Games, so at 2:30 am this morning i hit publish, i've not seen the results yet but

I'm praying it didn't fail. I can't see the site at work :(
 
But just to recap, in about 3-4 hours we went from blank project, to using a sample, to having a game, to having it on creators site to download<subject to it passing>
This, i hope you agree, is an astonishing thought. While my game is only Paper Scissors Stone, it's the simple ones that are the best,
So a few more hours of your time and you could make something a bit more substantial than RPS, but small enough to be a 1 night project.
 
Heres a teaser screenshot, check it out on Creators Club and if you really want to play and you're not in the USA, just drop me an email or a comment. 
 

Rock Paper Scissors


Posted Thu, Jul 31 2008 11:45 AM by conkerjoe
Filed under:

Comments

dna8088 wrote re: Unplanned 5 Hour Xna Game
on Thu, Jul 31 2008 1:14 PM

Man I wana play :-)

Will you be publishing the code?

It would be good to see how someone has used the net code, samples never seem to feel like a real example.

And nice one.

conkerjoe wrote re: Unplanned 5 Hour Xna Game
on Thu, Jul 31 2008 2:08 PM

Once the game is famous enough to be recognised as mine... Ill happily release the code.. :D

No on a serious note, once im happy the code is tidy enough for public consumption then yes absoloutly.

Dominique wrote re: Unplanned 5 Hour Xna Game
on Thu, Jul 31 2008 11:19 PM

Excellent stuff!

I think you need to add animations for each win in homage to Battle Chess. Rock smashes Scissors, Sissors cut Paper, Paper cover Rock. Sure'ly just another hour's work for men of your calibre.

Nemo Krad wrote re: Unplanned 5 Hour Xna Game
on Fri, Aug 1 2008 9:27 AM

LOL! AWESOME! Good work (should take longer dude, what if you are on an hourly rate!!)

Gorion wrote re: Unplanned 5 Hour Xna Game
on Fri, Aug 1 2008 8:05 PM

Yes, this is what XNA is made for basicaly, in my opinion :) Fast prototyping

Conkerjoe wrote re: Unplanned 5 Hour Xna Game
on Fri, Aug 1 2008 9:11 PM

With the added bonus of that this game will game make me 1 ...... Million.. Dollars!!! :D

walthergropius wrote re: Unplanned 5 Hour Xna Game
on Thu, Aug 7 2008 9:50 AM

Fantastic stuff mate. Nicely done!