IPB

Welcome Guest ( Log In | Register )

> [TF2] IBotManager::CreateBot() ?
Tauphi
post Jun 2 2009, 10:50 PM
Post #1


Newbie
*

Group: Members
Posts: 5
Joined: 2-June 09
Member No.: 1,564



Hi all and Hi Cheeseh,

I am currently playing with the IBotManager interface of the Orange Box SDK, but my plugins always crash, when I call the CreateBot() function.

The rcbot does work with the current TF2 version or?
May I ask how you get it to work to add and control a bot with the "broken" IBotManager interface?

Or did you find a workaround for it?
Thanks in advance for tips and help!

regards
Andi
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
 
Reply to this topicStart new topic
Replies
Tauphi
post Jun 4 2009, 09:45 AM
Post #2


Newbie
*

Group: Members
Posts: 5
Joined: 2-June 09
Member No.: 1,564



Hi Cheeseh,

thanks for the great info, how you made it.
But there is still one thing I don't understand...

I had the idea too, to add a braindead bot with the "bot" command and to control that bot with it's own bot controller ...

I used this OnGameFrame code for this:
CODE
void OnGameFrame( bool simulating ) {
    if ( simulating ) {
        for ( int client = 0; client < gpGlobals->maxClients; client++ ) {
            IGamePlayer *player = playerhelpers->GetGamePlayer(client);
            if ( player == NULL || !player->IsInGame() || !player->IsFakeClient() ) continue;

            IPlayerInfo *info = player->GetPlayerInfo();
            if ( info == NULL ) continue;
            
            edict_t *edict = player->GetEdict();
            if ( edict == NULL ) continue;
            
            IBotController *botc = botmanager->GetBotController(edict);
            if ( botc == NULL ) continue;

            CBotCmd cmd;
            Q_memset( &cmd, 0, sizeof( cmd ) );
            cmd.buttons |= IN_DUCK;
            
            botc->PostClientMessagesSent();
            botc->RunPlayerMove(&cmd);
        }
    }
}
On every Game Frame I check all players if they are bots and have a bot controller. When I add a bot with "bot" it has that controller, so it seemed ok for me ...

Next is, that I create"buttons" which say to crouch all the time with IN_DUCK ... But when I run "RunPlayerMove" with the buttons nothing happens.

Better said: Valves own Bot engine is running RunPlayerMove on every GameFrame, too. So the engine got told "crouch, dont crouch, crouch, dont crouch, and so on and so on" ... The crouch animation isn't fast enough, so it seems that nothing happens.

Another thing is, when I set "bot_forceattack" to 1 the bots start firing their guns ... This shows, that the bot's own engine is running at the same time, too...

I took a look into your source code and found your snippets about adding and controlling a bot ... but, how did you stop the bot's own engine?

I hope you understand what I mean, my english is not the best ;D

best regards
Andi
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Cheeseh
post Jun 10 2009, 04:59 PM
Post #3


Admin
*****

Group: Admin
Posts: 3,066
Joined: 11-September 03
From: uk
Member No.: 1



To be honest I don't know, I haven't tried bots crouching, I guess the same might happen come to think of it.

You could try 'bot_dontmove 1' command and it might stop some things from happening

the tf2 inbuilt bot stuff will still be running in the background, so bot_mimic etc will take over control and stuff, even if you use CreateBot() I noticed TF2 still did this, so there is something dodgy going on behind the scenes and this could be the cause of the "fast gravity" glitch
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Tauphi
post Jun 10 2009, 05:33 PM
Post #4


Newbie
*

Group: Members
Posts: 5
Joined: 2-June 09
Member No.: 1,564



I already tried commands like "bot_dontmove" or so ... but TF2 is still using it's own engine to overwrite my set bot commands ...

I think valve's code looks a bit like this:
CODE
void Bot_Think( CPluginBot *pBot )
{
    CBotCmd cmd;
    Q_memset( &cmd, 0, sizeof( cmd ) );

    if ( bot_dontmove.GetInt() > 0 )
    {
        //do something...
    }

    pBot->m_BotInterface->RunPlayerMove( &cmd );
}
that their think function at least resets the CBotCmd object ....

Did you ever have any contact to a guy from valve? I emailed Tony and Alfred about the broken IBotManager interface, but they never replied. Perhaps they are the wrong guys for that problem, but I don't know others of the team.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Cheeseh
post Jun 10 2009, 09:22 PM
Post #5


Admin
*****

Group: Admin
Posts: 3,066
Joined: 11-September 03
From: uk
Member No.: 1



If you have any questions/suggestions for valve I suggest using the hlcoders mailing list.

http://list.valvesoftware.com/mailman/listinfo/hlcoders

I will need to ask them sometime about this also.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Tauphi
post Jun 10 2009, 09:32 PM
Post #6


Newbie
*

Group: Members
Posts: 5
Joined: 2-June 09
Member No.: 1,564



I am on three lists ... hlcoders, hlds_linux and windows ...
I remember you already posted something about the bot interface a while ago.
QUOTE
*Bumps*
I Tested the "sample_bot_plugin" code that comes with the SDK (and latest beta SDK) and it doesn't work either with TF2, it suffers the exact same problem. So I guess I'd like to see a newer version of the sample bot plugin code (and get Valve to have a look at it themselves!).
Cheers!
[rcbot]Cheeseh
But nobody had a solution and valve didn't post something sad.gif
I think the best way would be to get a direct contact to one of the SDK developers at valve ...
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 20th June 2025 - 01:36 PM