.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   Bug Reports (http://forums.bots-united.com/forumdisplay.php?f=49)
-   -   Podbots cannot shoot breakables (http://forums.bots-united.com/showthread.php?t=2230)

sPlOrYgOn 07-07-2004 05:55

Podbots cannot shoot breakables
 
well here's one problem I can't solve since I barely know any math...
and here's the reason....
http://www.mapzap.org/images/SearchB...eTraceline.png
This image shows the 2 tracelines sent to try and search for the breakable..
as you can see.. they are going the wrong direction..
here's the code..
Code:

bool BotFindBreakable (bot_t *pBot)
{
  // Checks if Bot is blocked by a Shootable Breakable in his moving direction

  TraceResult tr;
  edict_t *pEdict = pBot->pEdict;

  Vector v_src = pEdict->v.origin;
  Vector vecDirection = (pBot->pShootBreakable->v.origin - v_src).Normalize ();
  Vector v_dest = v_src + vecDirection * 50;

  TRACE_LINE (v_src, v_dest, dont_ignore_monsters, pEdict, &tr);
  if ((tr.flFraction != 1.0)
      && (FStrEq ("func_breakable", STRING (tr.pHit->v.classname))
      || FStrEq ("func_pushable", STRING (tr.pHit->v.classname)))
      && IsShootableBreakable (tr.pHit))
  {
      pBot->vecBreakable = tr.vecEndPos;
      return (TRUE);
  }

  v_src = GetGunPosition (pEdict);
  vecDirection = (pBot->pShootBreakable->v.origin - v_src).Normalize ();
  v_dest = v_src + vecDirection * 50;

  TRACE_LINE (v_src, v_dest, dont_ignore_monsters, pEdict, &tr);
  if ((tr.flFraction != 1.0)
      && (FStrEq ("func_breakable", STRING (tr.pHit->v.classname))
      || FStrEq ("func_pushable", STRING (tr.pHit->v.classname)))
      && IsShootableBreakable (tr.pHit))
  {
      pBot->vecBreakable = tr.vecEndPos;
      return (TRUE);
  }

  pBot->pShootBreakable = NULL;
  pBot->vecBreakable = g_vecZero;
  return (FALSE);
}

All we need is a math wiz that knows how to figure out what direction a point is from another point...
anyone know how?
[edit]
Me are reading pages that teach this stuff :D
[/edit]

sPlOrYgOn 09-07-2004 02:53

Re: Podbots cannot shoot breakables
 
YAYA!
It's fixed :D!
here's the new code:
Code:

bool BotFindBreakable (bot_t *pBot)
{
  // Checks if Bot is blocked by a Shootable Breakable in his moving direction

  TraceResult tr;
  edict_t *pEdict = pBot->pEdict;

  Vector v_src = pEdict->v.origin;
  Vector vecDirection = (VecBModelOrigin (pBot->pShootBreakable) - v_src).Normalize ();
  Vector v_dest = v_src + vecDirection * 50;

  TRACE_LINE (v_src, v_dest, dont_ignore_monsters, pEdict, &tr);
  if ((tr.flFraction != 1.0)
      && (FStrEq ("func_breakable", STRING (tr.pHit->v.classname))
      || FStrEq ("func_pushable", STRING (tr.pHit->v.classname)))
      && IsShootableBreakable (tr.pHit))
  {
      pBot->vecBreakable = tr.vecEndPos;
      return (TRUE);
  }

  v_src = GetGunPosition (pEdict);
  vecDirection = (VecBModelOrigin (pBot->pShootBreakable) - v_src).Normalize ();
  v_dest = v_src + vecDirection * 50;

  TRACE_LINE (v_src, v_dest, dont_ignore_monsters, pEdict, &tr);
  if ((tr.flFraction != 1.0)
      && (FStrEq ("func_breakable", STRING (tr.pHit->v.classname))
      || FStrEq ("func_pushable", STRING (tr.pHit->v.classname)))
      && IsShootableBreakable (tr.pHit))
  {
      pBot->vecBreakable = tr.vecEndPos;
      return (TRUE);
  }

  pBot->pShootBreakable = NULL;
  pBot->vecBreakable = g_vecZero;
  return (FALSE);
}

I changed it from pShootBreakable->v.origin to VecBModelOrigin (pBot->pShootBreakable)
I don't know why v.origin is g_vecZero though.. seems strange..

[edit]
new dll can be found here http://www.mapzap.org/files/podbot/podbotBETA.zip
[/edit]

>BKA< T Wrecks 09-07-2004 10:57

Re: Podbots cannot shoot breakables
 
That's odd... I've never seen bots that got stuck in breakables (unless there were multiple breakables and the bot shot only one of them to pieces). Sometimes it took them some time to shoot it, but in the end it always worked. Well, let's see how the new dll performs...

KWo 09-07-2004 11:47

Re: Podbots cannot shoot breakables
 
Quote:

Originally Posted by >BKA< T Wrecks
That's odd... I've never seen bots that got stuck in breakables (unless there were multiple breakables and the bot shot only one of them to pieces). Sometimes it took them some time to shoot it, but in the end it always worked. Well, let's see how the new dll performs...

Try older beta and cs_house. There is a spawn point for T under ground. This point is exactly in the some breakable box. The same for cs_castle. Two breakable objects and one was no problem for bots , this second (some wood's obstacle under ground) was a problem. Now it's solved. :D


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

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