Forum

Bounding box fix + compatibility?

Discuss programming topics for the various GPL'd game engine sources.

Moderator: InsideQC Admins

Bounding box fix + compatibility?

Postby Baker » Sat Aug 21, 2010 5:56 pm

I incorporated the code R00k posted as a bounding box fix:

viewtopic.php?p=18605&highlight=whitehouse#18605

In hipnotic hip2m3.bsp the bounding box fix somehow results in the gold key (edict 134) being "free" instead of being there. So the gold key is missing.

I removed the bounding box fix and the key is there.

It is easy enough to just use a different bounding box fix and through testing verify all is fine, but the idea that a bounding box fix could cause an entity to not exist bothers me.

Why would a bounding box fix cause an edict to get freed? Any thoughts or ideas?

/ I know about bounding box issues with Qrally and/or Gold Cup, btw. Slightly annoying that to fix one problem (models near edge of screen disappearing) has to cause a gameplay change that can potentially break mods or actually make subtle alterations in game play :(
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby revelator » Sat Aug 21, 2010 7:39 pm

time for scalable bounding boxes :)

tbh i seen several weird effects due to bounding box problems i remember foundly my old demonquake engine with tenebraes infinite bounding box code, at first it looked ok then i came to the level with the drake and the walls dissapeared into the void :lol:

i even seen my weapon been offset so much that i could shoot myself in the arse (litterally) took me a while to figure that one out.

the problem seems to be intersection when the bounding box gets so large it clips the world box strange things happen :( it shouldnt really happen but it does.
User avatar
revelator
 
Posts: 2567
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Postby Baker » Sat Aug 21, 2010 8:07 pm

reckless wrote:time for scalable bounding boxes :)

tbh i seen several weird effects due to bounding box problems i remember foundly my old demonquake engine with tenebraes infinite bounding box code, at first it looked ok then i came to the level with the drake and the walls dissapeared into the void :lol:

i even seen my weapon been offset so much that i could shoot myself in the arse (litterally) took me a while to figure that one out.

the problem seems to be intersection when the bounding box gets so large it clips the world box strange things happen :( it shouldnt really happen but it does.


This key was, in fact, close to the edge of the world.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby Baker » Sat Aug 21, 2010 8:17 pm

Ok, here is what happened ...

The key fell out of the map:

Bonus item fell out of level at '3008.0 3088.0 -482.0'

And thanks to Metlslime's advice in an old thread, my engine kicks out the world bounds too with developer 1 on.

World bounds: -1280.0 -45.0 -960.0 to 3448.0 3200.0 696.0

I bet the bounding box fix had a Y dimension of greater than 112 (times 2) or thereabouts. My guess would be 128 or 256, I think the Rich Whitehouse code goes by powers of 2.

/Reckless ++; thanks!

Code: Select all
/*
============
PlaceItem

plants the object on the floor
============
*/
void() PlaceItem =
{
   local float   oldz;

   self.mdl = self.model;      // so it can be restored on respawn
   self.flags = FL_ITEM;      // make extra wide
   self.solid = SOLID_TRIGGER;
   self.movetype = MOVETYPE_TOSS;   
   self.velocity = '0 0 0';
   self.origin_z = self.origin_z + 6;
   oldz = self.origin_z;
   if (!droptofloor())
   {
      dprint ("Bonus item fell out of level at ");
      dprint (vtos(self.origin));
      dprint ("\n");
      remove(self);
      return;
   }
};


At this point, I'm wondering if a better bounding box fix might be adding a field that is used for rendering only rather than having a bounding box fix actually interfere with QuakeC.

Sigh.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby qbism » Sun Aug 22, 2010 4:47 am

Has anyone tried the Quake Info Pool fix?

Code: Select all
// 2001-11-31 Vanishing entity in screen corners fix by LordHavoc/Tomaz  start
/*
// FIXME: do this right
   mod->mins[0] = mod->mins[1] = mod->mins[2] = -16;
   mod->maxs[0] = mod->maxs[1] = mod->maxs[2] = 16;
*/

   for (i = 0; i < 3; i++)
   {
      mod->mins[i] = aliasbboxmins[i] * pheader->scale[i] + pheader->scale_origin[i];
      mod->maxs[i] = aliasbboxmaxs[i] * pheader->scale[i] + pheader->scale_origin[i];

      // Keep necessary minimum bounding box by Maddes  start
      if (mod->mins[i] > -16)
      {
         mod->mins[i] = -16;
      }
      if (mod->maxs[i] < 16)
      {
         mod->maxs[i] = 16;
      }
      // Keep necessary minimum bounding box by Maddes  end
   }
// 2001-11-31 Vanishing entity in screen corners fix by LordHavoc/Tomaz  end

There's other changes throughout the code, such as aliasbboxmins/ maxs:
http://www.atomicgamer.com/files/21126/qip-quake-sourcecode-compiles-with-ms-vc-winquake-glquake-and-djgpp-dosquake-needs-qip_src_general-zip
User avatar
qbism
 
Posts: 1236
Joined: Thu Nov 04, 2004 5:51 am

Postby Spike » Sun Aug 22, 2010 7:59 am

See the other topic where someone asked about shifting the model up a bit.
By changing the mins of the model, you change the default offset of the collision of all ents that use that model too (maxs is ignored for world collisions).
Normally, NQ will _always_ do an implicit setsize(ent, '-16 -16 -16', '16 16 16') every time you do setmodel(ent, "somemodel.mdl"). Yes, BSPs get a proper size, but regular ents always get +/- 16.
You still need the bbox fix, but use it only for the client's frustum checks.
The obvious hack here is to just make setmodel check to see if its an alias model and just set it to '-16 -16 -16' '16 16 16' if it is. Which is what I do with FTE.
(In QuakeWorld, setmodel only ever does a setsize if its a bsp model, dedicated servers don't need to load alias models)
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby qbism » Sun Aug 22, 2010 2:36 pm

Spike wrote:implicit setsize

...and this is overwritten for certain models by setmodel in qc? Example most pickup items are (self, '-16 -16 0', '16 16 56') and shambler is setsize (self, VEC_HULL2_MIN, VEC_HULL2_MAX). In that other post (if I'm looking at the right one) item bounds are set taller so they can be picked up even when jumped over.

Does the fustrum culling check look at frames, bboxmin and bboxmax, or the model mins and maxs? I'm going to look for that in the code...
Last edited by qbism on Sun Aug 22, 2010 3:48 pm, edited 1 time in total.
User avatar
qbism
 
Posts: 1236
Joined: Thu Nov 04, 2004 5:51 am

Postby Spike » Sun Aug 22, 2010 3:40 pm

http://forums.inside3d.com/viewtopic.php?t=2517

was refering to that one.


Basically, your entity clips with the world with its bounding box aligned to its mins value. If your ent is sized twice as big as the hull that its trying to use, then only the 'lower' 8th of the model will actually clip correctly. The rest will move through the world.

By changing the size reported in the model_t on the server, you have changed the mins of the entity, and thus moved the box with which it traces through the world (the hull box is the same size, its just offset).
And now that box makes contact with the world.
I'm not sure how better to explain it.
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby qbism » Sun Aug 22, 2010 4:06 pm

The relative way bbox alignment works is not intuitive, but the explanation combined with the previous thread is clear.
User avatar
qbism
 
Posts: 1236
Joined: Thu Nov 04, 2004 5:51 am

Postby r00k » Mon Aug 23, 2010 8:37 am

I always setsize after setmodel in quakeC anyways, ya never now...

That reminds me, I have noticed in CTF on DM6 specifically, the red flag's bounding box gets fubared somehow..(old 3wave bug) Not always but sometimes (i think if it falls in the hole where lg is after a telefrag), the next time a blue player gets the flag its "carried" at feet level, thus hidden in the floor :/

edit: Ah, i was calling setsize (flag, flag.mins, flag.maxs); in the respawn function but i needed to reset the mins/maxs as the engine can modify those values...

Code: Select all
void (entity flg) RegenFlag =
{
   if (flg == world) return;
   
   flg.movetype     = MOVETYPE_TOSS;
   flg.solid        = SOLID_TRIGGER;
      
   setorigin (flg, flg.oldorigin);         //original spawn position
                     
   if (ctf_state & CTF_TEAM_CAPTURE_CUSTOM)
   {         
      flg.mins    = '-16 -16 0';
      flg.maxs   = '16 16 74';      
   }
   else
   {
      flg.mins    = '-16 -16 -24';
      flg.maxs   = '16 16 32';
   }      
   
   setsize (flg, flg.mins, flg.maxs);      //Hopefully this will reset flag's bounding box after it got squished by bsp
                     
   sound(flg, CHAN_AUTO, "items/itembk2.wav", 1, ATTN_NORM);
   flg.angles       = flg.mangle;
   flg.cnt          = FLAG_AT_BASE;
   flg.owner        = world;
   flg.nextthink    = (time + sys_ticrate);
   flg.flags    = FL_ITEM;          // clear FL_ONGROUND and any other junk
};


Hmm i havent touched quakeC in over ayear, but shouldnt setorigin logically be set after setmodel and setsize?? :O
r00k
 
Posts: 1110
Joined: Sat Nov 13, 2004 10:39 pm


Return to Engine Programming

Who is online

Users browsing this forum: No registered users and 1 guest