AM to PM
Another long Reloaded day, with almost all of it within the FPSC source code :) I was distracted for no more than 20 minutes on a quick AGK fix, but right back into the light mapping work! Success.
Current Light Mapper
I have moved from the prototype to the main engine now, and redesigned the way in which the segments and entities are painted in the editor. Not outwardly, but internally the objects are no longer instances but clones so they can be light mapped, and with this I was able to paint down a few floors, drop in a light and presto, an almost instant light mapped ring of light.
After a little more work I could add several lights in, and again the light map would automatically adjust and the scene would be pre-lit within seconds.
As expected, now came the army of small unpredictable gremlins to spoil the party. When you click New to create a new scene, the old objects had to be deleted, and of course light mapping is still occurring so of course the whole thing crashed when I tried to reset the level. I also cannot delete any segments right now as the new system only handles additions to the scene, and of course when I start deleting these objects I will have the same issue as above with the light mapper not quite ready to let the object go.
This might not be a problem if the light map process is a few seconds, but a complex scene can take 10-20 seconds to light, and does the user want to wait that long before they can load a new level or start again, no.
My task for the remaining few hours and perhaps this evening is to bring these crashes to heal by adding a new light mapper command which can extract an object immediately from the scope and responsibility of the process, so one or all objects can be removed and the light map process terminated gracefully. It's also not straight forward as when using threads (which the real time light mapper certainly does), a crash is often reported in a different location with no call stack to fall back on, so it's pretty much a case of trial and error tweaks until the true cause of these drop-outs becomes apparent. Hopefully tomorrow I can bring news of victory over these gremlins.