SmartFoxServer 2X C++ API
|
The MMORoom object represents a specialized type of Room entity on the client. More...
#include <MMORoom.h>
Public Member Functions | |
MMORoom (long int id, string name, string groupId) | |
<exclude> | |
MMORoom (long int id, string name) | |
<exclude> | |
virtual | ~MMORoom () |
<exclude> | |
boost::shared_ptr< Vec3D > | DefaultAOI () |
Returns the default Area of Interest (AoI) of this MMORoom. More... | |
boost::shared_ptr< Vec3D > | LowerMapLimit () |
Returns the lower coordinates limit of the virtual environment represented by the MMORoom along the X,Y,Z axes. More... | |
boost::shared_ptr< Vec3D > | HigherMapLimit () |
Returns the higher coordinates limit of the virtual environment represented by the MMORoom along the X,Y,Z axes. More... | |
boost::shared_ptr< IMMOItem > | GetMMOItem (long int id) |
Retrieves an MMOItem object from its id property. More... | |
boost::shared_ptr< vector< boost::shared_ptr< IMMOItem > > > | GetMMOItems () |
Retrieves all MMOItem object in the MMORoom that fall within the current user's Area of Interest. More... | |
void | AddMMOItem (boost::shared_ptr< IMMOItem > item) |
<exclude> | |
void | RemoveItem (long int id) |
<exclude> | |
Public Member Functions inherited from Sfs2X::Entities::SFSRoom | |
boost::shared_ptr< string > | Name () |
The Room name More... | |
void | Name (string value) |
The Room name More... | |
boost::shared_ptr< string > | GroupId () |
The Room Group. Each Room is assigned to its Group. More... | |
bool | IsGame () |
Determines if a Room is a Game Room More... | |
void | IsGame (bool value) |
Determines if a Room is a Game Room More... | |
bool | IsHidden () |
Determines if the Room is hidden More... | |
void | IsHidden (bool value) |
Determines if the Room is hidden More... | |
bool | IsJoined () |
Returns true if the Room is joined by the current User More... | |
void | IsJoined (bool value) |
Returns true if the Room is joined by the current User More... | |
bool | IsPasswordProtected () |
Returns true if the Room requires a password for joining it More... | |
void | IsPasswordProtected (bool value) |
Returns true if the Room requires a password for joining it More... | |
boost::shared_ptr< vector< boost::shared_ptr< RoomVariable > > > | GetVariables () |
Returns all the Room Variables More... | |
boost::shared_ptr< RoomVariable > | GetVariable (string name) |
Get a Room Variable More... | |
long int | UserCount () |
Get the current number of users More... | |
void | UserCount (long int value) |
Get the current number of users More... | |
long int | MaxUsers () |
Get the maximum number of users allowed for this Room More... | |
void | MaxUsers (long int value) |
Get the maximum number of users allowed for this Room More... | |
long int | Capacity () |
Returns the max amount of users (both Users and Spectators) that can be contained in this room More... | |
long int | SpectatorCount () |
Get the number of spectators (only for Game Rooms) More... | |
void | SpectatorCount (long int value) |
Get the number of spectators (only for Game Rooms) More... | |
boost::shared_ptr< User > | GetUserByName (string name) |
Get a User from its name More... | |
boost::shared_ptr< User > | GetUserById (long int id) |
Get a User from its ID More... | |
boost::shared_ptr< vector< boost::shared_ptr< User > > > | UserList () |
Get the full list of users in the Room More... | |
bool | ContainsVariable (string name) |
Check for the presence of a Room Variable More... | |
bool | ContainsUser (boost::shared_ptr< User > user) |
Checks if a User is joined in this Room More... | |
The MMORoom object represents a specialized type of Room entity on the client.
The MMORoom is ideal for huge virtual worlds and MMO games because it works with proximity lists instead of "regular" users lists. This allows thousands of users to interact with each other based on their Area of Interest (AoI). The AoI represents a range around the user that is affected by server and user events, outside which no other events are received.
The size of the AoI is set at Room creation time and it is the same for all users who joined it. Supposing that the MMORoom hosts a 3D virtual world, setting an AoI of (x=100, y=100, z=40) for the Room tells the server to transmit updates and broadcast events to and from those users that fall within the AoI range around the current user; this means the area within +/- 100 units on the X axis, +/- 100 units on the Y axis and +/- 40 units on the Z axis.
As the user moves around in the virtual environment, he can update his position in the corresponding MMORoom and thus continuously receive events about other users (and items - see below) entering and leaving his AoI. The player will be able to update his position via the SetUserPositionRequest request and receive updates on his current proximity list by means of the PROXIMITY_LIST_UPDATE event.
Finally, MMORooms can also host any number of "MMOItems" which represent dynamic non-player objects that users can interact with. They are handled by the MMORoom using the same rules of visibility described before.
boost::shared_ptr< Vec3D > Sfs2X::Entities::MMORoom::DefaultAOI | ( | ) |
Returns the default Area of Interest (AoI) of this MMORoom.
boost::shared_ptr< IMMOItem > Sfs2X::Entities::MMORoom::GetMMOItem | ( | long int | id | ) |
boost::shared_ptr< vector< boost::shared_ptr< IMMOItem > > > Sfs2X::Entities::MMORoom::GetMMOItems | ( | ) |
boost::shared_ptr< Vec3D > Sfs2X::Entities::MMORoom::HigherMapLimit | ( | ) |
Returns the higher coordinates limit of the virtual environment represented by the MMORoom along the X,Y,Z axes.
If null
is returned, then no limits were set at Room creation time.
boost::shared_ptr< Vec3D > Sfs2X::Entities::MMORoom::LowerMapLimit | ( | ) |
Returns the lower coordinates limit of the virtual environment represented by the MMORoom along the X,Y,Z axes.
If null
is returned, then no limits were set at Room creation time.