Planetary Lighting Optimization Attempt

Changes how lighting is applied to the Surface.

The current method works by making every tile glow in a specific color and intensity. The issue is that when it is time to change the color/intensity, it can take the light controller a considerable amount of time for it to update every tile (estimated to be around 14,000 tiles), which can take a minute or two for the lighting controller to finish.

New method is to have a special light source for the surface, with different properties to the 'regular' light source that most things use for making light. The special version doesn't care about line of sight or lighting falloff. This special light source is applied to a series of invisible 'sun' objects that get generated as the planetary controller gets created. When the lights need to change, the lighting controller has to change a much smaller group of objects instead of literally every outdoor tile.
This commit is contained in:
Neerti
2018-02-10 07:16:56 -05:00
parent 6c1ab66d44
commit b95562a2ff
5 changed files with 144 additions and 2 deletions

View File

@@ -61,6 +61,13 @@ var/datum/controller/process/planet/planet_controller = null
if(P.needs_work & PLANET_PROCESS_SUN)
P.needs_work &= ~PLANET_PROCESS_SUN
//Redraw sun overlay
var/new_brightness = P.sun["brightness"]
var/new_color = P.sun["color"]
for(var/A in P.planet_suns)
var/obj/effect/sun/sun = A
sun.set_light(sun.light_range, new_brightness, new_color)
SCHECK
/*
var/new_range = P.sun["range"]
var/new_brightness = P.sun["brightness"]
var/new_color = P.sun["color"]
@@ -68,6 +75,7 @@ var/datum/controller/process/planet/planet_controller = null
var/turf/simulated/turf = T
turf.set_light(new_range, new_brightness, new_color)
SCHECK
*/
//Temperature needs updating
if(P.needs_work & PLANET_PROCESS_TEMP)