Hi,
It took us some time to pinpoint the problem. We believe this bit of codes creates the slow downs :
Code: Select all
eXp_lastWidgetCheck = Now;
if (!exp_widgetVisible.existskey(version) ) {
exp_widgetVisible[version] = Boolean[Text];
}
if (!exp_widgetVisible[version].existskey(id)) {
exp_widgetVisible[version][id] = True;
}
if (!exp_widgetLayers[version].existskey(id)) {
exp_widgetLayers[version][id] = "normal";
}
if (exp_widgetVisible[version][id] == True && exp_widgetLayers[version][id] == activeLayer && exp_widgetCurrentVisible != exp_widgetVisible[version][id]) {
Window.Show();
exp_widgetVisibilityChanged = True;
exp_widgetCurrentVisible = True;
} else if(exp_widgetCurrentVisible != exp_widgetVisible[version][id] || exp_widgetLayers[version][id] != activeLayer) {
Window.Hide();
exp_widgetCurrentVisible = False;
}
if (exp_enableHudMove == True) {
quad.Show();
}else {
quad.Hide();
}
exp_widgetLayersBuffered = exp_widgetLayers[version][id];
exp_widgetVisibleBuffered = exp_widgetVisible[version][id];
It is when we use persistent variables that it slow downs. Removing this part of the code will fix fps of the new player that joins the server and also impove the overall fps.
Removing the Window.show and all the things in the if's has no effect.
We tried to do this also :
Code: Select all
if((Now - eXp_lastWidgetCheck) > 500){
eXp_lastWidgetCheck = Now;
if (!exp_widgetVisible.existskey(version) ) {
exp_widgetVisible[version] = Boolean[Text];
}
if (!exp_widgetVisible[version].existskey(id)) {
exp_widgetVisible[version][id] = True;
}
if (!exp_widgetLayers[version].existskey(id)) {
exp_widgetLayers[version][id] = "normal";
}
if (exp_widgetVisible[version][id] == True && exp_widgetLayers[version][id] == activeLayer && exp_widgetCurrentVisible != exp_widgetVisible[version][id]) {
Window.Show();
exp_widgetVisibilityChanged = True;
exp_widgetCurrentVisible = True;
} else if(exp_widgetCurrentVisible != exp_widgetVisible[version][id] || exp_widgetLayers[version][id] != activeLayer) {
Window.Hide();
exp_widgetCurrentVisible = False;
}
if (exp_enableHudMove == True) {
quad.Show();
}else {
quad.Hide();
}
exp_widgetLayersBuffered = exp_widgetLayers[version][id];
exp_widgetVisibleBuffered = exp_widgetVisible[version][id];
}
This improves a lot overall FPS
but when you join the server during the first map you get lags every 500ms which is nearly worse then the overall fps dropdown.
Some numbers
Code: Select all
+------------------------------+-------------+-------------------------------+
| | On Join FPS | Global FPS(After Map Changed) |
+------------------------------+-------------+-------------------------------+
| First Code | 20 | 45-50 |
+------------------------------+-------------+-------------------------------+
| Second Code | 30 | 55-60 |
+------------------------------+-------------+-------------------------------+
| Removed Persistant variables | 50 | 60 |
+------------------------------+-------------+-------------------------------+
So we were able to fix our global FPS drain but when a player newly joins the server he can't play, he needs to wait a map skip for his FPS to stabilize.
Starting the server controller when players are on the server doesn't cause this slow down.
Thanks, if you need anything else
Edit : This code is repeated over nearly all our widgets soo 20 times.
Edit2 : The problem might be that on join all these widgets are synched and goes in the if of the code in the same frame? We will try to see if dong something where the waiting time is different for each widget on first loop improves anything
Edit3 : ^^I tried to add a 10ms gap between all the windows of the same player at first loop to see it it changed anything it sadly didin't.