| Author |
Thread: The big cvar standardization initiative (Read 2421 times)
|
|
Russell
|
MUTT DAYMONG
|
|
|
|
Posts: 64
|
| Developer
|
|
|
|
|
June 19, 2008, 21:05:59
|
|
|
Okay, as from discussion on irc, we have a problem.
Firstly, Cvars are console variables, which reside on the client and server, they are the ones that affect gameplay and other things.
The problem is: our current implementation. As of late commits (below r951), we send all server cvars to the client, which results in perfect sync of the client side values. This is what was needed to be done eventually.
However, we have a naming problem, the freelook bug is a good example of this: we have a cvar named allowfreelook, which existed on both client and server, but the clients version was affected by the servers version "through proxy" by changing the sv_freelook cvar, the client could toggle freelook on or off using cl_freelook.
There lies the problem, we now send allowfreelook, which is used by the client and server, it is a variable in the common codebase as well.
We can't: a) Stop sending allowfreelook (its has a CVAR_SERVERINFO and is needed), that is downright hacky as well. b) Remove cl_freelook and sv_freelook, then the server would force freelook on or off, depending on its setting. c) Countless other ways that results in hacky/buggy code.
Now, you may think this only affects freelook overall, but it doesn't, it affects a LARGE amount of other things as well, so what I and others of the team propose is this:
A) Put every single cvar in a single file that exists in the common codebase. B) Bring back namespaces (cl_* and sv_* prefixes) for cvars (we could use CVAR_SERVERINFO and CVAR_CLIENTONLY instead, but I have not thought this through completely) C) <add anything else>
There is one disadvantage to all of this, we break alot of older cfg's, BUT, because we aren't at 1.0 and not stable, we can do all of this.
Suggestions, opinions, criticisms?
|
| -=[]=-Russells software site-=[]=-
|
|
Logged
|
View Profile
| WWW
|
|
|
|
June 19, 2008, 21:20:41
|
|
This post will be used to document all changes agreed upon. The original cvarlists were pulled from r957 default configs. LEGEND A = Archived (Saved to cfg) S = Server (Server controlled) L = Latched (Map must change before it takes effect) U = ? - = ? ORIGINAL CVARLISTS AND CHANGESServer cvarlistA lookspring "1" developer "0" S speedhackfix "0" A filecompression "1" - port "10666" A chase_dist "90" A chase_height "-8" A forcewater "0" A loopepisode "0" nextmap "" - curmap "" A startmapscript "" A endmapscript "" A configver "40" A SL weaponstay "1" r_drawplayersprites "1" A ctf_flagtimeout "600" A ctf_flagathometoscore "1" A ctf_manualreturn "0" A SL antiwallhack "0" A rcon_password "" A spectate_password "" A password "" A S goldteam "0" A S redteam "1" A S blueteam "1" A SL teamplay "0" A S friendlyfire "1" A S scorelimit "10" A SL usectf "0" A S infiniteammo "0" A S allowfreelook "0" A S allowjump "0" A S fragexitswitch "0" A S allowexit "0" cleanmaps "" A SL nomonsters "1" A S fastmonsters "0" A S monstersrespawn "0" A SL itemsrespawn "0" A SL skill "5" A SL maxcorpses "200" A S timelimit "0" A S fraglimit "0" A SL deathmatch "1" A SL allowcheats "0" A SL maxplayers "16" A SL maxclients "16" A S allowtargetnames "1" A S globalspectatorchat "1" - clientcount "0" A S emptyreset "0" A S waddownload "1" A S email "" A S hostname "Unnamed" A usemasters "1" A website "" A natport "0" A networkcompression "0"
Client cvarlistA vid_winscale "1.0" A fullscreen "0" ticker "0" vid_fps "0" A mouse_threshold "10" A mouse_acceleration "2" A snd_crossover "0" A am_ovteleportcolor "ff a3 00" A am_ovexitcolor "ff ff 00" A am_ovlockedcolor "bb bb bb" A am_ovnotseencolor "00 22 6e" A am_ovxhaircolor "80 80 80" A am_ovgridcolor "44 44 88" A am_ovthingcolor "9f d3 ff" A am_ovcdwallcolor "00 00 5a" A am_ovfdwallcolor "1a 1a 8a" A am_ovtswallcolor "10 32 7e" A am_ovwallcolor "00 8b ff" A am_ovyourcolor "d8 e8 fc" A am_teleportcolor "ff a3 00" A am_exitcolor "ff ff 00" A am_lockedcolor "bb bb bb" A am_notseencolor "00 22 6e" A am_xhaircolor "80 80 80" A am_gridcolor "44 44 88" A am_thingcolor "9f d3 ff" A am_cdwallcolor "00 00 5a" A am_fdwallcolor "1a 1a 8a" A am_tswallcolor "10 32 7e" A am_wallcolor "00 8b ff" A am_yourcolor "d8 e8 fc" A am_backcolor "00 00 3a" A am_ovshare "0" A am_usecustomcolors "1" A am_classicmapstring "0" A am_showtime "1" A am_showmonsters "1" A am_showsecrets "1" A am_overlay "0" A am_rotate "0" A con_midtime "3" A conscrlock "0" A msgmidcolor "5" A msg4color "3" A msg3color "3" A msg2color "2" A msg1color "5" A msg0color "6" A msg "0" A con_scaletext "1" A con_notifytime "3" A print_stdout "0" A rate "10000" A cl_predict_players "1" A interscoredraw "1" S sv_freelook "0" A cl_freelook "0" S allowtargetnames "0" SL teamplay "0" SL allowcheats "0" SL itemsrespawn "0" S monstersrespawn "0" S scorelimit "0" S allowfreelook "0" S allowjump "0" S fragexitswitch "0" S allowexit "0" S fastmonsters "0" SL nomonsters "0" S timelimit "0" S fraglimit "0" S infiniteammo "0" SL maxclients "0" SL maxplayers "0" S friendlyfire "1" AU cl_team "blue" AU cl_skin "base" AU cl_gender "male" AU cl_color "40 cf 00" AU cl_name "Player" AU cl_autoaim "5000" A wipetype "1" A displaymouse "0" A m_side "2.0" A m_forward "1.0" A m_yaw "1.0" A m_pitch "1.0" A lookstrafe "0" A invertmouse "0" A cl_run "1" chasedemo "0" A SL deathmatch "1" A L skill "1" A usehighresboard "1" A hud_targetcount "2" A hud_targetnames "1" A chatmacro9 "Yes" A chatmacro8 "I'll take care of it." A chatmacro7 "Come here!" A chatmacro6 "Next time, scumbag..." A chatmacro5 "You suck!" A chatmacro4 "Help!" A chatmacro3 "I'm not looking too good!" A chatmacro2 "I'm OK." A chatmacro1 "I'm ready to kick butt!" A chatmacro0 "No" A configver "40" A ui_transblue "0" A ui_transgreen "0" A ui_transred "0" A show_messages "1" A revealsecrets "0" A novert "0" A mouse_type "0" A mouse_sensitivity "25.0" A dynresval "1.0" A dynres_state "0" A SL weaponstay "1" r_drawflat "0" A r_columnmethod "1" A screenblocks "10" A r_detail "0" - r_viewsize "0" A r_stretchsky "1" A crosshairscale "0" A crosshairdim "0" r_drawplayersprites "1" A crosshair "0" A snd_channels "8" A snd_musicvolume "0.5" A snd_sfxvolume "0.5" noise "0" A hud_scale "0" A st_scale "1" idmypos "0" A gammalevel "1" A dimcolor "00 00 00" A dimamount "0.7" A vid_defbits "8" A vid_defheight "200" A vid_defwidth "320" A lookspring "1" developer "0" S speedhackfix "0" A filecompression "1" - port "10667" A chase_dist "90" A chase_height "-8" A forcewater "0"
New Server cvarlistNew Client cvarlist
« Last Edit: June 19, 2008, 21:39:05 by Ralphis »
|
|
|
|
Logged
|
View Profile
|
|
|
|
June 19, 2008, 22:18:56
|
|
|
Some proposed changes to client cvars:
Automap Change all am_* prefixes to map_* as it's more user friendly.
am_ovteleportcolor becomes map_ovteleportcolor am_ovexitcolor becomes map_ovexitcolor am_ovlockedcolor becomes map_ovlockedcolor am_ovnotseencolor becomes map_ovnotseencolor am_ovxhaircolor becomes map_ovxhaircolor am_ovgridcolor becomes map_ovgridcolor am_ovthingcolor becomes map_ovthingcolor am_ovcdwallcolor becomes map_ovcdwallcolor am_ovfdwallcolor becomes map_ovfdwallcolor am_ovtswallcolor becomes map_ovtswallcolor am_ovwallcolor becomes map_ovwallcolor am_ovyourcolor becomes map_ovyourcolor am_teleportcolor becomes map_teleportcolor am_exitcolor becomes map_exitcolor am_lockedcolor becomes map_lockedcolor am_notseencolor becomes map_notseencolor am_xhaircolor becomes map_xhaircolor am_gridcolor becomes map_gridcolor am_thingcolor becomes map_thingcolor am_cdwallcolor becomes map_cdwallcolor am_fdwallcolor becomes map_fdwallcolor am_tswallcolor becomes map_tswallcolor am_wallcolor becomes map_wallcolor am_yourcolor becomes map_yourcolor am_backcolor becomes map_backcolor am_ovshare becomes map_ovshare am_usecustomcolors becomes map_usecustomcolors am_classicmapstring becomes map_classicmapstring am_showtime becomes map_showtime am_showmonsters becomes map_showmonsters am_showsecrets becomes map_showsecrets am_overlay becomes map_overlay am_rotate becomes map_rotate
Developer Cvars I propose that all cvars that won't affect the common user and were designed for developers in particular take on the dev_* prefix.
ticker becomes dev_ticker developer becomes dev_mode noise becomes dev_noise
Video fullscreen becomes vid_fullscreen
That's all I've got in me tonight, time to get some sleep. Please comment on these proposals with constructive criticism. If you disagree, please explain an alternative or argue why the command should stay the same.
Also feel free to propose your own changes. Remember that organization and user-friendliness are two key things to take into account while we tackle this so its best not to add too many new prefixes while still being able to explain the cvar in the shortest way possible.
« Last Edit: June 19, 2008, 22:22:15 by Ralphis »
|
|
|
|
Logged
|
View Profile
|
|
|
|
June 29, 2008, 09:28:12
|
|
Server cvarlist A lookspring "1" -> Delete (Client Side) developer "0" -> dev_mode S speedhackfix "0" -> sv_speedhackfix A filecompression "1" -> - port "10666" A chase_dist "90" -> Delete (Client Side) A chase_height "-8" -> Delete (Client Side) A forcewater "0" A loopepisode "0" nextmap "" - curmap "" A startmapscript "" A endmapscript "" A configver "40" A SL weaponstay "1" -> sv_weaponstay r_drawplayersprites "1" -> Delete (Client Side) A ctf_flagtimeout "600" A ctf_flagathometoscore "1" A ctf_manualreturn "0" A SL antiwallhack "0" -> sv_antiwallhack A rcon_password "" A spectate_password "" A password "" A S goldteam "0" -> sv_enablegoldteam A S redteam "1" -> sv_enableredteam A S blueteam "1" -> sv_enableblueteam A SL teamplay "0" -> sv_teamplay A S friendlyfire "1" -> sv_friendlyfire A S scorelimit "10" A SL usectf "0" -> sv_enablectf or merge this into ctf A S infiniteammo "0" -> sv_infiniteammo A S allowfreelook "0" -> sv_allowfreelook A S allowjump "0" -> sv_allowjump A S fragexitswitch "0" -> sv_fragexitswitch A S allowexit "0" -> sv_allowexit cleanmaps "" A SL nomonsters "1" -> sv_nomonsters A S fastmonsters "0" -> sv_fastmonsters A S monstersrespawn "0" -> sv_monstersrespawn A SL itemsrespawn "0" -> sv_itemsrespawn A SL skill "5" A SL maxcorpses "200" -> g_maxcorpses A S timelimit "0" A S fraglimit "0" A SL deathmatch "1" A SL allowcheats "0" -> sv_allowcheats A SL maxplayers "16" A SL maxclients "16" A S allowtargetnames "1" -> sv_allowtargetnames A S globalspectatorchat "1" -> sv_globalspectatorchat - clientcount "0" A S emptyreset "0" A S waddownload "1" A S email "" A S hostname "Unnamed" A usemasters "1" A website "" A natport "0" A networkcompression "0"
Client cvarlist A vid_winscale "1.0" A fullscreen "0" -> vid_fullscreen ticker "0" -> dev_ticker vid_fps "0" A mouse_threshold "10" A mouse_acceleration "2" A snd_crossover "0" A am_ovteleportcolor "ff a3 00" A am_ovexitcolor "ff ff 00" A am_ovlockedcolor "bb bb bb" A am_ovnotseencolor "00 22 6e" A am_ovxhaircolor "80 80 80" A am_ovgridcolor "44 44 88" A am_ovthingcolor "9f d3 ff" A am_ovcdwallcolor "00 00 5a" A am_ovfdwallcolor "1a 1a 8a" A am_ovtswallcolor "10 32 7e" A am_ovwallcolor "00 8b ff" A am_ovyourcolor "d8 e8 fc" A am_teleportcolor "ff a3 00" A am_exitcolor "ff ff 00" A am_lockedcolor "bb bb bb" A am_notseencolor "00 22 6e" A am_xhaircolor "80 80 80" A am_gridcolor "44 44 88" A am_thingcolor "9f d3 ff" A am_cdwallcolor "00 00 5a" A am_fdwallcolor "1a 1a 8a" A am_tswallcolor "10 32 7e" A am_wallcolor "00 8b ff" A am_yourcolor "d8 e8 fc" A am_backcolor "00 00 3a" A am_ovshare "0" A am_usecustomcolors "1" A am_classicmapstring "0" A am_showtime "1" A am_showmonsters "1" A am_showsecrets "1" A am_overlay "0" A am_rotate "0" A con_midtime "3" A conscrlock "0" -> con_scrlock A msgmidcolor "5" A msg4color "3" A msg3color "3" A msg2color "2" A msg1color "5" A msg0color "6" A msg "0" A con_scaletext "1" A con_notifytime "3" A print_stdout "0" A rate "10000" -> cl_rate A cl_predict_players "1" A interscoredraw "1" S sv_freelook "0" -> sv_allowfreelook A cl_freelook "0" S allowtargetnames "0" -> sv_allowtargetnames SL teamplay "0" SL allowcheats "0" -> sv_allowcheats SL itemsrespawn "0" -> sv_itemsrespawn S monstersrespawn "0" -> sv_monstersrespawn S scorelimit "0" S allowfreelook "0" -> sv_allowfreelook S allowjump "0" -> sv_allowjump S fragexitswitch "0" -> sv_fragexitswitch S allowexit "0" -> sv_allowexit S fastmonsters "0" -> sv_fastmonsters SL nomonsters "0" -> sv_nomonsters S timelimit "0" S fraglimit "0" S infiniteammo "0" -> sv_infiniteammo SL maxclients "0" SL maxplayers "0" S friendlyfire "1" -> sv_friendlyfire AU cl_team "blue" AU cl_skin "base" AU cl_gender "male" AU cl_color "40 cf 00" AU cl_name "Player" AU cl_autoaim "5000" A wipetype "1" -> r_wipetype A displaymouse "0" -> mouse_display A m_side "2.0" -> mouse_side A m_forward "1.0" -> mouse_forward A m_yaw "1.0" -> mouse_yaw A m_pitch "1.0" -> mouse_pitch A lookstrafe "0" -> mouse_lookstrafe A invertmouse "0" -> mouse_invert A cl_run "1" chasedemo "0" A SL deathmatch "1" A L skill "1" A usehighresboard "1" -> hud_usehighresboard A hud_targetcount "2" A hud_targetnames "1" A chatmacro9 "Yes" A chatmacro8 "I'll take care of it." A chatmacro7 "Come here!" A chatmacro6 "Next time, scumbag..." A chatmacro5 "You suck!" A chatmacro4 "Help!" A chatmacro3 "I'm not looking too good!" A chatmacro2 "I'm OK." A chatmacro1 "I'm ready to kick butt!" A chatmacro0 "No" A configver "40" A ui_transblue "0" A ui_transgreen "0" A ui_transred "0" A show_messages "1" A revealsecrets "0" A novert "0" -> mouse_novert A mouse_type "0" A mouse_sensitivity "25.0" A dynresval "1.0" A dynres_state "0" A SL weaponstay "1" -> sv_weaponstay r_drawflat "0" A r_columnmethod "1" A screenblocks "10" -> r_screenblocks A r_detail "0" - r_viewsize "0" A r_stretchsky "1" A crosshairscale "0" -> hud_crosshairscale A crosshairdim "0" -> hud_crosshairdim r_drawplayersprites "1" A crosshair "0" -> hud_crosshair A snd_channels "8" A snd_musicvolume "0.5" A snd_sfxvolume "0.5" noise "0" -> dev_sound A hud_scale "0" A st_scale "1" idmypos "0" A gammalevel "1" -> vid_gamma A dimcolor "00 00 00" A dimamount "0.7" A vid_defbits "8" A vid_defheight "200" A vid_defwidth "320" A lookspring "1" developer "0" -> dev_mode S speedhackfix "0" -> sv_speedhackfix A filecompression "1" - port "10667" A chase_dist "90" A chase_height "-8" A forcewater "0"
|
ReMooD Project Leader - http://remood.sf.net/ Strawberry Doom Project Leader Odamex Team Member
|
|
Logged
|
View Profile
| WWW
|
|
|
Russell
|
MUTT DAYMONG
|
|
|
|
Posts: 64
|
| Developer
|
|
|
|
|
July 02, 2008, 20:21:16
|
|
|
We have another problem.. What do we do with stuff like BEGIN_CUSTOM_CVAR (.. ?
|
| -=[]=-Russells software site-=[]=-
|
|
Logged
|
View Profile
| WWW
|
|
|
Russell
|
MUTT DAYMONG
|
|
|
|
Posts: 64
|
| Developer
|
|
|
|
|
July 03, 2008, 05:40:21
|
|
We have another problem.. What do we do with stuff like BEGIN_CUSTOM_CVAR (.. ?
I've figured it out, I have designed some macros named CVAR_FUNC_DECL and CVAR_FUNC_IMPL that have a similar effect to a normal function, ie: cl_cvars.cpp (location of all client cvars) CVAR_FUNC_DECL(vid_winscale, "1.0", CVAR_ARCHIVE | CVAR_NOENABLEDISABLE)
hardware.cpp (location of cvar implementation) CVAR_FUNC_IMPL(vid_winscale) { code ... }
I have not fully tested these, but they appear to work in game without any problems.
« Last Edit: July 03, 2008, 05:55:45 by Russell »
|
| -=[]=-Russells software site-=[]=-
|
|
Logged
|
View Profile
| WWW
|
|
|
Nes
|
|
|
|
|
Posts: 31
|
| Developer
|
|
|
|
|
July 07, 2008, 02:50:11
|
|
|
The client cvarlist should be split up into two lists:
- A list of actual client cvars. - A list of read-only server info cvars.
I'll look into the cvars later.
|
|
|
|
Logged
|
View Profile
|
|
|
Russell
|
MUTT DAYMONG
|
|
|
|
Posts: 64
|
| Developer
|
|
|
|
|
July 11, 2008, 19:57:11
|
|
|
As of HEAD, all cvars have been moved (except for the one in m_misc.cpp, thats special) to their client/server/common locations.
Now we need to sort out what flags they should have, which REAL location they reside on (client/server/common), what names they should have etc.
|
| -=[]=-Russells software site-=[]=-
|
|
Logged
|
View Profile
| WWW
|
|
|
Nes
|
|
|
|
|
Posts: 31
|
| Developer
|
|
|
|
|
July 21, 2008, 00:58:23
|
|
|
Ralphis and I think it's a good idea to merge the deathmatch, teamplay, and usectf/ctf cvars into one cvar: gamemode.
gamemode (int) - Common cvar. (Read-only for client) Distributed to launchers as an integer. (Will require protocol bump)
gamemode 0 - Coop gamemode 1 - DM gamemode 2 - TDM gamemode 3 - CTF gamemode 4+ - New gametypes. (Would show up as "unknown" for outdated clients/launchers)
This would eliminate the hassle of juggling multiple cvars (deathmatch and teamplay do what for usectf?) while paving a smooth way for potential new gametypes.
|
|
|
|
Logged
|
View Profile
|
|
|
|
July 21, 2008, 05:05:08
|
|
|
I agree
|
ReMooD Project Leader - http://remood.sf.net/ Strawberry Doom Project Leader Odamex Team Member
|
|
Logged
|
View Profile
| WWW
|
|
|
|
July 21, 2008, 10:09:35
|
|
deathmatch and teamplay do what for usectf? Well... when you put it that way I realised UT's Assault mode is just two teams playing CTF/TDM on the same map. But yeah, I agree too. The separate cvars are a leftover from DOS days IMO.
|
|
|
|
Logged
|
View Profile
|
|
|
Russell
|
MUTT DAYMONG
|
|
|
|
Posts: 64
|
| Developer
|
|
|
|
|
July 22, 2008, 17:31:33
|
|
Ralphis and I think it's a good idea to merge the deathmatch, teamplay, and usectf/ctf cvars into one cvar: gamemode. Its a good idea, but there are 2 problems, we have a ccmd named gamemode (which looks dated) and there is also variable in doomstat.h named gamemode. gamemode (int) - Common cvar. (Read-only for client) Distributed to launchers as an integer. (Will require protocol bump)
Read-only for client, why? And I don't think it will require a protocol bump, we can just translate it before sending it to keep compatibility. gamemode 0 - Coop gamemode 1 - DM gamemode 2 - TDM gamemode 3 - CTF gamemode 4+ - New gametypes. (Would show up as "unknown" for outdated clients/launchers)
Looks good, I would have suggested keeping the old variables and have it change this one, but I have researched this and it looks far too complicated (function cvars calling eachother resulting in recursion, latching not working correctly etc) This would eliminate the hassle of juggling multiple cvars (deathmatch and teamplay do what for usectf?) while paving a smooth way for potential new gametypes.
Sounds good, we'll have less problems as a result too.
|
| -=[]=-Russells software site-=[]=-
|
|
Logged
|
View Profile
| WWW
|
|
|
Nes
|
|
|
|
|
Posts: 31
|
| Developer
|
|
|
|
|
August 05, 2008, 11:17:00
|
|
|
Okay, so Ralphis wants a step-by-step guide on how we're going to implement this. This is the best way to go about this:
1) Create a branch called 'gamemode', exactly like trunk.
2) Remove gamemode cmd from client.
3) Rename all instances of the gamemode var with 'doommode'. And to keep with consistency, rename 'gamemission' to 'doommission', the GameMode_t enum to 'DoomMode_t', and the GameMission_t enum to 'DoomMission_t'. Not much more than simple find and replace.
4) Create a new CVAR_FUNC_IMPL in the common cvarlist: gamemode. Default value is "0", CVAR_SERVERINFO, CVAR_LATCHED, CVAR_NOENABLEDISABLE. The reason it's not standard CVAR is because we should do the following:
* Make it so when the client or server simply types in "gamemode", the console will read all supported values.
* We should add in value translation so that inputting "gamemode ctf" should do "gamemode 3".
5) Create #defines (or whatever is best) for
0 - GM_COOP 1 - GM_DM 2 - GM_TDM 3 - GM_CTF
It would be much better in the long run for us coders. (example: if (gamemode == GM_COOP))
6) Remove the 'deathmatch', 'teamplay', 'ctf', and 'usectf' cvars and, at the same time, replace all instances with the appropriate gamemode cvars.
7) Change launcher protocol to reflect the new cvar.
8) Run it by denis, fix bugs, merge to trunk when ready.
EDIT: We should also create two flags, CVAR_SERVERARCHIVE and CVAR_CLIENTARCHIVE for the common cvars. Same as CVAR_ARCHIVE but just for either server or client.
« Last Edit: August 05, 2008, 11:19:48 by Nes »
|
|
|
|
Logged
|
View Profile
|
|
|
Nes
|
|
|
|
|
Posts: 31
|
| Developer
|
|
|
|
|
August 08, 2008, 08:00:19
|
|
|
We should also establish and document which of the server cvars can be read by the client, even if these cvars do nothing to the client.
|
|
|
|
Logged
|
View Profile
|
|
|
Nes
|
|
|
|
|
Posts: 31
|
| Developer
|
|
|
|
|
August 13, 2008, 21:46:51
|
|
|
Here's the latest for the gamemode patch. It's not heavily tested, so there might be a few bugs with it. But overall it's pretty smooth.
|
|
|
|
Logged
|
View Profile
|
|