Forum

speculative thinking about parms...

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

speculative thinking about parms...

Postby behind_you » Thu Apr 28, 2011 8:17 am

one of the biggest plagues with quake are parms. 16 may seem like enough. the game uses about 9, so you have 7. these extra 7 parms are never enough. so i got to thinking about ways to increase the parms. i know that adding something like parm17, parm18 would never work...... for some reason. im not really sure why this wont work. i think it's bitfield crap or smthing.


but how about using parms to store vectors instead of floats? this way you have 3 numbers stored for every parm. 3 * 7 = 21. so 21 numbers are saved. you can use one specific number for a certain case (ie .vector ammotype1, when you use shotgun, self.ammotype1_x = self.ammotype1_x - 1;)(when you use the grenade launcher: self.ammotype1_y = self.ammotype1_y - 1:) catch my drift?

i dont have access to my computer now so it's possible this idea might not work.
User avatar
behind_you
 
Posts: 237
Joined: Sat Feb 05, 2011 6:57 am
Location: Tripoli, Libya

Postby mh » Thu Apr 28, 2011 9:07 am

The params are defined in the engine as so (progdefs.h, globalvars_t struct):
Code: Select all
   float   parm1;
   float   parm2;
   float   parm3;
   float   parm4;
   float   parm5;
   float   parm6;
   float   parm7;
   float   parm8;
   float   parm9;
   float   parm10;
   float   parm11;
   float   parm12;
   float   parm13;
   float   parm14;
   float   parm15;
   float   parm16;

So as they're explicitly floats only.

There's also NUM_SPAWN_PARMS #define'd as 16 in the engine, and reading/writing them is done like so (adjust as appropriate for writing):
Code: Select all
   for (i = 0; i < NUM_SPAWN_PARMS; i++)
      fscanf (f, "%f\n", &spawn_parms[i]);

So you're stuck at 16 and stuck with floats.

Easier to just use something like FRIK_FILE and do your own reading/writing of your own data if you really need to go beyond 16.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
User avatar
mh
 
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Postby behind_you » Thu Apr 28, 2011 9:10 am

ha...ha.... :lol: shot down. :(

well, thanks for the explanation. but how does frik file work? its really strange...
User avatar
behind_you
 
Posts: 237
Joined: Sat Feb 05, 2011 6:57 am
Location: Tripoli, Libya

Postby Nahuel » Thu Apr 28, 2011 10:40 am

behind_you wrote:ha...ha.... :lol: shot down. :(

well, thanks for the explanation. but how does frik file work? its really strange...

check the source code from this great mod of wazat!

http://www.moddb.com/mods/conquest

:) :)
hi, I am nahuel, I love quake and qc.
User avatar
Nahuel
 
Posts: 492
Joined: Wed Jan 12, 2011 8:42 pm
Location: mar del plata

Postby Spike » Thu Apr 28, 2011 12:24 pm

if you're using FTE...

Create a function:
void(float timediff) ClientReEnter = {foo();}

Once defined, instead of ClientConnect/PutClientInServer, that function will be called instead. All player fields will be as they were on the previous map. All floats, all vectors, all strings, everything. Actually even ents and timers, which can be annoying. You need to add timediff to each of your timers to correct the timer to cope with the map change. So you can get quads to persist over map changes and stuff. Other than that, you just need to setorigin the player to the location of a spawnspot, and set their angles.

Then you can totally ignore parms (which FTE supports 32 of, anyway).
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: speculative thinking about parms...

Postby Dr. Shadowborg » Thu Apr 28, 2011 3:50 pm

behind_you wrote:...the game uses about 9...


You can actually trim this down to 8 as stock id1 QC "wastes" a spawnparm to store self.armortype between level changes, when it could just as easily figure the defensive value to apply by checking to see what IT_ARMOR is stored in self.items...
User avatar
Dr. Shadowborg
InsideQC Staff
 
Posts: 1110
Joined: Sat Oct 16, 2004 3:34 pm

Re: speculative thinking about parms...

Postby Nahuel » Thu Apr 28, 2011 4:21 pm

Dr. Shadowborg wrote:
behind_you wrote:...the game uses about 9...


You can actually trim this down to 8 as stock id1 QC "wastes" a spawnparm to store self.armortype between level changes, when it could just as easily figure the defensive value to apply by checking to see what IT_ARMOR is stored in self.items...


:) :) :) in http://forums.inside3d.com/viewtopic.php?t=80&highlight=frikfile



FrikaC wrote:If you need a bit more than 10-16, I should note that parm9's use in Quake is kinda pointless. It stores the "armortype" variable, a variable with only 4 possible values all of which are already flagged in .items.

So all you need to do to free up parm9 is add this to the bottom of DecodeLevelParms:

if (self.items & IT_ARMOR1)
self.armortype = 0.3;
else if (self.items & IT_ARMOR2)
self.armortype = 0.6;
else if (self.items & IT_ARMOR3)
self.armortype = 0.8;
else
self.armortype = 0;



Is it possible to create a list of id1 qc "wastes"?
now it occurs to me
"float IT_SUPERHEALTH = 65536;"
(128 it is left freely therefore I do not believe that it is a real waste)
It would be good to create a list like that to obtain a clean code (compatible with all the engines)
hi, I am nahuel, I love quake and qc.
User avatar
Nahuel
 
Posts: 492
Joined: Wed Jan 12, 2011 8:42 pm
Location: mar del plata

Postby behind_you » Sat Apr 30, 2011 6:55 am

ah, quake. so inefficient and wasteful. but u still gotta love it. thanks everyone!
User avatar
behind_you
 
Posts: 237
Joined: Sat Feb 05, 2011 6:57 am
Location: Tripoli, Libya


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest