Adds a visualizer for lighting object updating. Optimizes the same (#67678)

It occured to me, we didn't have a good way to "see" what turfs were actually being updated
Figured I'd fix that

I've also added some debug vars on SSlighting to make testing with/without some checks easier

Speaking of which, I've added a second check to lighting corner updating
Basically, if our past and current cached rgb values are the same, there's no point updating

This is possible because static lighting is relative. If you've got a
TON of blue, it'll outweight the red and green you have in smaller amounts

We also do some rounding to ensure values look right

Similarly, if you've got roughly the same lighting, and a bit of something you already have a lot of is added, you're not likely to actually enter a new "bracket" of color

Anyway uh, it's hard to profile this, but I've seen it help quite a bit, mostly with things like emergency lighting that updates lighting in small amounts often, and in constricted spaces.

To some extent just comes down to map design

(cherry picked from commit a6d4e180ad)

# Conflicts:
#	code/modules/lighting/lighting_object.dm

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
This commit is contained in:
nevimer
2023-01-20 14:25:43 -05:00
committed by GitHub
parent d28142b30a
commit b095316f2f
5 changed files with 17 additions and 0 deletions
+4
View File
@@ -6,6 +6,10 @@ SUBSYSTEM_DEF(lighting)
var/static/list/sources_queue = list() // List of lighting sources queued for update.
var/static/list/corners_queue = list() // List of lighting corners queued for update.
var/static/list/objects_queue = list() // List of lighting objects queued for update.
#ifdef VISUALIZE_LIGHT_UPDATES
var/allow_duped_values = FALSE
var/allow_duped_corners = FALSE
#endif
/datum/controller/subsystem/lighting/stat_entry(msg)
msg = "L:[length(sources_queue)]|C:[length(corners_queue)]|O:[length(objects_queue)]"
+1
View File
@@ -569,6 +569,7 @@ SUBSYSTEM_DEF(timer)
* * callback the callback to call on timer finish
* * wait deciseconds to run the timer for
* * flags flags for this timer, see: code\__DEFINES\subsystems.dm
* * timer_subsystem the subsystem to insert this timer into
*/
/proc/_addtimer(datum/callback/callback, wait = 0, flags = 0, datum/controller/subsystem/timer/timer_subsystem, file, line)
if (!callback)