Back on the XNA Horse

No Comments

Well after the house move, I finally got back into some XNA coding. It’s probably been close to two months since I last did any. So I picked up where I left off, being working through Nick Gravelyn‘s excellent Alien Aggressors tutorial. I was up to the stage where I had the basic gameplay implemented and was ready to start on adding the menu system. So on Sunday I was able to get a reasonable chunk of time into it. I’m now not too far off done – I’ve just got scoring, continuous levels, sound and options to go, which I’m aiming to finish this week after work.

I want to use my own sound assets rather than the ones provided to practice how to do that (I’ve done the same with art assets). I’m not going to implement any background music, as the first thing I do with every game I play is to mute the background music, so I’ll be enforcing my Nazi like disdain of background music on games I write myself. At some point down the track I’ll figure out how to stream local mp3 files and that will be my sole foray into background music.

I was pleasantly surprised that even after the downtime, and that I am still very much learning the basics about XNA, I seemed to pick things up again quite quickly. I think it helped that in the interim I kept reading and regularly visited the XNA Forums. There are still a couple of things that aren’t quite instinctive for me yet, but these are mainly in the area of logic used for graphic placement. This doesn’t concern me too much as I think once I start working without training wheels, bugs in that area tend to be visible in nature and the logic required to get it to work correctly will quickly become intuitive at that time. I think this is just due to the nature of working through a pre written tutorial. You (at least I) don’t get a mental picture of where the sprites will appear purely based on the logic I type in.

All this is a precursor to me getting to the skill level required where I can attempt to implement my own turn based strategy game. Once I complete this tutorial, I want to work through the 2D tutorial from the MSDN library. Both these tutorials are similar in genre (2D Space Shooter) but I want to contrast the programmatic styles between the two. A dude who programs XNA regularly and is an MVP vs the official MSDN style.

After that I want to take the training wheels off and try to develop a very basic pre existing game to see how I go. Under advisement I’m looking at a Pong recreation for the first go, and Tetris for the next go around. From there I will revisit Alien Aggressors and have my first attempt at implementing original (read my) gameplay ideas.

I have a wiki where I note down various ideas about the various XNA developments that I’m undertaking as well as some basic completion status once I break the ideas down into a task list.

I’m following the Alien Aggressors tutorial faithfully (except background music) through this first phase even though I’ve picked up a couple of irritants. I’m holding off on addressing these until I come back to extend the game with my own ideas. These are only basic, minor things and I hope it’s a sign of my growing understanding that I’m picking it up. The first is checking for valid user command actions in the various state classes, for example in the menu, checking for Gamepad1 Button A or Gamepad1 Button Start or Gamepad2 Button A or Gamepad2 Button Start or Keyboard Space or Keyboard Enter to handle a menu selection. I’d prefer to abstract this away into a helper class and then only query a user input valid selection from within the state class and let the helper class work out what actual buttons constitute that command. I conceptually think that this will also help if I get to the stage of implementing user defined keyboard controls. The other quibble is that if you play in co-op mode without a gamepad, both players are synced to the same keyboard input. It confused me early as it appeared that my player 1 ship had stopped rendering, but it was only due to the fact that the player 2 ship was rendered on top of it and their movements were identical based on my keyboard commands. Once one died and re-spawned the ships were separate, but still moved to the same commands. Also, while the ships occupied the same space, a bullet impact would only kill one of them. I’m not sure whether this is logical in a purely 2D world. So I’ll look at changing these when I come back to it.

A final note, I departed from my title while coding this and had a glass of the bear instead.


Leave a Reply