Confused about what will / won't break sync

Discuss all aspects related to modding Zandronum here.
Post Reply
t3hplayer
 
Posts: 29
Joined: Thu Sep 19, 2013 10:58 pm

Confused about what will / won't break sync

#1

Post by t3hplayer » Sat Jan 18, 2014 8:37 am

So I'm confused about what will / won't break multiplayer sync. In particular, there's a warning about the GetCVar function on the ZDoom Wiki:
Warning: This feature has at least one use case where the outcome is indeterminate. This feature can break demo and multiplayer sync if an indeterminate result is used to modify the playsim (anything that uses the random number generator, modify level geometry, spawn obstacles, monsters, or powerups, and so on). Usage of the feature in conjunction with non-playsim related features, such as displaying a HudMessage, is safe.

Using non-playsim CVARs such as screenblocks or invertmouse will cause indeterminate behavior. Using Server or User variables, either internal or defined via CVARINFO, is however perfectly safe.
So, I've got some code which alters some game state stuff based on CVars. I'm just setting these CVars on the server by doing (for example):

Code: Select all

set sf_percentspeed 10
Then I've got a bit of ACS code that reads in this CVar, checks it against a random number, and if the CVar is greater than the random number, we modify the speed of the monster for which the code is being run.

So, I've got a few questions:

1. Do I need to define this CVar some other way? Right now, sf_percentspeed isn't even defined on clients which connect to the server, but is instead only defined on the server.
2. Is this something that will cause sync problems? Is all ACS run both locally (on the client) and remotely (on the server), and the results have to match? Or is that bit of ACS I described only run on the server, and so it won't be a problem?

Thanks!

Edit: As far as I can tell, I should be in the clear, but I wanted a second opinion
Last edited by t3hplayer on Sat Jan 18, 2014 8:46 am, edited 1 time in total.

User avatar
StrikerMan780
Forum Regular
Posts: 279
Joined: Tue May 29, 2012 9:16 pm
Clan: Shadow Mavericks
Clan Tag: [SM]

RE: Confused about what will / won't break sync

#2

Post by StrikerMan780 » Sat Jan 18, 2014 9:30 am

If this is for Zandronum, you won't have to worry about Sync.

Klofkac
Forum Regular
Posts: 481
Joined: Sat Jun 09, 2012 1:31 pm
Location: Ask Grandvoid servers

RE: Confused about what will / won't break sync

#3

Post by Klofkac » Sat Jan 18, 2014 2:50 pm

Your sync will break if you call gameplay altering function in clientside script.
About setting CVars, I'd set the CVar to defined value ACS wise if the CVAR does not exist (which is actually hard to check out because undefined CVAR throws 0 in GetCVAR...).
Clients should not need the CVar to be set, because it is currently used by ACS which is by default running serverside.

Uh, I hope you understand what I mean...
𝕂𝕝𝕠𝕗𝕜𝕒𝕔

User avatar
Ænima
Addicted to Zandronum
Posts: 3583
Joined: Tue Jun 05, 2012 6:12 pm

RE: Confused about what will / won't break sync

#4

Post by Ænima » Sat Jan 18, 2014 7:45 pm

Klofkac wrote: Your sync will break if you call gameplay altering function in clientside script.
About setting CVars, I'd set the CVar to defined value ACS wise if the CVAR does not exist (which is actually hard to check out because undefined CVAR throws 0 in GetCVAR...).
Clients should not need the CVar to be set, because it is currently used by ACS which is by default running serverside.

Uh, I hope you understand what I mean...
Yeah but what are you gonna do when they take our ConsoleCommand() away?
Reinforcements: midgame Survival joining/respawning
Doom64: Unabsolved: Doom64 + Diablo II
ZandroSkins: a pack made by our community
AeniPuffs: 3D blood and bullet puff effects, free to use for your own mods
Squad Radio: a WASD-based radio chat menu, add your own custom sounds!
Mercenaries (on hold)
Image

Ijon Tichy
Frequent Poster Miles card holder
Posts: 901
Joined: Mon Jun 04, 2012 5:07 am

RE: Confused about what will / won't break sync

#5

Post by Ijon Tichy » Sat Jan 18, 2014 8:08 pm

t3hplayer wrote: 1. Do I need to define this CVar some other way? Right now, sf_percentspeed isn't even defined on clients which connect to the server, but is instead only defined on the server.
no, and that's normal; serverside cvars shouldn't need to be on the clients, and clientside cvars, unless explicitly coded otherwise, should not affect the server
2. Is this something that will cause sync problems? Is all ACS run both locally (on the client) and remotely (on the server), and the results have to match? Or is that bit of ACS I described only run on the server, and so it won't be a problem?
unless specified otherwise, acs runs on the server
scripts called from clientside scripts will be clientside
using acs_executewithresult to run a clientside script will still have the script be serverside
Last edited by Ijon Tichy on Sat Jan 18, 2014 8:08 pm, edited 1 time in total.

t3hplayer
 
Posts: 29
Joined: Thu Sep 19, 2013 10:58 pm

RE: Confused about what will / won't break sync

#6

Post by t3hplayer » Sun Jan 19, 2014 12:23 am

Thanks for the input guys. I had suspected that probably generally the model was that the ACS runs on the server. The part that confused is that Zandronum doesn't have any support for server-side only mods (i.e., just modified ACS that only the server needs a copy of -- any client can connect without a copy). I figured that since clients have to have a copy of the ACS, even if there's no client-side ACS, it was being run on clients as well.

So, is it possible to have a server-side only mod in Zandronum, by modifying only server-side ACS? I think the answer is no, right, since files have to match?

Ijon Tichy
Frequent Poster Miles card holder
Posts: 901
Joined: Mon Jun 04, 2012 5:07 am

RE: Confused about what will / won't break sync

#7

Post by Ijon Tichy » Sun Jan 19, 2014 5:54 am

t3hplayer wrote: The part that confused is that Zandronum doesn't have any support for server-side only mods (i.e., just modified ACS that only the server needs a copy of -- any client can connect without a copy).
there actually is a way to run mods that are only on the server, but the problem is it requires sv_pure to be off, which brings in a whole host of problems, so no one does it

ZzZombo
Forum Regular
Posts: 323
Joined: Mon Jun 11, 2012 12:11 pm
Location: Ravenholm

RE: Confused about what will / won't break sync

#8

Post by ZzZombo » Sun Jan 19, 2014 7:34 am

Or modified servers.
QZRcon - Qt-based tool for Zandronum/Skulltag servers!
#grandvoid funny stats

Post Reply