.:: 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
Where to put it ???
Old
  (#1)
slash-evil
Guest
 
Status:
Posts: n/a
Default Where to put it ??? - 20-02-2004

//STEVE: instantly adjust aim if reticle near enemy target
if(pBot->STEVE_fire_pattern==1 && (pBot->pBotEnemy != NULL) &&pBot->iAimFlags & AIM_ENEMY)
{
pBot->vecEnemy= BotBodyTarget( pBot->pBotEnemy, pBot);

//old aiming algorithm
Vector vecDirection;
vecDirection = UTIL_VecToAngles(pBot->vecEnemy - GetGunPosition(pBot->pEdict));
vecDirection = vecDirection - pBot->pEdict->v.punchangle;
vecDirection.x = -vecDirection.x;

//new aiming algorithm
Vector vecDirection2;
float hypotenuse = (pBot->vecEnemy - GetGunPosition(pBot->pEdict)).Length();
float opposite = (pBot->vecEnemy.z - GetGunPosition(pBot->pEdict).z);
//arcsin (opposite / hypotenuse)
vecDirection2.x = (180/M_PI) * asin(opposite / hypotenuse);

opposite = (pBot->vecEnemy.y - GetGunPosition(pBot->pEdict).y);
float adjacent = (pBot->vecEnemy.x - GetGunPosition(pBot->pEdict).x);
//arctan (y/x)?
vecDirection2.y = (180/M_PI) * atan(opposite / adjacent);
//hypotenuse not used
// (pBot->vecEnemy - GetGunPosition(pBot->pEdict)).Length2D

float flDot = GetShootingConeDeviation(pBot->pEdict,&pBot->vecEnemy);
if(flDot > 0.90)
{
pBot->pEdict->v.ideal_yaw = vecDirection2.y;
pBot->pEdict->v.idealpitch = vecDirection2.x;
pEdict->v.v_angle.y = pEdict->v.ideal_yaw;
pEdict->v.v_angle.x = pEdict->v.idealpitch;
}
if (vecDirection2 != vecDirection)
SERVER_COMMAND("Old and new aiming algorith disagree!");
}

I found this code at the nuclearbox forum by steve++ , I wonder where I have to put it ?
  
Reply With Quote
Re: Where to put it ???
Old
  (#2)
slash-evil
Guest
 
Status:
Posts: n/a
Default Re: Where to put it ??? - 20-02-2004

I think I found one more bugs in my code , but I don't know which part of the code is the problem , so I explain it here : when I start a lan game , I have to wait about 20-30 seconds before I can add a bot , if I add a bot when I just get into the game , the game will crash
  
Reply With Quote
Re: Where to put it ???
Old
  (#3)
@$3.1415rin
Council Member, Author of JoeBOT
 
@$3.1415rin's Avatar
 
Status: Offline
Posts: 1,381
Join Date: Nov 2003
Location: Germany
Default Re: Where to put it ??? - 20-02-2004

you cannot search for bugs without understanding what the code actually does. so my advice is to read the sources carefully and then start debugging it. the other way around won't work


  
Reply With Quote
Re: Where to put it ???
Old
  (#4)
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: Where to put it ??? - 20-02-2004

@slash-evil: the 2nd bug you're talking about is a well-known bug in the HL engine. Creating a fakeclient (a bot) triggers the sending of a lot of network messages. If you attempt to create several of them during the same frame time, the engine will eventually hit its maximal buffer size for network messages about to be sent, and hence crash. It is safe to wait at least 0.5 second between each creation of a bot.



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
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