Creating a simple 3D game engine in XNA/Introduction

From Wikibooks, open books for an open world
Jump to navigation Jump to search

In learning XNA 3, then 4 myself, as I searched the internet, and read many books and I noticed there were no really good tutorials out there to really get you started with an engine. There is an old saying, you can give a man a fish, feed him for a day, or teach him to fish and feed him for a lifetime I mention this, because every book I've read, and tutor I've seen does just that, gives you a fish. I intend to teach you how to fish. As a hobbyist programmer myself, I write this for other hobbyist programmers looking to get some game creation going on. We are going to create a clone of the old classic arcade game, Asteroids by Atari in 1979, only we use 3D models for our graphics. Using the engine we create together with the 3D models and sounds I supply, it should only take a few hours a day to complete this tutor. Then it would only take hours to make a simple game of your own using this engine.

I assume you have a basic or general working knowledge of C#, Java, or C++ at least. What I mean by that is that you know what polymorphic methods are, and other OOP practices so I don't talk over your head. This is meant as an introduction to XNA 4 and real game programming using a game engine, not for learning general programming.

I start with a tutorial on how to make a simple 3D game engine, then proceed to use that engine to make the classic game of Asteroids. I only made one change to the original and that is when the player is hit, their ship does not explode, instead I take down their hits available points, the player starts with three. That was the one thing that frustrated me, starting after getting hit, and bam a rock hits the player ship again! As would often happen it would put the ship out, right in front of a rock. It would only do a check to make sure a rock was not at the spot.