Jump to content
Sign in to follow this  
ruPal

More than 300 publicVariables and performance issues

Recommended Posts

Currently I am working on a mod and to make it JIP compatible I have to save information in two public variables for each player. More than 150 players on server mean more than 300 public Variables (2 variables per unit). I want to ask about performance issue. Will I get some?
First variable store a string (classname of backpack) and second string - content of backpack (classnames and quantity). Sometimes I nil both of them for units that meet a condition.

Share this post


Link to post
Share on other sites

What kind of hardware are you running that you have 150 players per server? I have never seen a situation where that will be playable.

As for the publicVariables:

- Does every client need to know all of the values? If not, make sure to send updates via publicVariableClient so you can target one specific machine.

- How frequently are you sending updates for these variables? This will be one of your biggest factors affecting performance

You can use tricks to try to trim down large arrays in your case. You said the datastrcture is this:

["backpackClass",[["classname1","classname2","classname2","classname2","classname3"]]

You can trim to this (makes more sense with large arrays containing multiple of the same entry)

["backpackClass",[["classname1",1],["classname2",3],["classname3",1]]]

Share this post


Link to post
Share on other sites

I play on several russian projects - WOG, Tushino and RedBearGames. We have stable online of 140-190 players per game session (TvT events). I noticed some lags but looks like it depends on mission errors. Server admins told me that it was impossible to handleore than 200 players in one mission. I plan to make a mod for them.
The mod is backpack on chest. I connect groundweaponholder with backpack via attachTo to player and put items in it. I have to save backpack (classname) and backpack content in two publicVariables. So if player lose connection (JIP) he has a chance to get backpack and items in it back. When player put backpack on back both variables get nil values.

Am I understand right and publicVariables send only when changed? So is it ok to have a lot of them but not to change all of them at once?
 

Variables are changed in this situations:
- player puts backpack on chest (values)

- player puts backpack on back (nil)
- player get in vehicle with backpack on chest (values)
- player gets out of vehicle with backpack on chest (nil)

I don't think that more than 80 players will be with backpacks on chest in one game session and more than 30 players will be in the above situations in the same time.

It is a pity but looks like publicVariableClient not JIP compatible, just read comments for it on wiki. :(
Thank you for trim advice, will try it. So

 

Share this post


Link to post
Share on other sites

PublicVariables only send when you tell them to send via the publicVariable command. I don't know whether or not the engine will check if there actual differences or not.

As for worrying about JIP values for publicVariableClient, make use of onPlayerConnect on the server side to broadcast variables to the client on connect/reconnect.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×