Archive for the 'XNA' Category

22
May
08

Game Developers Conference 2008 Presentations

Over the past few days, I’ve been going over some of the presentations that were given at GDC 2008, which you can download here. The presentations are in PowerPoint 2007 format, but if you have an older version you should be able to find a compatibility pack somewhere, and if you don’t have it at all, you should be able to find a free viewer. Each presentation also comes with a WMA recording of the actual talk given.

All in all, the presentations that I’ve listened to have been very interesting. There’s a handful that I haven’t paid much attention to, just for general lack of interest, but there’s a lot of good stuff there. Here’s some comments about some of what I’ve listened to:

“CLR Performance” and “Understanding XNA Framework Performance” are both somewhat technical in nature, but certainly interesting information to keep in mind while programming. Of course, any performance issues are going to be more of an issue in a larger project, rather than a smaller one, it’s always good to get into good habits.

“The Evolving Windows Game Platform” does not address XNA specifically, but rather Windows game programming in general. Still, it’s got some good thoughts to keep in mind, especially since I’d like to move to DirectX in C++ at some point… As far as I can tell, that’s still the industry standard.

“Getting More from Multicore” is a bit above what I’m ready for, given my extremely limited parallel programming experience (all of one semester), but I’m definitely holding on to this one for reference later. After I’ve tackled a few game projects, I will ideally move to a project where multi-threading really makes sense, due to size, and have a chance to put some of the methodology presented here in place.

“Advanced Debugging with Managed Code” was a real treat to find. Since I’m very much self taught, and the programming I’ve been doing in school has been almost entirely in a Unix environment, I’ve missed a lot of what Windows based tools have to offer. I have a copy of Visual Studio 2008 Professional (free, from Dreamspark. The joys of being a student…), but this presentation gave a good primerĀ  in some of the Visual Studio debugging tools available to me. Hopefully, when I actually sit down and write some more code, this will make things a bit more efficient.

Tomorrow, I’m hoping to actually finalize a plan on paper, and get to coding SDH v2.

15
May
08

A look over the design of SDH v1

The initial version of Space Defense Hero served as my introduction to the XNA Framework. As such, the actual design and use of technology is rather atrocious. Since the conclusion of the semester, I have done some work towards refactoring and redesigning, but I think it’s important to go over the initial “release” of the game first.

High Level Overview

The concept is exceedingly simple. You are an unnamed hero who flies through 2-dimensional, side-scrolling levels of increasing difficulty, shooting any asteroids or enemy ships you find in your path. At the end of each level is a boss, which you must defeat to proceed. Each level is randomly generated, choosing locations for asteroids and enemies at run time. The initial position of the boss, however, is set, so each level is the same length.

There is no “winning” in this release. Game play continues, cycling through all of the boss models every third level, until the player has died enough times to run out of lives. As level increases, both the damage taken from getting hit and the score for making kills scale upwards. Theoretically, you could eventually get to a high enough level that requires you to avoid getting hit at all, because any one shot could kill you. As a practical matter, however, it is unlikely that anyone will get past level 6, except perhaps on easy difficulty.

The reasoning for this is simple. Since the class was “Sensor Enabled Game Design,” we hooked up a Wiimote to the computer, via Bluetooth, as the primary method of controls. The general lack of precision this introduces (since we did not have time to involve the sensor bar for a “point where you want to move” control scheme) makes it very difficult to accurately dodge anything. The real goal becomes dodging as much as you can, without making an sudden jerks that may slam you into more than you were trying to dodge initially.

However, this also adds the gimmick of the game: movement in and out of the screen. By tilting to the Nunchuk 90 degrees to the left or right, the player’s ship will dodge in or out of the screen, and then slowly return to the plane that all of the other enemies are on. As a result, the player can dodge laser fire and ships/asteroids. Of course, your lasers won’t hit anything either, while you’re dodging. To prevent abuse, this ability is usable every three seconds.

Of course, every gimmick must have a counter gimmick to encourage use. In this case, it’s the idea of “special weapons” on bosses. Every boss has a standard attack that fires a single shot in a random direction in front of it. The second boss model adds a secondary weapon, which shoots a sustained burst of weaker lasers in the direction of the player every once and a while. Taking one or two of the lasers from this burst will not hurt much, but on higher difficulty levels, taking the entire burst is enough to kill a player.

The third boss model adds another weapon, which is only used once the boss is under 50% health. This ability creates a wall of lasers, from top to bottom, all of which do significantly more damage than an average laser. Dodging this attack is crucial, as it will do a very large amount of damage. However, without the dodge gimmick, the only way to actually void it is to hope that there happens to be an asteroid between the player and the boss. This gamble is foolish at best, and at worst a failing strategy.

Each object has a base score. The score actually received depends on both the current level and the difficulty setting. Player max health, health regeneration rate, starting lives, and damage output all scale downwards with difficulty level. Enemy damage and health remain constant, but from the perspective of the player, who does not see the raw numbers, they appear to gain more health and hit harder.

As would be expected, sounds play when things blow up and lasers are fired. In addition, there are two pieces of music — one for levels, and one for boss fights. For a bit of eye candy, there are particle effects for explosions.

Code Structure

The game is based primarily on the GameStateManagement example. Modifications were made the the InputState class to allow Wiimote handling, as well as some basic additions to give a level completion screen. The bulk of the code, however, has just been thrown into the GameplayScreen object. It’s a fairly simple setup, involving lists of all of the objects we’re interested in, but with few functions. The code itself is pretty unwieldy here. Particle effects were implemented using an adaptation of the Particle sample. Essentially, we brute forced it into the GameStateManagement code. Audio was pulled from the internet (music from Overclocked Remix), converted to WAVs, and pulled in through XACT. The audio content makes up the bulk of the program size.

There are remnants in the code of an attempt to use Steffan Palleson’s Poly-perfect collision detection work, though we were never able to get it working properly. There were some issues trying to explain to our modeler what exactly we wanted in terms of low-poly physics models, so it is quite possibly just an issue of using models that are too complex.

Our object hierarchy could have been better designed, but it worked for the sake of getting an A in the class. Basically, we have a top level GameObject class, and several (Player, EnemyShip, Laser, Asteroid) classes that derive from that. Bosses are simply an extension of EnemyShips. A large amount of relevant data, such as the model and scale, must still be passed in on the constructor, however. Also, there is no really easy way to add additional types of enemies.

Our camera does not move, but rather the player moves within certain bounds, and all objects have been given velocities that will eventually move them into view. Lasers are destroyed once they get off screen, and objects are destroyed once they go off the left side of the screen.

Reflections

A lot of this was brute forced. By the end, encapsulation hardly existed. The concept is sound, and we were able to follow through to enough of an extent to achieve the short term goal of an A, but the code is in no real state to be expanded or improved upon.

To that end, my next project is to reimplement SDH, paying closer attention to design details and planning, then improving the game to fit more closely with the original vision.

15
May
08

Well, it’s gotta start somewhere.

A bit late, to be sure, but I suppose it was inevitable that I’d become a part of the blogging craze.

At any rate, a bit about my intentions and expectations for this blog. While random game related topics will surely find their way in from time to time (I am a gamer, after all), the main purpose is to have a place to discuss what I’m doing in software development. My main interest is game design, and I’ve somewhat recently been introduced to the joy that is Microsoft’s XNA Framework.

My current project is one that I started during this past semester of college: Space Defense Hero. While there’s about a billion 2D side-scrolling space shooters, it seems like a good starting point. Indeed, I’m fairly sure that the reason that there are so many of these is the relative ease. The only physics involved is collision detection, so none of the pain of gravity, etc.

Soon I’ll write up a post on the state of the game as of the end of the semester, and then another to explain what I’ve been doing since then. After that, the focus will be what I’m doing to improve and polish it.