ElDewrito / DewRecode

Discontinued - A recode and revamp of ElDewrito
GNU General Public License v3.0
18 stars 10 forks source link

Cvar replication from server -> client (vars like sv_cheats etc) #15

Closed emoose closed 9 years ago

emoose commented 9 years ago

It's partly done, got a flag for replicated cvars and code that writes them into the info server JSON, just need to find a way to know 100% that the client connected to the server so we can make sure we apply these cvars only if we need to (ie. only if we've connected)

Also maybe a way to rollback the cvars once the player disconnects, not sure how necessary that'd be though.

Shockfire commented 9 years ago

I'm actually almost done with implementing support for custom packets. They work, I just have to document everything and make a few utility functions for handling common networking tasks.

It might be a good idea to use packets instead of the server info JSON, because then variable replication would still work if you don't go through the server browser. Plus that would let us change variables while the game is running. The server info JSON should only be used for server metadata IMO and shouldn't affect gameplay in any way.

emoose commented 9 years ago

Oh nice, yeah having it go through the games packets would be much better.

because then variable replication would still work if you don't go through the server browser.

That's true, maybe we could use that for sending the mods enabled on the server too after we get mod file stuff sorted.

Maybe we should use JSON for these custom packets, so we can extend it with mod stuff/other things later on without much work.

The server info JSON should only be used for server metadata IMO and shouldn't affect gameplay in any way.

We should probably still print the replicated cvars in the info JSON though, just for the server browser to use, so that you could eg. filter for servers that have "Game.SprintEnabled 0", etc. Mods should also be in the info JSON so you could see what mods a server has enabled before joining.

As you said though none of the things in the info JSON should affect gameplay, especially since the values in the JSON could be out of date by the time you've connected.

kiwidoggie commented 9 years ago

I believe that cvar rep shouldn't be done by the server info, its way too much unneeded data. To ensure that everything got set correctly, on connect (so after you are joining etc), you can send cvars to be tweaked downstream via the custom packet system, if it fails at that point drop the client. The client should be able to either, 1 load defaults or config from file re-setting everything back to the way the person had it. Sort of like a pre-post config.

With that being said, certain variables should be exposed via the server info, but only information that would need to be shown on the server list/for filtering.

emoose commented 9 years ago

its way too much unneeded data.

Not all cvars would be sent, only the ones marked with the replication flag (currently only about 2 or 3). It wouldn't really be unneeded, replicated cvars could change gameplay which users might want to filter for in the server list.