Introduction
Unfortunately, the game code was hastily stripped and in poor condition, however it is still useful in many ways. I will be trying to write a full tutorial on games for beginners over the next few years.
At This State, Who is This Useful For
This is for beginners to steal the bits they need that are missing in XNA. It should be a great help for beginners to intermediate XNA programmers, especially the animation bits / how to load other animated models. It contains an upgrades ms skinning model sample. The math library also has many high level functions that are easy to understand such as rotating an object to face another in 2D or 3D, as well as position a 2D object with 3D coordinates, get a selected poly from a mesh, etc.
Background of the Engine and XNA
Everything is fairly optimized for XBOX which will be useful for many people. When I wrote this, I barely understood anything about 3D math and I am still no expert, but the good thing about that is I have encapsulated things so that you don't need to know much to do trivial tasks. When you start off in XNA, your expectations are so high, then you learn that the toolkit is not really going to produce quake 5 even in the hands of Carmack or anyone. Not only that, XNA IS* very unoptimized and not that* high level which is not what I expected at all. XNA is not a game engine, you have to create your own or use another one. Game engines are a bit of a catch 22; If you don't understand how to write one yourself, you will likely get stuck trying to do some trivial task. You can't even load an animated model (currently).
With this engine, you have a GameObject
and GameObject3D
that has a few main things such as Position
and Destination
, speed and gravity as you would kind of expect. You can use it to produce a 2D image or a 3D object with animation as you would expect XNA to do out of the box. You can also do operations such as get the 2D x,y of a 3D object with the mathHelper toolkit. The mathHelper contains almost everything you need to build a very simple game. (Note: Unfortunately, the Camera is very poorly written but you can easily grab another camera class off the net and plug it in. I say it is bad because it is currently hardcoded for viewing a level top down, it works, it is just specialized for the game I designed it for. I will be updating it soon.)
Features
The 2D part uses textured quads not spriteBatch. This is because the gameobject
has a layers property as you would expect!. GameObject3D
also contains the layers property so you can intermingle 2D and 3D to your hearts' content and not be ripping out your hair!
Easily move objects by using destination property, and catch events like OnClick
, OnCollision
.
ParticleEffects XML editor scripts gameobject
s to spawn with SimpleEmitter
(f4) reloads changes in gameplay so you can edit them on the fly.
The engine runs pretty damn decent, it is not going to shatter any records but for the hobbiest it can get you by on XBOX game which is actually saying a lot from my experience with XBOX. Many struct
s are passed by ref
which gives you a massive boost as well as the update is Not called when Isalive == false
. The objects move in and out of a hashTable
when isAlive == false
. This allows you to have nearly unlimited amounts of objects lying around that are not being used. It uses heavy OO structure which lags xbox quite a bit due to the amount of overrides but it is easier to use so that is more important than performance. Windows blazes of course.
Animated models work. I am not up to date on all the new goodies in XNA, but in my day that was saying a TON!.
Basic Usage
If you look at player1.cs:
public override void Update(GameTime time)
{
float f = 3;
DropCoin();
Destination3D = Levels.Inst.CurrentLevel.FindPos( GameMouse.inst.LClick() ,ref f);
base.Update(time);
}
Game objects can be an image or a static model or you can use animatedGameObject
derived from gameObject3D
to have an animated object.
This shows code above how to move and object by setting its destination. All game objects are derived from gameobject
and exist in a collection gameobject
s. The game objects are inserted into the collection automatically.
You can override many methods to gain access to events such as collision / mouse actions.
Particle effects are made from a collection of game objects. You can configure these collections in XML with the particle project. The coin stars are produced with this method for example. You will need to be intimately familiar with the engine to use the Particle effects. If you understand what every property of the gameobject does, you can use the effect XML generator because all the generator does is load the object in a property grid and spew them out with a few additional options.
Project:
Particle effects in game sample:
Old version 2009 game sample:
Funky Bits