.:: 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 > SDK Programming discussions > Half-Life 2 SDK
Half-Life 2 SDK For developments focused around the Half-Life 2 engine Half-Life 2

Reply
 
Thread Tools
Re: Yay - Bots move to given vector location...
Old
  (#11)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Re: Yay - Bots move to given vector location... - 06-01-2005

it would not suprise me if it did not work for bots...


Author of RealBot, "Arrakis" and "Dune 2 - The Maker" | co-Founder of Bots-United | Fundynamic | Blog | E-Mail me
  
Reply With Quote
Re: Yay - Bots move to given vector location...
Old
  (#12)
Cheeseh
[rcbot]
 
Cheeseh's Avatar
 
Status: Offline
Posts: 361
Join Date: Dec 2003
Location: China
Default Re: Yay - Bots move to given vector location... - 06-01-2005

actually I just tried it with the bots, they got the origin ok, maybe you do need to "GetIServerEntity()" because i was still using that : *changes code on post*
  
Reply With Quote
Re: Yay - Bots move to given vector location...
Old
  (#13)
botman
Super Moderator
 
Status: Offline
Posts: 280
Join Date: Jan 2004
Location: Plano, TX
Default Re: Yay - Bots move to given vector location... - 07-01-2005

I think when the bots spawn, they rotate to face the direction (YAW) of the spawnpoint, then they stay facing that way for the rest of the game.

Try creating your own little CS map with T and CT spawn points that face 0 and 180 degrees and I bet the bots that spawn there will be facing each other (or facing away from each other, whatever).

botman
  
Reply With Quote
Re: Yay - Bots move to given vector location...
Old
  (#14)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Re: Yay - Bots move to given vector location... - 07-01-2005

botman, that would not suprise me, as the spawn points always have had control about the view angles (in Hl1 aswell). Though this was not 'default' in HL1 with fake clients if i remember correctly


Author of RealBot, "Arrakis" and "Dune 2 - The Maker" | co-Founder of Bots-United | Fundynamic | Blog | E-Mail me
  
Reply With Quote
Re: Yay - Bots move to given vector location...
Old
  (#15)
Gun-Nut
Member
 
Status: Offline
Posts: 9
Join Date: Dec 2004
Default Re: Yay - Bots move to given vector location... - 08-01-2005

got anymore good news?
  
Reply With Quote
Re: Yay - Bots move to given vector location...
Old
  (#16)
botman
Super Moderator
 
Status: Offline
Posts: 280
Join Date: Jan 2004
Location: Plano, TX
Default Re: Yay - Bots move to given vector location... - 08-01-2005

I'm sure when something changes, someone will post news. No news means nothing has changed.

botman
  
Reply With Quote
Re: Yay - Bots move to given vector location...
Old
  (#17)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Re: Yay - Bots move to given vector location... - 09-01-2005

something changes
http://johannes.lampel.net/pics/shit/de_cbble0005.jpg

SteveC delivered some very helpfull stuff; though its not the neatest way to do it

EDIT:
BUT there is no neater to way to do it as well!


Author of RealBot, "Arrakis" and "Dune 2 - The Maker" | co-Founder of Bots-United | Fundynamic | Blog | E-Mail me
  
Reply With Quote
Re: Yay - Bots move to given vector location...
Old
  (#18)
Cheeseh
[rcbot]
 
Cheeseh's Avatar
 
Status: Offline
Posts: 361
Join Date: Dec 2003
Location: China
Default Re: Yay - Bots move to given vector location... - 10-01-2005

** Total Edit **

Alright, well I managed to get SteveC's CBaseEntity trick to work with my bots and got my bots to follow me whilst they look in the same direction (they don't look at me to follow me).

I have an example movie of a bot doing this here:

http://rcbot.bots-united.com/downloa...er/botmove.zip

The movement is actually the same as HL1 but the QAngles were between 0 and 360 instead of -180 and 180, which was confusing me.

PHP Code:
void CBot :: doMove ()
{
    
// Temporary measure to make bot follow me when i make listen serevr
    
setMoveTo(CBotGlobals::entityOrigin(INDEXENT(1)));

    if ( 
moveToIsValid () )
    {
        
float flMove 0.0;
        
float flSide 0.0;

        
m_fIdealMoveSpeed 320;

        
// fAngle is got from world realting to bots origin, not angles
        
float fAngle CBotGlobals::yawAngleFromEdict(m_pEdict,m_vMoveTo);
        
// fl Move is percentage (0 to 1) of forward speed,
        // flSide is percentage (0 to 1) of side speed.
        
        
float radians fAngle 3.141592f 180.0f// degrees to radians
        
flMove cos(radians);
        
flSide sin(radians);

        
m_fForwardSpeed m_fIdealMoveSpeed flMove;

        
// dont want this to override strafe speed if we're trying 
        // to strafe to avoid a wall for instance.
        
if ( m_fStrafeTime engine->Time() )
        {
            
// side speed 
            
m_fSideSpeed m_fIdealMoveSpeed flSide;
        }

        
// moving less than 1.0 units/sec? just stop to 
        // save bot jerking around..
        
if ( fabs(m_fForwardSpeed) < 1.0 )
            
m_fForwardSpeed 0.0;
        if ( 
fabs(m_fSideSpeed) < 1.0 )
            
m_fSideSpeed 0.0;
    }
    else
    {    
        
m_fForwardSpeed 0;
        
// bots side move speed
        
m_fSideSpeed 0;
        
// bots upward move speed (e.g in water)
        
m_fUpSpeed 0;
    }

To get the angle, here is the code i used:

PHP Code:
float CBotGlobals :: yawAngleFromEdict (edict_t *pEntity,Vector vOrigin)
{
    
float fAngle;
    
QAngle qBotAngles entityEyeAngles(pEntity);
    
QAngle qAngles;
    
Vector vAngles;

    
vAngles vOrigin entityOrigin(pEntity);

    
// Just get the angles from world
    
VectorAngles(vAngles,qAngles);
    
    
// NEED to put 0-360 angles from -180 to 180 to get negative and positive values
    
fixFloatAngle(&qBotAngles.y);
    
//fAngle = qAngles.y; // world angles
    
fAngle qBotAngles.qAngles.y;

    
fixFloatAngle(&fAngle);

    return 
fAngle;

you NEED CBaseEntity to get eye angles
PHP Code:
QAngle CBotGlobals :: entityEyeAngles edict_t *pEntity )
{
    
CBaseEntity *pBaseEntity CBaseEntity::Instance(pEntity);

    return 
pBaseEntity->EyeAngles();


Last edited by Cheeseh; 11-01-2005 at 00:43..
  
Reply With Quote
Re: Yay - Bots move to given vector location...
Old
  (#19)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Re: Yay - Bots move to given vector location... - 11-01-2005

yes, i got this working too, you can see it in the ubframework alpha template.

currently my css bots walk around de_cbble using waypoints! yay.


Author of RealBot, "Arrakis" and "Dune 2 - The Maker" | co-Founder of Bots-United | Fundynamic | Blog | E-Mail me
  
Reply With Quote
Re: Yay - Bots move to given vector location...
Old
  (#20)
Cheeseh
[rcbot]
 
Cheeseh's Avatar
 
Status: Offline
Posts: 361
Join Date: Dec 2003
Location: China
Default Re: Yay - Bots move to given vector location... - 11-01-2005

crap well when I try it again while changing the viewangles they move all over the place, I think there might be something else to do with the getting the right angle from either world or player forward vector, I'm still a bit unsure
  
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