.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   Offtopic (http://forums.bots-united.com/forumdisplay.php?f=23)
-   -   YaPB Developer Preview 1.1 (http://forums.bots-united.com/showthread.php?t=916)

Whistler 27-02-2004 04:18

YaPB Developer Preview 1.1
 
YaPB (Yet another POD-Bot) Developer Preview 1.1

...here it is:

Changes to the original POD-Bot 2.6 (in a fairly mess):

Code:

+ FIXED: Bot can't plant the bomb in CS 1.4 or later
 + FIXED: Invalid memory access in bots' hearing code
 + FIXED: Crash when shooting through obstacles
 + FIXED: Crash when the server has 32 players
 + FIXED: Crash in waypoint editor
 + FIXED: Some other random crashes
 + FIXED: Compatiable issue with CS Training Room
 + FIXED: Ignorance of shooting offset value in botskill.cfg
 + FIXED: Angle overflow issue
 + FIXED: Hitboxes issues
 + FIXED: Problems when bot's going through a door
 + FIXED: Selection "7" is not selectable in Weapon mode menu
 + FIXED: Bots having same score when they are re-added after kicked
 + FIXED: Incorrect usage of abs()
 + FIXED: Bots using dead hostages
 + FIXED: Incorrect kill experience collecting
 + FIXED: Recoil (punchangle) bug
 + Compatiable with current Steam/CS 1.6 (Thanks a lot for Pierre-Marie Baty for his source code and help on this !)
 + Bots will use the new weapons and the shield
 + Bots will buy weapons/shield/defuser correctly in CS 1.6
 + Added MetaMod support, you can use the DLL as both standalone bot and MetaMod plugin
 + Bots will pick up pistols on the ground
 + Changed player avoidance code, bots won't get stuck so easily
 + Changed A* pathfinder
 + Bots won't use A* pathfinder when collectexperience is off
 + Added a waypoint operating menu, command "waypoint menu", binded to "-" key by default
 + When error occures, the DLL will remove all bots and print an error message instead of crashing the server
 + Bots personality are now selectable in podbotmenu
 + Terrorists won't use the hostages any more
 + Bots will pick up defusers on the ground
 + Bots are now reasonable with the silencer
 + Much more careful connection/radius detecting in waypoint editor
 + Added "fillserver" command
 + Added "pathwaypoint connect/disconnect [Waypoint Nr.]" command to create/remove 2-way connections
 + Console commands can be used directly in the dedicated server console now, no more "pb addbot" (use "cmd addbot" for other bots when using this bot with other bots)
 + Added "botuseradio" command in podbot.cfg
 + Removed unnecessary "newmap" command, use "map" or "changelevel" instead, they won't crash (at least on my computer :) )
 + Improved bots' using sniper rifles and zoomable rifles
 + Source code is now restructured and cleaned up
 + Changed FakeClientCommand() stuff (Thanks to PMB again !)
 + Changed 'Need backup', bots won't always take the nearest waypoint to the caller
 + Added botman's chat humanizer code, bots will make some mistakes while chating
 + Rewrote the messy CS buy routines in a clean way
 + Ladder waypoints can be marked automatically now, just add a 'normal' waypoint
 + Path finding errors are no longer logged to poderror.txt, you have to use 'waypoint check' manually
 + Implemented VecToYaw, VecToAngles and MakeVectors directly in the bot code, no more engine calls
 + Simplified UTIL_GetTeam() code, no more strcpy/strcmp's
 + Some experience data is displayed in waypoint editor
 + Some other things I missed
 + Some bugs added (oops, I hope it's none) :)

Known bugs:
Code:

+ Incorrect camping direction bug
 + Very machine-like (not human-like) ladder climbing
 + Bots don't use grenades very well
 + Most of the known issues listed in the original PB 2.5 readme :)

Of course, it's currently only a PREVIEW release which is just a POD-Bot unoffical patch (that's why I left the POD-Bot welcome message as it used to be). But I'll continue working on it to make a much better bot as long as I have enough time. :)

My homepage: http://yapb.yeah.net (There are also some other things out there, such as bot for Ricochet, bot for old HL/CS, fix for RealBot 1.0 which allows continue using RB v1.0 in Steam)

Direct download:
http://planet.time.net.my/Technology...yapbalpha1.exe
Full source code is included.

Of cource I owes a lot to Count Floyd and PMB !

I have also tested it with RealBot v1.0 and the latest RealBot WIP.

Hope you like it.

Enjoy,
Wei 'Whistler' Mingzhi

Pierre-Marie Baty 27-02-2004 08:55

Re: YaPB Developer Preview 1.1
 
Good job Whistler! :)

In changing the A* pathfinder, have you put an heuristic function ? Because Count Floyd had none, that's why his bot was very "shy" when following an A* generated path. I wrote a square distance heuristic. Check that you've put one too :)

But MOST IMPORTANT: you made it work with RealBot. How ? By not using FL_FAKECLIENT and using FL_THIRDPARTYBOT instead ? But TurtleRocker recommends us to put the FL_FAKECLIENT back anyway. So I'd like to know how you did it :)

@$3.1415rin 27-02-2004 10:22

Re: YaPB Developer Preview 1.1
 
A* without heustic ? heh guys, that's called dijkstra then, rght ?

stefanhendriks 27-02-2004 10:42

Re: YaPB Developer Preview 1.1
 
i dunno about dijkstra exactly. I thought that was by bi-directional searching? Or am i messing stuff up now?

A* always has an heuristic, if it does not have one, it would not create a path at all. So i guess a 'non heuristic' one is meant to be 'find the best node thats gets closer to goal'...

stefanhendriks 27-02-2004 10:44

Re: YaPB Developer Preview 1.1
 
Quote:

But MOST IMPORTANT: you made it work with RealBot. How ? By not using FL_FAKECLIENT and using FL_THIRDPARTYBOT instead ? But TurtleRocker recommends us to put the FL_FAKECLIENT back anyway. So I'd like to know how you did it :)
yeah, i am quite anxious too... i'd like to fix this up so RB will work with all bots! It would be super cool to have a server with 4 types of bots fighting along/against each other (VS humans l33t).

Pierre-Marie Baty 27-02-2004 14:42

Re: YaPB Developer Preview 1.1
 
Quote:

Originally Posted by stefanhendriks
i dunno about dijkstra exactly. I thought that was by bi-directional searching? Or am i messing stuff up now?

A* always has an heuristic, if it does not have one, it would not create a path at all. So i guess a 'non heuristic' one is meant to be 'find the best node thats gets closer to goal'...

No, Aspirin is right ; basically all searching algorithms can be bidirectional if you want, but it is right to say that A* is a directed Dijkstra. The direction influence is provided by the heuristic function.

Having no heuristic function (or a heuristic function that returns the same value for every node evaluated) will make the algorithm not directed at all, and so it will expand in all directions.

A* can have no heuristic ; in this case the algorithm is exactly Dijkstra's (after simplification). Actually I'm starting to wonder if Count Floyd did really write all this A* function himself, because it's really well thought of. If he did, kudos! It's rather a generic-purpose A* template. You can pass as arguments to this function pointers to the addresses of the functions that you want it to use to compute the cost, to evaluate the heuristic, and to determine if the goal is reached or not. It's really polyvalent. But in his implementation, Count Floyd was always calling his A* function with a pointer to a heuristic function that was returning 0 for every node evaluated.

Look at his prototype:
Code:

PATHNODE *AStarSearch (PATHNODE *root, int (*gcalc) (PATHNODE *), int (*hcalc) (PATHNODE *),
                                          int (*goalNode) (PATHNODE *), PATHNODE * (*children) (PATHNODE *),
                                          int (*nodeEqual) (PATHNODE *, PATHNODE *));

gcalc(), hcalc(), goalNode(), children() and nodeEqual() are pointers to functions. Really nice, isn't it ? Although from a strict performance point of view I'm not sure it's very computationally efficient.

The heuristic function he was always passing as hcalc(), was this function:
Code:

// No heurist (greedy) !!
int hfunctionNone (PATHNODE *p)
{
  if (p == NULL)
          return (65355);
  return (0);
}

so I added mine:
Code:

// Square Distance Heuristic
int hfunctionSquareDist (PATHNODE *p)
{
  int deltaX = abs ((int) paths[g_iSearchGoalIndex]->origin.x - (int) paths[p->iIndex]->origin.x);
  int deltaY = abs ((int) paths[g_iSearchGoalIndex]->origin.y - (int) paths[p->iIndex]->origin.y);
  int deltaZ = abs ((int) paths[g_iSearchGoalIndex]->origin.z - (int) paths[p->iIndex]->origin.z);
  return (deltaX + deltaY + deltaZ);
}


Terran 27-02-2004 16:24

Re: YaPB Developer Preview 1.1
 
I've made some minor fixes to yapb to make it compile and run at my linux server. You can download it at my homepage (as usual) ;)

Whistler 28-02-2004 02:25

Re: YaPB Developer Preview 1.1
 
I'm using the Floyd Table as the heuristic. I have also changed the cost function.
Code:

    int gfunctionDamageDistCT(PATHNODE *p)
    {
      if (p == NULL)
              return 65355;
   
      if (!p->parent)
              return 0;
   
      int iThisIndex = p->iIndex;
      int iCost = 0;
   
      int iDangerIndex = (pBotExperienceData + iThisIndex * g_iNumWaypoints + iThisIndex)->iTeam1_danger_index;
      if (iDangerIndex != -1)
              iCost += (pBotExperienceData + iThisIndex * g_iNumWaypoints + iDangerIndex)->uTeam1Damage;
   
      for (int i = 0; i < MAX_PATH_INDEX; i++)
      {
              int iNeighbour = paths[iThisIndex]->index[i];
              if (iNeighbour != -1)
              {
                  iDangerIndex = (pBotExperienceData + iNeighbour * g_iNumWaypoints + iNeighbour)->iTeam1_danger_index;
                    if (iDangerIndex != -1)
                  iCost += (pBotExperienceData + iNeighbour * g_iNumWaypoints + iDangerIndex)->uTeam1Damage;
              }
      }
   
      iCost *= MAX_DAMAGE_VAL / (g_uMaxDamageCT + 1) / RANDOM_LONG(1, 8);
      iCost += GetPathDistance(p->parent->iIndex, iThisIndex);
   
      return iCost;
    }
   
    int hfunctionPathDist(PATHNODE *p)
    {
      if (p == NULL)
              return 65355;
      return GetPathDistance(p->iIndex, g_iSearchGoalIndex);
    }

About the RealBot thing: I'm not using any flags to flag the bot. I just use CBaseBot::Instance() function (similar botman's UTIL_GetBotPointer() ) :)

@Terran: Thanks for the fix ! I'll take a look at it...

Edit: cannot download your file Terran, just break up in half way :(

Terran 29-02-2004 20:25

Re: YaPB Developer Preview 1.1
 
Strange, I had no trouble downloading it...

I tried to upload the file here at the forum but I always get an database error...

Please try this link to download the file, you should be able to use a download manager this way.

Pierre-Marie Baty 29-02-2004 22:18

Re: YaPB Developer Preview 1.1
 
Quote:

Originally Posted by Whistler
iCost *= MAX_DAMAGE_VAL / (g_uMaxDamageCT + 1) / RANDOM_LONG (1, 8 );
iCost += GetPathDistance (p->parent->iIndex, iThisIndex);

I don't understand what you are doing here... ???:( could you explain it a bit ?

Terran 02-03-2004 15:56

Re: YaPB Developer Preview 1.1
 
1 Attachment(s)
I've made a patchfile with my changes.
Note: I used dos2unix to remove the (at linux) unneccessary carridge-return chars of the files, therefore the patch might not apply at your system. But the changes are minimal at all...

Terran 02-03-2004 16:21

Re: YaPB Developer Preview 1.1
 
One wish for the next release:

please change the commands from "addbot" to something like "yapb addbot" as most of the other bots do. Otherwise it could be difficult to mix it with other bots at the same server...

eAnic 02-03-2004 18:00

Re: YaPB Developer Preview 1.1
 
Quote:

Originally Posted by Terran
I've made a patchfile with my changes.
Note: I used dos2unix to remove the (at linux) unneccessary carridge-return chars of the files, therefore the patch might not apply at your system. But the changes are minimal at all...

a patch? for what?

Terran 03-03-2004 09:51

Re: YaPB Developer Preview 1.1
 
This patch contains the changes I had to made at Whistlers yapb sources to make it compile at my linux system...

Whistler 06-03-2004 02:10

Re: YaPB Developer Preview 1.1
 
That pathfinder is based on distance, and take the damage value in account.

@Terran: Thanks a lot !

eAnic 06-03-2004 06:05

Re: YaPB Developer Preview 1.1
 
This bot is very nice! I got naded more than once by this bastards ;)
How about adding them to BU ?

Pierre-Marie Baty 06-03-2004 12:05

Re: YaPB Developer Preview 1.1
 
Whenever Whistler requests it... :)

Whistler 23-03-2004 11:48

Re: YaPB Developer Preview 1.1
 
okay I've just uploaded a new version (as well as some other new things) :)

Check them out if you wish...

Terran 23-03-2004 14:00

Re: YaPB Developer Preview 1.1
 
I will check it out once my headache is over... :(

Terran 30-03-2004 14:05

Re: YaPB Developer Preview 1.1
 
2 Attachment(s)
Today I finally was able to start looking at it :|.

I had to make some minor changes to compile the bot at my debian 3.0 testing/glibc2.3 system, I've attached the changes and the compiled bot.

Terran 30-03-2004 14:29

Re: YaPB Developer Preview 1.1
 
I'm getting lots of "SZ_GetSpace: overflow on SVC_RuleInfo" lines...

dead bwoy 31-03-2004 01:24

Re: YaPB Developer Preview 1.1
 
me 2, but only after i got cz and started using metamodX
is this on a cz or cs server?

Whistler 31-03-2004 12:11

Re: YaPB Developer Preview 1.1
 
Hmmm.... try putting that FL_FAKECLIENT in the CBaseBot constructor and it should be okay (Don't know whether this putting will crash CZero - I still haven't bought it)

I just wanted it can be used with RealBot so I didn't put it

PS, I don't think any 3rdparty bots can be used with CZero since when CZero bots are get added the ClientConnect and ClientPutInServer in the bot DLL won't get called and this will causes problems.

Terran 31-03-2004 12:37

Re: YaPB Developer Preview 1.1
 
About the SZ problem:
This problem could be caused by AMXX to, some users have reported this problem with the current version. I'll check this out and test yapb without any other plugins.

BTW:
A few days ago I switched from AMX to AMXX and also replaced MetaMod with MetaModX. See http://www.amxmodx.org

Whistler 31-03-2004 13:45

Re: YaPB Developer Preview 1.1
 
Terran, I wonder why you're doing this...
Code:

+#ifdef _WIN32
  #define LINK_ENTITY_TO_GAME(mapClassName) \
 - extern "C" EXPORT void mapClassName( entvars_t *pev ) { \
 -        static LINK_ENTITY_GAME otherClassName = NULL; \
 -        if (otherClassName == NULL) \
 -          otherClassName = (LINK_ENTITY_GAME)GetProcAddress(h_Library, #mapClassName); \
 -        if (otherClassName == NULL) \
 -          return; \
 -        (*otherClassName)(pev); }
 +        extern "C" __declspec(dllexport) void mapClassName( entvars_t *pev ) { \
 +        static LINK_ENTITY_GAME otherClassName = NULL; \
 +        if (otherClassName == NULL) \
 +        otherClassName = (LINK_ENTITY_GAME)GetProcAddress(h_Library, #mapClassName); \
 +        if (otherClassName == NULL) \
 +        return; \
 +        (*otherClassName)(pev); }
 +#else
 +#define LINK_ENTITY_TO_GAME(mapClassName) \
 +        extern "C" void mapClassName( entvars_t *pev ) { \
 +        static LINK_ENTITY_GAME otherClassName = NULL; \
 +        if (otherClassName == NULL) \
 +        otherClassName = (LINK_ENTITY_GAME)GetProcAddress(h_Library, #mapClassName); \
 +        if (otherClassName == NULL) \
 +        return; \
 +        (*otherClassName)(pev); }
 +#endif

The EXPORT has already been defined like this in cbase.h...
Code:

#ifdef _WIN32
 #define EXPORT        _declspec(dllexport)
 #else
 #define EXPORT
 #endif

PS, that 1.2 version has a bug in experience collecting (PODBot 2.6 leftover). Add this in CBaseBot::FindPath() function should fix it...
Code:

    m_iChosenGoalIndex = iSourceIndex;
    m_flGoalValue = 0.0;


Terran 31-03-2004 14:36

Re: YaPB Developer Preview 1.1
 
I've been lazy and simply copied the working code from my modified 1.1 version:D.

You didn't include the bot.h in the linkgame.cpp therefore this define wasn't there! I included the bot.h AFTER i changed those lines because of some other errors I got.
I've undone the changes (but kept the bot.h include) and this works too - as expected ;).

Quote:

m_iChosenGoalIndex = iSourceIndex;
m_flGoalValue = 0.0;

I've added this at the start of the method.

Terran 31-03-2004 22:31

Re: YaPB Developer Preview 1.1
 
Bug report (yapb 1.2):

I set my server to
Code:

yapb_maxbots 2
 yapb_minbots 2

and wait till the bots have joined. Than I set those values to 0.
Now I cannot remove those bots! Well, I can remove them but they keep coming back, no matter what I tried (yapb removebots, kicked manually...). For a few seconds it seams as if the bots are gone but then they reappear.

Terran 31-03-2004 23:25

Re: YaPB Developer Preview 1.1
 
Another "bug":
While running awp_map I set mp_freezetime to 0 (to minimize spawn killing). But the bots still freeze for some seconds at each round start...

Whistler 02-04-2004 12:05

Re: YaPB Developer Preview 1.1
 
Quote:

Originally Posted by Terran
Bug report (yapb 1.2):

I set my server to
Code:

  yapb_maxbots 2
  yapb_minbots 2

and wait till the bots have joined. Than I set those values to 0.
Now I cannot remove those bots! Well, I can remove them but they keep coming back, no matter what I tried (yapb removebots, kicked manually...). For a few seconds it seams as if the bots are gone but then they reappear.

Ah ! I'm stupid:
Code:

    static float flCvarUpdateTime = 0.0;
 
    // if a new map has started then (MUST BE FIRST IN StartFrame)...
    if (gpGlobals->time + 0.1 < g_flTimePrevThink)
    {
          int count = 0;
 
          // mark the bots as needing to be respawned...
          for (index = 0; index < gpGlobals->maxClients; index++)
          {
                  if (count >= g_iPrevNumBots)
                  {
                        bot_respawn[index].bIsUsed = FALSE;
                        bot_respawn[index].iRespawnState = 0;
                        bot_respawn[index].flKickTime = 0.0;
                  }
 
                  if (bot_respawn[index].bIsUsed)  // is this slot used?
                  {
                        bot_respawn[index].iRespawnState = RESPAWN_NEED_TO_RESPAWN;
                        count++;
                  }
 
                  // check for any bots that were very recently kicked...
                  if (bot_respawn[index].flKickTime + 5.0 > g_flTimePrevThink)
                  {
                        bot_respawn[index].iRespawnState = RESPAWN_NEED_TO_RESPAWN;
                        count++;
                  }
                  else
                    bot_respawn[index].flKickTime = 0.0;  // reset to prevent false spawns later
          }
 
          // set the respawn time
          g_flRespawnTime = gpGlobals->time + 15.0;
          g_flBotCheckTime = gpGlobals->time + 20.0;
 
          flCvarUpdateTime = 0.0; // I FORGOT THIS ONE !
    }
 
    if (flCvarUpdateTime < gpGlobals->time)
    {
          g_iMinBots = (int)CVAR_GET_FLOAT(g_cvarMinBots.name);

About the freeze thing:
They are waiting for buying weapons

Terran 02-04-2004 16:10

Re: YaPB Developer Preview 1.1
 
About the SZ_Getspace error messages see the documentation of the NoSeeVar MetaMod plugin...

Whistler, you exporting all CVars which is causing this error message. IMHO there is no need to export them, nobody cares for those values except for the admin...

About the freezing:
This makes them helpless prey at e.g. awp_map...

Terran 03-04-2004 16:58

Re: YaPB Developer Preview 1.1
 
I've blocked those CVars from the server rules:

yapb_autosaveexp
yapb_botchat
yapb_botspray
yapb_botuseradio
yapb_debuggoal
yapb_detailnames
yapb_followuser
yapb_inhumanturns
yapb_maxbots
yapb_maxskill
yapb_minskill
yapb_shootthruwalls
yapb_timergrenade
yapb_timerpickup
yapb_timersound
yapb_useexp
yapb_votekick

Whistler 08-04-2004 06:50

Re: YaPB Developer Preview 1.1
 
blocking those CVARs may cause weird problems.

you can try modify the source code to the old dev1.1 version (use pfnAddServerCommand).

Also you can try using the DLL as normal HPBbot type DLL (i.e., use +localinfo mm_gamedll) and it may be better

Terran 09-04-2004 00:25

Re: YaPB Developer Preview 1.1
 
I'm not blocking the engines access to the CVARs, I prevent the remote access to them via the server status request of the game browsers.

When you define a CVAR you can set some flags. One of those flags makes the CVAR appear in the server status report (that's what causes the problem). All this plugin does is defining those CVAR before other plugins do (CVARS can only be defined once 8)) - but without the "export" flag (I don't know the correct name).

Pierre-Marie Baty 09-04-2004 02:24

Re: YaPB Developer Preview 1.1
 
The possible flags a CVAR can wear are those here:
Code:

#define FCVAR_ARCHIVE  (1<<0) // set to cause it to be saved to vars.rc
#define FCVAR_USERINFO  (1<<1) // changes the client's info string
#define FCVAR_SERVER  (1<<2) // notifies players when changed
#define FCVAR_EXTDLL  (1<<3) // defined by external DLL
#define FCVAR_CLIENTDLL        (1<<4)  // defined by the client dll
#define FCVAR_PROTECTED        (1<<5)  // It's a server cvar, but we don't send the data since it's a password, etc.  Sends 1 if it's not bland/zero, 0 otherwise as value
#define FCVAR_SPONLY                (1<<6)  // This cvar cannot be changed by clients connected to a multiplayer server.
#define FCVAR_PRINTABLEONLY (1<<7)  // This cvar's string cannot contain unprintable characters ( e.g., used for player name etc ).
#define FCVAR_UNLOGGED  (1<<8)  // If this is a FCVAR_SERVER, don't log changes to the log file / console if we are creating a log

Please Terran, could you tell me which one I need to set in order for my CVARs to stay accessible locally on the server and not externally ?
I'd like to make sure I do things right.

Terran 09-04-2004 08:04

Re: YaPB Developer Preview 1.1
 
The problem is caused by the FCVAR_SERVER flag. Remove it from your flags and the SZ_Getspace error should be history.

Pierre-Marie Baty 09-04-2004 11:41

Re: YaPB Developer Preview 1.1
 
ah great. I never used it anyway :)

Whistler 19-04-2004 07:07

Re: YaPB Developer Preview 1.1
 
Oh sorry but I've never been an admin, thanks for pointing this out anyway, I've fixed it now.


All times are GMT +2. The time now is 04:55.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.