This project is read-only.

Brain 2 Game Engine
Last Updated: 04/12/2012
LAR Gaming

1. Implementing
1.1 Using Game class
To implement the Engine using the Game class, see the below sample class:

public class Game1 : Game
GraphicsDeviceManager graphics;

public Game1()
graphics = new GraphicsDeviceManager(this);
graphics.PreferredBackBufferWidth = 1280;
graphics.PreferredBackBufferHeight = 720;

protected override void Initialize()


protected override void Update(GameTime gameTime)


protected override void Draw(GameTime gameTime)


Some managers may be needed for full Engine support. Look at the Demos project Game1 file to understand that better.

2. Managers
The Engine class is full of Managers. Managers uses the IEngineManager interface, and by default by calling Engine.InitializeWithDefaultManager the Engine will create all it’s Default Managers. By the current date(03/24/2012) it’s a little hard to use your own made managers if it’s a manager essential for the Engine.
Below are all the IEngineManagers that come by default with the Engine. If not mentioned, all the Default version of these managers are present on the Brain 2 CORE library.
2.1 IAnimationManager
2.1.1 What the Default Manager needs to have
To implement(and work) a class using the IAnimationManager interface must have:
bool Playing -> Indicates if the Animation Manager is currently playing.
int CurrentFrame -> Indicates what is the Current Frame the Animation Manager is in. This is used for all IBaseAnimations to know what frame it should update
float FrameDifference -> How much the CurrentFrame advanced from the lastFrame. Yes, CurrentFrame is an int, so you have to keep track of a frame in float values(but the Engine’s Animations work with integer frames)
void Play() -> A method to start playing the IAnimationManager
void Stop() -> A method to stop playing the IAnimationManager

2.1.2 Default Animation Manager
The Default Animation Manager covers everything needed by the IAnimationManager interface.

2.1.3 Why it was made like that
By the start (LarX, years ago), every Animation Time Line updated itself. But this way, synchronize stuff animation could be a painful work, almost impossible. With the Animation Manager, every object will have the same Current Frame, so if 2 objects have an animation on frame 0, both will play on frame 0(or if StartFrame is more than 0, in this case take a look in Chapter _, about Animation). Please note that having this Animation Manager doesn’t affect Loop animations. They will play perfectly, it doesn’t matter the Current Frame for them (only the first time they we’re played).

2.2 ICameraManager
2.2.1 What the Default Manager needs to have
ICamera2D -> A Two-Dimensional Camera
ICamera3D -> A Three-Dimensional Camera
2.2.2 Default Camera Manager
TODO -> Accept Camera animation.
Currently: You can only assign a camera to it. Renderers will use the camera assigned to render.

2.3 IConsoleManager
2.3.1 What the Default Manager needs to have
void AcceptString(string s) -> Adds a string to the console

2.3.2 Default Console Manager
The DefaultConsoleManager is on the library Brain 2 DEV.
TODO -> Finish it, it does nothing currently.

2.4 IContentManager
2.4.1 What the Default Manager needs to have
ContentManager -> A Content Manager
T Load<T>(string place) -> A Method for loading Content

2.4.2 Default Content Manager
The Default Content Manager is just an usual ContentManager, with 1 bonus: if you use: Load(“confile:TheNameOfTheFile”) it will search for the filename in the Engine.SerializationManager.LevelData.ContentProject.
This is used on the Editor for building files, so you save the name of the file that will be needed to build, not the place it was built(it makes sense, you will see on the Editor section).

2.5 IDebugManager
2.6 IEditorManager
2.7 IInputManager
2.8 IPhysics2DManager
2.9 IPhysics3DManager
2.10 IRenderManager2D
2.11 IRenderManager3D
2.12 IScreenManager
2.13 ISerializator
2.14 ITimeManager

3. Editor

Last edited May 12, 2012 at 1:37 AM by lukinhas95, version 1


No comments yet.