Forum

Trigger surfaces

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

Moderator: InsideQC Admins

Trigger surfaces

Postby Irritant » Thu Oct 14, 2010 1:35 pm

So how does the renderer know not to draw a trigger in Quake 2?

I thought it might be node contents, but I'm seeing everything with contents of -1? Leafs perhaps?
http://red.planetarena.org - Alien Arena and the CRX engine
Irritant
 
Posts: 250
Joined: Mon May 19, 2008 2:54 pm
Location: Maryland

Postby Spike » Thu Oct 14, 2010 4:02 pm

hrm? why would it?
triggers are entities, not part of the world.
the gamecode sets the fields properly such that the server never sends those ents to the client.
The renderer never sees a trigger entity, and thus never draws one.

I don't remember the specifics, just that in Q1, and ent is not sent if either its model name or modelindex are empty. Triggers in Q1 are actually bbox-clipped, and so can have either model or modelindex clear (actually both, I think). Obviously the details here are Q1-specific, but Q2 is identical in regards to the results upon the network in this regard.
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby Irritant » Thu Oct 14, 2010 6:34 pm

Spike wrote:hrm? why would it?
triggers are entities, not part of the world.
the gamecode sets the fields properly such that the server never sends those ents to the client.
The renderer never sees a trigger entity, and thus never draws one.

I don't remember the specifics, just that in Q1, and ent is not sent if either its model name or modelindex are empty. Triggers in Q1 are actually bbox-clipped, and so can have either model or modelindex clear (actually both, I think). Obviously the details here are Q1-specific, but Q2 is identical in regards to the results upon the network in this regard.


No in Q2 at least, those surfaces do get loaded into r_worldmodel. The issue has been solved though, thanks to Eihrul, who figured out that it was to do with marksurfaces.
http://red.planetarena.org - Alien Arena and the CRX engine
Irritant
 
Posts: 250
Joined: Mon May 19, 2008 2:54 pm
Location: Maryland

Postby andrewj » Fri Oct 15, 2010 3:09 am

SURF_NODRAW flag
andrewj
 
Posts: 133
Joined: Mon Aug 30, 2010 3:29 pm
Location: Australia

Postby Irritant » Fri Oct 15, 2010 4:46 am

andrewj wrote:SURF_NODRAW flag


It's unused in Q2.

Like I said, the method of parsing the surfaces to exclude the triggers is thus:

Code: Select all
for (surf = &r_worldmodel->surfaces[r_worldmodel->firstmodelsurface]; surf < &r_worldmodel->surfaces[r_worldmodel->firstmodelsurface + r_worldmodel->nummodelsurfaces] ; surf++)
   
http://red.planetarena.org - Alien Arena and the CRX engine
Irritant
 
Posts: 250
Joined: Mon May 19, 2008 2:54 pm
Location: Maryland

Postby andrewj » Fri Oct 15, 2010 10:44 am

You're right that SURF_NODRAW is unused.

But that code you mentioned is merely a for loop iterating through some surfaces. It shows nothing. Also which function is it in? I cannot find it in the stock Q2 source.

I think it's this code in the game stuff (g_trigger.c), doing what Spike is saying about Q1, prevents the server from sending the trigger entity to the client:

Code: Select all
self->svflags = SVF_NOCLIENT;
andrewj
 
Posts: 133
Joined: Mon Aug 30, 2010 3:29 pm
Location: Australia

Postby Irritant » Fri Oct 15, 2010 1:40 pm

andrewj wrote:You're right that SURF_NODRAW is unused.

But that code you mentioned is merely a for loop iterating through some surfaces. It shows nothing. Also which function is it in? I cannot find it in the stock Q2 source.

I think it's this code in the game stuff (g_trigger.c), doing what Spike is saying about Q1, prevents the server from sending the trigger entity to the client:

Code: Select all
self->svflags = SVF_NOCLIENT;


That's in a function that we wrote for our ragdoll code. It's basically looping though surfaces that are not submodels. This bypasses all of the inline bmodels, such as plats, doors, triggers, etc. That way you can grab everything for the world, then individually add the submodels if you want. This was done for creating collision surfaces in the Open Dynamics Engine for our ragdolls. (Which btw are now working very well).
http://red.planetarena.org - Alien Arena and the CRX engine
Irritant
 
Posts: 250
Joined: Mon May 19, 2008 2:54 pm
Location: Maryland


Return to Engine Programming

Who is online

Users browsing this forum: No registered users and 1 guest