Nebula
|
#include <gameserver.h>
The game server setups and runs the game world.
Functionality and queries on the game world are divided amongst several FeaturesUnits. This keeps the game server's interface small and clean, and lets 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 beginning a new game, load or save a game.
Inherits Core::RefCounted.
Classes | |
struct | State |
contains internal state and world management More... | |
Protected Attributes | |
bool | isOpen |
bool | isStarted |
Util::CommandLineArgs | args |
Util::Array< Ptr< FeatureUnit > > | gameFeatures |
Private Member Functions | |
virtual __DeclareClass(GameServer) __DeclareSingleton(GameServer) public | ~GameServer () |
destructor | |
virtual bool | Open () |
Initialize the game server object. | |
virtual bool | Start () |
Start the game world, called after loading has completed. | |
virtual void | Stop () |
Stop the game world. | |
virtual void | Close () |
Close the game server object. | |
bool | HasStarted () const |
has the game world already started | |
virtual void | OnBeginFrame () |
trigger actions before rendering the game world | |
virtual void | OnFrame () |
trigger the game world | |
virtual void | OnEndFrame () |
trigger actions after rendering the game world | |
virtual void | NotifyBeforeLoad () |
call OnBeforeLoad on all game features | |
virtual void | NotifyBeforeCleanup () |
call OnBeforeCleanup on all game features | |
virtual void | NotifyGameLoad () |
call OnLoad on all game features | |
virtual void | NotifyGameSave () |
call OnSave on all game features | |
void | RenderDebug () |
call when debug gui and primitives are up for rendering | |
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 | |
Util::Array< Ptr< FeatureUnit > > const & | GetGameFeatures () const |
access to all attached features units | |
void | SetCmdLineArgs (const Util::CommandLineArgs &a) |
set command line args | |
const Util::CommandLineArgs & | GetCmdLineArgs () const |
get command line args | |
virtual void | SetupEmptyWorld (World *) |
setup an empty game world | |
virtual void | CleanupWorld (World *) |
cleanup the game world | |
World * | CreateWorld (WorldHash hash) |
create a world. The game server handles all worlds | |
World * | GetWorld (WorldHash worldHash) |
get a world by hash | |
World * | GetWorld (WorldId id) |
get a world by WorldId | |
void | DestroyWorld (WorldHash worldHash) |
destroy a world | |
Private Attributes | |
struct Game::GameServer::State | state |
Additional Inherited Members | |
Public Member Functions inherited from Core::RefCounted | |
RefCounted () | |
constructor | |
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::String & | GetClassName () const |
get the class name | |
Util::FourCC | GetClassFourCC () const |
get the class FourCC code | |
Static Public Member Functions inherited from Core::RefCounted | |
static void | DumpRefCountingLeaks () |
dump refcounting leaks, call at end of application (NEBULA_DEBUG builds only!) | |
Protected Member Functions inherited from Core::RefCounted | |
virtual | ~RefCounted () |
destructor (called when refcount reaches zero) | |
|
privatevirtual |
destructor
|
private |
add game feature
|
privatevirtual |
cleanup the game world
Cleanup the game world.
This should undo the stuff in SetupWorld(). Override this method in a subclass if your app needs different behaviour.
|
privatevirtual |
Close the game server object.
create a world. The game server handles all worlds
|
private |
destroy a world
|
inlineprivate |
get command line args
|
private |
access to all attached features units
|
private |
has the game world already started
|
private |
is feature attached
|
privatevirtual |
call OnBeforeCleanup on all game features
|
privatevirtual |
call OnBeforeLoad on all game features
|
privatevirtual |
call OnLoad on all game features
|
privatevirtual |
call OnSave on all game features
|
privatevirtual |
trigger actions before rendering the game world
|
privatevirtual |
trigger actions after rendering the game world
|
privatevirtual |
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.
|
privatevirtual |
Initialize the game server object.
|
private |
remove game feature
|
private |
call when debug gui and primitives are up for rendering
|
inlineprivate |
set command line args
|
privatevirtual |
setup an empty game world
Setup a new, empty world.
|
privatevirtual |
Start the game world, called after loading has completed.
|
privatevirtual |
Stop the game world.
|
protected |
|
protected |
|
protected |
|
protected |
|
private |