.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   General Bot Coding (http://forums.bots-united.com/forumdisplay.php?f=24)
-   -   not correct detection by bots chicken as a friend/enemy (http://forums.bots-united.com/showthread.php?t=3884)

teame06 22-04-2005 19:27

not correct detection by bots chicken as a friend/enemy
 
1 Attachment(s)
Hello all,

I found this bug. The System spec i tested on was a P4 2.4 Ghz, WindowsXp, Hlds Dedicated Counter Strike server, Amxmodx 1.01, with Chicken Rebirth 1.0 plugin. PoDBotMM

KWo told me to write in it because he said alot of the Bots Programs are base of a template. Here alittle explaination of what Chicken Rebirth 1.0 does. It is a plugin that changes the person model into a chicken model. person can only use knifes, nade, and plant bomb. Here is the problem, When i use the Chicken Rebirth 1.0 plugin to change into a chicken, or change every Bots into chickens. The Bots enemy changes to Friendly and the Bots Friends changes to enemys for the Bots. So the Bots will not kill the enemy and Bots friends will be killed. So even though you change back to regular model it will still do it. But once round restart it will go back to normal. There also a demo, it was record in cs_estate. Not sure if chicken models are needed.

If their is a solution please tell me. I use PodBotMM to test the plugins i maintain on amxmodx.

Thank you.

KWo 22-04-2005 21:56

Re: not correct detection by bots chicken as a friend/enemy
 
I may attest. He is right. Bot get confused if the model of player (or other bot) is changed. Before - when the people were asking me about compatibility bots with SuperheroMod I didn't understand the reason why it may not work. But after tests with ChickenMod and after I got some knowledge from Aspirin I know why bots have problems with players when they change models. Since detection of enemy/friends is based on model the bot can see, it works exactly like teame06 wrote.
Since the people from AMX (dJeyL + T(+)rget) and AMX X (SidLuke , Bailopan) were helping us to get their mods compatible with bots (by talking and fixing some bugs/mistakes/incorrect parts of code for bots) - I guess - this time we should also think what we can do at bot's side code - to solve the problem described by teame06.
For Your knowledge - teame06 is currently working for AMX X on some of the most popular plugin - Advanced Team Attack Control (authorsT(+)rget and f177bomb). Last time he improved the code for AMX X and for multilanguage system and few things more hi did for AMX X.
http://www.amxmodx.org/forums/viewtopic.php?t=11930

I've been helping him as I could , but this problem he found is unsolvable for me (since I'm not a bot coder). :(
I hope here - at BU - is possible find someone giving us the hand.

Pierre-Marie Baty 23-04-2005 17:34

Re: not correct detection by bots chicken as a friend/enemy
 
I don't understand exactly your description of the problem. In fact, the chicken model in cs_italy not being a player model, this implies that chicken plugins cannot change the player model to the chicken one like that. Instead, they make the player invisible and they spawn another (new) entity right at their feet, with chicken.mdl as render model. The problem is that chickens are func_breakable, and most bots find it funny to shoot at func_breakables when they encounter some.

Put yourself in the skin of a bot. You see a func_breakable on your way. Your code tells you to shoot at it. And so you do.

Now, how would a human think in the same situation ? How do you recognize a chicken to be your friend, or your enemy ? If you are able to tell a bot coder exactly what are the thinking steps that lead you to either conclusion, he will be able to implement that in his bot code.

Personally, I find that problem very difficult to handle for bots, unless cheating is involved (for example, let the bot see invisible entities, thus making them able to see the players hiding behind the chickens). Another method would be to agree with the chicken plugin authors on something, that for example the v.owner field of the chicken's edict be set to the player who owns it. The bot could then parse the v.owner of a func_breakable chicken when it sees one, and find out whether the player behind it is an enemy or an ally.

botman 23-04-2005 17:51

Re: not correct detection by bots chicken as a friend/enemy
 
PM, I think what he's saying is if I change a player's model to a chicken (not terrorist or anti-terrorist), the bot's get confused about who is an enemy.

The bot code uses the player's model to determine who is friendly and who it enemy. If the player's model is not a terrorist model or an anti-terrorist model, the bot will attack his own team members because the bot thinks they are on some other team.

The solution to this is to NOT change player's models to something other than terrorist model or anti-terrorist model, or change the bot code UTIL_GetTeam() so that it uses some other method to determine what team the bot is on.

botman

sPlOrYgOn 23-04-2005 19:58

Re: not correct detection by bots chicken as a friend/enemy
 
right now I only see one way of fixing this. I was looking through StatsMe code and I found this.
Code:

void Client_TeamInfo(void* mValue)
{       
        if (mPlayer) return;

        static int index;

        switch (mState++) {
        case 0:
                index = *(int*)mValue;
                break;
        case 1:
                const char* team = (char*)mValue;

                int i;
               
                for(i = 0; i < sm.team_num ; ++i)
                        if ( !strcmpi(sm.team_name[i],team) )
                                break;

                //accept only new teams, max. 4 teams
                if ( i == sm.team_num && i < 4 )
                        strcpy( sm.team_name[sm.team_num++], team);

                player_t*pPlayer = GET_PLAYER_POINTER_I( index );

                if ( !pPlayer->ingame && !strcmpi(GETPLAYERAUTHID(INDEXENT(index)),"BOT")) //this is bot...
                {
                        edict_t* pEntity = INDEXENT(index);
                        PlayerConnect( pEntity , STRING(pEntity->v.netname), "127.0.0.1:27005" );
                        PlayerPutInServer( pPlayer );
                }

                strcpy(pPlayer->team_name, sm.team_name[i]); //save name of team
                pPlayer->team_index = i;
                sm.team_players[0] = 0;
                sm.team_players[1] = 0;
                sm.team_players[2] = 0;
                sm.team_players[3] = 0;
                for ( i = 1; i <= gpGlobals->maxClients; ++i )
                {
                        pPlayer = GET_PLAYER_POINTER_I( i );
                        sm.team_players[pPlayer->team_index]++;
                }
        }
}

This function is the function that processes the "TeamInfo" message

I tried using this before but it seems unreliable, but statsme seems to be able to use it just fine. For me, the "TeamInfo" message seems to be sent only when people connect to the server. Each time someone connects to the server, it sends the TeamInfo message for each player in the server. But those people that just connected haven't chosen a team yet so they are in team "unknown". The first part of the message is an integer for the team index and the second part is a string of the team name. Appearantly Statsme uses this message for multiple mods.

KWo 23-04-2005 22:20

Re: not correct detection by bots chicken as a friend/enemy
 
Quote:

Originally Posted by botman
PM, I think what he's saying is if I change a player's model to a chicken (not terrorist or anti-terrorist), the bot's get confused about who is an enemy.

The bot code uses the player's model to determine who is friendly and who it enemy. If the player's model is not a terrorist model or an anti-terrorist model, the bot will attack his own team members because the bot thinks they are on some other team.

It's exactly this problem. But it's not only about ChickenMod. The topic is corresponding also to other mods changing player's model - for example SuperHero mod (another AMX plugin).

How do I recognize/detect which chicken is currently a friend or an enemy? It's for me (as a human player) very easy - I'm getting the chicken at crosshair and it tells me who is a friend or who is an enemy... :)
I may ask T(+)rget - man from AMX mod dev team - he knows good Chicken Mod and players detection in AMX - maybe he can show us simply way how do the people in AMX detect player's team.

@$3.1415rin 23-04-2005 22:41

Re: not correct detection by bots chicken as a friend/enemy
 
the team information in CS is only in the internal variables which are not available to the public, since we dont know the class defs used there, therefore we have to use this model stuff. additionally the team variable in the entvars_t isnt updated. it wouldnt be difficult to ignore chickens, but dunno about how to see if they are enemies or not, at least not in cstrike. a lot of other bots update their entvars team information, therefore the problem shouldnt appear there.

T(+)rget 24-04-2005 13:46

Re: not correct detection by bots chicken as a friend/enemy
 
Code:

void Client_ScoreInfo(void* value) {
        static int id;
        static int deaths;
        switch (state++) {
                case 0:
                        id = *(int*)value;
                        break;
                case 2:
                        deaths = *(int*)value;
                        break;
                case 4:
                        if(id < 1 || id > gpGlobals->maxClients) {
                                break;
                        }
                        CPlayer* pPlayer = GET_PLAYER_POINTER_I(id);
                        pPlayer->deaths = deaths;
                        pPlayer->team = *(int*)value;
        }
}

Above is how I get which team someone is on, works on VexdUM bots just tested for Counter-Strike.

How above was tested:
Test1) Using radius_damage with sv_friendlyfire 0, bot didn't take no damage (correct) teams match so its a team mate.

Test2) Using radius_damage with sv_friendlyfire 1, bot died by my rocket launcher (correct) because team matching is ignored since sv_friendlyfire is enabled.

Conclusion:
Above code must be working correctly, else my new damage natives would fail, since I get the team variables from that code.

ChickenMod:
As for PMB's mention on ChickenMod, VexdUM uses different code which was carried across to AMXX (engine module) which does actually change the player model. Also the chicken model supplied is not the normal chicken model from cs_italy, its been modified so it has animation + a few fixes.

Pierre-Marie Baty 24-04-2005 20:50

Re: not correct detection by bots chicken as a friend/enemy
 
Quote:

Originally Posted by T(+)rget
which does actually change the player model

ah, OK then.

In that case, netcode parsing is definitely the way to go.

T(+)rget 24-04-2005 23:31

Re: not correct detection by bots chicken as a friend/enemy
 
I'll be carrying out further testing tomorrow someone I know is using ZBot and the damage natives don't work against it unless sv_friendlyfire is enabled. It might be a lan issue, unsure until I do adaquet testing.

A friend or 2 is going to help, so all bots for CS will be undergoing testing.

Testing should finish by the weekend!


All times are GMT +2. The time now is 18:35.

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