Neat trick with static entities and lighting

Post tutorials on how to do certain tasks within game or engine code here.
Post Reply
mh
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Neat trick with static entities and lighting

Post by mh »

Static entities never move. You can save a certain amount of BSP tree tracing at runtime by running them through R_LightPoint and saving out the surface and point they hit. Then just run the per-surface part of R_LightPoint again when it comes time to light the model (ent->efrag can be used to test if an entity is static in GLQuake as only static entities have efrags; in software Quake you'll need to add a flag or something). Don't forget to also add dynamic lights.

Depending on how many static entities you have in a scene the performance boost can be significant.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
Cobalt
Posts: 445
Joined: Wed Jun 10, 2009 2:58 am
Location: New England, USA
Contact:

Re: Neat trick with static entities and lighting

Post by Cobalt »

Good information. I messed with makestatic (self) in QC a few times, but mistaked it for more or less a remove self.
mh wrote:Static entities never move. You can save a certain amount of BSP tree tracing at runtime by running them through R_LightPoint and saving out the surface and point they hit. Then just run the per-surface part of R_LightPoint again when it comes time to light the model (ent->efrag can be used to test if an entity is static in GLQuake as only static entities have efrags; in software Quake you'll need to add a flag or something). Don't forget to also add dynamic lights.

Depending on how many static entities you have in a scene the performance boost can be significant.
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Re: Neat trick with static entities and lighting

Post by Spike »

heh, aye, many QW clients hide static ents to gain a tiny bit of fps, can easily see how makestatic might be equivelent to remove.
Cobalt
Posts: 445
Joined: Wed Jun 10, 2009 2:58 am
Location: New England, USA
Contact:

Re: Neat trick with static entities and lighting

Post by Cobalt »

I messed with the code opee made for nails [ er spike? ] sticking in the walls today....kind of clever. Its got a think that removes the nail after a time, but I thought, why not just make it static, that way its not going to be included in the packet and wil reduce chances of overflow, but when I tested the code, the nail was nt visible, much less stuck in the wall. Then I remembered LH telling me makestatic
wont show the entity up to any client currently conected, but any client connecting after its made static will see it. So I reconnected and could see them stuck all over. Some of my code performs ricochets if its not gonna stick, and they still are live when dropped to the floor, so if you walk on them (ouch!). If you have armor on they disarm after the first touch. Kinda neat for teamplay if you want to protect a certain item, like a flag...heh. Lots of ppl complain that the nailgun is a useless weapon compared to the others.
Spike wrote:heh, aye, many QW clients hide static ents to gain a tiny bit of fps, can easily see how makestatic might be equivelent to remove.
ceriux
Posts: 2230
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Re: Neat trick with static entities and lighting

Post by ceriux »

Cobalt wrote:I messed with the code opee made for nails [ er spike? ] sticking in the walls today....kind of clever. Its got a think that removes the nail after a time, but I thought, why not just make it static, that way its not going to be included in the packet and wil reduce chances of overflow, but when I tested the code, the nail was nt visible, much less stuck in the wall. Then I remembered LH telling me makestatic
wont show the entity up to any client currently conected, but any client connecting after its made static will see it. So I reconnected and could see them stuck all over. Some of my code performs ricochets if its not gonna stick, and they still are live when dropped to the floor, so if you walk on them (ouch!). If you have armor on they disarm after the first touch. Kinda neat for teamplay if you want to protect a certain item, like a flag...heh. Lots of ppl complain that the nailgun is a useless weapon compared to the others.
Spike wrote:heh, aye, many QW clients hide static ents to gain a tiny bit of fps, can easily see how makestatic might be equivelent to remove.
you can make it to where they dont hurt you when you touch them, i forget how i did it back when i was messing with them.
Post Reply