Page 1 of 1
[0.11.1] Multiplayer mod GUIs broken
Posted: Mon Nov 03, 2014 10:16 am
by JamesOFarrell
If you create a GUI object within a mod the next time someone connects you will get an endless cycles of desyncs. If you create the exact same gui with console commands everything works fine. I've attached a mod that creates a button at the top of the screen for all connected players every few seconds (if it doesn't already exist). Running a multiplayer game with this mod will cause the desync every time.
Re: [0.11.1] Multiplayer mod GUI weirdness
Posted: Mon Nov 03, 2014 10:20 am
by jeroon
I've tried working around it by having all GUI actions stop the moment someone joins the game, but so far no luck..
Re: [0.11.1] Multiplayer mod GUI weirdness
Posted: Mon Nov 03, 2014 10:26 am
by JamesOFarrell
I have had luck with a workaround but there is 1 unavoidable desync, either when someone connects or when the game saves depending on the work around you use,
Re: [0.11.1] Multiplayer mod GUI weirdness
Posted: Mon Nov 03, 2014 3:01 pm
by drs9999
Could you also attach the version with the workaround, please?
Re: [0.11.1] Multiplayer mod GUI weirdness
Posted: Mon Nov 03, 2014 3:35 pm
by jeroon
https://www.dropbox.com/s/6fdsgp77hdq5k ... l.zip?dl=0
It's a bit messy, but basically what it does is:
In the game.oninit, game.onload and in a function that checks if someone joined/left (simple if #game.players ~= oldnumberofplayers) are flags that delete any current GUI, activate a timer, and once that timer runs out, redraws the GUI.
(For the timer I tried a simple counter++ in the ontick loop, but if timers don't start at the exact same tick, it creates an desync, so now I round off to current tick + 300 )
This solution desyncs once, right after the second player joins, but auto/manual saves are fine.
Re: [0.11.1] Multiplayer mod GUI weirdness
Posted: Wed Nov 05, 2014 5:12 pm
by cpy
Is this mod? Or do you overwrite control in save?
What do you do with that file????
Re: [0.11.1] Multiplayer mod GUIs broken
Posted: Tue Nov 18, 2014 10:02 am
by Rseding91
Looking at this a much simpler explanation is: mod-added GUIs "game.players[1].gui.top.add()" are not maintained between MP saves.
Adding a GUI with a mod (not the console) in a MP game
Save the game
Exit the game
Load the game back up in MP
The GUi will be gone
Re: [0.11.1] Multiplayer mod GUIs broken
Posted: Tue Nov 18, 2014 10:58 am
by JamesOFarrell
Rseding91 wrote:Looking at this a much simpler explanation is: mod-added GUIs "game.players[1].gui.top.add()" are not maintained between MP saves.
Adding a GUI with a mod (not the console) in a MP game
Save the game
Exit the game
Load the game back up in MP
The GUi will be gone
This is correct and a much better way of describing it. When this bug was logged I didn't fully understand what was going on just what was happening. It happens in multiplayer maps opened in single player as well.
Re: [0.11.1] Multiplayer mod GUIs broken
Posted: Sun Nov 30, 2014 8:03 pm
by kovarex
Hello, thank you for the report.
All the gui created by mods was really removed when loading the game, it is now fixed for 0.11.4, and only the gui of mods that were removed is removed as before.
Re: [0.11.1] Multiplayer mod GUIs broken
Posted: Sun Nov 30, 2014 10:38 pm
by JamesOFarrell
kovarex wrote:Hello, thank you for the report.
All the gui created by mods was really removed when loading the game, it is now fixed for 0.11.4, and only the gui of mods that were removed is removed as before.
Thanks Kovarex, looking forward to getting my hands on 0.11.4.