.:: 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
bots not seeing through glass bug FIX
Old
  (#1)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 4643'60N 043'0W 0.187A
Default bots not seeing through glass bug FIX - 01-04-2004

This bug affects ALL the HL bots (no matter if it's CS related or not)

In order to make one's bot see through glass, the bot coder usually uses an overloaded TraceLine() call with the "ignore_glass" parameter. It looks like this:

UTIL_TraceLine (vecStart, vecEnd, ignore_monsters, ignore_glass, pEdict, &tr);

However THIS DOES NOT ALWAYS WORK. There are several ways to create glass-like effects with entities when building a map, but all of them have something in common: the created entity must have the "kRenderTransTexture" as "render mode" and a render amount between 0 and 255 (0 being totally transparent, and 255 totally opaque). However SOME MAPPERS ALSO MAKE THEIR GLASS ENTITIES WEAR THE FL_WORLDBRUSH FLAG, THUS ASSIMILATING THEIR ENTITY WITH THE WORLD. This is especially true for non-breakable glasses like those you can see in the Counter-Strike map cs_siege, for example.

The problem with this is that UTIL_TraceLine with the ignore_glass flag doesn't pass anymore through world brushes !

In order to allow our TraceLine to pass, we must then clear the transparent entity of its FL_WORLDBRUSH flag.

Since this flag is set when the entity is spawned, we must clear it AFTER the actual engine function Spawn() is called. Non-metamod (hook DLL) bots can do this in DispatchSpawn, right AFTER "g_engfuncs.pfnSpawn" is called.

However, metamod bots must hook on one metamod API more, and use one function from the GetEntityAPI2_Post interface. The appropriate code for metamod bots will then look like this:
Code:
int Spawn_Post (edict_t *pent)
{
   // solves the bots unable to see through certain types of glass bug.
   // MAPPERS: NEVER ALLOW A TRANSPARENT ENTITY TO WEAR THE FL_WORLDBRUSH FLAG !!!
 
   // is this a transparent entity ? 
   if (pent->v.rendermode == kRenderTransTexture)
	  pent->v.flags &= ~FL_WORLDBRUSH; // then clear the FL_WORLDBRUSH flag
 
RETURN_META_VALUE (MRES_IGNORED, 0);
}
Note that you MUST declare Spawn_Post in the GetEntityAPI2_Post interface and you MUST notify metamod that you are using this new API, IN ADDITION to the GetEntityAPI2 one (you usually do this when defining gMetaFunctionTable).



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."

Last edited by Pierre-Marie Baty; 01-04-2004 at 03:03..
  
Reply With Quote
Re: bots not seeing through glass bug FIX
Old
  (#2)
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: bots not seeing through glass bug FIX - 01-04-2004

WOW! you can find a fix for everything
  
Reply With Quote
Re: bots not seeing through glass bug FIX
Old
  (#3)
SoUlFaThEr
Moderator
 
SoUlFaThEr's Avatar
 
Status: Offline
Posts: 860
Join Date: Mar 2004
Default Re: bots not seeing through glass bug FIX - 02-04-2004

i mapped enough in my day......whatever this fl_worldbrush flag is......its not called this in the fgd editor properties thingy when making the entity.....
so what is that?


  
Reply With Quote
Re: bots not seeing through glass bug FIX
Old
  (#4)
Austin
Moderator
 
Austin's Avatar
 
Status: Offline
Posts: 403
Join Date: Nov 2003
Default Re: bots not seeing through glass bug FIX - 02-04-2004

Great work again PM!
A standard plugin I wrote that runs on my server all the time uses Spawn_Post() so all I have to do is add those two lines to it and POD2.5 will now finally shoot me through railings and things! WOOoo..oottttTT!
Great work again, and again, and again PM!
  
Reply With Quote
Re: bots not seeing through glass bug FIX
Old
  (#5)
Cheeseh
[rcbot]
 
Cheeseh's Avatar
 
Status: Offline
Posts: 361
Join Date: Dec 2003
Location: China
Default Re: bots not seeing through glass bug FIX - 02-04-2004

/sarcasm : I already knew that ...

cool

oh, btw entities will have the worldbrush flag set if it is unbreakable or not a breakable entity I think. (normal glass doesnt have it set but unbreakable glass does! I don't know about func_walls, I'd believe so)

Last edited by Cheeseh; 02-04-2004 at 13:27..
  
Reply With Quote
Re: bots not seeing through glass bug FIX
Old
  (#6)
SoUlFaThEr
Moderator
 
SoUlFaThEr's Avatar
 
Status: Offline
Posts: 860
Join Date: Mar 2004
Default Re: bots not seeing through glass bug FIX - 02-04-2004

i think it may have something to do with those ZHLT's Lightflags.....

entities are invisible
to make entities cast a shadow....you can set different settings for light blockage:
normal
Embedded fix
Opaque(blocks light)
Opaque + Embedded fix

it might be these things giving an entity a worldbrush flag so that it will be rendered SOLID......

is that it?.......most of the newer maps have a lot of this on thier func_walls and breakables and illusionaries......but then again it doesnt make sense with the cs_siege thing because the light flags were added LOOOOONG after that map was made unless they updated it for cs_1.5


  
Reply With Quote
Re: bots not seeing through glass bug FIX
Old
  (#7)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 4643'60N 043'0W 0.187A
Default Re: bots not seeing through glass bug FIX - 02-04-2004

@Cheeseh you already knew that and you let the others fiddle with bugs that have been solved already, you horrible egoistic boy ???




@SoUlFaThEr: no, actually an entity wearing the FL_WORLDBRUSH flag is an entity that is static all along the game (such as unbreakable glass). You don't "set" an entity to wear this flag explicitly, you do so when you make an entity with no breakable/movable/pushable/triggerable properties. Such as a func_wall for example...



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."

Last edited by Pierre-Marie Baty; 02-04-2004 at 15:20..
  
Reply With Quote
Re: bots not seeing through glass bug FIX
Old
  (#8)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Re: bots not seeing through glass bug FIX - 04-04-2004

thanks pm! Even i could apply that fix without trouble


Author of RealBot, "Arrakis" and "Dune 2 - The Maker" | co-Founder of Bots-United | Fundynamic | Blog | E-Mail me
  
Reply With Quote
Re: bots not seeing through glass bug FIX
Old
  (#9)
SoUlFaThEr
Moderator
 
SoUlFaThEr's Avatar
 
Status: Offline
Posts: 860
Join Date: Mar 2004
Default Re: bots not seeing through glass bug FIX - 05-04-2004

ok so its just a damn func_wall with rendermode "texture" and fxamount "N"

lol


  
Reply With Quote
Re: bots not seeing through glass bug FIX
Old
  (#10)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 4643'60N 043'0W 0.187A
Default Re: bots not seeing through glass bug FIX - 05-04-2004

not necessarily! It can be a func_illusionary, a func_yomomma, a func_whatever...
ANYTHING that is fixed and won't ever move during the game will wear the FL_WORLDBRUSH flag.



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 - 2020, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com