{
Game Development
Using Visual Studio and XNA
{Arvind Raja Yadav
Microsoft Student Partner
Lead Programmer – Neptune, a Half Life 2 Modification
Programmer – Dystopia, a Half Life 2 Modification available on Steam
I also make a lot of small games in various languages for fun
What is a game?
{ {World of Goo = Game MS Word = Software
How do we know the difference?
{
Here’s what games have that software
doesn’t :1. Conditions for victory/failure ;2. Testing various qualities of the player ;3. Withholding content from the player;4. Thinking for themselves ;5. Partially under the player’s control ;6. Changing objectives and/or methods;7. They are more fun!
The basic structure of a gameInitialize content
While (exit condition is false){
Get user input
Run input related logic
Run input independent logic
Draw graphics and play sounds}
Shut down
{
1. Windows doesn’t allow direct access to it’s display and sound drivers.
2. APIs make coding games much easier
3. APIs also mean that we need not worry about compatibility issues
Why do we need an API to make games ?
{I’m not going to teach you how to make Halo in 3 days.
DISCLAIMER
It took me and my team about 2 weeks to make this level work.
{
XNA allows you to make games for both Windows and Xbox 360 platforms using the same code and assets.
Introducing
{1. Open Visual C#
2008 Express Edition
2. Select “File”, then “New Project”
3. You should see a dialog like the one here
4. Select “Windows Game (3.1)” and enter a name of your choice
Getting started with XNA
The skeleton code
Constructor; Initialize; LoadContent;
UnloadContent;
Update; Draw
Contents of the game class
}}
}
Getting content from the disk into the main memory + graphics memory
Removing content from the memory
Game logic and drawing
Display text on the screen
Display an image on the screen
Getting input from the keyboard
Changing window size (resolution);
Full screen/windowed mode ;
Changing window properties
{Print a message when the image moves off-screen
Exercise : Make an image move using the arrow keys
Using the mouse
XNA Time Management
Our first game : Dodger
{
Congratulations!
If everything went well, you just made a game by yourself !