Page 1 of 1

Neat trick with static entities and lighting

Posted: Wed Aug 31, 2011 9:39 pm
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.

Re: Neat trick with static entities and lighting

Posted: Wed Aug 31, 2011 11:19 pm
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.

Re: Neat trick with static entities and lighting

Posted: Thu Sep 01, 2011 12:24 am
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.

Re: Neat trick with static entities and lighting

Posted: Thu Sep 01, 2011 1:48 am
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.

Re: Neat trick with static entities and lighting

Posted: Thu Sep 01, 2011 2:53 am
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.