.:: 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 ::. > Developer's Farm > General Bot Coding
General Bot Coding See what a pain it is to get those little mechs shooting around

Reply
 
Thread Tools
Suicidal tendencies of the Botmanīs BOT#1o
Old
  (#1)
MIFUNE
Member
 
Status: Offline
Posts: 13
Join Date: Mar 2014
Warning Suicidal tendencies of the Botmanīs BOT#1o - 23-03-2014

Hi. First of all I know that this BOT is almost 10 years old, but it works perfectly for my MOD...

http://www.moddb.com/mods/zion-warcry

...except for the fact that they have a serious and stupid suicidal tendencies. I have tried to use the code in the BOTīs source which is used to find walls, but with no luck.

Code:
BOOL CBot::BotChecFloor( void )
{
   Vector v_src, v_up;
   TraceResult tr;

   UTIL_MakeVectors( pev->v_angle );

   // do a trace down...

   v_src = pev->origin;
   v_left = v_src + gpGlobals->v_up * -40;  // 40 units down

   UTIL_TraceLine( v_src, v_left, dont_ignore_monsters, ENT(pev), &tr);

   // check if the trace hit something...
   if (tr.flFraction < 1.0)
   {
      if (f_wall_down = 1)
         f_wall_down = gpGlobals->time;

      return TRUE;
   }

   return FALSE;
}
Itīs the best approach I have found. In the first version BOTs get stuck (2007 version), and now (2014) I have made them walk on the bridges, buuuuuuut... even if they aparently check that thereīs no floor beneath them (they stop and start walking in other direction), they finally return to the void and fall to death.

What should I do?. Any help will be added to the credits.

Thanks in anticipation.
  
Reply With Quote
Re: Suicidal tendencies of the Botmanīs BOT#1o
Old
  (#2)
Cheeseh
[rcbot]
 
Cheeseh's Avatar
 
Status: Offline
Posts: 361
Join Date: Dec 2003
Location: China
Default Re: Suicidal tendencies of the Botmanīs BOT#1o - 26-03-2014

Quote:
Originally Posted by MIFUNE View Post
Hi. First of all I know that this BOT is almost 10 years old, but it works perfectly for my MOD...

http://www.moddb.com/mods/zion-warcry

...except for the fact that they have a serious and stupid suicidal tendencies. I have tried to use the code in the BOTīs source which is used to find walls, but with no luck.

Code:
BOOL CBot::BotChecFloor( void )
{
   Vector v_src, v_up;
   TraceResult tr;

   UTIL_MakeVectors( pev->v_angle );

   // do a trace down...

   v_src = pev->origin;
   v_left = v_src + gpGlobals->v_up * -40;  // 40 units down

   UTIL_TraceLine( v_src, v_left, dont_ignore_monsters, ENT(pev), &tr);

   // check if the trace hit something...
   if (tr.flFraction < 1.0)
   {
      if (f_wall_down = 1)
         f_wall_down = gpGlobals->time;

      return TRUE;
   }

   return FALSE;
}
Itīs the best approach I have found. In the first version BOTs get stuck (2007 version), and now (2014) I have made them walk on the bridges, buuuuuuut... even if they aparently check that thereīs no floor beneath them (they stop and start walking in other direction), they finally return to the void and fall to death.

What should I do?. Any help will be added to the credits.

Thanks in anticipation.
Are you using waypoints? You shouldn't need this is you have waypoints.
This code is either for waypointless navigation or for another reason.

What is done after and before this function is called? How does a bot know when to stop or move forward?

Better waypointless navigation can be foound in RACC bot source or try old RCBot1 source for ideas.
  
Reply With Quote
Re: Suicidal tendencies of the Botmanīs BOT#1o
Old
  (#3)
MIFUNE
Member
 
Status: Offline
Posts: 13
Join Date: Mar 2014
Default Re: Suicidal tendencies of the Botmanīs BOT#1o - 26-03-2014

Hi!. No, I donīt use waypoints. Bot#10 uses a navigation system without nodes or waypoints. This function is called inside BotThink function, where itīs used to check if thereīs a wall or, in this case, floor with which interact.

In theory, the bot stops its movement if it find a wall in a certain degree based on its line of sight. For the floor, as you can see, Iīm quite lost.

Aniway, would it be a better approach to make it avoid a dangerous func_x like a trigger_hurt?, I am now studying how to code it (Iīm totally noob at this ), but any help will be much appreciated

Thanks for replying!!
  
Reply With Quote
Re: Suicidal tendencies of the Botmanīs BOT#1o
Old
  (#4)
Cheeseh
[rcbot]
 
Cheeseh's Avatar
 
Status: Offline
Posts: 361
Join Date: Dec 2003
Location: China
Default Re: Suicidal tendencies of the Botmanīs BOT#1o - 01-04-2014

as far as I'm aware botman never implemented any non-waypoint navigation code except for very basic waypointless navigation, unless I'm mistaken.

What PMB and I did for RACC bot and RCBot respectively was to take several tracelines across the bots field of view and choose to go down the path which had the longest distance to any wall. It's a basic technique used in carpet cleaning bots and in webots for example.

From my own understanding, this function that you've shown, doesn't do anything useful for bots to avoid falling.

Imagine this scenario
BotChecFloor() = true : okay move forward
BotChecFloor() = true : okay move forward
BotChecFloor() = true : okay move forward
BotChecFloor() = true : okay move forward
(bot has already fallen off floor now)
BotChecFloor() = false: okay turn or stop
(bot is falling and can't turn or stop)
(bot dies)

as you can see BotChecFloor will return true even if the bot is eventually going to fall, so it's not a useful function for this. you need to check the floor in front of the bot not directly below the bot.

example
Code:
BOOL CBot::BotChecFloor( void )
{
   Vector v_src, v_fwd;
   TraceResult tr;

   v_src = pev->origin;
   v_fwd = pev->velocity;

   v_fwd.z = v_fwd.z - 50.0f;

   UTIL_TraceLine( v_src, v_fwd, dont_ignore_monsters, ENT(pev), &tr);

   // check if the trace hit something...
   if (tr.flFraction < 1.0)
   {
      if (f_wall_down = 1)
         f_wall_down = gpGlobals->time;

      return TRUE;
   }

   return FALSE;
}
this code will do this:

Code:
  O -.
 /|\   `.
  /\      `.______
the previous code did this

Code:
  O 
 /|\   
  /\      
   .
   .
   .
____
  
Reply With Quote
Re: Suicidal tendencies of the Botmanīs BOT#1o
Old
  (#5)
MIFUNE
Member
 
Status: Offline
Posts: 13
Join Date: Mar 2014
Default Re: Suicidal tendencies of the Botmanīs BOT#1o - 02-04-2014

OMG!, I repeat that I was quite lost in coding, 7 years are much for an already noob to left C++ books on a shelf...
Trying to avoid my bots from killing themselves I created a better way to make them die...

Iīl l put your function on my code, and put here the results!!

If it works, man, youīll be on the v2.0 credits!!

EDIT: Tested... unfortunately, they still throw themselves to the void.. Iīll keep trying poking a bit with your code !!

Last edited by MIFUNE; 02-04-2014 at 00:55..
  
Reply With Quote
Re: Suicidal tendencies of the Botmanīs BOT#1o
Old
  (#6)
Cheeseh
[rcbot]
 
Cheeseh's Avatar
 
Status: Offline
Posts: 361
Join Date: Dec 2003
Location: China
Default Re: Suicidal tendencies of the Botmanīs BOT#1o - 02-04-2014

Sorry there's a bug in the code


Try

Code:
BOOL CBot::BotChecFloor( void )
{
   Vector v_src, v_fwd;
   TraceResult tr;

   v_src = pev->origin;
   v_fwd = pev->velocity;

   v_fwd.z = v_fwd.z - 50.0f;

   UTIL_TraceLine( v_src, v_src + v_fwd, dont_ignore_monsters, ENT(pev), &tr);

   // check if the trace hit something...
   if (tr.flFraction < 1.0)
   {
      if (f_wall_down = 1)
         f_wall_down = gpGlobals->time;

      return TRUE;
   }

   return FALSE;
}
Note it should be v_src + v_fwd in UTIL_TraceLine

Ps:You'll need to show me the decision the bot takes after you call this function

Last edited by Cheeseh; 02-04-2014 at 04:16.. Reason: Bug in code spotted!
  
Reply With Quote
Re: Suicidal tendencies of the Botmanīs BOT#1o
Old
  (#7)
MIFUNE
Member
 
Status: Offline
Posts: 13
Join Date: Mar 2014
Thumbs up Re: Suicidal tendencies of the Botmanīs BOT#1o - 03-04-2014

Ok!, I have tested and tested yesterday and I finished thinking that I was an absolute moron for not making it work...

The actions that the Bot will do after this function is called are:

1st. Turn (randomly) 45-60 degrees (randomly) to its right or left side
2nd. Pause 1 second
3rd. Start walking again.

If it is engaged in combat it wonīt walk, unless its armor or health (engine) is low, so it will search for a func_reloader (wall mounted health charger. In my mod Iīve gave it a model and some other capabilities). You can see it under the central tower (so I want the bots wonīt fall to the void when they start walking towards the reloaders from the external circle of the dock).



Actually Iīm starting from scratch using the old source (bot.cpp and bot_combat.cpp ) all (c) Botman, modified to fit ZWC, because for one reason I cannot understand, the bots make the game crash again (I have probably touched something relative to one pointer or similar )

Also Iīm curious on how to make the Bot search team mates and make groups of three, but this is, by now, something impossible to me , Iīm now studying HPBpt source and also PODBot source to see how I should do it.

Thanks again, Iīll post the testing results as soon as I re-compile the zwc source
  
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