adamqqqplay / dota2ai

Ranked Matchmaking AI: An improved Dota2 AI based on Valve's default AI. Has more than 3 million subscribers on Steam.
http://steamcommunity.com/sharedfiles/filedetails/?id=855965029
GNU General Public License v3.0
309 stars 85 forks source link

significant fps drop #146

Open rust2 opened 5 months ago

rust2 commented 5 months ago

When I play with this bots and game is not paused, the console is being spammed with these yellow messages and game fps drops significantly for me (around 40fps -> 10fps). Can I do anything to fix this? Maybe it's unnoticeable with good PC builds. Looking for some help image

StingyJack commented 5 months ago

I have this FPS drop problem also. It usually starts at around the 20 minute mark and I go from 60-80 FPS down to 21 FPS, but the choppiness makes it feel like 5 FPS,

This scrolling spamming console may be unrelated - each of those function calls to get information about something that cant be seen is wasted CPU cycles, but I would think that would be rather constant throughout the game time and not different for the first X minutes and then FPS hell. They ought to be fixable by checking CanBeSeen() before checking IsInvulnerable(), GetHealth(), GetMaxHealth(), etc.

This set of yellow messages... image .... is probably caused by this code that isnt checking CanBeSeen() before trying to GetMaxHealth() and GetHealth() https://github.com/adamqqqplay/dota2ai/blob/1cb962e6b5d1a6eadb6a35b4d18beb5b371ca0b6/team_desires.lua#L196

Disclaimer: this is just an educated guess by someone who does not know Lua, or how the Dota2 bots API works, but has been programming professionally for a long time.

This same thing does not happen with the default bots.

adamqqqplay commented 4 months ago

I have this FPS drop problem also. It usually starts at around the 20 minute mark and I go from 60-80 FPS down to 21 FPS, but the choppiness makes it feel like 5 FPS,

This scrolling spamming console may be unrelated - each of those function calls to get information about something that cant be seen is wasted CPU cycles, but I would think that would be rather constant throughout the game time and not different for the first X minutes and then FPS hell. They ought to be fixable by checking CanBeSeen() before checking IsInvulnerable(), GetHealth(), GetMaxHealth(), etc.

This set of yellow messages... image .... is probably caused by this code that isnt checking CanBeSeen() before trying to GetMaxHealth() and GetHealth()

https://github.com/adamqqqplay/dota2ai/blob/1cb962e6b5d1a6eadb6a35b4d18beb5b371ca0b6/team_desires.lua#L196

Disclaimer: this is just an educated guess by someone who does not know Lua, or how the Dota2 bots API works, but has been programming professionally for a long time.

This same thing does not happen with the default bots.

@StingyJack Thanks for your analysis, we will try to fix it. We also welcome everyone to submit PR.

StingyJack commented 4 months ago

@adamqqqplay - sorry to just leave a guess like that and no PR. I did look at the bot documentation, but I couldn't find out how start or how to make changes and see if they worked or not.

Yahfz commented 1 week ago

Is it possible to disable console logging at all? Disabling console doesn't do anything as its probably still writing to it. So I wonder if disabling logging would help at all.