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

PBlover 11-03-2004 08:28

Re: Hi I'm new and have some question !
 
(3)COLORS ??? He is simply the best cs players in the online cs server , almost many people know !

Pierre-Marie Baty 11-03-2004 09:42

Re: Hi I'm new and have some question !
 
...and also the worst bot coding/vaporware llama to have ever walked this forum (Marconi pathfinder anyone? :D). (3)COLORS is/was just a clueless kid seeking attention. Revendicating any connection to this n00b is not a smart thing to do here, if you don't want to be suspected of the same thing.

PBlover 11-03-2004 09:47

Re: Hi I'm new and have some question !
 
oh no , I don't know much about him , I just know he is a cs pro only

koraX 11-03-2004 09:48

Re: Hi I'm new and have some question !
 
Quote:

Originally Posted by PBlover
(3)COLORS ??? He is simply the best cs players in the online cs server , almost many people know !

o_O

(I think i was right pmb)

Onno Kreuzinger 11-03-2004 09:57

Re: Hi I'm new and have some question !
 
Marconi, well they where kind of "switched" off, or i'm i wrong ;-)

Terran 11-03-2004 10:23

Re: Hi I'm new and have some question !
 
Quote:

Originally Posted by Pierre-Marie Baty
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.

Well, joebot is actually a metamod plugin. The player function is redefined in bot.cpp:

Code:

//extern "C"
 //{
 // this is the LINK_ENTITY_TO_CLASS function that creates a player (bot)
 //void player(entvars_t *pev);
 //}
 
 void player( entvars_t *pev )
 {
                static LINK_ENTITY_FUNC otherClassName = NULL;
                if (otherClassName == NULL)
                            otherClassName = (LINK_ENTITY_FUNC)GetProcAddress(h_Library, "player");
                if (otherClassName != NULL){
                                (*otherClassName)(pev);
                }
 }

Note: this isn't my code, I've got this from the CVS at sourceforge...

Pierre-Marie Baty 11-03-2004 11:39

Re: Hi I'm new and have some question !
 
@Terran: calling the player function like this is not a smart thing to do. This is bypassing the metamod interface, it can screw it up seriously (especially is joebot is loaded in the middle of other heaps of plugins).

I advise anybody who has commit access to the JoeBot CVS to get rid of this player() redefinition and use the CALL_GAME_ENTITY() metamod macro instead.


@PBLover: your IP is logged. Someday when we'll be curious enough we'll compare your IP with the one of that former (3)COLORS lamer. If it shows up they're the same, you'll be kicked/banned from here without warning. Be advised.

Pierre-Marie Baty 11-03-2004 11:51

Re: Hi I'm new and have some question !
 
actually FYI I did the search myself:
Quote:

The Second (3)COLORS:
210.187.192.121 (email sxyozh04@hotmail.com)

PBlover:
210.187.192.135 (email sang049@hotmail.com)
Same ISP, same geographic region.
*edit* and same crappy email account @ hotmail, too.
*edit* it appears he's behind a modem. He just disconnected and reconnected and his IP changed from 192.41 to 192.135. It won't fool many people...

Gentlemen, what to do ? 9_9

Terran 11-03-2004 13:45

Re: Hi I'm new and have some question !
 
Quote:

Originally Posted by Pierre-Marie Baty
@Terran: calling the player function like this is not a smart thing to do. This is bypassing the metamod interface, it can screw it up seriously (especially is joebot is loaded in the middle of other heaps of plugins).

I suppose this code is there because joebot has a compile time option whether it's a plugin or not.
Anyway I've changed this im my copy of the code (it was already there but commented out).

I've done some testing as I suspected other metamod plugins causing this odd behaviour. But even with yapb or joebot as the only loaded and running metamod plugin the playerstats don't get cleared.

Pierre-Marie Baty 11-03-2004 14:04

Re: Hi I'm new and have some question !
 
I think if the guy who did the JoeBot port for metamod missed this out then there must be plenty of things missing as well. If there's indeed a compile-time option for metamod then the correct code will look like this:

Code:

#ifdef METAMOD
CALL_GAME_ENTITY (PLID, "player", &pBotEdict->v);
#else
player (&pBotEdict->v);
#endif

I'm sure there are other problems like this one.

Pierre-Marie Baty 11-03-2004 14:14

Re: Hi I'm new and have some question !
 
Hey, my bad, my fault ! I forgotten one line:
the correct code for FREE_PRIVATE() is this one
Code:

  if (pEdict->pvPrivateData != NULL)
          FREE_PRIVATE (pEdict); // free our predecessor's private data
  pEdict->pvPrivateData = NULL; // fools the private data pointer
  pEdict->v.frags = 0; // reset his frag count

the last line is needed because the player's frags are stored outside of the private data. Freeing the private data resets the death count and any other statistic, but you also need to reset the frags count which is the only player statistics held in the entvars.

Terran 11-03-2004 15:06

Re: Hi I'm new and have some question !
 
STRIKE ! :D

It works now as expected. Even the deaths are cleared...

PBlover 11-03-2004 15:46

Re: Hi I'm new and have some question !
 
lol , I will change myself , plz don't thread me like that .. I am still learning ...

koraX 11-03-2004 18:56

Re: Hi I'm new and have some question !
 
don't post too much into this thread guys, thread will be deleted if he is banned. That's what happened to all my valuable 9_9 posts on 3colors's threads and there goes my postcount :(

(and this time I recommend an IP range instead of single IP :| )

cruft 15-03-2004 08:11

Re: Hi I'm new and have some question !
 
Quote:

Originally Posted by Pierre-Marie Baty
I think if the guy who did the JoeBot port for metamod missed this out then there must be plenty of things missing as well. If there's indeed a compile-time option for metamod then the correct code will look like this:

Code:

#ifdef METAMOD
CALL_GAME_ENTITY (PLID, "player", &pBotEdict->v);
#else
player (&pBotEdict->v);
#endif

I'm sure there are other problems like this one.

Well, it kinda looks like that but it's more like:

Code:

#ifndef USE_METAMOD
#define CALL_GAME_ENTITY(plid, entStr, pev) UTIL_CallGameEntity(entStr, pev)
#endif /* USE_METAMOD */

plid is ignored when compiling a standard dll. The code at sourceforge compiles both a metamod and standard dll based on the USE_METAMOD define. The entire codebase is free to look at in context at sourceforge which will make more sense then posted code snippets.


All times are GMT +2. The time now is 10:20.

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