Game Development Community

Night Vision

by Howard Dortch · in Torque Game Engine · 05/31/2005 (9:11 am) · 8 replies

I implemented the Night Vision resource (C3GuiNightVisionCtrl) some time ago and it has been working fine. The 1.3 release seems to have a problem and I dont know if it was a result of 1.3 or something I did (probably me). Here is what it does. When I activate (toggle) the NVG the player jerks about every second or so while running. Runs fine with it off. As a test I activated the NVG at program startup and it runs fine. It's only when I toggle it that problems occur. It seems that the C3GuiNightVisionCtrl::registerLights() which has lightManager->addLight(&mLight); is not getting added to the scene in the proper location or rendered properly in sequence. Almost like the engine gets lost trying to figure which to render or which to calculate and goes into a stall looping thru many iterations of calculations.
As I said if I have it active at the start of the game it runs well so it's not the object it's the toggle that seems to be issue.
Any clues?

#1
05/31/2005 (11:12 am)
It sounds like one of the merges are incomplete (either the Lighting Pack update or the night vision resource), try double checking to make sure everything is in the right place.
#2
05/31/2005 (12:38 pm)
I used your 1.3 version intact and added my things in so I assume yours is right. The NVG just does a dynamic light and overlay on the screen.
#3
05/31/2005 (3:24 pm)
The night vision resource just creates a big dynamic light? Wow, that must really cause a large performance hit. I don't know why it would cause the player to stutter though, usually that's related to the client and server being out of sync - slowdowns due to rendering are usually relatively consistent from frame to frame.
#4
05/31/2005 (8:34 pm)
Actually only drops a couple frames with it on, the radius can be smaller to lower the impact. I think the clue lies in the fact that it runs fine if on but if toggled it causes proplems. When lighitng a scene with dynamics does it try to resolve near light first then other light?
#5
06/01/2005 (11:37 am)
The lights are sorted by order of importance (a combination of distance and intensity). This resource works fine in a stock TGE?
#6
06/01/2005 (1:08 pm)
That light should be top of the list then I would think. Havent tried in a stock TGE yet but I will, it's just one file drop in and run.
#7
06/01/2005 (1:33 pm)
I added it to the stock 1.3 fps.starter and it seems to run fine.
#8
06/02/2005 (11:16 am)
Hmm, that's odd. I recommend running TGE's profiler on the Lighting Pack + Night Vision and getting a snapshot of the stats while the night vision is on and off (just remember to reset the stats in between).

Or you could tryout the new night vision resource which uses image post processing for the effect, which should look a lot better.