User vs Player and Room vs Game
Posted: 26 Nov 2010, 21:28
I have a question about storage my data associated with User and GameRoom.
1. How to set the context of the player?
Maybe using UserVariable:
or use
2. How much will a quick search for an "id" in the "context" in UserVariable ?
3. Rooms:
I have zone Extension, and rooms I create dynamically on server.
and then
where myExtension - an instance of my class were logic, data and room event handlers in the room-game.
Everything is correct?
1. How to set the context of the player?
Maybe using UserVariable:
Code: Select all
ProfileVO profileVO = (ProfileVO) data.getVo();
UserVariable variable = new SFSUserVariable("context", profileVO);
try
{
user.setVariable(variable);
}
catch (SFSVariableException ex)
{
getExtension().trace(ExtensionLogLevel.ERROR, ex);
}Code: Select all
private static ConcurrentHashMap <User, ProfileVO> profilesByUser = new ConcurrentHashMap <User, ProfileVO> ();
private static ConcurrentHashMap<Integer, ProfileVO> profilesById = new ConcurrentHashMap<Integer, ProfileVO>();
3. Rooms:
I have zone Extension, and rooms I create dynamically on server.
Code: Select all
SFSGameApi
createGame(Zone zone, CreateSFSGameSettings settings, User owner) Code: Select all
room.setExtension(ISFSExtension myExtension)Everything is correct?