Class SFS2X.Entities.MMORoom
A specialized type of Room entity on the client.
- Extends SFS2X.Entities.SFSRoom
Constructor Attributes | Constructor Name and Description |
---|---|
SFS2X.Entities.MMORoom(id, name, groupId)
Creates a new MMORoom instance.
|
Field Summary
Method Summary
Class Detail
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 proximityListUpdate 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.
NOTE: developers never istantiate an MMORoom manually: this is done by the SmartFoxServer 2X API internally. Creating an instance and passing it to the API can disrupt its functioning. You should use the CreateRoomRequest request instead.
- Parameters:
- {Number} id
- The MMORoom id.
- {String} name
- The MMORoom name.
- {String} groupId Optional, Default: "default"
- The id of the Group to which the MMORoom belongs.
Field Detail
NOTE: setting the defaultAOI property manually has no effect on the server and can disrupt the API functioning.
null
is returned, no limits were set at Room creation time.
NOTE: setting the higherMapLimit property manually has no effect on the server and can disrupt the API functioning.
null
is returned, no limits were set at Room creation time.
NOTE: setting the lowerMapLimit property manually has no effect on the server and can disrupt the API functioning.
Method Detail
-
{MMOItem} getMMOItem(id)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:
- {Number} id
- The id of the item to be retrieved.
- Returns:
- {MMOItem} An MMOItem object, or
null
if the item with the passed id is not in proximity of the current user.
-
{Array} getMMOItems()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:
- SFS2X.Entities.MMOItem