Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

Eris::World Class Reference

the entity database and dispatch point More...

#include <World.h>

List of all members.

Public Member Functions

 World (Player *p, Connection *c)
EntityPtr lookup (const std::string &id)
 convert an entity ID to an instance pointer

EntityPtr getRootEntity ()
 obtain a pointer to the root entity for this client (i.e look(""))

ConnectiongetConnection () const
 Retrieve the Connection object associated with the World.

PlayergetPlayer () const
void tick ()
 update the World state periodically : this runs various house-keeping tasks, such as running client side looping events, flushing old entities from memory, and running client-side motion prediction and interpolation.

void setFocusedEntity (EntityPtr f)
 specify the origin entity for the world; nearly always the player

EntityPtr getFocusedEntity ()
 get the currently focused entity.

const std::string & getFocusedEntityID ()
 get the id of the focused entity.

const std::string & getDispatcherID () const
void registerFactory (Factory *f, unsigned int priority=1)
void unregisterFactory (Factory *f)
 Remove an factory from the search set.

Avatar * createAvatar (long refno, const std::string &id="")
Avatar * getPrimaryAvatar ()
 gets the avatar, named this way in case we have multiple ones later


Static Public Member Functions

WorldgetPrimary ()
 World is a singleton; this is the accessor.

WorldInstance ()
 deprecated accessor


Public Attributes

SigC::Signal1< void, Entity * > EntityCreate
 Emitted after an entity has been created, added to the world and parented for the first time (i.e basic setup is all complete).

SigC::Signal1< void, Entity * > EntityDelete
 Emitted before an entity is deleted.

SigC::Signal0< void > CharacterSuccess
 CharacterSuccess signal is invoked just once, when we get notice that a character was taken or created.

SigC::Signal1< void, Entity * > Entered
 Entered signal is invoked just once, when the player enters the IG world.

SigC::Signal1< void, Entity * > Appearance
 Appearance is emitted when an entity becoms visible to the client.

SigC::Signal1< void, Entity * > Disappearance
 Disappearance indicates the client should hide the entity from the user.

SigC::Signal1< void, Entity * > RootEntityChanged
 RootEntity change : emitted when the Top-Level Visible Entity (TLVE) change.

SigC::Signal0< void > Destroyed
 The World and any Avatar were destroyed due to logout/disconnect/deletion of the Avatar.

SigC::Signal1< void, double > GotTime
 emitted whenever time information is recieved from the server.


Protected Types

typedef std::multimap< unsigned
int, Factory * > 
FactoryMap

Protected Member Functions

void look (const std::string &id)
EntityPtr create (const Atlas::Objects::Entity::GameEntity &ge)
bool isPendingInitialSight (const std::string &id)
void registerCallbacks ()
void setRootEntity (Entity *root)
void markInvisible (Entity *e)
 interface for entities to get themselves cleaned up eventually; this method will place the entity into an internal LRU cache maintained by world (the InvisibleEntityCache) for some duration, before the Entity is deleted.

void markVisible (Entity *e)
 mark the entity as visible again : this will place the entity back into the active list.

void flush (Entity *e)
 callback from the entity cache, when it decided an entity can be completely deleted

void recvInfoCharacter (const Atlas::Objects::Operation::Info &ifo, const Atlas::Objects::Entity::GameEntity &character)
void recvAppear (const Atlas::Objects::Operation::Appearance &ap)
void recvDisappear (const Atlas::Objects::Operation::Disappearance &ds)
void recvSightObject (const Atlas::Objects::Operation::Sight &sight, const Atlas::Objects::Entity::GameEntity &ent)
void recvSightCreate (const Atlas::Objects::Operation::Sight &sight, const Atlas::Objects::Operation::Create &cr, const Atlas::Objects::Entity::GameEntity &ent)
void recvSightDelete (const Atlas::Objects::Operation::Delete &del)
void recvSightSet (const Atlas::Objects::Operation::Sight &sight, const Atlas::Objects::Operation::Set &set)
void recvSightMove (const Atlas::Objects::Operation::Sight &sight, const Atlas::Objects::Operation::Move &mv)
void recvSoundTalk (const Atlas::Objects::Operation::Sound &snd, const Atlas::Objects::Operation::Talk &tk)
void recvErrorLook (const Atlas::Objects::Operation::Look &lk)
void lookupTimeout (std::string id)
void netConnect ()
 callback when Connection generates a 'Connected' signal (usually a reconnect)


Protected Attributes

std::string _characterID
 ID of the playing character (usually the same as the focused entity's ID).

std::string _igID
 this can't change, even if _characterID does

Connection_con
 The underlying connection.

Player_player
 The Player object (future : list).

bool _initialEntry
 Set if World.Entered needs to be emitted.

EntityIDMap _lookup
 this map tracks all entities we mirror

EntityPtr _root
 the root entity of the world (manged by us)

EntityPtr _focused
 origin entity for field-of-view and so on

FactoryMap _efactories
 storage of every entity factory registered on the world

StringSet _pendingInitialSight
 Set of entities that are waiting for a SIGHT after a LOOK (caused by an appear / move / set / ...).

InvisibleEntityCache * _ieCache
 cache of invisble entities that might re-appear so we keep them around

Avatar * _avatar
 the player character in this world


Static Protected Attributes

World_theWorld = NULL
 static singleton instance


Detailed Description

the entity database and dispatch point


Member Function Documentation

EntityPtr Eris::World::getFocusedEntity  )  [inline]
 

get the currently focused entity.

This value is only valid after World.Entered is emitted; prior to that it will return NULL.

const std::string & Eris::World::getFocusedEntityID  ) 
 

get the id of the focused entity.

This should be identical to doing getFocusedEntity()->getID(), except that is value is valid before World.Entered is emitted.

void Eris::World::markVisible Entity e  )  [protected]
 

mark the entity as visible again : this will place the entity back into the active list.

Note that no other state changes occur.

void Eris::World::registerFactory Factory f,
unsigned int  priority = 1
 

Parameters:
f The factory instance
priority Controls the search order; higher-valued factories are tried first

void Eris::World::tick  ) 
 

update the World state periodically : this runs various house-keeping tasks, such as running client side looping events, flushing old entities from memory, and running client-side motion prediction and interpolation.

Basically, you want to be calling this reasonably often.


Member Data Documentation

SigC::Signal1<void, Entity*> Eris::World::EntityDelete
 

Emitted before an entity is deleted.

The signal is invoked before the ID is unregistered or entity is unparented

SigC::Signal1<void, double> Eris::World::GotTime
 

emitted whenever time information is recieved from the server.

Argument is the curent world time in seconds.

SigC::Signal1<void, Entity*> Eris::World::RootEntityChanged
 

RootEntity change : emitted when the Top-Level Visible Entity (TLVE) change.

The TLVE is the entity returned by LOOK("") at any given point. The signals specifies the new TLVE; you can obtain the current one by calling getRootEntity, i.e the the internal value is updated after the signal is emitted.


The documentation for this class was generated from the following files:
Generated on Tue Jul 27 21:00:43 2004 for Eris by doxygen 1.3.7