.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   General Bot Coding (http://forums.bots-united.com/forumdisplay.php?f=24)
-   -   bots not seeing through glass bug FIX (http://forums.bots-united.com/showthread.php?t=1226)

Pierre-Marie Baty 01-04-2004 03:01

bots not seeing through glass bug FIX
 
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).

sPlOrYgOn 01-04-2004 03:47

Re: bots not seeing through glass bug FIX
 
WOW! you can find a fix for everything :D

SoUlFaThEr 02-04-2004 06:41

Re: bots not seeing through glass bug FIX
 
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?

Austin 02-04-2004 06:44

Re: bots not seeing through glass bug FIX
 
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!

Cheeseh 02-04-2004 13:22

Re: bots not seeing through glass bug FIX
 
/sarcasm : I already knew that ... 8) :)

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)

SoUlFaThEr 02-04-2004 15:16

Re: bots not seeing through glass bug FIX
 
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

Pierre-Marie Baty 02-04-2004 15:17

Re: bots not seeing through glass bug FIX
 
@Cheeseh you already knew that and you let the others fiddle with bugs that have been solved already, you horrible egoistic boy ??? :D

:P


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

stefanhendriks 04-04-2004 22:35

Re: bots not seeing through glass bug FIX
 
thanks pm! Even i could apply that fix without trouble :)

SoUlFaThEr 05-04-2004 06:59

Re: bots not seeing through glass bug FIX
 
ok so its just a damn func_wall with rendermode "texture" and fxamount "N"

lol

Pierre-Marie Baty 05-04-2004 07:22

Re: bots not seeing through glass bug FIX
 
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.


All times are GMT +2. The time now is 12:00.

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