.:: 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
bots stuck ?
Old
  (#1)
Whistler
Summoner
 
Whistler's Avatar
 
Status: Offline
Posts: 1,499
Join Date: Feb 2004
Location: Mist Village
Default bots stuck ? - 31-03-2004

Why does the two bots just get stuck INTO each other sometimes ?

I know the problem may be because the msec calculation, but Tobias' method is l33t enough I think... (my computer is an old Celeron 466MHz with 64MB RAM, but Tobias' method should work well)

And also I'm running the bot in Metamod so the GetBlendingInterface shouldn't be a problem

Code:
    static float msecdel = 0;
    static float msecnum = 0;
 
    if (msecdel + msecnum / 1000 < gpGlobals->time - 0.5 ||
 	  msecdel > gpGlobals->time)
    {
 	  msecdel = gpGlobals->time - 0.05;
 	  msecnum = 0;
    }
 
    g_iMsecval = (gpGlobals->time - msecdel) * 1000 - msecnum; // optimal msec value since start of 1 sec period
    msecnum = (gpGlobals->time - msecdel) * 1000; // value we have to add to reach optimum
 
    // do we have to start a new 1 sec period?
    if (msecnum > 1000)
    {
 	  msecdel += msecnum / 1000;
 	  msecnum = 0;
    }
 
    if (g_iMsecval < 5)
 	  g_iMsecval = 5; // don't allow the msec delay to be too low
    else if (g_iMsecval > 255)
 	  g_iMsecval = 255; // don't allow it to last longer than 255 milliseconds either
  
Reply With Quote
Re: bots stuck ?
Old
  (#2)
botman
Super Moderator
 
Status: Offline
Posts: 280
Join Date: Jan 2004
Location: Plano, TX
Default Re: bots stuck ? - 31-03-2004

They get stuck because their collision bounding boxes intersect each other. The same kind of stuck condition will occur if you create a map and place a player spawn point too close to world geometry.

In order to keep guys from getting stuck, you should try to make them not get near each other. When the msec value passed into pfnRunPlayerMove() is wrong, bots will move further than they should during the next frame interval. If two bots are moving directly towards each other and they both move so far that their bounding boxes intersect each other, they will become stuck together like Siamese Twins.

I have always suspected that temporarily putting one of the bots in "noclip" mode would allow you to easily get them unstuck, but I haven't actually tried this myself.

botman
  
Reply With Quote
Re: bots stuck ?
Old
  (#3)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: bots stuck ? - 01-04-2004

The noclip cheat works well, I already tried something like this, but the problem is that with it your bot won't collide with the world either. Thus for example if your bots get stuck together while climbing a slope, putting one into noclip mode and making it move away may bury the bot into the ground rather than doing anything useful...



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
  
Reply With Quote
Re: bots stuck ?
Old
  (#4)
botman
Super Moderator
 
Status: Offline
Posts: 280
Join Date: Jan 2004
Location: Plano, TX
Default Re: bots stuck ? - 01-04-2004

Yes, you would need to do some UTIL_TraceHull() calls in the direction that you plan to "unstuck" the bot in before moving it that way to make sure there is room to move the bot.

You should be able to determine which of the two bots has the most empty space around it (by tracing several hulls in different directions) and picking that bot as the one to put in "noclip" mode. Then move it away from the other one (moving it upwards slightly to keep it from intersecting the ground) and putting it back into normal "non-noclip" mode.

botman
  
Reply With Quote
Reply


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

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