iFractor is an Xbox 360 game, created by Dave, using XNA Game Studio Express. I think Dave’s “first game” highlights the advantages of using the XNA framework, both as a learning tool and for game development.
“The project was really just a learning tool for me, that morphed, over time, into a working game.”
The game looks very polished – variety of sprites, backgrounds, music, enemy AI, weapon choices… all the minor details that were put into the game. You just have to watch this video!
The objectives could seem a bit confusing at first, but as the tutorial explains, this is more of a Math numbers game than a Geometry Wars type of shooter (although there is that resemblance in the controls). Destroying an enemy will give you points and their value added to you. Enemies are also destroyed when you add your value to them to make it zero. To make things more interesting, there’s an active enemy AI unit that forces bigger numbers on to you – getting over +10 or below -10 means defeat.
It’s a pretty nifty game, I wonder if there could be bosses that require more than basic addition to battle? Reguardless, grab yourself a copy of the game, and give it a shot. I’ll wait.
The free source code for this XNA game is quite good for samples, and to learn from. All of the class files are pretty simplistic, between 20 and 130 lines of code, and are easy to follow. You really don’t need much to get started in game development. The game file itself is a bit more involving, at 3354 lines – it really could have been cut into smaller pieces, the tutorial scripting makes up a large part of the code.
Though I really like how the main game loop is structured:
if (CurrentState == GameState.Playing)
{
Read360ControlPads();
CueScale();
MoveEnemy();
MoveBullets();
MoveDrones();
MoveExplosions();
MoveDeathBar();
MoveScoreboard();
UpdateScore();
AI();
CollidePlayerBulletEnemyShip();
ClearEnemies();
CheckPenalties();
EndLevel();
EndGame();
JukeBox.PopUp();
PlayMusic();
if (!Tutorial) EnemyStream();
else MyTutorial();
}
Read controls, Move, Update Screen, repeat! Take a look through Dave’s code, it’s makes for a good example to a simple XNA game. Then take a look at the Rocket Commander for XNA and Microbe Patrol for more free XNA games, full of sample source code.
Discussion
Post a comment