.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   General Bot Coding (http://forums.bots-united.com/forumdisplay.php?f=24)
-   -   Hi I'm new and have some question ! (http://forums.bots-united.com/showthread.php?t=1047)

PBlover 10-03-2004 07:48

Hi I'm new and have some question !
 
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 !

Pierre-Marie Baty 10-03-2004 11:55

Re: Hi I'm new and have some question !
 
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! :D

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 ?

PBlover 10-03-2004 12:37

Re: Hi I'm new and have some question !
 
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!

Terran 10-03-2004 14:31

Re: Hi I'm new and have some question !
 
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...

Pierre-Marie Baty 10-03-2004 15:18

Re: Hi I'm new and have some question !
 
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.

Terran 10-03-2004 17:54

Re: Hi I'm new and have some question !
 
Than this is really strange.
I added this lines to joebot's source code too but the bots still inherit the old data...

koraX 10-03-2004 17:59

Re: Hi I'm new and have some question !
 
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 ? :D

Pierre-Marie Baty 10-03-2004 20:23

Re: Hi I'm new and have some question !
 
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...)

Terran 10-03-2004 22:09

Re: Hi I'm new and have some question !
 
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 );


Pierre-Marie Baty 10-03-2004 22:32

Re: Hi I'm new and have some question !
 
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.


All times are GMT +2. The time now is 22:51.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.