The Nebula Device 3: Game::GameServer Class Reference

The Nebula Device 3

Game::GameServer Class Reference

#include <gameserver.h>

Inheritance diagram for Game::GameServer:

Core::RefCounted

Detailed Description

The game server setups and runs the game world, consisting of a number of active "game entities". Functionality and queries on the game world are divided amongst several Game Features. This keeps the game server's interface small and clean, and lets Mangalore applications easily extend functionality by implementing new, or deriving from existing game features.

To add or replace FeatureUnit objects, derive from Game::FeatureUnit and add your features on application start or gamestatehandler enter.

The GameServer triggers all attached features. Start and Stop is called within the gamestatehandler to allow all features do stuff after everything is loaded and initialized. Load and Save is invoked from the BaseGameFeature which allows begining a new game, load or save a game.

(C) 2007 RadonLabs GmbH

Public Member Functions

 GameServer ()
 constructor
virtual ~GameServer ()
 destructor
virtual bool Open ()
 open the game world
virtual void Close ()
 close the game world
virtual bool Start ()
 start the game world
bool HasStarted () const
 has the game world already started
virtual void Stop ()
 stop the game world
virtual void OnFrame ()
 trigger the game world
virtual void NotifyGameLoad ()
 call OnLoad on all game features
virtual void NotifyGameSave ()
 call OnSave on all game features
void AttachGameFeature (const Ptr< FeatureUnit > &feature)
 add game feature
void RemoveGameFeature (const Ptr< FeatureUnit > &feature)
 remove game feature
bool IsFeatureAttached (const Util::String &stringName) const
 is feature attached
bool IsQuitRequested () const
 is quit requested
void SetQuitRequested ()
 request quit
int GetRefCount () const
 get the current refcount
void AddRef ()
 increment refcount by one
void Release ()
 decrement refcount and destroy object if refcount is zero
bool IsInstanceOf (const Rtti &rtti) const
 return true if this object is instance of given class
bool IsInstanceOf (const Util::String &className) const
 return true if this object is instance of given class by string
bool IsInstanceOf (const Util::FourCC &classFourCC) const
 return true if this object is instance of given class by fourcc
bool IsA (const Rtti &rtti) const
 return true if this object is instance of given class, or a derived class
bool IsA (const Util::String &rttiName) const
 return true if this object is instance of given class, or a derived class, by string
bool IsA (const Util::FourCC &rttiFourCC) const
 return true if this object is instance of given class, or a derived class, by fourcc
const Util::StringGetClassName () const
 get the class name
Util::FourCC GetClassFourCC () const
 get the class FourCC code

Static Public Member Functions

static void DumpRefCountingLeaks ()
 dump refcounting leaks, call at end of application (NEBULA3_DEBUG builds only!)

Protected Member Functions

void CheckDebugRendering ()
 check input for render debug and return feature for rendering

Member Function Documentation

bool Game::GameServer::Open (  )  [virtual]

open the game world

Initialize the game server object. This will create and initialize all subsystems.

void Game::GameServer::Close (  )  [virtual]

close the game world

Close the game server object.

bool Game::GameServer::Start (  )  [virtual]

start the game world

Start the game world, called after loading has completed.

void Game::GameServer::Stop (  )  [virtual]

stop the game world

Stop the game world, called before the world(current level) is cleaned up.

void Game::GameServer::OnFrame (  )  [virtual]

trigger the game world

Trigger the game server. If your application introduces new or different manager objects, you may also want to override the Game::GameServer::Trigger() method if those gameFeatures need per-frame callbacks.

int Core::RefCounted::GetRefCount (  )  const [inline, inherited]

get the current refcount

Return the current refcount of the object.

void Core::RefCounted::AddRef (  )  [inline, inherited]

increment refcount by one

Increment the refcount of the object.

void Core::RefCounted::Release (  )  [inline, inherited]

decrement refcount and destroy object if refcount is zero

Decrement the refcount and destroy object if refcount is zero.

const Util::String & Core::RefCounted::GetClassName (  )  const [inline, inherited]

get the class name

Get the class name of the object.

Util::FourCC Core::RefCounted::GetClassFourCC (  )  const [inline, inherited]

get the class FourCC code

Get the class FourCC of the object.

void Core::RefCounted::DumpRefCountingLeaks (  )  [static, inherited]

dump refcounting leaks, call at end of application (NEBULA3_DEBUG builds only!)

This method should be called as the very last before an application exits.