How do you create a common gui if possible ?
Posted: Sun Aug 28, 2022 12:03 pm
Hello everyone,
I'm developing on a mod and I've an issue in my scenario, sometimes in the server I get like 40 players that are playing, the issue is that the GUI is updated frequently which generates a lot of calls because you need to the update of gui to same value 40 times (bad for perf late game with all that is happening around it too).
My idea to avoid that issue was to create a common gui, but I can't figure out how to make one, and if it's ever possible... Any idea? I just want to initialize in the end a variable as a luagui so other players gui points to it.
I've tried things like that :
It didn't work obviously (error cant add to nil)
I've also tried things like that :
But it doesnt' work too.
And my idea was then once I've this common gui variable, I could just do something along this line for the elements that are frequently updated :
The goal is in the end is to improve performance even more, gui being one of the top issues.
Thanks in advance,
Masamune
I'm developing on a mod and I've an issue in my scenario, sometimes in the server I get like 40 players that are playing, the issue is that the GUI is updated frequently which generates a lot of calls because you need to the update of gui to same value 40 times (bad for perf late game with all that is happening around it too).
My idea to avoid that issue was to create a common gui, but I can't figure out how to make one, and if it's ever possible... Any idea? I just want to initialize in the end a variable as a luagui so other players gui points to it.
I've tried things like that :
Code: Select all
/c global.common_gui= {}
/c global.common_gui.add {name="test",type = "label", caption = "Threat: "}
I've also tried things like that :
Code: Select all
/c global.common_gui = LuaGui
And my idea was then once I've this common gui variable, I could just do something along this line for the elements that are frequently updated :
Code: Select all
for player in players
player.gui = global.common_gui
end
Thanks in advance,
Masamune