Edit Bot Object?

Please post any questions about developing your plugin here. Please use the search function before posting!
User avatar
D3CEPTION
Senior Member
Posts: 129
Joined: Tue Jan 26, 2016 1:24 pm
Location: Switzerland

Edit Bot Object?

Postby D3CEPTION » Thu Sep 01, 2016 11:13 am

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!
User avatar
D3CEPTION
Senior Member
Posts: 129
Joined: Tue Jan 26, 2016 1:24 pm
Location: Switzerland

Re: Edit Bot Object?

Postby D3CEPTION » Thu Sep 01, 2016 11:20 am

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
Last edited by D3CEPTION on Thu Sep 01, 2016 11:23 am, edited 1 time in total.
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: Edit Bot Object?

Postby L'In20Cible » Thu Sep 01, 2016 11:21 am

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.
User avatar
D3CEPTION
Senior Member
Posts: 129
Joined: Tue Jan 26, 2016 1:24 pm
Location: Switzerland

Re: Edit Bot Object?

Postby D3CEPTION » Thu Sep 01, 2016 11:30 am

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
User avatar
D3CEPTION
Senior Member
Posts: 129
Joined: Tue Jan 26, 2016 1:24 pm
Location: Switzerland

Re: Edit Bot Object?

Postby D3CEPTION » Thu Sep 01, 2016 12:53 pm

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!
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: Edit Bot Object?

Postby L'In20Cible » Thu Sep 01, 2016 1:16 pm

I'm not too sure what you are trying to achieve exactly, could you elaborate with examples, description, etc?
User avatar
D3CEPTION
Senior Member
Posts: 129
Joined: Tue Jan 26, 2016 1:24 pm
Location: Switzerland

Re: Edit Bot Object?

Postby D3CEPTION » Thu Sep 01, 2016 1:24 pm

i want to copy a players UserCMD and use it on a bot.
User avatar
iPlayer
Developer
Posts: 590
Joined: Sat Nov 14, 2015 8:37 am
Location: Moscow
Contact:

Re: Edit Bot Object?

Postby iPlayer » Thu Sep 01, 2016 1:26 pm

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.
Image /id/its_iPlayer
My plugins: Map Cycle • Killstreaker • DeadChat • Infinite Jumping • TripMines • AdPurge • Bot Damage • PLRBots • Entity AntiSpam

Hail, Companion. [...] Hands to yourself, sneak thief. Image
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: Edit Bot Object?

Postby L'In20Cible » Thu Sep 01, 2016 1:31 pm

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.
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Re: Edit Bot Object?

Postby satoon101 » Thu Sep 01, 2016 1:36 pm

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?
Image
User avatar
D3CEPTION
Senior Member
Posts: 129
Joined: Tue Jan 26, 2016 1:24 pm
Location: Switzerland

Re: Edit Bot Object?

Postby D3CEPTION » Thu Sep 01, 2016 1:42 pm

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.
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: Edit Bot Object?

Postby L'In20Cible » Thu Sep 01, 2016 1:59 pm

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.
User avatar
D3CEPTION
Senior Member
Posts: 129
Joined: Tue Jan 26, 2016 1:24 pm
Location: Switzerland

Re: Edit Bot Object?

Postby D3CEPTION » Thu Sep 01, 2016 2:07 pm

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.
User avatar
Ayuto
Project Leader
Posts: 2193
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: Edit Bot Object?

Postby Ayuto » Thu Sep 01, 2016 5:46 pm

Try bot_stop 1. That should disable almost everything in CCSBot::Update(), which does a lot of the logic.
User avatar
D3CEPTION
Senior Member
Posts: 129
Joined: Tue Jan 26, 2016 1:24 pm
Location: Switzerland

Re: Edit Bot Object?

Postby D3CEPTION » Thu Sep 01, 2016 10:33 pm

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
User avatar
Ayuto
Project Leader
Posts: 2193
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: Edit Bot Object?

Postby Ayuto » Fri Sep 02, 2016 6:09 am

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.

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 24 guests