code architecture

(1/1)

Richard Marks:
I have decided to build the game separate from the game engine, and as a result, the engine will be reusable.

All of the game-specific code will reside in the game project, and all game-engine code resides within the engine library project.

I am documenting every component as it is added to the engine, so that there is no missing documentation.

The engine is mostly run through a single class instance of the EUCore class.
This class is responsible for letting you do whatever you need to do.

The game code is responsible for creating the single instance of EUCore, and using it to set up the initial game states, which are then processed.

Every state that the game will ever be in is handled by separate classes.

Richard Marks:
This is the main code file for the game project.
As you can see, its very clean, and very simple. 8)
This was an important thing in my design choices, I want the engine to be reusable, and easily used. No sitting there wondering how to do things.

Code:

#region File Information
// EveUltimateGame.cs
// The main game class implementation
/**
 * Eve Ultimate: The Story of Leo Chaos
 * version 0.0.1
 * Developed by Undefined Aeon Software, CCPS Solutions, NOGDUS
 * (C) Copyright 2010, Richard Marks
 */
#endregion

#region Using Statements
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

using EUEngine.Core;
using EUEngine.Utility;
using EveUltimate.Screens;
#endregion // end Using Statements region

namespace EveUltimate
{
    /// <summary>
    /// The main game class implementation
    /// </summary>
    public class EveUltimateGame : EUGame
    {
        #region Initialization

        /// <summary>
        /// class constructor
        /// </summary>
        public EveUltimateGame() :
            base(800, 600)
        {
            Core.ScreenManager.Add(new EUGameBackgroundScreen(), null);
        }

        #endregion // end Initialization region

        #region Rendering

        /// <summary>
        /// This is called when the game should draw itself.
        /// take note that all drawing is handled by each game screen class automatically
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Black);
            base.Draw(gameTime);
        }

        #endregion // end Rendering region
    }

    #region Program Entry Point

    /// <summary>
    /// The game startup program class
    /// </summary>
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main(string[] args)
        {
            using (EveUltimateGame game = new EveUltimateGame())
            {
                game.Run();
            }
        }
    }

    #endregion // end Program Entry Point region
}

Navigation

[0] Message Index