Posts: 527
Threads: 54
Joined: May 2013
Alright Guys.
i just wanted to know about something here when i been scripting Commands etc all that stuff the script is only 4k lines long and as i uploaded everything to my hosted sever just to test it was using CPU 9.00 with 3 players testing stuff i did have spam on the Service Web Console but also this was something to do with Sscanf am not sure what would happen but as i am kinda new to scripting from scratch etc. now would this hurt anything if i keep scripting stuff ino the CPU 9.00 is nothing.
Thanks for everything have a great day
Posts: 100
Threads: 3
Joined: Mar 2012
Reputation:
0
9% is definitely high for 3 players, I have tens of thousands of lines of code and only get around 2.3% (3%ish with a few players). Showing us the code would make it easier to tell what the problem is, but generally, abstain from using OnPlayerUpdate too much and don't spam timers.
Posts: 1,781
Threads: 13
Joined: Sep 2009
Reputation:
0
my gamemode uses 6% CPU with 0 players. its 12 timers, 1024 zones, 300 interiors, >7000 streamed objects etc, OnPlayerUpdate() contains 1 line: return 1;.
considering that sscan does have nothing to do with it (how can 3 players use any CPU on executing many commands) - so its some of your routines/algorithms/timers perhaps?
add 20 fcnpcs and have an eye on the CPU, or better let some more players join and tell them to not type any command and stand still. if the CPU usage keeps raising, feel free to start the Performance Profiler plugin.
if you want to speedup your scripts in general, search for the JIT plugin - it precompiles the scritps upon loading and gives them a speed increase between 2x and 10x. i passed the 10x with ease by doing 400000 calculations per 40 ms - its definetly the #1 plugin to use lol
edit: oh, i forgot the sense of your topic while typing ^^
when i load 490 npcs, the CPU usage raises depending on the pathfinding speed, not linear according to the amount of npcs btw, so its easy to let the 1 filterscript eat 80% CPU, remaining 20% for other scripts. i would define 90% as CPU barrier: lag-insurance.
keep scripting, use the JIT, and profile your scripts. stop @ 90%
Posts: 527
Threads: 54
Joined: May 2013
Quote:
Originally Posted by Babul
my gamemode uses 6% CPU with 0 players. its 12 timers, 1024 zones, 300 interiors, >7000 streamed objects etc, OnPlayerUpdate() contains 1 line: return 1;.
considering that sscan does have nothing to do with it (how can 3 players use any CPU on executing many commands) - so its some of your routines/algorithms/timers perhaps?
add 20 fcnpcs and have an eye on the CPU, or better let some more players join and tell them to not type any command and stand still. if the CPU usage keeps raising, feel free to start the Performance Profiler plugin.
if you want to speedup your scripts in general, search for the JIT plugin - it precompiles the scritps upon loading and gives them a speed increase between 2x and 10x. i passed the 10x with ease by doing 400000 calculations per 40 ms - its definetly the #1 plugin to use lol
edit: oh, i forgot the sense of your topic while typing ^^
when i load 490 npcs, the CPU usage raises depending on the pathfinding speed, not linear according to the amount of npcs btw, so its easy to let the 1 filterscript eat 80% CPU, remaining 20% for other scripts. i would define 90% as CPU barrier: lag-insurance.
keep scripting, use the JIT, and profile your scripts. stop @ 90%
|
Am only using like 4 timers on the script it self but as soon i put the AVS Dynamic dealerships in started to spam alot of sscanf warnings and that might have been the issue also i will use that plugin as you did say for a 5k long script am sure it shouldnt use that much CPU with 3 players about NPCS i used them before and i didnt like how there was using the slots up etc, so i need to be careful the way am scripting

thanks for your reply. and i will use the plugin