Raised This Month: $ Target: $400
 0% 

CSGO plugin optimization


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hitmany
Senior Member
Join Date: Jul 2010
Old 02-02-2016 , 05:03   CSGO plugin optimization
Reply With Quote #1

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)
{



Last edited by hitmany; 02-02-2016 at 05:03.
hitmany is offline
Miu
Veteran Member
Join Date: Nov 2013
Old 02-02-2016 , 05:48   Re: CSGO plugin optimization
Reply With Quote #2

the second doesn't make any sense
Miu is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 02-02-2016 , 11:42   Re: CSGO plugin optimization
Reply With Quote #3

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.

Last edited by Mitchell; 02-02-2016 at 11:44.
Mitchell is offline
hitmany
Senior Member
Join Date: Jul 2010
Old 02-02-2016 , 12:09   Re: CSGO plugin optimization
Reply With Quote #4

Quote:
Originally Posted by Mitchell View Post
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?
hitmany is offline
Potato Uno
Veteran Member
Join Date: Jan 2014
Location: Atlanta, Georgia
Old 02-02-2016 , 12:38   Re: CSGO plugin optimization
Reply With Quote #5

Profile your plugin and get some hard statistical data before you declare random sections of code as "unoptimized".
Potato Uno is offline
hitmany
Senior Member
Join Date: Jul 2010
Old 02-02-2016 , 12:43   Re: CSGO plugin optimization
Reply With Quote #6

Quote:
Originally Posted by Potato Uno View Post
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?
hitmany is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 02-02-2016 , 13:22   Re: CSGO plugin optimization
Reply With Quote #7

Quote:
Originally Posted by hitmany View Post
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...

Last edited by Mitchell; 02-02-2016 at 14:00.
Mitchell is offline
hitmany
Senior Member
Join Date: Jul 2010
Old 02-02-2016 , 13:57   Re: CSGO plugin optimization
Reply With Quote #8

Quote:
Originally Posted by Mitchell View Post
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

Last edited by hitmany; 02-02-2016 at 13:57.
hitmany is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 02-02-2016 , 14:05   Re: CSGO plugin optimization
Reply With Quote #9

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.
Mitchell is offline
Dr!fter
The Salt Boss
Join Date: Mar 2007
Old 02-02-2016 , 14:24   Re: CSGO plugin optimization
Reply With Quote #10

Using the forwards isn't going to cause lag or whatever it's all dependent on what you do inside the forwards.
Dr!fter is offline
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 00:39.


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