This project is read-only.

Getting Started

Starting a new project

Open Visual Studio 2010 and go to File->New->Project, select Windows Game (4.0), name it and press OK.

Now we have a blank XNA project.

Adding the engine

To add the engine to the game we have to add a BaseEngine variable and, in the constructor, create a new instance of the variable

BaseEngine engine;

public Test()
{
    engine = new BaseEngine(this);
}

Now the engine is ready and we have to add entities to the engine.

Other settings

Camera

If we want to add 3d models to the engine, we need to set up camera, otherwise the game crashes!

To add the camera we need to add the follow code to the constructor:

engine.camera = new Camera(new Vector3(0), new Vector3(0, 0, 1), 1f,
   (float)engine.graphics.PreferredBackBufferWidth / (float)engine.graphics.PreferredBackBufferHeight, 0.1f, 10000f);

The first parameter is the position of the camera.

The second is the orientation of the camera.

The third is the FOV of the camera(by default 1f).

The fourth is the aspect ratio (use (float)engine.graphics.PreferredBackBufferWidth / (float)engine.graphics.PreferredBackBufferHeight)).

The fifth is the near plane.

The sixth is the far plane.

Antialiasing

To add antialiasing filter to the engine we need to add "engine.antialisingPass = 4;", where 4 is the pass of multisampling and engine is the BaseEngine variable.

Resolution and Fullscreen

To set resolution of the screen for the game we use "engine.resolution = new Vector2(1680, 1050);" and to set fullscreen "engine.graphics.ToggleFullScreen();".

Adding Entities

To add enties we need to add this code to the Initialize() method of the game

engine.entities.AddAndInitialize(new IEntity());

Where engine is the BaseEngine variable and IEntity is the entity we want to add.

Last edited Sep 9, 2011 at 6:17 PM by giulioz, version 3

Comments

No comments yet.