violently Jul 1, 2013 @ 6:38pm
Game Events for Team selection?

Most of the docs suggest that if you want to sync data between a server and a client class, that you should use the CNetworkVar stuff to transmit state, but this seems to be contrary to what the game does, and it doesn't seem to work all by itself. Here's an example:

CBasePlayer::ChangeTeam(...) does 2 things: 1) It fires off an event called "player_team" that appears to be caught in ClientModeShared::FireGameEvent(), which then calls TeamChange on the Local/Client player object. 2) Calls ChangeTeam all the way down in BaseEntity on the server side, which sets m_iTeamNum to the specified team. This variable is a CNetworkVar() that should be synchronized with the client side

Why is it synchronized with the client side twice?

I'm beginning to think that this is necessary for the following reason: I implemented a class selection menu in the same way that the team menu was made, except there's one difference: I didn't fire off a game event when the class selection was made. What happens is the client doesn't get the class selection data most of the time, despite m_iClassNum being a CNetworkVar!

Am I correct in assuming that you MUST use a Game Event in cases like this? How do I know when the server will send its updated variables to the client? (I thought it was several times each second...)

Any help would be greatly appreciated.
< >
Showing 1-1 of 1 comments
violently Jul 2, 2013 @ 7:21pm 
NM... didn't initialize values, was only SendProp'ing 3 bits... :D
< >
Showing 1-1 of 1 comments
Per page: 15 30 50