I'm trying to create a multi arena lobby server. I know the idea is to assign to each arena a certain dimension then set players to that dimension but that only solves the problem of separating the players in the physical world it doesn't separate the synchronization of players, in other words, if a map started in deathmatch arena ALL players in the server will download that map.. not only those in the arena.. players in dd or shooter for example will unnecessarily download maps from other arenas. Here is my code:
function initResource()
-- Lobby
Arenas.lobby = createElement("Arena", "lobby")
Arenas.lobby:setData("dimension", 16)
Arenas.lobby:setParent(g_Root)
-- Deathmatch arena
Arenas.deathmatch = createElement("Arena", "deathmatch")
Arenas.deathmatch:setData("dimension", 0)
Arenas.deathmatch:setParent(g_Root)
loadMaps()
end
addEventHandler("onResourceStart", g_resRoot, initResource)
then when player joins the server he goes automatically to lobby:
function onJoin()
fadeCamera(source, true)
setCameraMatrix(source, unpack(CameraCoordenates))
setElementParent(source, Arenas.lobby)
end
addEventHandler("onPlayerJoin", g_Root, onJoin)
Loading a map. Called from bindKey for debugging purposes.
local map = loadMapData(xmlNode, Arenas.deathmatch)
So this is the way i tried loading the map I used the server function loadMapData and set its second parameter to the deathmatch arena hoping that the map will only load for childs in the deathmatch arena element but it didn't :/ the way i knew it didn't work is simply by staying at lobby and not joining the deathmatch arena then calling the function with bindkey... the download bar appeared obviously and downloaded about one to two megabytes of data..
So i have some questions:
What does the second parameter of loadMapData do?
Does createObject() work the same way client side and server side? Or does the object created in client side only appears to local player?
How to separate synchronization of players?