AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   CSGO plugin optimization (https://forums.alliedmods.net/showthread.php?t=278505)

hitmany 02-02-2016 05:03

CSGO plugin optimization
 
Hello, I want to optimize my sourcemod plugins.

I read this article from wiki. Anything else I should know?

Someone sad that SDKHook_OnTakeDamage very strongly loads CPU on CSGO with so many players.
How to resolve this issue?

For example, which code is best by your experience?
PHP Code:

public OnClientPutInServer(client)
{
    
SDKHook(clientSDKHook_OnTakeDamagePostHook_OnTakeDamagePost);


Or

PHP Code:

public SDKHooks_TakeDamage(playerownerowner999999.0DMG_GENERIC, -1NULL_VECTORNULL_VECTOR)
{




Miu 02-02-2016 05:48

Re: CSGO plugin optimization
 
the second doesn't make any sense

Mitchell 02-02-2016 11:42

Re: CSGO plugin optimization
 
What would you be doing with SDKHook_OnTakeDamage that would put it under a heavy load?
You should be doing quick calculations there, simple math.

hitmany 02-02-2016 12:09

Re: CSGO plugin optimization
 
Quote:

Originally Posted by Mitchell (Post 2389353)
What would you be doing with SDKHook_OnTakeDamage that would put it under a heavy load?
You should be doing quick calculations there, simple math.

Okay, how about another optimization tricks, above then tricks in wiki?

Potato Uno 02-02-2016 12:38

Re: CSGO plugin optimization
 
Profile your plugin and get some hard statistical data before you declare random sections of code as "unoptimized".

hitmany 02-02-2016 12:43

Re: CSGO plugin optimization
 
Quote:

Originally Posted by Potato Uno (Post 2389370)
Profile your plugin and get some hard statistical data before you declare random sections of code as "unoptimized".

Yes of course I'll use a profiler.
But maybe you guys know from your experience how to better coding?

Mitchell 02-02-2016 13:22

Re: CSGO plugin optimization
 
Quote:

Originally Posted by hitmany (Post 2389373)
Yes of course I'll use a profiler.
But maybe you guys know from your experience how to better coding?

are you asking for general comments on how to be better at coding??
Like show an example that is making OnTakeDamage slow down the server...

hitmany 02-02-2016 13:57

Re: CSGO plugin optimization
 
Quote:

Originally Posted by Mitchell (Post 2389382)
are you asking for general commands on how to be better at coding??
Like show an example that is making OnTakeDamage slow down the server...

Yes, what other functions are slowing down the server, except OnTakeDamage, OnGameFrame?
If I will use so much code in this functions

Mitchell 02-02-2016 14:05

Re: CSGO plugin optimization
 
A ton of things. If your server cant handle more than 32 players, then don't set the slots above 32..
None of these should show drastic changes in the server, unless for some reason you have a plugin doing stupid stuff.

Dr!fter 02-02-2016 14:24

Re: CSGO plugin optimization
 
Using the forwards isn't going to cause lag or whatever it's all dependent on what you do inside the forwards.


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

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