Bydlo Posted September 15, 2018 Share Posted September 15, 2018 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? Link to comment
MIKI785 Posted September 15, 2018 Share Posted September 15, 2018 You cant use loadMapData for this, its more complicated than that. loadMapData loads a map file onto the server, meaning that indeed all players will get those elements. You have to do this client sided, you have to make your own client sided version of 'loadMapData'. Link to comment
Bydlo Posted September 15, 2018 Author Share Posted September 15, 2018 Thanks for the reply. Then why does the function take a parent element at its second parameter if its gonna load the map for all players anyway? So you're suggesting working client side, that's what I thought it would be the best too but will it work though? When I create my loadMapData client version I obviously will need to use the function createObject, will that function create the object then synchronizes it for all players too or only for local player? My question applies for many similar functions like createMarker, createPed, createBlip etc... Link to comment
Addlibs Posted September 15, 2018 Share Posted September 15, 2018 (edited) Element hierarchy and parenting has nothing to do with sync, its mostly about propagation. The second parameter is simply a question of where in the element tree the map will be loaded. On the second point, everything created on the client side is only created on client, it is not synced to the server. This includes objects, vehicles, markers, peds, blips, everything. Edited September 15, 2018 by MrTasty Link to comment
Bydlo Posted September 15, 2018 Author Share Posted September 15, 2018 Thanks for the info The reason I was confused is because sometimes you find client functions that sync with server like elements functions: setElementData, getElementsByType etc.. Link to comment
MisterQuestions Posted October 2, 2018 Share Posted October 2, 2018 Its actually complex if you have no experience at all. You have to generate individual maps for only certain clients on each arena (a custom map manager), individual gamemode states, etc. Generating map in client-side will make that map load for only that client, you also have to download map files and start map scripts which is another issue. Link to comment
sanyisasha Posted October 3, 2018 Share Posted October 3, 2018 Why don't download all map datas in once? Maybe in a background progress (downloadFile). The idea is good, but if a player want to play, and have bad internet, annoying to wait until he can play. (If everybody should that's th worst). Link to comment
N3xT Posted October 4, 2018 Share Posted October 4, 2018 17 hours ago, sanyisasha said: Why don't download all map datas in once? Maybe in a background progress (downloadFile). The idea is good, but if a player want to play, and have bad internet, annoying to wait until he can play. (If everybody should that's th worst). He's trying to make a race multigamemode I think, downloading almost thousands of maps at the same time?! I won't recommend this idea. Link to comment
sanyisasha Posted October 4, 2018 Share Posted October 4, 2018 2 hours ago, N3xT said: He's trying to make a race multigamemode I think, downloading almost thousands of maps at the same time?! I won't recommend this idea. Why? Better wait always minutes before game? (Meaning with low internet players, not everybody have gigabit internet ) 1 Link to comment
N3xT Posted October 4, 2018 Share Posted October 4, 2018 (edited) Dude, you're talking about downloading 17GB obviously no one will join your server and download a 17GB! also, when you're making a multigamemode you can't download the map for every single player or this gonna cause a problem the only way is to read the map objects/markers etc.. and create them client-side. Edited October 4, 2018 by N3xT Link to comment
sanyisasha Posted October 4, 2018 Share Posted October 4, 2018 1 minute ago, N3xT said: Dude, you're talking about downloading 17GB obviously no one will join your server and download a 17GB! Didn't said download all in the default mta downloader He make a progressbar somewhere, and if a player want to download in yours way, can disable it. But think a bit: you go, play something, and in the "background" the game download all files. Next what you will say: But man, it will cause lag. Solution: pause download when a match start. Link to comment
N3xT Posted October 4, 2018 Share Posted October 4, 2018 Just now, sanyisasha said: Didn't said download all in the default mta downloader He make a progressbar somewhere, and if a player want to download in yours way, can disable it. But think a bit: you go, play something, and in the "background" the game download all files. Next what you will say: But man, it will cause lag. Solution: pause download when a match start. You could skip all of this trouble by reading the map file for the client instead of downloading them all once. Link to comment
sanyisasha Posted October 4, 2018 Share Posted October 4, 2018 55 minutes ago, N3xT said: You could skip all of this trouble by reading the map file for the client instead of downloading them all once. Yeah maybe. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now