.:: Bots United ::.  
filebase forums discord server github wiki web
cubebot epodbot fritzbot gravebot grogbot hpbbot ivpbot jkbotti joebot
meanmod podbotmm racc rcbot realbot sandbot shrikebot soulfathermaps yapb

Go Back   .:: Bots United ::. > Cyborg Factory > HPB_bot
HPB_bot The trusty good ole mechs by botman HLDMTFCOpposing ForceDMCFront Line Force

Reply
 
Thread Tools
Joining a team in CS 1.6
Old
  (#1)
Neoptolemus
Member
 
Status: Offline
Posts: 93
Join Date: Apr 2012
Default Joining a team in CS 1.6 - 04-06-2015

Hi everyone,

I downloaded the latest HPB Bot source (version 4.0) as I want to try implementing my own variation of the detour and recast libraries.

Having successfully compiled the dll however, and setting up metamod, I cannot get the bots to join a team, they just sit in spectator mode.

Looking at the source and doing some debugging, they correctly interpret the team select VGUI message and issue the command "menuselect <team>", but this appears not to work as they never receive the next VGUI message to choose a T or CT model.

Menuselect doesn't work for me either if I enter it at the console, so I can only surmise that the system has changed in the current version of CS 1.6 (steam version).

What is weird though is that I downloaded the EPODbot 5.3 source and tried it, and the bots join the teams just fine. In the source they're still issuing the "menuselect" command, but somehow it works for them. The FakeClientCommand function has changed in EPODbot but it looks like it's a change to the way the command is parsed to allow for scripting, rather than a fundamental change to the way its issued.

Anyone able to enlighten me as to why the HPB bot cannot join but EPODbot can? By the way, I disabled the MOTD as I noticed HPB bot cannot handle it by default, so they're not stuck on it (I've also confirmed that they do get to the team select menu).

Thanks in advance!
  
Reply With Quote
Re: Joining a team in CS 1.6
Old
  (#2)
The Storm
Council Member / E[POD]bot developer
 
The Storm's Avatar
 
Status: Offline
Posts: 1,618
Join Date: Jul 2004
Location: Bulgaria
Default Re: Joining a team in CS 1.6 - 06-06-2015

Hello,

There is little trick when creating the bot. Locate the code that connects a bot on the server(CREATE_FAKE_CLIENT in bot.cpp) and there you will see setting some client values like "cl_updaterate". There you need to add one more:
Code:
SET_CLIENT_KEY_VALUE(clientIndex, infobuffer, "_vgui_menus", "0");
This should get the bots joining a team.

P.S. Also note that there is other issues that are present in HPB_bot that are not fixed because of missing maintainer, like this snipped from E[POD]bot that will fix your server behave strange and crash when you kick a bot.
Code:
// Fix from Pierre-Marie Baty
if (BotEnt->pvPrivateData != NULL)
    FREE_PRIVATE(BotEnt);  // free our predecessor's private data
BotEnt->pvPrivateData = NULL;     // fools the private data pointer
BotEnt->v.frags = 0;      // reset his frag count

Last edited by The Storm; 07-06-2015 at 01:31..
  
Reply With Quote
Re: Joining a team in CS 1.6
Old
  (#3)
Neoptolemus
Member
 
Status: Offline
Posts: 93
Join Date: Apr 2012
Default Re: Joining a team in CS 1.6 - 07-06-2015

That's brilliant, that got it working I had completely forgotten that you could disable VGUI menus (it's been that long!).

The only other thing I had to do was implement a fix in BotClient_CS_ShowMenu for the team select menu (it looks like the menu string was changed from #Team_Select to #Team_Select_Spect), I used EPODbot's method of just using strncmp to compare the first 12 characters.

There's some more tidying up to do as bots don't detect the new round properly, then it will be a process of stripping everything out right to the bare bones.

I'm intending to abstract a lot of this stuff out and expose a simplified bot API based around events like SeePlayer(), TakeDamage(), ReceiveHUDNotification() etc. I don't know if there is still any interest in something like this, but if anyone would like an updated bare-bones template to play with then let me know and I'll upload something.
  
Reply With Quote
Re: Joining a team in CS 1.6
Old
  (#4)
The Storm
Council Member / E[POD]bot developer
 
The Storm's Avatar
 
Status: Offline
Posts: 1,618
Join Date: Jul 2004
Location: Bulgaria
Default Re: Joining a team in CS 1.6 - 07-06-2015

Hello again,

I guess that it is bug in the function BotClient_CS_HLTV. The state variable there although static it will never be incremented to 1 so the new round will never be detected...
However I don't think the fix would be simple, because every other bot projects that I know use it as global variable and reset it in MessageBegin/End in order to always have correct count.

Good luck.

P.S. Actually a fix would be to increment the value each time the function enters and to put it back to zero when reaches 1. However this might not be enough, because I don't know how much states the HLTV message can have. But you can try to debug it.

To be more exact, do it like this:
Code:
void BotClient_CS_HLTV(void *p, int bot_index)
{
   static int state = 0;   // current state machine state
   static int players;
   int index;

   if (state == 0)
   {
      state++;
      players = *(int *) p;
   }
   else if (state == 1)
   {
      // new round in CS 1.6
      state = 0;
      if ((players == 0) && (*(int *) p == 0))
      {
         for (index = 0; index < 32; index++)
         {
            if (bots[index].is_used)
               BotSpawnInit (&bots[index]); // reset bots for new round
         }
      }
   }
   else
   {
      state++;
   }
}
Sorry, had posted the code with mistake.
  
Reply With Quote
Re: Joining a team in CS 1.6
Old
  (#5)
Neoptolemus
Member
 
Status: Offline
Posts: 93
Join Date: Apr 2012
Default Re: Joining a team in CS 1.6 - 08-06-2015

Thanks again, it's good to see this forum still has some life in it yet! The round restart code still isn't quite working yet, it's probably because BotClient_CS_HLTV isn't being called properly. I'll take a look in a bit...

EDIT: Never mind, the bots do detect the new round correctly, but the HPB bot source has no logic for buying equipment, it just resets all their variables in BotSpawnInit. There's no logic either to handle the 5 second "buy" period at the start of each round, so the bot expects to be able to move right away. This isn't an issue as I want to strip this stuff out anyway.

Last edited by Neoptolemus; 08-06-2015 at 09:55..
  
Reply With Quote
Re: Joining a team in CS 1.6
Old
  (#6)
The Storm
Council Member / E[POD]bot developer
 
The Storm's Avatar
 
Status: Offline
Posts: 1,618
Join Date: Jul 2004
Location: Bulgaria
Default Re: Joining a team in CS 1.6 - 08-06-2015

Yeah, I check out the forum from time to time, it's also nice for me to see that someone is up to something.

Good luck with your work, I will expect the results.

P.S. Also check out this framework of koraX:
https://sourceforge.net/projects/kxb...ework%201.0.0/

It might be better start than HPB_bot.
  
Reply With Quote
Re: Joining a team in CS 1.6
Old
  (#7)
Neoptolemus
Member
 
Status: Offline
Posts: 93
Join Date: Apr 2012
Default Re: Joining a team in CS 1.6 - 09-06-2015

Thanks for the heads up. I took a quick look at koraX but couldn't find a proper description of it anywhere. A quick 2-minute scan of a few source files seems to indicate a system to automatically generate waypoints and paths (i.e. not needing to manually place them as with traditional HPB-based bots), some techniques to understand the topography of a map and a much more sophisticated decision-making system.

Looks interesting, will need to take a closer look after work! Will take a look at them in action too.

For me, I've finished gutting HPB bot, so everything has been stripped right back including the navigation system. All that's left are some bots that can "join" a server, pick a team, issue client commands and receive server messages. Now to start building my own framework Once I have something worth posting about, I'll create a blog and put the link here.

The challenging part will be analysing the BSP files to create a triangle soup for the recast library to operate on, but luckily I'm a data nerd so I quite enjoy that sort of thing.

Last edited by Neoptolemus; 09-06-2015 at 18:16..
  
Reply With Quote
Re: Joining a team in CS 1.6
Old
  (#8)
The Storm
Council Member / E[POD]bot developer
 
The Storm's Avatar
 
Status: Offline
Posts: 1,618
Join Date: Jul 2004
Location: Bulgaria
Default Re: Joining a team in CS 1.6 - 09-06-2015

If you are going to check out koraX bot, download the bot itself, not the framework. The bot version is 1.1 but it might need updates of the hlsdk and metamod headers and recompile to work properly.

About BSP data. Check out the RACC bot template. Most of the work done there is about scanning map and navigating without manual waypoints. It uses navigation meshes just like the official CSBot.
  
Reply With Quote
Re: Joining a team in CS 1.6
Old
  (#9)
Neoptolemus
Member
 
Status: Offline
Posts: 93
Join Date: Apr 2012
Default Re: Joining a team in CS 1.6 - 10-06-2015

Quote:
Originally Posted by The Storm View Post
If you are going to check out koraX bot, download the bot itself, not the framework. The bot version is 1.1 but it might need updates of the hlsdk and metamod headers and recompile to work properly.

About BSP data. Check out the RACC bot template. Most of the work done there is about scanning map and navigating without manual waypoints. It uses navigation meshes just like the official CSBot.
You're right, trying to use koraX "out of the box" results in a nasty crash to the desktop. I'll take a look at fixing it at some point.

I'll also look at RACC, I do remember reading PMB's posts on the tech behind his bot. I couldn't read a line of code back then and had no idea how BSPs worked, so it was a bit like the technobabble in sci-fi films but was still impressive. It's fun to come back to those same posts now and be able to understand it properly.
  
Reply With Quote
Re: Joining a team in CS 1.6
Old
  (#10)
The Storm
Council Member / E[POD]bot developer
 
The Storm's Avatar
 
Status: Offline
Posts: 1,618
Join Date: Jul 2004
Location: Bulgaria
Default Re: Joining a team in CS 1.6 - 11-06-2015

So it seems that you have been longer with us than I thought. Is that your first registration?
  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com