CSc 165 Lecture Notes 1 - Game Engines CSc 165 Computer Game Architecture Basic Game Structure

Start while (!gameOver)

Initialize system Player Input Initialize 1 - Game Engines game One iteration Game Main Logic Update Loop = 1 Frame

Shutdown Render

Exit “Tightly-coupled” game loop

2

CSc 165 Lecture Notes CSc 165 Lecture Notes 1 - Game Engines 1 - Game Engines

Game ENGINE Typical Functions A reusable collection of modules ▪ Independent of any particular Game Logic • Simulation of elapsed time • View (camera) control ▪ Encapsulates platform dependencies • Scene Management • Input handling o Objects, geometry details ▪ Possible because all games have things in common • Sound generation • Rendering • Network communication • Collision Detection/Handling Game Application Logic o Physics simulation • Special effects • Lights, Shadows, Textures o Explosions, fire, …

Game Engine

Player 3 4

CSc 165 Lecture Notes CSc 165 Lecture Notes 1 - Game Engines 1 - Game Engines Game Engine Design Some Game Engines

Game Application Logic o o jMonkey o Unreal o OGRE

o o Quake <> <> <> <> … other RenderSystem Input Audio Networking o CryEngine o Lumberyard o Blender (Amazon) Game Engine o Panda 3D o 3D Network o GameMaker o Hero Engine

For an expanded list see: http://en.wikipedia.org/wiki/List_of_game_engines 5 6 CSc 165 Lecture Notes CSc 165 Lecture Notes 1 - Game Engines 1 - Game Engines

RAGE : “Raymond’s Awesome Game Engine” Abstracting Game Structure

A collection of Java packages <> ray.rage.game.AbstractGame rage # abstract void startup(); # abstract void loadConfiguration(); math assets renderer scene # abstract void RenderSystemFactory(); # abstract void setupGpuShaderPrograms(); jogl light # abstract void setupWindowViewports(); # abstract void SceneManagerFactory(); in RAGE it’s called “RML” # abstract void run(); # abstract void shutdown(); # abstract void setupCameras(); # abstract void setupScene(); audio input physics AI networking # abstract void setupWindow(); # abstract void update(); jbullet - Game.State

... SomeGame

7 8

CSc 165 Lecture Notes CSc 165 Lecture Notes 1 - Game Engines 1 - Game Engines

Abstracting Game Structure (cont.) Abstracting Game Structure (cont.)

<> AbstractGame

<> BaseGame ray.rage.game.BaseGame

ray.rage.game.VariableFrameRateGame startup() shutdown() exit() run() setState() # run() getState() getEngine() # setupWindow() # setupWindowViewport() # setupGpuShaderPrograms() # createRenderSystemFactory() # createSceneManagerFactory() keyPressed(), keyTyped(), etc... mouseClicked(), mouseMoved(), etc...

9 10

CSc 165 Lecture Notes CSc 165 Lecture Notes 1 - Game Engines 1 - Game Engines Creating A Simple Game

<> AbstractGame Note – there is another, proprietary game engine called “RAGE”.

<> Provides a default RAGE classes BaseGame display window used by Rockstar Games <> Provides a default for Grand Theft Auto, Max Payne, etc. VariableFrameRateGame “run” game loop

MyGame Not required but usually “Rockstar Advanced Game Engine” # void setupWindow(); beneficial to override # void setupCameras(); # void setupScene(); Required # void update();

11 12