.:: 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
not correct detection by bots chicken as a friend/enemy
Old
  (#1)
teame06
Member
 
Status: Offline
Posts: 6
Join Date: Apr 2005
Default not correct detection by bots chicken as a friend/enemy - 22-04-2005

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.
Attached Files
File Type: zip chicken.zip (158.4 KB, 395 views)
  
Reply With Quote
Re: not correct detection by bots chicken as a friend/enemy
Old
  (#2)
KWo
Developer of PODBot mm
 
KWo's Avatar
 
Status: Offline
Posts: 3,425
Join Date: Apr 2004
Default Re: not correct detection by bots chicken as a friend/enemy - 22-04-2005

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.
  
Reply With Quote
Re: not correct detection by bots chicken as a friend/enemy
Old
  (#3)
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: not correct detection by bots chicken as a friend/enemy - 23-04-2005

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.



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: not correct detection by bots chicken as a friend/enemy
Old
  (#4)
botman
Super Moderator
 
Status: Offline
Posts: 280
Join Date: Jan 2004
Location: Plano, TX
Default Re: not correct detection by bots chicken as a friend/enemy - 23-04-2005

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
  
Reply With Quote
Re: not correct detection by bots chicken as a friend/enemy
Old
  (#5)
sPlOrYgOn
<-- He did it.
 
sPlOrYgOn's Avatar
 
Status: Offline
Posts: 1,558
Join Date: Jan 2004
Location: Los Angeles, California, USA, North America, Earth, Solar System, Milky Way.
Default Re: not correct detection by bots chicken as a friend/enemy - 23-04-2005

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.
  
Reply With Quote
Re: not correct detection by bots chicken as a friend/enemy
Old
  (#6)
KWo
Developer of PODBot mm
 
KWo's Avatar
 
Status: Offline
Posts: 3,425
Join Date: Apr 2004
Default Re: not correct detection by bots chicken as a friend/enemy - 23-04-2005

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.
  
Reply With Quote
Re: not correct detection by bots chicken as a friend/enemy
Old
  (#7)
@$3.1415rin
Council Member, Author of JoeBOT
 
@$3.1415rin's Avatar
 
Status: Offline
Posts: 1,381
Join Date: Nov 2003
Location: Germany
Default Re: not correct detection by bots chicken as a friend/enemy - 23-04-2005

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.


  
Reply With Quote
Re: not correct detection by bots chicken as a friend/enemy
Old
  (#8)
T(+)rget
AMX Dev Team
 
T(+)rget's Avatar
 
Status: Offline
Posts: 28
Join Date: Dec 2004
Location: UK
Default Re: not correct detection by bots chicken as a friend/enemy - 24-04-2005

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.

Last edited by T(+)rget; 24-04-2005 at 13:49..
  
Reply With Quote
Re: not correct detection by bots chicken as a friend/enemy
Old
  (#9)
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: not correct detection by bots chicken as a friend/enemy - 24-04-2005

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.



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: not correct detection by bots chicken as a friend/enemy
Old
  (#10)
T(+)rget
AMX Dev Team
 
T(+)rget's Avatar
 
Status: Offline
Posts: 28
Join Date: Dec 2004
Location: UK
Default Re: not correct detection by bots chicken as a friend/enemy - 24-04-2005

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!

Last edited by T(+)rget; 24-04-2005 at 23:33..
  
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