• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

TFS 1.X+ Tfs 1.x High CPU usage (think is attack Speed)

roriscrave

Advanced OT User
Joined
Dec 7, 2011
Messages
1,188
Solutions
34
Reaction score
200
Hi, i'm getting cpu usage 70~85%, and i looking this topic i think it can be because attack Speed system

But I use in config.lua
Lua:
classicAttackSpeed = false

but i have changed this part of my player.h
to it:
C++:
            int32_t SpeedAttack;
            SpeedAttack = vocation->getAttackSpeed() - player->getLevel());
                if (SpeedAttack < 500) {
                    return 500;
                } else {
                    return (uint32_t) SpeedAttack;
                }
        }

some players have speed attack 500ms, can it be the problem of high cpu usage?
 
What kind of server are you running in first place? If its <= 8.6 I would say stick to classicAttackSpeed = true in your config.lua and see what the differences are.

And have you tried to reverse what you have changed?

If you're using the newer versions I would ask you to post your entire player.cpp and player.h in Pastebin.com - #1 paste tool since 2002! (https://pastebin.com/) and drop the links here so I(we all) can check what might be off in your code. Not sure if you've been changing a lot by yourself, could also cause issues if not thought about using same functions more then once and have it on loop by accident.
Those two files are connected to each other. I would not really go for the if/else you made there.

Sincerely,
Ralumbi(Caleb)
 
What kind of server are you running in first place? If its <= 8.6 I would say stick to classicAttackSpeed = true in your config.lua and see what the differences are.

And have you tried to reverse what you have changed?

If you're using the newer versions I would ask you to post your entire player.cpp and player.h in Pastebin.com - #1 paste tool since 2002! (https://pastebin.com/) and drop the links here so I(we all) can check what might be off in your code. Not sure if you've been changing a lot by yourself, could also cause issues if not thought about using same functions more then once and have it on loop by accident.
Those two files are connected to each other. I would not really go for the if/else you made there.

Sincerely,
Ralumbi(Caleb)
i dont make any changes in player.cpp
so here is my player.h, the unique change i made is in line 1171:
default is:
C++:
        uint32_t getAttackSpeed() const {
            return vocation->getAttackSpeed();
        }
i changed to:
C++:
        uint32_t getAttackSpeed() const {
            int32_t SpeedAttack;
            SpeedAttack = vocation->getAttackSpeed() - player->getLevel());

                if (SpeedAttack < 500) {
                    return 500;
                } else {
                    return (uint32_t) SpeedAttack;
                }
        }
 
In my head this piece of extra code does exactly nothing. Specially since you only did the change only in the header file.
 
Install something like perf to determine whether the scheduler is being throttled or not. Someone might be taking advantage of the House bug that were brought to light a few days ago (See this).
 
Install something like perf to determine whether the scheduler is being throttled or not. Someone might be taking advantage of the House bug that were brought to light a few days ago (See this).
already make this change, but not change in my cpu usage
Can you post prints of a perf top on your server?
command perf top
1588016446494.png

command top:
1588016495461.png
 
Back
Top