Thursday, 2 April 2009

Getting Started with XNA Game Development Studio 3.0

XNA Game Studio is now in it's third incarnation and well worth having a play with if you've even a passing interest in developing your own games. It includes Hardware acceleration and an API geared towards moving 2D and 3D graphics around the screen - and is so much easier to pick up than the old Managed DirectX.

You can download it here, and it can even be used in conjunction with the Microsoft C# Express edition.

I'm going to illustrate how easy it is to get started, by displaying a 2D Sprite, which will be hardware accelerated, and subsequently moving it around the screen.

Here's the sprite we'll be using:



I know, I'm so artistic.

Once you've got XNA installed, load up Visual Studio and create a new XNA Game Studio project, selecting the one labelled Windows Game (3.0).

Open up the solution explorer if it's not already visible, right click content, then Add Exisiting, and choose the location that you saved the above sprite to. You should then see Sprite1.png appear under Content in the solution explorer.

Now, open up Game1.cs and add the following two declarations inside the Game1 class:


Texture2D playerTexture;
Vector2 playerPosition;

These will hold the sprite texture, and position respectively. Now we need to load our sprite into memory. Find the LoadContent method, and add to it so it looks like the following:

protected override void LoadContent()
{
// Create a new SpriteBatch, which can be used to draw textures.
spriteBatch = new SpriteBatch(GraphicsDevice);

// TODO: use this.Content to load your game content here
playerTexture = Content.Load<Texture2D>("Sprite1");
}

Likewise, do the same for the Initialise method, where we'll set the initial position of the player:

protected override void Initialize()
{
// TODO: Add your initialization logic here
playerPosition = new Vector2(20, 20);

base.Initialize();
}

Done that? Good. Finally, we need to draw the sprite on the screen. Find the Draw method, and add code so it looks as follows:

protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);

// TODO: Add your drawing code here
spriteBatch.Begin();
spriteBatch.Draw(playerTexture, playerPosition, Color.White);
spriteBatch.End();

base.Draw(gameTime);
}

Now press F5, and all being well you'll see your sprite on the screen:



Now let's add the ability to move our sprite up and down. Find the Update method and add the following code to allow our player to be moved up and down with the arrow keys:

protected override void Update(GameTime gameTime)
{
// Allows the game to exit
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
this.Exit();

// TODO: Add your update logic here

if (Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.Down))
{
float y = playerPosition.Y;
float x = playerPosition.X;
playerPosition = new Vector2(x, y + 2);
}

if (Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.Up))
{
float y = playerPosition.Y;
float x = playerPosition.X;
playerPosition = new Vector2(x, y - 2);
}

base.Update(gameTime);
}

Hit F5 again, and congratulations! You successfully displayed a 2D hardware accelerated sprite on the screen and enabled it to be moved up and down. This is a simple example, but hopefully you get an idea of how rapidly you can put together a simple game using XNA Game Develpopment Studio.

Labels: , , ,

Bookmark and Share

Wednesday, 18 March 2009

Edge for iPhone

No, I'm not talking about the 2.5G mobile technology. Nor will I mention that we're getting copy and paste at last! Oh dear, sorry about that.

No, I want to talk about another shiny gem of an iPhone game called
Edge, that I discovered over the weekend. Sadly, no screenshot I can take does it justice, so I strongly recommend you check it out on YouTube.

Retro graphics, a simple concept and a varied 8-bit inspired soundtrack combine to provide something really quite engaging.

Guide your cube around numerous cubic landscapes, each one more fiendish than the last. When your cube reaches the goal tile, based on how many times you dropped off the world, the number of smaller cubes you managed to collect and the time taken, you'll get a rating, which as far as I can tell is between A and D.

Very simple. Insidiously addictive.

Labels: , ,

Bookmark and Share

Monday, 9 March 2009

Time Out: Ancient Frog

I happened to stumble upon a rather excellent iPhone app called Ancient Frog at the weekend. I thought it was so excellent, I'm sharing it with you.


The premise? Help a variety of flexible frogs get the fly by guiding their limbs, for which there are limited spots to place them, across various surfaces. Not only is it an original and entertaining product, it's developed by a one man band.

I have a bit of a soft spot for Independent Game developers. Previously, I worked on both Thievery and the first incarnation of Alien Swarm, and I'm currently working on an as yet unannounced XBox 360 community game. It can be a hard slog, especially if you're trying to fit in a life and a day job.

Want to support Indie Game devs? This is definitely one to buy if you've got an iPhone or an iTouch.

Labels: , ,

Bookmark and Share

Sunday, 1 March 2009

Second Impression of Quake Live

Following on from my first impression of Quake Live, where I did some hardcore waiting, I've now had the chance to play it properly.


Rather than have you sit, drumming your fingers, whilst approximately 260Mb of data downloads into your browser, a staged downloading process is taken. A small core of files is downloaded, then whilst you're playing an initial match against a bot that determines your skill level, the rest of the game continues to download seamlessly in the background and places itself in your Application Data folder:

\Documents and Settings\[user]\Application Data\id software\quakelive

As a technical aside, I'm guessing the format of the PK3 files has changed as they can no longer be opened with WinZip. Anyway, moving on. Once your skill level has been determined, matches at a suitable skill level are chosen for you and highlighted as "best picks":




There's nothing to stop you joining a match with a higher or lower skill ranking than your own, mind you. As with Quake III, there is a myriad of different player models and colours to choose from, and lots of graphic settings to tinker with. Switch the game into full-screen mode and you wouldn't even know you're playing, effectively, in a browser.

With one exception, every game I've played has been smooth and non-laggy. As for the gameplay itself, well, it's pretty much Quake III Arena. Just via your browser. And this is a good thing. Free-For-All, Team DM, InstaGib and Capture The Flag are all present and correct.

It's worth checking what gametype you're playing before you start shooting though. I embarrassingly mistook a Team Deathmatch for a Free For All, and many team mates gave their lives needlessley before I realised all the abuse regarding team kills was directed at me. Sorry, Blue Team.

Currently, match stats are disabled whilst stability issues are sorted, but once they're enabled I'd expect to see the average length of the queue increase again, much to my chagrin.

Pleasingly though, it's a queue worth waiting to get to the front of. Fire up your browser, go make a cup of tea, come back ten minutes later and enjoy.

Just one more gripe. Epic, where the hell is my Unreal Tournament '99 Live?

Labels:

Bookmark and Share

Thursday, 26 February 2009

First Impression of Quake Live

I was moderately excited when I learnt that Quake Live (a browser-based version of Quake III) was now available to try. First impression, you'll need a lot of patience.


Nice, uh, colour scheme. The orange offsets the grey so well, don't you think?

Labels:

Bookmark and Share

Friday, 20 February 2009

iPhone Gaming Comes of Age

Yep, I'm one of those horrible people with an iPhone. You'll have to take my word for it that I didn't buy it to be cool - it was bought with good reason. Without doubt, it's a device I use more for browsing the web using 3G than talking to people on - and the beautiful multi-touch screen makes this a breeze.

Until recently, I didn't think very much of the quality of games available for it, which seemed to predominantly consist of third-rate racing games keen to capitalise on the novelty of the built in tilt sensing ability to steer. But now, finally, we have some quality products coming through, even if they are 'just' ports of older games available on other platforms. SimCity 3000 was the first to catch my eye, and a beautiful thing it is too. The developers have thought about the interface, and how it translates to a touch screen. It's full of clever touches like being able to move zoning after you've placed it with your finger, that make playing a joy rather than a frustration.

Secondly, Super Monkey Ball. Another port, but oh so much fun, and making full use of the iPhone's tilt in a good way - not a steering wheel in sight.

I've left the best mention to last. Pinball Dreams.



Now, I'm of the opinion that pinball is one of man's finest creations and second only to the wheel. Only recently was this released, and you cannot imagine my glee at seeing it. A port of a very old Amiga/PC game, faithfully reproduced on Apple's finest. The original music and graphics are back, and as a pick-up-and-play kind of title, perfect for the iPhone.

If I'm being harsh, sometimes there's very slight jerkiness noticable on the ball, but it's never enough to be annoying. Sometimes the flipper will get stuck in the 'up' position, and require you to tap it to bring it back down - maybe this is by design but again, it's slightly annoying.

Thirdly - it's not Pinball Fantasies, which was, without doubt in my mind, the better sequel. Rumour has it that it may be on the cards. And now you know who to go bug about it.

If you're going to buy one app from the app store, buy this. Or maybe you should wait until Pinball Fantasies is released?

It's your call.

Labels: , ,

Bookmark and Share

Wednesday, 18 February 2009

Time Out: Why I Love Burnout Paradise

As I've mentioned, I do like to indulge in some quality time with my XBox 360 on occasion. As a developer, it's my responsibility to sit back and take pleasure from code someone else has written once in a while. One game I've spent many happy hour in front of is Burnout Paradise.



The premise of Burnout Paradise is simple. Get a fast car, drive it around and around a big, open city performing all kinds of stunts, skids, jumps and general mischief. And if you so choose, complete a variety of collabarative challenges such as 'Jump over all the other players'. You can do it all on-line with 8 friends to boot. Perform in races and other events, and you'll win better cars.

But why is this so captivating? Because it's fun. Ramming other cars off the road is run. Crashes and smashes are shown close up and in slow motion, and they never seem to get boring. Racing is fun. Hollering down the microphone at some poor random soul you've just nudged into the sea is fun. Finding all the secret jumps, gates and billboards? Fun. Boosting down the highway, stereo on high, racing inch-to-inch with people thousands of miles away - fun. Instantly accessible, mindless fun; perfect if you need to unwind.

And you know what? It's slick. It looks great, the music is great (maybe I would have liked to see some better known tracks, but it's a minor niggle), and the menu system is great. Playing on your own and want to get straight into the online action? Simply done from the D-Pad without ever leaving your car.

Not getting out of the car is good. As Skeeter once said, "Never get outta the car."

Do I care how Burnout Paradise is coded? No, I do not. Them boys done good. That's all you need to know.

Labels: ,

Bookmark and Share