Warning in advance: This is a very technical feature request, based on some assumptions about the lighting system in the game. It’s very possible that my suggestion can’t be implemented, or that my assumptions about the lighting system aren’t even correct. Please keep this in mind while reading this post.
I’ve noticed some inefficiencies with lighting in the game (the broad area lighting that is, not the taxiway lights etc.). For one, it seems to have a massive impact on the performance of the game (100FPS to 30FPS going from a dark area to an exterior lit area), and secondly, placing too many lights close together (or having a few + sunrise/sunset) can completely wash out an area. I think I may have an idea for a lightweight implementation of lighting. If it can actually be implemented is something the devs will have to see. Please also do correct me if the slowdowns I’m seeing isn’t down to lighting, but simply to traffic / passengers, or something like that. To be 100% clear: I’m assuming that lighting is resource-heavy, I don’t know it for sure. Everything below this is based on that assumption.
Given the current resource consumption that lighting seems to have, and the possibility of multiple lights washing out an area, I’m assuming that lighting is currently done on a source-basis, where each lightsource simply adds a bit of brightness in their masked area. If you’ve got hundreds of lights, and every time you move your viewport even slightly, this all has to be recalculated, I can understand this being resource-heavy.
What I came up with may be very lightweight, if it can be implemented:
Instead of calculating lighting on every draw() call (assuming a basic game structure here), I would start off with one massive mask, that covers the entire map. This map would probably be a grayscale mask, with white being as bright as possible, and black as dark as possible. This mask doesn’t change during the day, but instead it gets blended over top of the gameworld.
So during a bright sunny day, the mask isn’t doing anything. As soon as sunset comes around, the mask starts getting blended in, decreasing the brightness in the entire game. At full effect (100% masked), the game would look like night currently does in game.
Now for lighting: Every time you place a light (or build an interior area, which is lit as well), you change the mask. For “mood lighting” (which isn’t in the game at the moment), you could use a grey-ish value in the mask, to simulate that the light isn’t very bright. For a floodlight, you’d obviously use a full white value, to indicate that the light is as bright as it gets (or maybe go to 90% or 95% if you’d want to distinguish between daylight and artificial lighting.
I would also suggest to split the mask up into multiple sections, so the game only has to change a part of the mask for each light built or removed, instead of having to handle a larger file. This would be completely dependent on how the game handles changing the mask though, maybe it’s fine with using a single large mask.
Why it should be implemented:
Like mentioned before, I’m working on assumptions here. If my assumptions are correct though, this would result in pretty massive performance gains at night. It would also prevent the washout we’re currently seeing when placing lights close together, since there’s a maximum brightness (full white on the mask), which is as bright as daylight. Brighter than that isn’t possible with this technique.
So, simply put:
- Grayscale mask
- Either covering the full map, or split into sections, based on how the game handles the mask performance-wise.
- Black (0) means that there’s no lighting at all in that area.
- White (1) means that there’s light as bright as daylight in that area. Daylight could also be set to less than 1, so a light can be brighter than daylight. To me, that’s unrealistic, but that’s down to the developer.
- Anything in between (0-1) means that there’s some light in that area.
- The mask is only updated upon building or destroying a light.
- Mask is either off during the day, or at a low intensity when daylight is set to a lower value than 1.
- At sunset, the mask slowly gets blended into the game, at sunrise, the mask gets slowly blended out.
Instead of processing every light individually for every frame, the game now only needs to process a mask. Hopefully, this should result in lighting taking up less resources, and the game looking better.
Please note: special lighting like aircraft, taxiway and runway lighting should not be implemented in this mask, partially because taxiway/runway lights and plane indicator lights don’t give off light, and partially because the landing and taxi lights on a plane are constantly moving, which defeats the purpose of a static mask. Only static lights that actually illuminate an area should be implemented in this mask.
If anything is unclear, or you simply have a question, please do let me know. I’ll gladly try to explain my idea better, if I can.