2.1 Creating a Blank project
-> Load a Model ->
2.3 Models and Entities
The XNA Framework is designed to handle a lot of the grunt work
that many games spend many man hours on! Part of this is just
the loading of the models, textures and shaders.
At this point we're simply going to follow the XNA Framework 1
Tutorial. Which can be found in the XNA help.
Once you get to the end of tutorial 1 you should be able to see
a rotating space ship.

At this point I'm going to replace the space ship with a
Slightly more Machines like model!

I've had to tweak a number of things:
- Model loading code to load this model and not the space ship
(duh!)
- Camera distance. The machines models have a "natural" scale of
metres. So 5000 in z is 5km away into the screen!
- I'm applying a double rotation during rendering to shift the
model into the default axis set of DirectX. The Machines models were
all modelled on their sides and we had a different view of the world
(ho ho). For simplicity it makes an awful lot of sense to stick with
one of the major conventions. We'll choose XNAs convention. Of
course, I should just re-export the models from my favourite
modeller or nobble the X files directly. I may do that later on!
- I've added some keyboard handling code so that I can move the
model around with the arrow keys and press escape to exit.
Here is the zip file for the Knight (level 3 aggressor).
OriginalKnightLevel3.zip
Here is the C# - it looks remarkably like the XNA tutorial code at
this point. The explanations in the XNA help text (e.g. about
rotations, Vectors, Keyboard, etc) are sufficient that I'm not going
to add anything.
Comments on the Code though as presented:
- The Keyboard handling is rubbish and needs to include user
configurable files right from the get go. This supports localisation
and preferred keys later on.
- The model itself is VERY old. It was built back when the 3DFX
was the most powerful card on the market. The nVidia TNT had just
about been released. As such it shows a number of things: 1) It has
a LOT of textures, not just one. Implies lots of state changes
during rendering 2) It doesn't have normals for bump mapping. 3)
It's pretty low poly (always good!)
- The use of global (essentially) variables is obviously not a
good thing.
Complete Solution at this stage can be downloaded here.
RTSTest1_2.2.zip
Next: 2.3 Models and Entities
(c) Hal Angseesing 2007 All Rights Reserved.