.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   Ideas (http://forums.bots-united.com/forumdisplay.php?f=50)
-   -   Remove the requirement of CS specific waypoints (http://forums.bots-united.com/showthread.php?t=6164)

Simon Logic 09-03-2007 09:20

Remove the requirement of CS specific waypoints
 
Under CSDM there is no CS goals. So, for maps specially designed for DM style game why should i insert CS-specific waypoints? Hope, it's possible & easy to implement. Also an absence of CS-specific waypoints means that bots should use DM-tactics.

I waypointed a Crossfire map. Looks too stupid when bots pass through their team specific waypoints because i know that they MUST pass through that point soon & there is no any trick.

KWo 09-03-2007 09:55

Re: Remove the requirement of CS specific waypoints
 
The bot needs some "goals", otherwise it doesn't know where to go. The bots aren't aware they are playing DM (because there is few DM mods like CSDM, tDM etc) - how the bot should know he is playing DM? To control that I should have the additional cvar. But while waypointing the map - how to know the map will be usable only for DM?

Simon Logic 09-03-2007 13:44

Re: Remove the requirement of CS specific waypoints
 
Quote:

Originally Posted by KWo (Post 54433)
how the bot should know he is playing DM?

a) pb_ffa 1
b) using dll.cpp::Spawn().g_iMapType

Quote:

Originally Posted by KWo (Post 54433)
But while waypointing the map - how to know the map will be usable only for DM?

That map does not have CS goal entities: func_vip_safetyzone, info_vip_safetyzone, hostage_entity, func_bomb_target & info_bomb_target.

KWo 09-03-2007 15:34

Re: Remove the requirement of CS specific waypoints
 
pb_ffa is for free for all mode. It used if DM with FFA is on, but is not used if DM is without FFA.

Simon Logic 09-03-2007 17:23

Re: Remove the requirement of CS specific waypoints
 
So, is it possible to detect map type by method b)? FY_ maps are DM also, right?

KWo 10-03-2007 19:01

Re: Remove the requirement of CS specific waypoints
 
It would need to change the whole bots navigation (to let them know where they should go on such maps). If I would remove the necessity to place these waypoints (goals nad team specyfic), I would need to put some code to let them know where they should go then. It's how pb mm navigation system works.
I don't think it's a realy big problem for You to put some goal and important waypoints to let them know where do You wish they should go.

Ancient 10-03-2007 20:11

Re: Remove the requirement of CS specific waypoints
 
I thought the goals have the same attributes and stuff for bomb areas and hostages.

Simon Logic 12-03-2007 13:03

Re: Remove the requirement of CS specific waypoints
 
That would lead that bots will run strictly through those waypoinst in predictable manner. Right? And for DM-style map i should place at the same place two team-specific waypoints (for both sides respectively)?

KWo 12-03-2007 16:39

Re: Remove the requirement of CS specific waypoints
 
Quote:

Originally Posted by Simon Logic (Post 54477)
That would lead that bots will run strictly through those waypoinst in predictable manner. Right?

Have You seen the bots "running in predictable manner" on other maps? The navigation code works the same way on all maps type. Once the bot starts to see an enemy - it is starting to move in "uw-waypointed" movement. But after the round's start the bot needs something to let him go at the beginning in some direction.

Quote:

Originally Posted by Simon Logic (Post 54477)
And for DM-style map i should place at the same place two team-specific waypoints (for both sides respectively)?

No. On small maps I'm just doing it so - I'm placing one goal and one team specyfic waypoints at the opposite team spawn area. That just forces them to meet somewhere. And if the map is a bit bigger - I'm placing these waypoints in some areas I want they visit. That's all.
Note:
Camp waypoints are also some kind of "goal" waypoints for deffensive style playing bots.

Simon Logic 13-03-2007 08:59

Re: Remove the requirement of CS specific waypoints
 
I'm talking about DM maps only & searching for method of its best waypointing. Your arguments are valid for CS maps only. Well, if it's hard to implement then i retire.

KWo 13-03-2007 09:50

Re: Remove the requirement of CS specific waypoints
 
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.

Simon Logic 13-03-2007 12:22

Re: Remove the requirement of CS specific waypoints
 
ok. Is it possible to remove team specific waypoint requirement then? Or they are also part of basic navigation?

KWo 13-03-2007 14:26

Re: Remove the requirement of CS specific waypoints
 
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. :)

Simon Logic 15-03-2007 10:52

Re: Remove the requirement of CS specific waypoints
 
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).


All times are GMT +2. The time now is 22:44.

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