Depth of Field Tutorial

January 5th, 2008

I’ve submitted a new tutorial to Ziggyware about creating a Depth of Field effect. It includes a lot of information about Gaussian Blurring as well. Check it out at Ziggyware. And If you like it, vote for it in the Ziggyware Holiday Contest.

Back, with a threading tutorial!

October 3rd, 2007

Alright, so long story short – I didn’t slip off the earth, just found a new cave to inhabit. About the time of Gamefest my University Advisor contacted me and informed me that there had been some mistakes in my scheduling, and instead of having graduated in May, I still had 5 credits left to complete! Imagine my dismay! So I pulled things together pretty quickly and managed to work it out so I can complete those credits by using XNA more – lucky me!

First of all – I’m now helping out on the FlatRedBall engine. It’s a 2.5D engine – meaning it renders 2D objects in 3D space. It’s got tons of great features – collision detection, particle systems, great debugging tools, a wide range of graphical options, and now, post-processing. Go check it out!

Second, I’m rebuilding Dream Sower. Our first version was wonderful, but needed something extra to take it over the top. I’ve got a lot of feedback on it, and I’m rewriting some of the low-level code to get it ready for reimplementation. I really really really need an artist, so if you have services you could offer (or know someone who can), please let me know! I’m decent with 3D art, but I’d much rather have a game that has more than programmer art!

Third, and last for today (may we meet again soon!) – I’ve written an article on multi-threading using XNA for Ziggyware’s XNA Article Contest. It has some good information on writing a background loader, teaches you about some common pitfalls in multi-threading, and I even threw in a managed thread class I developed for my game. Let me know what you think of it, and if you like it a lot, go vote for it!

That’s all for now!

Call for games for XNA Arcade

August 13th, 2007

So, I’d like to add some more links to the XNA Arcade tracker I’m running so I can properly test the program as I develop it further. So, if you’d like your game added, please send me the following (or post it in the comments of this post):

Game Name
Game Download Link (see below)
Executable Name and Location within Zip File
Game Image (a 407×170 image file, uploaded on the web)
Developer Name
Website Link
Game information text (about 6 lines of information about your game)

For the downloadable, you’ll need to zip the contents of your project’s compiled bin/x86/Release/ directory (please compile in release mode). You should navigate to that directory, select all files and add them to an archive (as opposed to zipping up the “Release” folder itself). The Executable name and location will then be something like “myGame.exe.”

You’ll then need to upload that zip file somewhere, and include that link in your submission (I’m sorry, I don’t have the webspace to host everyone’s games).

XNA Arcade Alpha 1

August 8th, 2007

Frustrated over the difficulty of distributing XNA games? Don’t like having to package installers all the time? I sure am.

I figured it’s about time we had a front-end for normal people to get and play our XNA games. As a community we’ve made some amazing stuff, but it’s still difficult to get casual gamers playing our games. Enter XNA Arcade.

This program will grab a games listing from one or more xml trackers on the web, which it will use to populate a categorized listing of games. The user can then navigate to a category, choose a game, then download it, all through the app. Once the game is downloaded, it will install itself, and the user can just click the Play button in the application to play the game.

Easy!

And better – as a developer, all you have to do is zip up your compiled “bin” directory and upload it somewhere, then get your game’s information in a tracker. Since XNA Arcade will install the DirectX, XNA and .NET 2.0 redistributables with itself (it doesn’t do this yet), you don’t have to worry about the end-user having them!

Like the title says, this is still an early alpha (i.e. functional prototype). It’s not necessarily secure, robust or cleaned up yet, but if you’d like to try it out, you can download it here:

http://www.kyleschouviller.com/files/gametest/XNAArcade.zip

I figure with some more development and community support, we could get a couple sites hosting games/trackers which developers can submit their games to. We could even add some ratings system or some other features.

Let me know what you think!

Added: I should note that Chris Hildenbrand, the artist of Shuggy and SSH, did the interface graphics. A great thanks to him.

Time Control

August 1st, 2007

A quick note about time control, with code.

XNA makes time relatively simple – a GameTime object is managed automatically and given to you every frame. This makes calculations involving time relatively simple. However, what happens when you want to slow down time?

You could just use a variable to set the time speed, and then multiply your elapsed time by that every frame. However, if you try this trick on total times, you better not change the time speed, because your numbers will be way off when you change speeds.

My team ran into this problem on our DBP project, and I suggested that we use a time controller to manage game time. Basically, the time controller maintains its own time variables, which it updates every frame based on the current time speed (adding to total modified time every frame). Then, when updating objects, the time controller’s time is used (be it real or modified time).

You can download the code below – it’s part of a library I’ve been working on for my own projects, but since it seems like it’d be useful to others, I figured I’d post it. Let me know if you find it useful.

Get the code!

ps: I’m obviously not dead – just been really busy lately…hopefully will be able to share what I’m working on in a couple weeks.

Dream Sower Interview

July 10th, 2007

Zedox interviewed me today about my team’s Dream Build Play entry, Dream Sower. Check it out at Ziggyware!

Eliminating Magic Numbers

July 5th, 2007

With the Dream Build Play competition nearing a close, I’m sure everyone is busy with tweaking their game to make it as fun as possible. Of course, this can be quite the monumental task if you’ve got a large code base with “magic numbers” all over the place.

What’s a magic number, you ask? A magic number is any number in your code that doesn’t have a concrete reason for being that number, and could be changed without changing the meaning of that number. For example, your character’s velocity equation might have something like this:

Velocity += 9.81f * Vector3.Down * elapsedSeconds;

That’s obviously an equation to add gravity to your velocity. Who’s to say that gravity is 9.81 though? Your world will most likely have different units, you might change these units over time, or, worst-case, you might want to change your world’s gravity late in production and have to track down all of the places where 9.81 is used. Now, you could search through your entire project for this number and change each instance…but then what happens when you need to change your overall fade speeds? How about the delay after enemy attacks?

One solution I’ve found (and enforced on my team’s DBP entry) was to have a static constants class. This class is very simple – it just contains a bunch of constants. You can even organize them by placing more static classes within that class (or by using namespaces). For example, I ight have something like this:

public static class Constants
{
public static class World
{
public const float Gravity = 9.81f;
}
}

Then, whenever I need to make use of gravity, I can just reference the Constants.World.Gravity variable. That way, if I need to make changes, I can do it very easily.

This is especially helpful when playtesting. If you have a good tester (and especially if you have another screen/machine to test on), you can sit them down to play and have them comment on anything that doesn’t feel right. Maybe the attack isn’t firing fast enough, perhaps the enemies are getting too strong too fast. You can stop their game, change the AttackDelay and DifficultyRampFactor variables, recompile and have them playing again in just a couple minutes.

As an extension of this, you can have all of your constants stored in a file, and load them all upon starting your game. Then you don’t even have to recompile between tests!

Dream Sower Demo

July 3rd, 2007

I’ve been pretty silent lately because I’ve been pushing hard to finish my team’s Dream Build Play entry. I was lucky to get to work with Rockstar, Catalin and Greg on a game we’ve called Dream Sower (formerly Mind Tap).

Dream Sower is a pretty simple game. You’re in control of a Dream Sower – a small robot that is inside a dreamscape. Your goal is to fight off Nightmares and to keep the dream interesting by planting dream seeds. These seeds will alter the landscape, grow trees and refresh the land, all to keep it interesting for the dreamer (who will become bored if you don’t constantly entertain him).

The game has gone through several phases of development, lots of last-minute design changes, and some great testing. In fact, I had such good playtesting experiences that I might just have to write an article on it in the future.

We finished the yesterday (just in time to hear about the extension), and I prepared and uploaded an Xbox 360 version of the game for your enjoyment. I’ll be putting up a PC version and an updated Xbox 360 version later in the week, after I clean out a couple cobwebs in the code.

As always, comments are appreciated.

Download the Xbox 360 ccgame
Download the Windows Installer

(please let me know if either of these has any problems working)

WSUXNA Engine Code

June 9th, 2007

It’s about time I release the engine I created last fall in XNA. This engine is purely academic, and should be treated as such (i.e. don’t go trying to make your own games with it unless you want to retouch most of the engine). However, it’s fully commented, and I believe the code is both an excellent example of something I’ve done in the past, and of how to tackle a ton of different common game programming tasks.

This engine accomplishes many things – input management, 3D-rendering of 2D sprites, animation, text rendering (it was made before the refresh release), Quadtree, Separating Axis Theorem (oh boy!), and of course, object management. It’s not perfect, since I had to code it in a couple weeks so my team could actually do their assignments (see the WSUXNA page for more). However, with as many problems as it tackles, I think the code could be useful to look through for an aspiring game programmer.

Along with the engine code I’ve provided the engine test project I used while developing as a small example of how the engine is used. It’s a bunch of different shapes bouncing around in a box. Each shape also has debug outlines showing the underlying polygon used for collision detection (separating axis theorem allows for any convex polygon to be used!). The bouncing is just based on object centers and current velocities – so it’ll look a little odd. You can switch between objects with up/down (on dpad or keyboard) and rotate them with left/right (dpad or keyboard, again).

Get the code

Or just the engine demo

Enjoy!

Finished with College

May 22nd, 2007

I finished my final final exams last week, and I’m now packing up to head back to the United States. After handling the jet lag, I’m thinking I’ll write a new tutorial. What would you like to see? Let me know by posting in the comments – I’ll read them all and then decide next week when I’m finally home.