View Full Version : Client Server stuff in bg files:

06-17-2002, 02:40 AM
Okay, I've been using Quake III editing sites for most of my reference, and it appears that a few core things that QIII coders rely on are missing, and I was wondering if anyone had any ideas on how to get around them...

I'm trying to change the speed of a character based on what class he is. I want to multiply a scout's speed by 1.5, making him 50% faster... But first I need to know what class tha client is.

The place where you can alter his speed is located in a bg file, and is used so the client can predict his location without talking to the server. This means the only thing I have to work with is a playerstate_t, as it is the only thing shared between both the client and the server.

So my first thought was to add a new variable to the playerstate_t class, but that screws everything up, and my map appears with no entities at all on it.

Then I notice a comment above the playerstate struct, which says to change the contents of the playerstate I need to make changes to msg.c.

Unfortunately, there is no msg.c :-(

I also can't seem to get CVars to work in the bg file, so I'm pretty lost with what I can do next.

Any help would be most appreciated.


06-17-2002, 03:43 AM
Don't change anything to q_shared.h or q_shared.c

(I agree with you now Ask :) )

if you change the playerstate struct the game will be screwed...
create an extern struct containing an array [MAX_ENTITY]
and add your changes to it ...
that's how i do it ...
(not very clean but it works )

06-17-2002, 07:06 AM
can u explain with what you mean with "class" class of stance? class of model? class of weapons?

06-17-2002, 07:15 AM
ever heard of team fortress?
he means character class like scout, sniper, engineer, medic, heavyweapons guy and stuff like that.

06-17-2002, 07:39 AM
Team Fortress yes, but not in relation with JK2 :)

anyway, this has nothing todo with your above statement if i get it right, u want something like this:

switch( ent->client->pers.yourplayerclass )
case SCOUT:
client->ps.speed *= 1.2;
client->ps.speed *= 1.0;
case SITH:
client->ps.speed *= 1.1;

06-20-2002, 10:54 PM
I need to do it in the bg file surely, otherwise if I do it in game, the client will predict the player's position incorrectly, as it will not be aware he's moving at 1.5x the normal speed.

Therefore I need to do it in BG_Move, which is called by both the client and the server, so I know they are both coming up with the same result.

As I said before, the only thing I have access to from here, (to my knowledge) is the playerstate_t.... I have the clientNum, but that's it, I don't even have access to the global entity or client lists.


06-20-2002, 11:02 PM
you could also try placing it in g_active.c in the clientthink function, that won't give prediction errors.