In the notes for Cannon III I said that I would take a look at using an Xbox 360 controller instead of the mouse… This kind of broke the quick movements necessary to play the game so Cannon Zero is mouse-only.
Cannon III is complete. Just as Cannon II borrowed a lot from Cannon I, this game reuses code from Cannon II except now we’re using the XNA framework. The assets file provided by 3D Buzz contained some enhanced graphics labelled XNA, so I used those instead of the boring default sprites.
Here’s a video of Cannon III in action:
That wraps up XNA Xtreme 101 Volume 1. Before I move on to Volume 2, I’m going to make my own final version of the Cannon game. Probably with new graphics, sound support, and Xbox 360 gamepad support. I’d also like to fix the issue with CheckFire() being called too quickly – which is causing the projectile to be fired on BeginGame() and ResetTarget().
One quick introductory XNA project before getting into Cannon III: The Simple XNA Application. It’s just a new version of a bouncing ball demo that was originally created as a regular Windows app:
It looks like the lessons could get a little tricky, as they were created with the XNA 1.0 Refresh. Version 3.0 is the current release, and I can already see that the content manager is structured differently. No problems so far though.
Cannon II is done now. It’s pretty much Cannon I, except using a (mostly) proper game loop and custom classes.
For fun I’ve changed the graphics and added sound effects using SoundPlayer from System.Media. I used a tool called sfxr to randomly create the sounds:
The graphical changes are the very worst in programmer art, but what the hell… Here it is in action:
Also, while I was looking for something else, I came across this tool for generating animated explosion sprites: Explosion Generator. Might be useful later.
For the second game project in 3D BuzzXNA Xtreme 101 we’re writing a simple target-shooting game called Cannon. From a single initial design, the game will be implemented three times. First as a basic WinForms application, then as a more complex one with custom objects, and finally as an XNA framework game.
The mechanics of the first implementation are complete, with the rest of the gameplay to come in the next lesson.
The objects in Cannon I are PictureBoxes loaded up with some simple graphics supplied by 3D Buzz. Here is the player ship firing on the moving target:
Last week I completed the Hyperion lessons, leaving me with a finished engine and basic game about rearranging some objects into the correct rooms.
I worked a little on making my own original game with the engine, but in the end I wasn’t inspired. As much as I have fond memories of early text adventure games (Scott Adams’ Adventureland, Douglas Adams’ Hitchhiker’s Guide to the Galaxy), it doesn’t seem like I have anything to bring to the table. Plus I’d rather get on with the XNA lessons.
I added a couple of things to the engine before I finished though:
Lots of command aliases like “get” or “take” instead of “pickup”
Directional commands are implemented differently from the way that 3D Buzz guys did it
Partial text matching for items so that you can “drop gre” instead of “drop green ball”
So, that’s it for Hyperion. On to the next block of lessons.
I’ve been continuing the 3D BuzzXNA Xtreme 101 lessons before work this week… Now the “Hyperion” text adventure game engine is starting to take shape. As the methods are discussed, I like to pause the video and fill them in myself before seeing how the instructors complete them.
I’m curious to know how someone new to programming would feel at this point. This early portion of Volume 1 jumps right into development with only a small amount of whiteboarding and explanations, promising in-depth discussion later on. It seems like a good approach, giving a feel for making something “real” before trying to lecture people on the intricacies of C#.
I’m starting over with a new set of instructional videos from 3D Buzz called XNA Xtreme 101. I opted for the monthly Member Sponsorship account that includes access to streaming versions of XNA Xtreme 101 along with various 3d modeling packages.
So far this approach feels better than following a book. Having multiple instructors explain things in different ways (with Photoshop used as a whiteboard) helps keep me interested. Even though the initial videos I’ve watched are going over material that I already understand, I haven’t been bored yet. In fact I’m a little bit impressed – the Hello World app is a text adventure game engine!
The only downside is that the videos are heavily watermarked, in an effort to discourage piracy. And let me tell you – it’s really fucking annoying. Check this out:
Yes, my full name and address plastered across every frame of every video that I watch. If you’re the sort of person driven to insanity by stuck pixels on an LCD, think carefully before making a similar purchase! :)
In fact I normally skip products with heavy-handed DRM, but the instructors are very enthusiastic and knowledgeable… They really give a damn about what they’re doing, so the Member Sponsorship seems to be worth the money.
The chapter 2 project is a Pong clone using simple 2D shapes. It supports one or two players with either the keyboard or a couple of gamepads.
Ben jumps right in with the Agile methodology of development, unit testing, and lots of wacky rectangles. My first look at the unit testing code frightened me a bit until I absorbed a few other examples.
The idea is that you should develop and test small pieces of the game before assembling them into something that can be played. Doing so avoids a situation where you get your game into a playable but buggy state where maybe the rendering code is the problem, maybe the collision detection is the problem, etc… Test reuse means that issues in subsequent iterations of the code can be quickly identified.
There’s some interesting discussion about designing a resolution-independent game. Since an XNA game could run on a PC or an Xbox 360 plugged into a TV, you can’t make assumptions about the screen. So instead of saying “place the player one paddle 20 pixels to the right of the left edge” you say “place the player one paddle an amount of pixels to the right of the left edge that is equal to five percent of the total horizontal resolution”. Similarly, the graphics and variables like the ball’s velocity (in pixels per second) are also scaled as necessary.
Unfortunately, if you follow the code in the book you won’t have a working program by the time you get to the end of the first unit test. The downloadable code associated with the book here (as of today) is also out of date, not ready for use as an XNA 2.0 project. If you want the actual correct XNA 2.0 version of the Pong code you have to visit the author’s personal site here. Lame.
I’m done with the first chapter of Professional XNA Programming (2nd edition) by Benjamin Nitschke. It jumps right in to things without a lot of explanations… It’s not bad, but there are some annoying bits like the screenshots and text not being fully updated for the latest version of XNA Game Studio. There must have been a pretty long publishing lead time.
Anyway, chapter 1 explains the basic structure (Initialize, Update Draw) and content pipeline of games developed with XNA. It also shows how to load 2D textures and take input from the gamepad and keyboard.
Here is a happy fellow that you can move around the screen: