• Overview
    • For a quick overview of how this scene was created, let’s take a look at SampleScene.cs in the QuickStartSampleGame_Windows project.
      • This project is meant to serve a demonstration of the engine’s capabilities. Unless you’re looking to make modifications to the Engine’s architecture on your own, you will want to make most of your changes in this project, or a new project of your own.
    • The QuickStart Engine is setup to load scenes. The Scene Manager will load any scenes needed, and that is what you will see in the game. Loading of scenes and objects will eventually be supported through an Editor and XML files, but while the architecture of the engine is in progress, we’re simply loading from C# files (although we can load many things from XML referenced in the code). The first time you startup the engine, you’re seeing the scene loaded from SampleScene.cs in the ‘QuickStartSampleGame_Windows’ project.
    • SampleScene (in SampleScene.cs) is of the class type Scene. A scene is a container for a group of things for loading, and it also contains settings for things like fog and gravity. We will eventually be loading scenes from XML, but until then it is loaded in code.

      Here’s the constructor:
      public SampleScene(QSGame game) : base(game)

          // Load terrain


          // Load light


          // Load a space ship
      BaseEntity newEntity = new BaseEntity(this.game, new Vector3(1000.0f, 254.0f,
          600.0f), Matrix.CreateRotationX(0.3f), 10.0f);
          this.game.SceneManager.AddEntityByTemplateID(newEntity, 8);



          BoxStack(2, new Vector3(1015.0f, 185.0f, 700.0f));
          BoxAntiGrav(new Vector3(1000.0f, 185.0f, 730.0f), false);
          BoxAntiGrav(new Vector3(1000.0f, 185.0f, 575.0f), true);

          game.GameMessage += this.Game_GameMessage;
    • Very simply, we’re loading terrain, and a light for the Renderer to use. LoadCharacter() to load a controllable character. We’re calling LoadSkyDome(), to load the sky and rotate it into place. We setup parameters for a space ship and then load it. LoadRainParticleEmitter() to get some rainy weather going. LoadWater(), to get a plane of water. BoxStack() for loading up some box shapes for the scene just for fun. And BoxAntiGrav() loads a box that acts as anti-gravity (we’re loading two, one visible and one invisible for this scene).
    • LoadSkyDome() loads up a sky dome. The SkyDomeComponent is very simple, but we’ll discuss it later on.
    • LoadCharacter() loads a controllable character. Within this function there is a commented message, if you uncomment that message you will start the demo in control of the character, otherwise you can hit tab during the demo until you are attached to the character (which looks like single a green sphere).
    • LoadRainParticleEmitter() loads a particle emitter that emulates weather.
    • LoadWater() loads a water plane.
    • BoxStack() creates a stack of boxes, gives them positions, and then places them in the world. You’ll learn more about this later in the tutorial.
    • BoxAntiGrav() creates a box that changes gravity when physics are within it. We’ll see that later as well.
    • The camera we see in the sample is the Engine’s default camera, which you’ll learn about later, everything else you see in the scene was loaded with these functions we just talked about.
    • This was just a basic overview to show you that a Scene is your loading point for objects when you get started with your own game, and now you can see how little we had to do to get a large terrain with many some boxes, a sky, and some water into the game. If you’d like to learn some basic details on how the engine works under the hood, and how to take advantage of some of it, we recommend reading through the rest of the engine documentation.

Last edited Jan 24, 2012 at 5:00 AM by LordIkon, version 6


No comments yet.