blitz-foundation / monkey2

zlib License
3 stars 0 forks source link

LightType.Point is very slow to init #82

Open Pharmhaus-2 opened 5 years ago

Pharmhaus-2 commented 5 years ago

Original Author: DruggedBunny

I've heavily re-worked Bust! (now Super Thrusting Game!) into separate classes, and been tweaking lots tonight (not that much will show), and I noticed Point lights are now working. (It may be that when I tried them before, I hadn't realised they wouldn't shine outside my orb without some alpha applied to it.)

However, Point lights seem to be extremely slow to initialise, whereas Spot lights are instant.

Source

This is located in orb.monkey2, line 34 -- try starting the game, flying away from the platform and hitting 'O'... huge pause!

        glow = New Light (model)

            glow.Type               = LightType.Point ' Very slow to init!
            glow.CastsShadow        = True
            glow.Color              = Color.HotPink * 8.0
            glow.Range              = 10.0

Change to LightType.Spot and it's instant.

I'm imagining there's some sort of gathering of scene vertex data or something (toggling it doesn't cause the delay), but couldn't immediately locate anything. (Guessing the hard work is done in the shader?)

I tried init'ing a Point light during game start, but that didn't avoid the pause on first Orb-spawn, so must be Light instance-specific, I guess.

Is this just something we'll have to live with -- initialise prior to game processing -- or should it be possible to start these lights in real time?

Pharmhaus-2 commented 5 years ago

@DruggedBunny Do you have an reproducable example?

DruggedBunny commented 5 years ago

Hi PH2, I've just tweaked it to build with current mx2 and re-uploaded to the same location -- just hit the Source link above...

Move away from the start position and hit O to spawn the orb -- you should see a large delay the first time you try it. Per above, change LightType in orb.monkey2 to Spot and it should be instant.

Out of curiosity... is this something you're trying to resolve, specifically, or just taking on random bug reports? Got plans for your fork?

Pharmhaus-2 commented 5 years ago

@DruggedBunny

Thanks.

Out of curiosity... is this something you're trying to resolve, specifically, or just taking on random bug reports? Got plans for your fork?

First things first. It unclear for many of the issues how to reproduce them. The ones that are clearly reproducable I marked as bugs and the ones I could not reproduce directly I labeled "Reproduce This Bug". I am going to start fixing the bugs with the bug tag first. Once I run out of reproducable bugs I am going to start inspecting the "Reproduce This Bug" ones. The queue for the current ToDo can be found here: https://github.com/blitz-foundation/monkey2/projects/1