[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4787: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4789: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4790: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4791: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
InsideQC Forums • View topic - using unused cvars for mods?

using unused cvars for mods?

Discuss programming topics for the various GPL'd game engine sources.

Moderator: InsideQC Admins

using unused cvars for mods?

Postby drm_wayne » Tue Aug 26, 2014 3:59 pm

Hey,

I found a few unused cvars in Quake like "saved1", saved2" etc, and im currently wondering if i can use them
for a mod but i have a few questions:

- The cvar gets saved to the config, so is it a client side cvar?
- Can i use it for setting custom start weapons or teams?

If yes it would be really usefull since alot of engines have those saved cvars, so my mod will run in Darkplaces too :)
User avatar
drm_wayne
 
Posts: 232
Joined: Sat Feb 11, 2012 5:47 pm

Re: using unused cvars for mods?

Postby Cobalt » Tue Aug 26, 2014 7:19 pm

There is also :

nomonsters , monsters

both I believe are traditional cvars that came with original Quake.

The cvars are always 16 bit floats , range is : -16777216 to 16777216

Actually when you look at it, its really a 32 bit float if you make code to account for the negative values.

Now that I think of it, I wonder of the PARMS 1-15 which are 24 bit floats also hold negative values in which case they would be 48 bit in the same sense.

But anyway, the cvar floats are server side, not client side as far as writing or changing them. Client side is read-only written by the QC.
User avatar
Cobalt
 
Posts: 445
Joined: Wed Jun 10, 2009 2:58 am
Location: New England, USA

Re: using unused cvars for mods?

Postby Spike » Tue Aug 26, 2014 10:38 pm

frikac did a load of float tricks to pack more info into the parms in prydon gate. most of these tricks will loose precision from string conversions, and will thus be unusable for cvars, but may be usable if your settings are player-specific and thus can use parms for them.
using the negative bit of floats only gives 1 extra bit, not twice as many. due to string conversions you cannot distinguish between positive and negative 0 (also true if you're using dp).
an ieee single-precision float has 23 mantissa bits, 8 exponent bits, and 1 sign bit.
thus 23 integer bits can trivially be stored in a float. 24 bits is possible, but uses a different bit pattern. 25 bits will suffer from precision issues and will start to forget other bits.

nomonsters, gamecfg, scratch1, scratch2, scratch3, scratch4, savedgamecfg, saved1, saved2, saved3, saved4, temp1, noexit
none of those cvars have any special meaning to the engine.
you can probably find others (like modem cvars) which are defined but not used by most players.

many engines support a 'set' console command which can be used to dynamically create new cvars. be sure it use it in your mod's default.cfg
'seta' also exists in many engines, which will attempt to preserve the cvars over engine restarts.
you can then just use the regular cvar builtins for these cvars as if they always existed.

for completeness: if you're making a quakeworld mod, you can use the serverinfo/localinfo/setinfo commands combined with the infokey builtin to create custom(or per-player) settings.
.
Spike
 
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: using unused cvars for mods?

Postby drm_wayne » Wed Aug 27, 2014 5:02 pm

well i want to add a custom menu where the player can choose their starting layout in a multiplayer match..
so i can use the saved1 etc.. or did i need to add a new one?

I dont want everybody have the same layout xD
User avatar
drm_wayne
 
Posts: 232
Joined: Sat Feb 11, 2012 5:47 pm

Re: using unused cvars for mods?

Postby Cobalt » Wed Feb 04, 2015 12:58 am

User avatar
Cobalt
 
Posts: 445
Joined: Wed Jun 10, 2009 2:58 am
Location: New England, USA

Re: using unused cvars for mods?

Postby Spike » Wed Feb 04, 2015 2:14 am

ditch register_cvar.
the most portable solution, and the most user friendly, is to provide your own default.cfg and include lots of set console commands in there. This allows you to easily set your various defaults. use seta if you want it to be saved to the user's config so that its restored when they next load up your game.
the advantage of using the console command is that the cvar is valid before any qc code was even execed. which means it can be changed by the user before they start a map - plus ALL default cvar settings are then in the same place.

the most efficient way to deal with cvars is to use autocvars, but this requires an engine that supports them (read: dp+fte).

choosing starting positions requires you to know the valid locations first. I would assume such things would be best implemented inside csqc on a per-spawn basis or so - this would result in removing the need for using cvars for it, or at least cut it down to a single client-side cvar.
remember dedicated servers have no menuqc or csqc, so its either personal spawn spot, or its unusable.
.
Spike
 
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK


Return to Engine Programming

Who is online

Users browsing this forum: No registered users and 2 guests