.:: 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
Hi I'm new and have some question !
Old
  (#1)
PBlover
Guest
 
Status:
Posts: n/a
Default Hi I'm new and have some question ! - 10-03-2004

Hi , I am new here ! I have some question , but before that , I introduced myself , I am a bot CODER , but I DON'T MAKE BOTS ! I just code ! I love PODbot , and I am develop it , I have some question , can u help me ? ???

1.)the bomb plant and defuse issues , I can't seem to fix it

2.)the new bot use the kicked bot's stats

3.)they always stuck on their teammate

4.)sometimes they jump 2 times at a wpt then they move to another and
jump 2 times there , so they just keep jumping in the round

5.)terrible aiming when eney was near !

*I found this code

Code:
//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 don't know how to mix it with the PODbot's aiming algo
*the original PODbot aiming algo

Code:
edict_t *pEdict = pBot->pEdict;
Vector vecDirection;
vecDirection = UTIL_VecToAngles(vecPos - GetGunPosition(pEdict));
vecDirection = vecDirection - pEdict->v.punchangle;
vecDirection.x = -vecDirection.x;
pEdict->v.ideal_yaw = vecDirection.y;
pEdict->v.idealpitch = vecDirection.x;
THANKS FOR ALL YOUR HELP ! I KNOW YOU ALL ARE ALL GOOOOOODD MAN , AND SORRY FOR MY BAD ENGLISH !
  
Reply With Quote
Re: Hi I'm new and have some question !
Old
  (#2)
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: Hi I'm new and have some question ! - 10-03-2004

Quote:
Originally Posted by PBlover
I am a bot CODER , but I DON'T MAKE BOTS ! I just code !
this I don't understand somehow...

Quote:
1.)the bomb plant and defuse issues , I can't seem to fix it
hint: there is a problem in BotThink(). The problem comes that Count Floyd did a quick and dirty fix to prevent the bots from jumping at freeze time, and this broke the task queue. The problem comes from an incorrect handling of the bBotMovement boolean variable. I won't tell you exactly where it is, it's up to you to find it.

Quote:
2.)the new bot use the kicked bot's stats
This can be solved by calling FREE_PRIVATE() on the bot's pvPrivateData each time a bot is created (in BotCreate(), just before the player() function is called. The correct code is: )
Code:
	  if (BotEnt->pvPrivateData != NULL)
		 FREE_PRIVATE (BotEnt);
	  BotEnt->pvPrivateData = NULL;
Quote:
3.)they always stuck on their teammate
There is no known fix for this but to find a more accurate msecval computation method.

Quote:
4.)sometimes they jump 2 times at a wpt then they move to another and jump 2 times there , so they just keep jumping in the round
I don't understand what you say ???

Quote:
5.)terrible aiming when eney was near !
Then improve it!

Quote:
*I found this code [snip PoXBot code]
*I don't know how to mix it with the PODbot's aiming algo [snip POD-bot code]
This is Steve++'s now defunct PoXBot code, I recognize it. It won't fit naturally in the POD-bot code because it uses new variables in the bot_t structure that have been added for PoXBot but are not present in POD-bot, simple as that.

Quote:
THANKS FOR ALL YOUR HELP ! I KNOW YOU ALL ARE ALL GOOOOOODD MAN , AND SORRY FOR MY BAD ENGLISH !
No problem, please don't use caps, it's like shouting. And there's no need to shout, is there ?



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: Hi I'm new and have some question !
Old
  (#3)
PBlover
Guest
 
Status:
Posts: n/a
Default Re: Hi I'm new and have some question ! - 10-03-2004

The queston 4 mean that they jump 2 two times at a waypoint , then they go to another waypoint and jump 2 times there , then they move to another waypoint and jump two times there ....... until the round end ...

And I am not a bot maker mean I only research the bot code!
  
Reply With Quote
Re: Hi I'm new and have some question !
Old
  (#4)
Terran
Member
 
Terran's Avatar
 
Status: Offline
Posts: 431
Join Date: Jan 2004
Default Re: Hi I'm new and have some question ! - 10-03-2004

Quote:
Originally Posted by Pierre-Marie Baty
This can be solved by calling FREE_PRIVATE() on the bot's pvPrivateData each time a bot is created (in BotCreate(), just before the player() function is called. The correct code is: )
Code:
  	  if (BotEnt->pvPrivateData != NULL)
  		 FREE_PRIVATE (BotEnt);
  	  BotEnt->pvPrivateData = NULL;
This seam not to work if the bot is compiled as metamod plugin (I've seen this code in the yapb source).

This happens also between different bots at the same server. I use joebot and yapbot at the same time and if I kick a bot of one kind and add a bot of the other kind the new bot inherites the old values...

I haven't looked very deep into the bots codes but the only reason for this could be that those values are stored outside the bots own data structures. And if the bots are compiled as metamod plugins something in conjunction with metamod prevents those external data structures from been cleared correctly...
  
Reply With Quote
Re: Hi I'm new and have some question !
Old
  (#5)
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: Hi I'm new and have some question ! - 10-03-2004

Yes, those values (player stats) belong to the player entities' private data ; and the HL engine does not free the player's private data for not needing to reallocate it later. It's normally up to the client, when he inheritates of this player structure, to tell the engine to zap all the contents of the private data, but since bots are not real clients, we have to empty this private data somehow. Calling FREE_PRIVATE() will force the engine to reallocate a new block of data, and to zero it out. Actually the point is not to make it free or release this data, the point is to tell it to zero it out.

I have never seen this code fail on every bot where I put it to work, be it metamod or not.



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: Hi I'm new and have some question !
Old
  (#6)
Terran
Member
 
Terran's Avatar
 
Status: Offline
Posts: 431
Join Date: Jan 2004
Default Re: Hi I'm new and have some question ! - 10-03-2004

Than this is really strange.
I added this lines to joebot's source code too but the bots still inherit the old data...
  
Reply With Quote
Re: Hi I'm new and have some question !
Old
  (#7)
koraX
Member
 
koraX's Avatar
 
Status: Offline
Posts: 145
Join Date: Jan 2004
Location: Slovak Republic
Default Re: Hi I'm new and have some question ! - 10-03-2004

Quote:
Originally Posted by PBlover
Hi , I am new here ! I have some question , but before that , I introduced myself , I am a bot CODER , but I DON'T MAKE BOTS ! I just code ! I love PODbot , and I am develop it , I have some question , can u help me ? ???

.
.
.

THANKS FOR ALL YOUR HELP ! I KNOW YOU ALL ARE ALL GOOOOOODD MAN , AND SORRY FOR MY BAD ENGLISH !
He reminds me someone ....... maybe 3COLORS ?


kXBot
koraX's utils
- see my homepage for other projects (OpenGL CSG Editor, FAT16 Sim, NNetwork Sim, ...)
  
Reply With Quote
Re: Hi I'm new and have some question !
Old
  (#8)
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: Hi I'm new and have some question ! - 10-03-2004

I don't think so... remember (3)COLORS wasn't even able to understand a single line of C code ; and the snippets of code PBlover has posted are all very relevant to his problem(s).

@Terran: post the changes you made to JoeBot's source code (accompanied by a dozen lines above and below as a context...)



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: Hi I'm new and have some question !
Old
  (#9)
Terran
Member
 
Terran's Avatar
 
Status: Offline
Posts: 431
Join Date: Jan 2004
Default Re: Hi I'm new and have some question ! - 10-03-2004

I did nothing special just added the lines you mentioned above...

bot.cpp:
Code:
 				if (IS_DEDICATED_SERVER())
 					    printf("JoeBOT : Creating bot...\n");
 				else if (pPlayer)
 					    ClientPrint( VARS(pPlayer), HUD_PRINTNOTIFY, "JoeBOT : Creating bot...\n");
 
 				//FREE_PRIVATE(BotEnt);
 				//BotEnt->pvPrivateData = 0;
 
 +			   if (BotEnt->pvPrivateData != NULL)
 +					   FREE_PRIVATE (BotEnt);
 +			   BotEnt->pvPrivateData = NULL;
 
 			    // create the player entity by calling MOD's player function
 			    // (from LINK_ENTITY_TO_CLASS for player object)
 
 			    // CALL_GAME_ENTITY (PLID, "player", VARS(BotEnt));
 				player( VARS(BotEnt) );
 
 			    infobuffer = GET_INFOBUFFER( BotEnt );
 				clientIndex = ENTINDEX( BotEnt );
  
Reply With Quote
Re: Hi I'm new and have some question !
Old
  (#10)
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: Hi I'm new and have some question ! - 10-03-2004

This is not for metamod, right ? The code you posted can't work properly as a metamod plugin. You need to use the CALL_GAME_ENTITY() macro instead of the player() class function.



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