Page 1 of 1

Edit Bot Object?

Posted: Thu Sep 01, 2016 11:13 am
by D3CEPTION
Any chance i can unload the AI module from a bot object to avoid all its calculations? for performance boost.

using fakeclient stuff via bot_manager.create_bot is no option as that has trouble calculating gravity and animations on the client..(unless there is a way to fix that ofc)

thanks!

Re: Edit Bot Object?

Posted: Thu Sep 01, 2016 11:20 am
by D3CEPTION
one way, that comes to mind is using bot_zombie 1.
but my fear is tha itll not boost performance, but instead only "block" the botcmd and botcontroller, after it was already heavily calculated by the server.
so if anyone could give any insight on whether bot_zombie 1 will disable calculations instead of blocking ites execution that would also help

Re: Edit Bot Object?

Posted: Thu Sep 01, 2016 11:21 am
by L'In20Cible
You may want to hook and block pre/post_think methods from being executed. This should prevent any logic to be performed on the specific entities.

Re: Edit Bot Object?

Posted: Thu Sep 01, 2016 11:30 am
by D3CEPTION
yeah, do you know WHICH ONES?
let me try to prepare some code:

Syntax: Select all

from entities.hooks import EntityPreHook

@EntityPreHook(EntityCondition.is_bot_player, dummy_function)
def dummy_function(args):
##handle args / return

now i need to find the specific dummy functions and use the above code on them?
or is there some global way to mute all actions on a secific entity?

edit: nvm you LINKED me to "pre_think", didnt see that

Re: Edit Bot Object?

Posted: Thu Sep 01, 2016 12:53 pm
by D3CEPTION
thanks for the help so far.
"pre_think" seems to be sthn like a "1tick-priorto-server-excecution", mb similar to "run_command" just here with access ONLY to the player object. (ofc i can deactivate everything here via the playerobj, but the calculations for AI are still made somwhere else, i only block their execution here)

maybe the AI calculations are made in bot_manager?
so my idea would be to disable the whole module.

Code: Select all

"from players.bots import bot_manager"

anyone got an idea or a hint? thanks in advance!

Re: Edit Bot Object?

Posted: Thu Sep 01, 2016 1:16 pm
by L'In20Cible
I'm not too sure what you are trying to achieve exactly, could you elaborate with examples, description, etc?

Re: Edit Bot Object?

Posted: Thu Sep 01, 2016 1:24 pm
by D3CEPTION
i want to copy a players UserCMD and use it on a bot.

Re: Edit Bot Object?

Posted: Thu Sep 01, 2016 1:26 pm
by iPlayer
He wants to read the data from one player's UserCmd and make the bot mimic that player, preferably disabling all the bot's AI as it's not needed anymore.

Re: Edit Bot Object?

Posted: Thu Sep 01, 2016 1:31 pm
by L'In20Cible
Well, if you prevent the bot from running its logic, how will it run the commands you copied from that said player? You don't want to "disable" the AI, you want to inject your own data - which is totally different. Disassemble engine/server.so files and search for CSSBot methods (probably some CCSGameRules doing some checks internally as well) and from their name you may be able to find the right one. There is no magic solution here, hardcore digging is required.

Re: Edit Bot Object?

Posted: Thu Sep 01, 2016 1:36 pm
by satoon101
Isn't there a bot_mimic command? Also, you might try to hook run_command and overwrite the BotCmd object with the human player's UserCmd object?

Re: Edit Bot Object?

Posted: Thu Sep 01, 2016 1:42 pm
by D3CEPTION
LOL idk what you are talking about there L'In20Cible ..
im only trying to find a way to get an empty player-object. ( i could buy csgo accounts and use them on a VM, but this is a bad way - does this emphasize my point better? ) im trying to disable any unneded calculations that are done by the server. i want a simple and clean player-botobject than i can use in my current code to transfer a players usercmd into a bots usercmd.

edit: for example, you talk about CSSBot methods. but my idea and question is to disable the whole module, not every function manually.

Re: Edit Bot Object?

Posted: Thu Sep 01, 2016 1:59 pm
by L'In20Cible
D3CEPTION wrote:edit: for example, you talk about CSSBot methods. but my idea and question is to disable the whole module, not every function manually.

Like I said, there is no magic. The bots logic is embedded into the server process, disabling the whole thing means manually blocking/modifying (by hooking, mutating pointers, etc) everything related to it. But again, you don't want to disable, you want to inject your own data. Find the method that process the moves, and you may be able to pass the UserCmd data to it. Also, Satoon mentionned "bot_mimic", I never played with that command but you should definitely play with that first.

Re: Edit Bot Object?

Posted: Thu Sep 01, 2016 2:07 pm
by D3CEPTION
okay, im just wondering, because your "answer" seems to be rephrasing my "question" or statements ive already made. im also using my own code to copy a usercmd. its all working. the only technical problem is, that it always has a delay of 1 tick ( time difference of prehook ).
i doubt that bot_mimic will be realtime mimic, but ill look into it, thanks.

right now i really i just want to find the best way to use the most efficient player object, as said. i know that i can dig out every function to avoid bot calculation, but i was hoping that somebody has a better idea here maybe.

i said this before, but theres also the method with adding the player object with bot_manager.create_bot, but using the usercmd on this object, will fail at clientside physics and anim simulations. but that object is very ressource efficient as it seems.

Re: Edit Bot Object?

Posted: Thu Sep 01, 2016 5:46 pm
by Ayuto
Try bot_stop 1. That should disable almost everything in CCSBot::Update(), which does a lot of the logic.

Re: Edit Bot Object?

Posted: Thu Sep 01, 2016 10:33 pm
by D3CEPTION
Ayuto wrote:Try bot_stop 1. That should disable almost everything in CCSBot::Update(), which does a lot of the logic.

any sourcecode where you found that? i know that bot_chatter 0 will also, additionally disable the radio commands. im just afraid that those built-in console commands will only disable execution, as mentioned above a few times, but maybe thats wrong.

until i have better solution i will use these 2 commands:

Code: Select all

bot_stop 1
bot_chatter OFF

Re: Edit Bot Object?

Posted: Fri Sep 02, 2016 6:09 am
by Ayuto
I assume that you actually have performance issues. Otherwise there would be no reason to ask that question at this point. If so, you could simply proof (or the opposite) this assumption by testing.
D3CEPTION wrote:im just afraid that those built-in console commands will only disable execution, as mentioned above a few times, but maybe thats wrong.