WIP: Fix "Variables X and Y have same netid" happening way too often
No need to use hashes for netvars, since they are always registered in the same order.
-
Lua can probably load netvars out of order, which can cause problems.
Even if this code doesn't do it some code could probably be made that will...
if players[consoleplayer] == <some number> then CV_RegisterVar{"var1", ...} CV_RegisterVar{"var2", ...} else CV_RegisterVar{"var2", ...} CV_RegisterVar{"var1", ...} end
-
Master
I do not believe it is a solid approach. Specifically, it prevents replay compatibility between minor versions that add or remove cvars, whether that's versions of Lua mods or the base game in the case of Kart's netreplays, in a way that silently fails càstrophically.
-
Master
Lua can probably load netvars out of order, which can cause problems.
Registering cvars is stuff that must be done at script load, and as such MUST be done in a deterministic order (like all other resources/hooks/etc basically). Any script that does otherwise (if it's even possible, that is) is effectively broken.
-
Master
I do not believe it is a solid approach. Specifically, it prevents replay compatibility between minor versions that add or remove cvars, whether that's versions of Lua mods or the base game in the case of Kart's netreplays, in a way that silently fails càstrophically.
Actually, very fair point.
I suppose we should either:
- keep using hashes, but use 32 bits instead of only 16,
- keep the new system, but add a header at the start of replay files, that maps the full names of each used cvar to a temporary ID.
-
marked as a Work In Progress
Toggle commit list -
Master
Well actually, the simplest way to handle replays is to use the cvar names directly in the replay files, instead of using numeric IDs of sort.
-
-
closed
Toggle commit list