Assignment 4 Game Engine Architecture Solution

$30.00 $26.40

Description

Assignment

You will work on creating and using your own game loop and escape from dependence on ogre’s frame listener and the sample framework. We have talked extensively about the architecture of the game engine in class and your design and implementation will t within the game engine architecture that we have been discussing in class. All pre-written code for this assignment is here. Your mission:

Re-implement assignment three in this new architecture

Architecture (90 points)

The game engine will now be implemented in a class called Engine. Your main program (in main.cpp) will create, initialize, run, and cleanup your 381 game engine as shown below.

#include <Engine.h>

int main(int argc, char *argv[]){

Engine *engine = new Engine();

engine->Init();

engine->Run();

engine->Cleanup();

return 0;

}

The Engine class is de ned here: Engine.cpp. The Engine class

  1. Constructs manager instances

  1. Initializes manager instances

  1. Implements the game tick. It computes the time for one tick, and passes this on to all your Manager instances.

1

4. Brings the engine down gracefully

It should be clear from the Engine implementation code that the game engine contains the following Managers.

  1. An EntityMgr to create and keep track of all game entities. This will change from my posted solution to assignment three (15 points)

  1. A GfxMgr to initialize ogre graphics (as in Tutorial 6), and initialize the camera. This class’ tick function calls ogre’s renderOneFrame as shown in Tutorial 6 (20 points)

  1. An InputMgr to initialize the keyboard, mouse, and setup bu ered input. Handle tab selection, handle camera movemement, and handle user input to change entity desired speed and desired heading. (20 points)

  1. A GameMgr to initialize the game level (scene) and create game entities (15 points)

You have to design and implement EntityMgr, GfxMgr, InputMgr, GameMgr. All man-agers inherit from the Mgr class and call their superclass (Mgr’s) constructor to store a pointer to the game engine.

You may use and modify EntityMgr from my solution to assignment three. Most of the functionality and code for GfxMgr and InputMgr can be found in Tutorial 6 on the ogre website and in the solutions to prior assignments on our class website. Note that, apart from the class constructor, each manager implements the following methods: Init, Tick, LoadLevel, Stop.

You will also need to design and implement two aspects to be attached to each entity.

  1. Physics (10 points): Implements the same physics from our prior assignment three

  1. Renderer (10 points): Creates and manages a 381 entity’s ogre scene node and takes care of copying the 381 entity’s position and orientation to its scene node. Exactly like in assignment three.

You may copy these from the posted solution to assignment three. You will need some changes to my Entity381. I would use the following signature for an Entity38’s constructor:

Entity381::Entity381(Engine *engine, std::string meshfname, Ogre::Vector3 pos, int ident)

This assignment is very similar to the prior assignment and you are to choose and load at least one example of each of ve (5) di erent types of ship models (entity types) at http://www.cse.unr.edu/~sushil/models/381/ into your evolving game engine.

Camera control (5 points)

You will now control the camera with the WASD and PgUp and PgDown keys (get my permission if you would like to use di erent keys).

2

Quitting

Hitting the escape key should shut down your running game engine.

Tab selection (5 points)

Bind the tab key to selection – that is – pressing the tab key will select the “next” entity.

Only selected entities have visible axis aligned bounding boxes.

Design contraints (-100 points)

You may not change main.cpp, Mgr.cpp, Mgr.h, Engine.cpp, Engine.h.

Cumulative Extra Credit

Add ying entities (a class that inherits from entities) and make the alien ship a subclass of the class of ying entities. Make the alien y (+5).

Add a rst person or third person view for the camera. Switch between RTS and rst person view with a hotkey.

Add mouse selection (+5)

Add shift-selection, where pressing the left-shift-key and tab key, adds the next entity to the list of selected entities. User control applies to all selected entities (+5)

Add a speci c selection sound for each di erent type of entity. For example, when an entity of type, say, destroyer gets selected, it says Ready to destroy while when the frigate gets selected it says Let’s go. Nothing obscene please (+10).

Third person view forward from a selected entity’s point of view (+5) Add group mouse selection (+5)

Add the ability for selected entities to intercept another entity. Use right-mouse click to indicate the target ship to be intercepted (+5)

Add wakes to all entities. This code should be added to Renderer (+5)

Turning in your assignment

Assume that this format will be used for all your laboratory assignments throughout the semester unless otherwise speci ed.

  1. Demonstrate your working program in the lab on the due date. You will be graded on your demonstration.

3

  1. In lab, submit the assignment using canvas

    1. Make a subdirectory in your workspace named as4.

    1. Place all your project les in as4 (you will demo from this folder in lab).

    1. Tar and gzip or Zip the entire folder and submit using Canvas

Ask me (sushil@cse.unr.edu) if you have questions.

Objectives

  1. Demonstrate an ability to apply knowledge of computing, mathematics, science, and engineering by learning and applying knowledge of C++ and game engine architecture to solve the problem of implementing a game engine

  1. Demonstrate an ability to analyze a problem, and identify, formulate and use the appropriate computing and engineering requirements for obtaining its solution by using inheritance, callbacks, and polymorphism

  1. Demonstrate an ability to use the techniques, skills, and modern engineering tools necessary for engineering practice by using the ogre engine framework and the eclipse

IDE

  1. Demonstrate an ability to apply design and development principles in the construction of software systems or computer systems of varying complexity such as our game engine

4