Raised This Month: $51 Target: $400
 12% 

CL_FlushEntityPacket when >=120 entities' info is sent to player


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 03-19-2016 , 11:43   CL_FlushEntityPacket when >=120 entities' info is sent to player
Reply With Quote #1

i'm getting a huge lag spike and CL_FlushEntityPacket when creating 120 or more entities and 3 or 4 times higher ping while they are sent to the client(increases from 3-5 to 12-15).
if the client goes into a different map zone, this does not happen.
the ping goes back to normal when the entities are removed.

how to get rid of these problems?

i tried increasing the following connection cvars on both client and server side:

Quote:
Originally Posted by client
"rate" is "100000.0"
"sv_lan_rate" is "100000.0"
Usage: cl_rate <num>
Client to server transmission rate (bytes/sec)
Current: 9999.00000
"cl_updaterate" is "102.0"
"cl_cmdrate" is "105.0"
"ex_interp" is "0.000001"
Quote:
Originally Posted by server
sv_lan_rate : 20000
sv_maxrate : 20000, sv
sv_maxupdaterate : 100
sv_minrate : 20000, sv
sv_minupdaterate : 100
to the following ones hoping that the server would be able to send more data to the client:

Quote:
Originally Posted by client
"rate" is "999999.0"
"sv_lan_rate" is "999999"
Usage: cl_rate <num>
Client to server transmission rate (bytes/sec)
Current: 9999.00000
"cl_updaterate" is "999.0"
"cl_cmdrate" is "999.0"
"ex_interp" is "0.000001"
Quote:
Originally Posted by server
sv_lan_rate : 999999
sv_maxrate : 999999, sv
sv_maxupdaterate : 999
sv_minrate : 20000, sv
sv_minupdaterate : 100
i noticed that increasing the client values only has no effect.
when i increased the server values though, it increased the ping multiplication from x3-x4 to x5-x6(from 3-5 -> 12-15 to 3-5 -> 25-30) instead of lowering it.
__________________

Last edited by georgik57; 03-19-2016 at 11:45.
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
Depresie
Veteran Member
Join Date: Nov 2013
Old 03-19-2016 , 17:05   Re: CL_FlushEntityPacket when >=120 entities' info is sent to player
Reply With Quote #2

Either lower the number of entities, or, use maps with more rooms
__________________
Depresie is offline
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 03-19-2016 , 17:45   Re: CL_FlushEntityPacket when >=120 entities' info is sent to player
Reply With Quote #3

none of those are a valid solution.
lowering the number of entities will make the visual effects bad.
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 04-10-2016 , 05:41   Re: CL_FlushEntityPacket when >=120 entities' info is sent to player
Reply With Quote #4

bump
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
didoWEE
Senior Member
Join Date: Oct 2012
Location: Bulgaria
Old 04-10-2016 , 08:22   Re: CL_FlushEntityPacket when >=120 entities' info is sent to player
Reply With Quote #5

Can you share your code or atleast the part we need
I had similar problem with my alien AI when my entities were more than 200
didoWEE is offline
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 04-10-2016 , 08:33   Re: CL_FlushEntityPacket when >=120 entities' info is sent to player
Reply With Quote #6

Mine are just env_sprite entities with move type changed to MOVETYPE_NOCLIP and some velocity set.

They also got a think registered with engine module's register_think. I've made the "manual" think method because engine's think was only triggering 10 times per second for some reason and I didn't have time to debug it. Still that isn't the reason why the problem is happening since I tried it with engine's think too.

Here's part of the code. Unfortunately, I can't fully post it since it's a private request.

Code:
            static iAllocStringEnvSprite;                         if (!iAllocStringEnvSprite)                 iAllocStringEnvSprite = engfunc(EngFunc_AllocString, "env_sprite");//info_target                         new Float:fCvarMolotovRadius = get_pcvar_float(g_pCvarFire_field_radius);                         new iID_Ent2;                         for (new iID = 0; iID < get_pcvar_num(g_pCvarFire_field_flames); iID++)             {                 iID_Ent2 = engfunc(EngFunc_CreateNamedEntity, iAllocStringEnvSprite);                                 if (!pev_valid(iID_Ent2))                     continue;                                 ftEntSetSprite(iID_Ent2, g_iArrayID_SPMF, random_num(0, g_iArraySize_SPMF))                                 set_pev(iID_Ent2, pev_animtime, fGameTime)                 set_pev(iID_Ent2, pev_framerate, random_float(10.0, 15.0))//random_float(20.0, 25.0)                 set_pev(iID_Ent2, pev_spawnflags, SF_SPRITE_STARTON)                 set_pev(iID_Ent2, pev_flags, (pev(iID_Ent2, pev_flags) | FL_ALWAYSTHINK))                                 dllfunc(DLLFunc_Spawn, iID_Ent2)                                 set_pev(iID_Ent2, pev_classname, g_szClassNameMolotovFlame)                 set_pev(iID_Ent2, pev_owner, iID_Ent)                 set_pev(iID_Ent2, pev_solid, SOLID_NOT)                                 set_pev(iID_Ent2, pev_scale, 0.5)//random_float(0.357, 0.577)                 set_pev(iID_Ent2, pev_rendermode, kRenderTransAdd)                 //set_pev(iID_Ent2, pev_rendercolor, Float:{ 255.0, 255.0, 255.0 })                 //set_pev(iID_Ent2, pev_renderfx, kRenderFxNone)                 set_pev(iID_Ent2, pev_renderamt, 255.0)                 //set_pev(iID_Ent2, pev_sequence, 0)                 //set_pev(iID_Ent2, pev_gaitsequence, 0)                 //set_pev(iID_Ent2, pev_frame, 0.0)                                 if (!iID)                 {                     fVecTemp[0] = 0.0;                     fVecTemp[1] = 0.0;                 }                 else                 {                     fVecTemp[0] = random_float(-fCvarMolotovRadius, fCvarMolotovRadius); //g_fFireFieldRadiusVisual 0.0, random_num(0, 1) ? fCvarMolotovRadius : -fCvarMolotovRadius                     fVecTemp[1] = random_float(-fCvarMolotovRadius, fCvarMolotovRadius);                 }                                 fVecTemp[2] = 45.0; //0.0; //5.0                                 // save our fire sprite position                 set_pev(iID_Ent2, pev_punchangle, fVecTemp)                                 fVecTemp[0] += fVecOrigin[0];                 fVecTemp[1] += fVecOrigin[1];                 fVecTemp[2] += fVecOrigin[2];                                 set_pev(iID_Ent2, pev_fuser4, fVecTemp[2])                                 set_pev(iID_Ent2, pev_origin, fVecTemp)                 //set_pev(iID_Ent2, pev_, )                                 set_pev(iID_Ent2, pev_movetype, MOVETYPE_NOCLIP)                                 fVecTemp[0] = 0.0;                 fVecTemp[1] = 0.0;                 fVecTemp[2] = random_float(40.0, 70.0);                                 set_pev(iID_Ent2, pev_velocity, fVecTemp)             }         }

Code:
public server_frame() {     new iID_Ent = g_iMaxPlayers;         while ((iID_Ent = engfunc(EngFunc_FindEntityByString, iID_Ent, "classname", g_szClassNameMolotovFlame)) != 0)         fwEgThinkMolotovFlame(iID_Ent) } public fwEgThinkMolotovFlame(const iID_Ent) { /*  static Float:fGameTime, Float:fGameTimeLast, iThinkCount, iID;         fGameTime = get_gametime();         //Make sure we count the thinks on a single entity     if (iID == iID_Ent)     {         if (fGameTime - fGameTimeLast <= 1.0)         {             iThinkCount++;         }         else         {             ftD7Log(_, _, "[fwEgThinkMolotovFlame] iID_Ent: %d. Thinks per second: %d.", iID_Ent, iThinkCount)                         iThinkCount = 0;                         fGameTimeLast = fGameTime;         }     }     else if (fGameTime - fGameTimeLast > 1.0)     {         iID = iID_Ent;                 iThinkCount = 0;                 fGameTimeLast = fGameTime;     }     */     static Float:fVecTemp[3];     pev(iID_Ent, pev_punchangle, fVecTemp)         new Float:fCvarMolotovRadius = get_pcvar_float(g_pCvarFire_field_radius),     Float:fCvarMolotovRadiusZ = (fCvarMolotovRadius - fVecTemp[2]);// * 0.3;         static Float:fVecOrigin[3];     pev(iID_Ent, pev_origin, fVecOrigin)         new Float:fStartPositionZ;     pev(iID_Ent, pev_fuser4, fStartPositionZ)         new Float:fEntDistanceTraveled = fVecOrigin[2] - fStartPositionZ;         //ftD7Log(_, _, "[fwEgThinkMolotovFlame] iID_Ent: %d. fStartPositionZ: %f. fVecOrigin[2]: %f. fCvarMolotovRadiusZ: %f. Percentage: %f. iID_Ent render amount: %f.",     //iID_Ent, fStartPositionZ, fVecOrigin[2], fCvarMolotovRadiusZ, fPercentage, 255.0 * fPercentage / 100.0)     //     if (fEntDistanceTraveled > fCvarMolotovRadiusZ)     {         new iID_EntOwner = pev(iID_Ent, pev_owner);                 if (iID_EntOwner != iID_Ent)         {             set_pev(iID_Ent, pev_frame, 0.0)                         if (!pev_valid(iID_EntOwner) || pev(iID_EntOwner, g_iConstPevNadeType) != g_iConstPevNadeTypeMolotov)             {                 //ftD7Log(_, _, "[fwEgThinkMolotovFlame] iID_Ent: %d. iID_EntOwner(%d) is = iID_Ent, invalid or not type molotov.", iID_Ent, iID_EntOwner)                 //                 //iID_EntOwner = iID_Ent;                 //                 set_pev(iID_Ent, pev_owner, iID_Ent)                                 ftEntSetSprite(iID_Ent, g_iArrayID_SPMS, random_num(0, g_iArraySize_SPMS))                                 set_pev(iID_Ent, pev_scale, 5.0)                 set_pev(iID_Ent, pev_rendermode, kRenderTransAlpha)                 set_pev(iID_Ent, pev_rendercolor, { 1.0, 1.0, 1.0 })                 set_pev(iID_Ent, pev_renderamt, 255.0)                                 //set_pev(iID_Ent, pev_frame, 0.0)                 set_pev(iID_Ent, pev_framerate, 5.0)                 /*                 // Smoke sprite                 engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, fVecOrigin, 0)                 write_byte(TE_SMOKE) // TE id                 engfunc(EngFunc_WriteCoord, fVecOrigin[0]) // x                 engfunc(EngFunc_WriteCoord, fVecOrigin[1]) // y                 engfunc(EngFunc_WriteCoord, fVecOrigin[2]) // z                 write_short(ArrayGetCell(g_iArrayID_SPMS_IDs, random_num(0, g_iArraySize_SPMS))) // sprite                 write_byte(random_num(7, 10)) // scale                 write_byte(random_num(10, 15)) // framerate                 message_end()*/                                 return;             }                         //ftD7Log(_, _, "^n[fwEgThinkMolotovFlame] iID_Ent: %d. Reset.", iID_Ent)             //             pev(iID_EntOwner, pev_origin, fVecOrigin)                         static Float:fVecTemp2[3], Float:fVecTemp3[3];                         if (fVecTemp[0] != 0.0)             {                 fVecTemp2[0] = fVecOrigin[0] + random_float(-fCvarMolotovRadius, fCvarMolotovRadius);                 fVecTemp2[1] = fVecOrigin[1] + random_float(-fCvarMolotovRadius, fCvarMolotovRadius);                 fVecTemp2[2] = fVecOrigin[2];                                 fVecTemp3[0] = 9000.0;                                 trace_line(iID_Ent, fVecOrigin, fVecTemp2, fVecTemp3);                                 if (fVecTemp3[0] != 9000.0)                 {                     fVecTemp[0] = fVecTemp3[0];                     fVecTemp[1] = fVecTemp3[1];                 }                 else                 {                     fVecTemp[0] = fVecTemp2[0];                     fVecTemp[1] = fVecTemp2[1];                 }             }             else             {                 fVecTemp[0] = fVecOrigin[0];                 fVecTemp[1] = fVecOrigin[1];             }                         fStartPositionZ = fVecTemp[2];                         fVecTemp[2] = fVecOrigin[2];                         fVecTemp2[0] = fVecTemp[0];             fVecTemp2[1] = fVecTemp[1];             fVecTemp2[2] = fVecOrigin[2] - fCvarMolotovRadius;                         fVecTemp3[0] = 9000.0;                         trace_line(iID_Ent, fVecTemp, fVecTemp2, fVecTemp3);                         fVecTemp[2] = fStartPositionZ;                         if (fVecTemp3[0] != 9000.0)                 fVecTemp[2] += fVecTemp3[2];             else                 fVecTemp[2] += fVecTemp2[2];                         //fVecTemp[2] += fVecOrigin[2];             //             set_pev(iID_Ent, pev_origin, fVecTemp)                         set_pev(iID_Ent, pev_fuser4, fVecTemp[2])                         fVecTemp[0] = 0.0;             fVecTemp[1] = 0.0;             fVecTemp[2] = random_float(40.0, 70.0);                         set_pev(iID_Ent, pev_velocity, fVecTemp)         }         else         {             if (fEntDistanceTraveled > (fCvarMolotovRadiusZ * 2))             {                 //ftD7Log(_, _, "[fwEgThinkMolotovFlame] iID_Ent: %d. iID_EntOwner: %d. Removing flame/smoke entity.", iID_Ent, iID_EntOwner)                 //                 engfunc(EngFunc_RemoveEntity, iID_Ent)             }             /*else             {                 //ftD7Log(_, _, "[fwEgThinkMolotovFlame] iID_Ent: %d. iID_EntOwner(%d) != iID_Ent. Setting new render, sprite, owner and start position.", iID_Ent, iID_EntOwner)                 //                 ftEntSetSmoke(iID_Ent)             }*/         }     }     else     {         new Float:fPercentage;         fPercentage = fEntDistanceTraveled * 100.0 / fCvarMolotovRadiusZ;         //fPercentage = 50.0 - (50.0 - fPercentage);         fPercentage = 50.0 - fPercentage;         if (fPercentage < 0.0)             fPercentage *= -1;         fPercentage = 50.0 - fPercentage;         fPercentage = fPercentage * 100.0 / 50.0;         if (fPercentage < 0.0)             fPercentage = 0.0;         else if (fPercentage > 100.0)             fPercentage = 100.0;                 set_pev(iID_Ent, pev_renderamt, 255.0 * fPercentage / 100.0)     } }
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
didoWEE
Senior Member
Join Date: Oct 2012
Location: Bulgaria
Old 04-10-2016 , 09:23   Re: CL_FlushEntityPacket when >=120 entities' info is sent to player
Reply With Quote #7

This seems to be too much for the server
Try to optimise the code somehow

As I can see your Think method is using Server_frame()
Why would you do it this way?
didoWEE is offline
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 04-10-2016 , 11:10   Re: CL_FlushEntityPacket when >=120 entities' info is sent to player
Reply With Quote #8

Quote:
Originally Posted by didoWEE View Post
This seems to be too much for the server
Try to optimise the code somehow

As I can see your Think method is using Server_frame()
Why would you do it this way?
Quote:
Originally Posted by georgik57 View Post
They also got a think registered with engine module's register_think. I've made the "manual" think method because engine's think was only triggering 10 times per second for some reason and I didn't have time to debug it. Still that isn't the reason why the problem is happening since I tried it with engine's think too.
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
didoWEE
Senior Member
Join Date: Oct 2012
Location: Bulgaria
Old 04-10-2016 , 11:42   Re: CL_FlushEntityPacket when >=120 entities' info is sent to player
Reply With Quote #9

try
set_pev(iID_Ent2, pev_flags, (pev(iID_Ent2, pev_flags) | FL_ALWAYSTHINK)
->
set_pev(iID_Ent2, pev_flags, (pev(iID_Ent2, pev_flags) | FL_CUSTOMENTITY)

bring back register_think() and use
entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.01);
at the beggining of the think
It should be called more frequently than flags ALWAYSTHINK

server_frame() is the problem I believe
didoWEE is offline
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 04-10-2016 , 13:41   Re: CL_FlushEntityPacket when >=120 entities' info is sent to player
Reply With Quote #10

Still only 10 thinks per second, only this time the entities don't draw anymore.

Quote:
L 04/10/2016 - 20:23:52: [fwEgThinkMolotovFlame] iID_Ent: 89. Thinks per second: 10.
L 04/10/2016 - 20:23:53: [fwEgThinkMolotovFlame] iID_Ent: 89. Thinks per second: 10.
L 04/10/2016 - 20:23:54: [fwEgThinkMolotovFlame] iID_Ent: 89. Thinks per second: 10.


If i remove FL_CUSTOMENTITY the entities are drawn.



Eventually tried setting both the flags and the entities still won't draw.

Code:
set_pev(iID_Ent2, pev_flags, (pev(iID_Ent2, pev_flags) | (FL_ALWAYSTHINK + FL_CUSTOMENTITY)))

It seems that FL_CUSTOMENTITY is causing them not to draw anymore.
Attached Images
File Type: jpg de_aztec0019.jpg (83.6 KB, 389 views)
File Type: jpg de_aztec0020.jpg (71.8 KB, 379 views)
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 19:53.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode