Packagecom.smartfoxserver.v2.entities
Classpublic class MMORoom
InheritanceMMORoom Inheritance SFSRoom Inheritance Object

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 SFSEvent.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.

See also

CreateRoomRequest
MMORoomSettings
SetUserPositionRequest
proximityListUpdate event
MMOItem


Public Properties
 PropertyDefined By
 Inheritedcapacity : int
[read-only] Returns the maximum amount of users, including spectators, that can be contained in this Room.
SFSRoom
  defaultAOI : Vec3D
Returns the default Area of Interest (AoI) of this MMORoom.
MMORoom
 InheritedgroupId : String
[read-only] Returns the Room Group name.
SFSRoom
  higherMapLimit : Vec3D
Returns the higher coordinates limit of the virtual environment represented by the MMORoom along the X,Y,Z axes.
MMORoom
 Inheritedid : int
[read-only] Indicates the id of this Room.
SFSRoom
 InheritedisGame : Boolean
Indicates whether this is a Game Room or not.
SFSRoom
 InheritedisHidden : Boolean
Indicates whether this Room is hidden or not.
SFSRoom
 InheritedisJoined : Boolean
Indicates whether the client joined this Room or not.
SFSRoom
 InheritedisPasswordProtected : Boolean
Indicates whether this Room requires a password to be joined or not.
SFSRoom
  lowerMapLimit : Vec3D
Returns the lower coordinates limit of the virtual environment represented by the MMORoom along the X,Y,Z axes.
MMORoom
 InheritedmaxSpectators : int
Returns the maximum number of spectators allowed in this Room (Game Rooms only).
SFSRoom
 InheritedmaxUsers : int
Returns the maximum number of users allowed in this Room.
SFSRoom
 Inheritedname : String
Indicates the name of this Room.
SFSRoom
 InheritedplayerList : Array
[read-only] Returns a list of User objects representing the players currently inside this Room (Game Rooms only).
SFSRoom
 Inheritedproperties : Object
Defines a generic utility object that can be used to store custom Room data.
SFSRoom
 InheritedroomManager : IRoomManager
Returns a reference to the Room Manager which manages this Room.
SFSRoom
 InheritedspectatorCount : int
Returns the current number of spectators in this Room (Game Rooms only).
SFSRoom
 InheritedspectatorList : Array
[read-only] Returns a list of User objects representing the spectators currently inside this Room (Game Rooms only).
SFSRoom
 InheriteduserCount : int
Returns the current number of users in this Room.
SFSRoom
 InheriteduserList : Array
[read-only] Returns a list of User objects representing all the users currently inside this Room.
SFSRoom
Public Methods
 MethodDefined By
  
MMORoom(id:int, name:String, groupId:String = default)
MMORoom
 Inherited
containsUser(user:User):Boolean
Indicates whether the specified user is currently inside this Room or not.
SFSRoom
 Inherited
containsVariable(name:String):Boolean
Indicates whether this Room has the specified Room Variable set or not.
SFSRoom
  
Retrieves an MMOItem object from its id property.
MMORoom
  
getMMOItems():Array
Retrieves all MMOItem object in the MMORoom that fall within the current user's Area of Interest.
MMORoom
 Inherited
Retrieves a User object from its id property.
SFSRoom
 Inherited
getUserByName(name:String):User
Retrieves a User object from its name property.
SFSRoom
 Inherited
Retrieves a Room Variable from its name.
SFSRoom
 Inherited
getVariables():Array
Retrieves all the Room Variables of this Room.
SFSRoom
 Inherited
toString():String
Returns a string that contains the Room id, name and id of the Group to which it belongs.
SFSRoom
Property Detail
defaultAOIproperty
defaultAOI:Vec3D

Returns the default Area of Interest (AoI) of this MMORoom.


Implementation
    public function get defaultAOI():Vec3D
    public function set defaultAOI(value:Vec3D):void

See also

higherMapLimitproperty 
higherMapLimit:Vec3D

Returns the higher coordinates limit of the virtual environment represented by the MMORoom along the X,Y,Z axes. If null is returned, no limits were set at Room creation time.


Implementation
    public function get higherMapLimit():Vec3D
    public function set higherMapLimit(value:Vec3D):void

See also

lowerMapLimitproperty 
lowerMapLimit:Vec3D

Returns the lower coordinates limit of the virtual environment represented by the MMORoom along the X,Y,Z axes. If null is returned, no limits were set at Room creation time.


Implementation
    public function get lowerMapLimit():Vec3D
    public function set lowerMapLimit(value:Vec3D):void

See also

Constructor Detail
MMORoom()Constructor
public function MMORoom(id:int, name:String, groupId:String = default)

Parameters
id:int
 
name:String
 
groupId:String (default = default)
Method Detail
addMMOItem()method
kernel function addMMOItem(item:IMMOItem):void

Parameters

item:IMMOItem

getMMOItem()method 
public function getMMOItem(id:int):IMMOItem

Retrieves an MMOItem object from its id property. The item is available to the current user if it falls within his Area of Interest only.

Parameters

id:int — The id of the item to be retrieved.

Returns
IMMOItem — An MMOItem object, or null if the item with the passed id is not in proximity of the current user.
getMMOItems()method 
public function getMMOItems():Array

Retrieves all MMOItem object in the MMORoom that fall within the current user's Area of Interest.

Returns
Array — A list of MMOItem objects, or an empty list if no item is in proximity of the current user.

See also

removeItem()method 
kernel function removeItem(id:int):void

Parameters

id:int