.:: 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 > POD-Bot mm > Ideas
Ideas One idea per thread please! :)

Reply
 
Thread Tools
Re: Remove the requirement of CS specific waypoints
Old
  (#11)
KWo
Developer of PODBot mm
 
KWo's Avatar
 
Status: Offline
Posts: 3,425
Join Date: Apr 2004
Default Re: Remove the requirement of CS specific waypoints - 13-03-2007

You are not listenting to me at all.
The navigation code is common for ALL maps types. The bot NEEDS to know where to start to go. For that they are using (ALWAYS on ALL MAPS) those waypoints. Making something specyfic (for Your maps) needs to change the NAVIGATION SYSTEM (which I don't mind). BotFindGoal is one of basic functions the bot is using for navigation. No goals = the bot is lost.
  
Reply With Quote
Re: Remove the requirement of CS specific waypoints
Old
  (#12)
Simon Logic
Member
 
Status: Offline
Posts: 24
Join Date: Aug 2006
Location: RF, Bryansk
Default Re: Remove the requirement of CS specific waypoints - 13-03-2007

ok. Is it possible to remove team specific waypoint requirement then? Or they are also part of basic navigation?
  
Reply With Quote
Re: Remove the requirement of CS specific waypoints
Old
  (#13)
KWo
Developer of PODBot mm
 
KWo's Avatar
 
Status: Offline
Posts: 3,425
Join Date: Apr 2004
Default Re: Remove the requirement of CS specific waypoints - 13-03-2007

Quote:
Originally Posted by botnavigate.cpp
Code:
int BotFindGoal (bot_t *pBot)
   // Chooses a Destination (Goal) Waypoint for a Bot

   int iTactic;
   int iOffensive;
   int iDefensive;
   int iGoalDesire;
   int iForwardDesire;
   int iCampDesire;
   int iBackoffDesire;
   int iTacticChoice;
   int *pOffensiveWPTS = NULL;
   int iNumOffensives;
   int *pDefensiveWPTS = NULL;
   int iNumDefensives;
   bool bHasHostage = BotHasHostage (pBot);
   int index;
   int min_index;
   float distance;
   float min_distance;
   int iGoalChoices[4];
   float iGoalDistances[4];
   edict_t *pEdict;
   int iBotIndex = pBot->curr_wpt_index;  // KWo - 14.02.2006
   int iTestIndex; // KWo - 14.02.2006
   bool bSorting; // KWo - 14.02.2006
   bool bGoalNearby = false;  // KWo - 12.02.2006
   int iClosestGoalIndex = -1;  // KWo - 12.02.2006
   int iRescueIndex; // KWo - 24.12.2206
   pEdict = pBot->pEdict;

   // if there is debugoal enabled - return the index of the debugged goal
   if (g_iDebugGoalIndex != -1) // KWo - 25.07.2006
   {
      pBot->chosengoal_index = g_iDebugGoalIndex;
         return (g_iDebugGoalIndex);
   }

   // Pathfinding Behaviour depending on Maptype
   if (pBot->bot_team == TEAM_CS_TERRORIST)
   {
      pOffensiveWPTS = &g_rgiCTWaypoints[0];
      iNumOffensives = g_iNumCTPoints;
      pDefensiveWPTS = &g_rgiTerrorWaypoints[0];
      iNumDefensives = g_iNumTerrorPoints;
   }
   else
   {
      pOffensiveWPTS = &g_rgiTerrorWaypoints[0];
      iNumOffensives = g_iNumTerrorPoints;
      pDefensiveWPTS = &g_rgiCTWaypoints[0];
      iNumDefensives = g_iNumCTPoints;
   }

   // Terrorist carrying the C4 ?
   if ((pBot->pEdict->v.weapons & (1 << CS_WEAPON_C4))
       || pBot->bIsVIP)
   {
      iTactic = 3;
      goto tacticchosen;
   }

   else if (bHasHostage && (pBot->bot_team == TEAM_CS_COUNTER))
   {
      min_distance = 9999;
      min_index = -1;

      for (index = 0; index < g_iNumRescuePoints; index++) // KWo - 24.12.2006
      {
         iRescueIndex = g_rgiRescueWaypoints[index];
         distance = (paths[iRescueIndex]->origin - pEdict->v.origin).Length();

         if (distance < min_distance)
         {
            min_distance = distance;
            min_index = index;
         }
      }

      if (min_index != -1)
      {
         pBot->chosengoal_index = g_rgiRescueWaypoints[min_index]; // KWo - 27.02.2007
         if (pBot->chosengoal_index != pBot->curr_wpt_index) // KWo - 27.02.2007
            pBot->fTimeHostageRescue = 0.0;

//         ALERT(at_logged, "[DEBUG] BotFindGoal - Bot's %s has a hostage and chose a goal = %d, flags = %d.\n", pBot->name, pBot->chosengoal_index, paths[pBot->chosengoal_index]->flags);
         return (g_rgiRescueWaypoints[min_index]);
      }
   }

   iOffensive = (int) pBot->fAgressionLevel * 100;
   iDefensive = (int) pBot->fFearLevel * 100;

//   ALERT(at_logged, "[DEBUG] BotFindGoal - Bot's %s AgressionLevel = %f, FearLevel = %f.\n", pBot->name, pBot->fAgressionLevel, pBot->fFearLevel);

   if ((g_iMapType & MAP_AS) || (g_iMapType & MAP_CS))
   {
      if (pBot->bot_team == TEAM_CS_TERRORIST)
      {
         iDefensive += 30;
         iOffensive -= 30;
      }
      else // KWo - 27.06.2006
      {
         iDefensive -= 30;
         iOffensive += 30;
      }

   }

   if (g_iMapType & MAP_DE)
   {
      if (pBot->bot_team == TEAM_CS_COUNTER)
      {
         if (g_bBombPlanted)
         {
            if ((g_b_cv_chat) && (g_bBombSayString)) // KWo - 06.04.2006
            {
               BotPrepareChatMessage (pBot, szBombChat[RANDOM_LONG (0, iNumBombChats - 1)]);
               BotPushMessageQueue (pBot, MSG_CS_SAY);
               g_bBombSayString = FALSE;
            }
            int iTemp = BotChooseBombWaypoint (pBot); // KWo - 27.06.2006
            pBot->chosengoal_index = iTemp; // KWo - 27.06.2006
            return (iTemp); // KWo - 27.06.2006
         }

         iDefensive += 30;
         iOffensive -= 30;
      }
      else // KWo - 27.06.2006
      {
         iDefensive -= 30;
         iOffensive += 30;
      }
   }
/*
   iGoalDesire = RANDOM_LONG (0, 100) + iOffensive;
   iForwardDesire = RANDOM_LONG (0, 100) + iOffensive;
   iCampDesire = RANDOM_LONG (0, 100) + iDefensive;
   iBackoffDesire = RANDOM_LONG (0, 100) + iDefensive;
*/
   iGoalDesire = RANDOM_LONG (0, 70) + iOffensive;
   iForwardDesire = RANDOM_LONG (0, 50) + iOffensive;
   iCampDesire = RANDOM_LONG (0, 70) + iDefensive;
   iBackoffDesire = RANDOM_LONG (0, 50) + iDefensive;

   if (!BotHasSniperWeapon(pBot) && !BotHasRifleWeapon(pBot)) // KWo - 27.02.2007
      iCampDesire = 0;
   else if (BotHasSniperWeapon(pBot))
      iCampDesire = (int)(RANDOM_FLOAT(1.5,2.5) * (float)(iCampDesire));

//   ALERT(at_logged, "[DEBUG] BotFindGoal - Bot's %s GoalDesire = %d, ForwardDesire = %d, iCampDesire = %d, iBackoffDesire = %d.\n", pBot->name, iGoalDesire, iForwardDesire, iCampDesire, iBackoffDesire);

   iTacticChoice = iBackoffDesire;
   iTactic = 0;

   if (iCampDesire > iTacticChoice)
   {
      iTacticChoice = iCampDesire;
      iTactic = 1;
   }
   if (iForwardDesire > iTacticChoice)
   {
      iTacticChoice = iForwardDesire;
      iTactic = 2;
   }
   if (iGoalDesire > iTacticChoice)
   {
      iTacticChoice = iGoalDesire;
      iTactic = 3;
   }

tacticchosen:
   for (index = 0; index < 4; index++)
   {
      iGoalChoices[index] = -1;
      iGoalDistances[index] = 9999.0;
   }

   // Defensive Goal
   if (iTactic == 0)
   {
      for (index = 0; index < 4; index++)
      {
         iGoalChoices[index] = pDefensiveWPTS[RANDOM_LONG (0, iNumDefensives - 1)];
         assert ((iGoalChoices[index] >= 0) && (iGoalChoices[index] < g_iNumWaypoints));
      }
   }

   // Camp Waypoint Goal
   else if (iTactic == 1)
   {
      for (index = 0; index < 4; index++)
      {
         iGoalChoices[index] = g_rgiCampWaypoints[RANDOM_LONG (0, g_iNumCampPoints - 1)];
         assert ((iGoalChoices[index] >= 0) && (iGoalChoices[index] < g_iNumWaypoints));
      }
   }

   // Offensive Goal
   else if (iTactic == 2)
   {
      for (index = 0; index < 4; index++)
      {
         iGoalChoices[index] = pOffensiveWPTS[RANDOM_LONG (0, iNumOffensives - 1)];
         assert ((iGoalChoices[index] >= 0) && (iGoalChoices[index] < g_iNumWaypoints));
      }
   }

   // Map Goal Waypoint
   else if (iTactic == 3)
   {
      Vector vBotOrigin = pBot->pEdict->v.origin;  // KWo - 12.02.2006
      for (index = 0; index < g_iNumGoalPoints; index++)  // KWo - 12.02.2006
      {
         iClosestGoalIndex = g_rgiGoalWaypoints[index];
         if ((vBotOrigin - paths[iClosestGoalIndex]->origin).Length() < 600)  // KWo - 03.09.2006
         {
            if ((iClosestGoalIndex >= 0) && (iClosestGoalIndex < g_iNumWaypoints))
            {
               bGoalNearby = true;
               break;
            }
         }
      }

      for (index = 0; index < 4; index++)
      {
         iGoalChoices[index] = g_rgiGoalWaypoints[RANDOM_LONG (0, g_iNumGoalPoints - 1)];
         assert ((iGoalChoices[index] >= 0) && (iGoalChoices[index] < g_iNumWaypoints));
      }
   }

   if ((pBot->curr_wpt_index < 0) || (pBot->curr_wpt_index >= g_iNumWaypoints))
      BotChangeWptIndex (pBot, WaypointFindNearestToMove (pBot->pEdict->v.origin));

   if ((iTactic == 3) && (bGoalNearby) && (pBot->pEdict->v.weapons & (1 << CS_WEAPON_C4)))  // KWo - 12.02.2006
   {
      pBot->chosengoal_index = iClosestGoalIndex;  // KWo - 27.06.2006
      return (iClosestGoalIndex);
   }

   if (pBot->bot_personality == 1) // Psycho doesn't care about danger :)  KWo - 14.02.2006
   {
      iTestIndex = iGoalChoices[RANDOM_LONG (0, 3)];
      if ((iTestIndex >=0) && (iTestIndex < g_iNumWaypoints))
      {
         pBot->chosengoal_index = iTestIndex;  // KWo - 27.06.2006
//         ALERT(at_logged, "[DEBUG] BotFindGoal - Bot's %s chose goal = %d, flags = %d.\n", pBot->name, pBot->chosengoal_index, paths[pBot->chosengoal_index]->flags);
         return (iTestIndex);
      }
   }

   do
   {
      bSorting = FALSE;
      for (index = 0; index < 3; index++)
      {
         iTestIndex = iGoalChoices[index + 1];
         if (iTestIndex < 0)
            break;

         if (pBot->bot_team == TEAM_CS_TERRORIST)
         {
            if ((pBotExperienceData + (iBotIndex * g_iNumWaypoints) + iGoalChoices[index])->wTeam0Value
                < (pBotExperienceData + (iBotIndex * g_iNumWaypoints) + iTestIndex)->wTeam0Value)
            {
               iGoalChoices[index + 1] = iGoalChoices[index];
               iGoalChoices[index] = iTestIndex;
               bSorting = TRUE;
            }
         }
         else
         {
            if ((pBotExperienceData + (iBotIndex * g_iNumWaypoints) + iGoalChoices[index])->wTeam1Value
                < (pBotExperienceData + (iBotIndex * g_iNumWaypoints) + iTestIndex)->wTeam1Value)
            {
               iGoalChoices[index + 1] = iGoalChoices[index];
               iGoalChoices[index] = iTestIndex;
               bSorting = TRUE;
            }
         }

      }
   } while (bSorting);

   pBot->chosengoal_index = iGoalChoices[0]; // KWo - 27.06.2006
//   ALERT(at_logged, "[DEBUG] BotFindGoal - Bot's %s chose goal = %d, flags %d.\n", pBot->name, pBot->chosengoal_index, paths[pBot->chosengoal_index]->flags);
   return (iGoalChoices[0]);
}
After reading that - I can say so - I was focusing before on fixing problems with map goals, camps and rescue points, but now I can see there is still something to do with team specyfic waypoints. But any change here may really affect bots behavior (I mean even on standard maps).

As You can see the bots - according to their aggressivity/fear level and the map type - they "choose" some kind of tactic with choosing the goal they would to go. More aggressive go to map goals and offensive WPs, more scarried go to camp and deffensive WPs etc.

If I would remove team specyfic waypoints I would need to force You to put at least some camps, etc. Or I would remove to use the tactic for such maps at all which would affect so - they would always start to go in the same predictable direction.
Another thing against - there is a lot of such maps waypointed already with all these kind of waypoints - changing the work for them would break the backward compatibility. I really don't wan to test what may happen somewhere else in the code if I remove the necessity of placing waypoints they are needed for podbots since the beginning. I have a lot of other things to do, but I'm alone. But if You have time - You can read some my sticky at this forum how to comiple podbot mm under windows with mingw/cygwin - so You can mess around the code and let me know the results.
  
Reply With Quote
Re: Remove the requirement of CS specific waypoints
Old
  (#14)
Simon Logic
Member
 
Status: Offline
Posts: 24
Join Date: Aug 2006
Location: RF, Bryansk
Default Re: Remove the requirement of CS specific waypoints - 15-03-2007

Ok. I see it's defensive/offensive waypoints. They are suited for teamplay only. If CSDM is on they are not needed. When itemmode is on, then goals are items on the ground. When itemmode is off then i don't know what assume as goals.

Anyway there is much work to do. I'll take it ASAP (as usual).
  
Reply With Quote
Reply


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

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