SFS2X Objective-C API  1.7.13
iOS / macOS / tvOS
MMORoom Class Reference

#import <MMORoom.h>

Inherits SFSRoom.

Instance Methods

(id< IMMOItem >) - getMMOItem:
 
(NSArray *) - getMMOItems
 
(void) - addMMOItem:
 
(void) - removeMMOItem:
 
- Instance Methods inherited from SFSRoom
(id- initWithId:name:groupId:
 
(NSArray *) - getVariables
 
(id< RoomVariable >) - getVariable:
 
(id< User >) - getUserByName:
 
(id< User >) - getUserById:
 
(BOOL) - containsVariable:
 
(BOOL) - containsUser:
 
(void) - merge:
 

Properties

Vec3DdefaultAOI
 
Vec3DlowerMapLimit
 
Vec3DhigherMapLimit
 
- Properties inherited from SFSRoom
NSInteger id
 
NSString * name
 
NSString * groupId
 
BOOL isGame
 
BOOL isHidden
 
BOOL isJoined
 
BOOL isPasswordProtected
 
BOOL isManaged
 
NSInteger maxUsers
 
NSInteger maxSpectators
 
NSInteger userCount
 
NSInteger capacity
 
NSInteger spectatorCount
 
NSDictionary * properties
 
id< IRoomManager > roomManager
 
NSArray * userList
 
NSArray * playerList
 
NSArray * spectatorList
 

Additional Inherited Members

- Class Methods inherited from SFSRoom
(id< Room >) + fromSFSArray:
 
- Protected Attributes inherited from SFSRoom
NSInteger _id
 
NSString * _name
 
NSString * _groupId
 
BOOL _isGame
 
BOOL _isHidden
 
BOOL _isJoined
 
BOOL _isPasswordProtected
 
BOOL _isManaged
 
NSMutableDictionary * _variables
 
NSDictionary * _properties
 
id< IUserManager > _userManager
 
NSInteger _maxUsers
 
NSInteger _maxSpectators
 
NSInteger _userCount
 
NSInteger _spectatorCount
 
__weak id< IRoomManager > _roomManager
 

Detailed Description

The MMORoomobject 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 [ISFSEvents onProximityListUpdate] 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
MMOItem
[ISFSEvents onProximityListUpdate]

Method Documentation

◆ getMMOItem:

- (id< IMMOItem >) getMMOItem: (NSInteger)  itemId

Gets an MMOItem by its unique id

Parameters
itemIdthe id
Returns
the MMOItem or nil if no item was found with the provided id
See also
MMOItem

◆ getMMOItems

- (NSArray *) getMMOItems

Get all MMOItems managed by this MMORoom

Returns
all MMOItems
See also
MMOItem

Property Documentation

◆ defaultAOI

- (Vec3D*) defaultAOI
readwritenonatomicstrong

The default Area of Interest (AoI) of this MMORoom.

See also
Vec3D

◆ higherMapLimit

- (Vec3D*) higherMapLimit
readwritenonatomicstrong

The highest coordinates value for the MMORoom.

See also
Vec3D

◆ lowerMapLimit

- (Vec3D*) lowerMapLimit
readwritenonatomicstrong

The lower coordinates value for the MMORoom.

See also
Vec3D