Server scoreboard sync is inconsistent

Published by mensreamc on
Status
Can not reproduce
Issue description

On a dedicated server running this mod you'll notice that sometimes the scoreboard is reported accurately while other times it lags behind or disappears altogether. Attached is the workspace.

Issue comments

I can not see the workspace.

This could be a problem on who scoreboards work, as we do not control the synchronization of the scoreboards, they are done in the backend of Minecraft.

The scoreboard is accurate, it's getting the information from the scoreboard and setting it as a global_session variable that seems to be acting up. It works fine in single player but on the server it often doesn't set global_sessions at all.

 

For some reason I can't seem to upload my workspace here so this is my dropbox link for it https://www.dropbox.com/s/lqzwywed69s239e/mod.zip?dl=0

This could be a problem on who scoreboards work, as we do not control the synchronization of the scoreboards, they are done in the backend of Minecraft.

This could be the problem that the server and client do not synchronize it properly. I will take a look, but first please give me more details what to check:

When possible, include your MCreator workspace (or even better a minimal example workspace required to reproduce the bug), game crash logs (full logs, do not crop them, in text format, not screenshots of logs) from the Console tab or terminal and steps to reproduce the bug in your workspace. Please specify which mod elements to check in your workspace too, if applicable.

Basically just make a dedicated server with the mod I posted. Join the server and hit the "c" button. Click "create custom" and you'll see a GUI with buttons and text fields saying stuff like "stat points" and "skill points" with numbers next to them. It's those numbers that are messing up on the server. They are actually values being pulled from global variables.

They all work fine on single player, and they occasionally work on a server, but not enough to be useful. The last update you did made it so they work occasionally but not often enough to be useful.

How does the vanilla game manage to sync scoreboard values? I can use the /scoreboard objectives setdisplay command and it's perfectly accurate on a server.

 

Oh and the element you would probably want to check is "use_view_character". It has perfect examples of the procedures I'm using to display scoreboard data on the GUI's.

This specifically seems to be happening after server restarts are after people have logged off and come to log back on later. Should I make a new issue?

I have done some tests in an isolated case of setting the user points and they seemed to work. Are you sure you never pull values from the server or to it via global variable as you use session variables which are not synced at all?

This page might help too: https://mcreator.net/wiki/developing-multiplayer-compatible-mods

If this does not help, consider making a plain minimal workspace to reproduce this error, really minimal blocks needed as I can not orient myself in such a huge workspace :/

All I'm doing is setting GLOBAL_SESSION variables to scoreboard numbers, and then using <VAR:global_session_variable> in GUI's to display it. It works in single player. It works in multiplayer until you log out, and then it breaks and never works again.

 

If GLOBAL_SESSION variables don't work on servers is there some other way I can display scoreboard values on the GUI? Without the ability to display those numbers on the server this mod is really kind of useless.

 

Here, I actually just made this mod specifically to prove this: https://www.dropbox.com/s/n0507wa4a0a9xba/test1.zip?dl=0

Make a dedicated server.

Log in to it with a client that has this loaded on it.

Hit "1" and press the "+" button on the GUI to add points to a scoreboard value. Notice how the display changes to reflect how many times you hit the button.

Exit the game.

Log back in and hit "1". The display now says 0. If you use the /scoreboard command on yourself you can see that it's not 0.