[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/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/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/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 - Defining a STAT_

Defining a STAT_

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

Moderator: InsideQC Admins

Defining a STAT_

Postby DusterdooSmock » Wed Oct 20, 2010 1:15 am

I used this tutorial () to add reloading to quake, and then i added my own animations to it, it works fine, but now i'm trying to add a bullet counter to my engine.

I already have the code for the counter itself but i have to make a STAT_ that shows the count of self.pistolclip, not self.ammo_shells.

How would i go about doing this?
DusterdooSmock
 
Posts: 170
Joined: Thu Aug 19, 2010 9:58 pm

Postby Jukki » Wed Oct 20, 2010 2:39 pm

Jukki
 
Posts: 214
Joined: Wed Apr 07, 2010 4:59 am

Postby Spike » Wed Oct 20, 2010 3:48 pm

the easy way from QC is to writebyte(msg_foo, svc_updatestat); writebyte(msg_foo, stat_mine); writelong(msg_foo, myvaluehere);

probably msg_foo=msg_one.
stat_mine is whatever value you want. if its <32 you'll not break network compatibility. DP, FTE, and other QW clients have specific interpretations for many <32 stats. CSQC states that 32-128 are for mod use. If you don't care about compatibility then it doesn't matter, just be aware that you might end up changing DP/FTE's zoom and stuff :)
myvaluehere is whatever value your mod wants to send for that stat.

then you can send what you want, when you want to send it. don't flood it! make it a function to be used to set a field and delta check it. that works too. logically you're limited to integer values, though really all that matters is that its 4 bytes. you can mangle them clientside if you really wanted to send a float instead, but you'd need a union or a *(float*)&cl.stats[foo] or something. If you want to send a full 32bit int bitmask, send two shorts, the first is the lower 16 bits, the second is the upper (floats can only retain precision to about 24 bits).

An NQ engine will flood the client with regular stat updates once per frame, but at least its only one byte per stat (see svc_clientdata), while QuakeWorld deltas them, but knowing this isn't too important.

The QC-directed stat sending is the easiest to explain. An engine could easily be configured to send fields, but that's far far more lines of code (field access with delta storage+delta code, or protocol changes, depending on how you want it).
.
Spike
 
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby DusterdooSmock » Wed Oct 20, 2010 5:21 pm

@Spike thanks for the help, but i figured out how to do it.

I just used the normal STAT_AMMO function, and made the self.pistolclip the current ammo when the bullets are taken away or the clip is reloaded. (don't know if that's the right way to do it, but it works!)
:D
DusterdooSmock
 
Posts: 170
Joined: Thu Aug 19, 2010 9:58 pm

Postby Jukki » Wed Oct 20, 2010 5:23 pm

hmm spike. Could you lil explain to this no c noob how to do that lol. I am only coder on our team XD
Jukki
 
Posts: 214
Joined: Wed Apr 07, 2010 4:59 am

Postby DusterdooSmock » Wed Oct 20, 2010 9:58 pm

DusterdooSmock
 
Posts: 170
Joined: Thu Aug 19, 2010 9:58 pm

Postby Jukki » Thu Oct 21, 2010 3:38 am

Jukki
 
Posts: 214
Joined: Wed Apr 07, 2010 4:59 am

Postby DusterdooSmock » Thu Oct 21, 2010 1:40 pm

DusterdooSmock
 
Posts: 170
Joined: Thu Aug 19, 2010 9:58 pm

Postby Jukki » Sun Oct 24, 2010 1:16 pm

Jukki
 
Posts: 214
Joined: Wed Apr 07, 2010 4:59 am

Postby DusterdooSmock » Sun Oct 24, 2010 3:54 pm

DusterdooSmock
 
Posts: 170
Joined: Thu Aug 19, 2010 9:58 pm

Postby Jukki » Sun Oct 24, 2010 3:56 pm

Jukki
 
Posts: 214
Joined: Wed Apr 07, 2010 4:59 am


Return to Engine Programming

Who is online

Users browsing this forum: No registered users and 1 guest