[MIRROR] Ventcrawling improvements, performance and visual [MDB IGNORE] (#13461)

* Ventcrawling improvements, performance and visual (#66709)

* Initial pipecrawl work

Ok so pipecrawl images were updating EVERY TIME YOU MOVED
This was not good mojo

What I've done here is twofold
First, I ensured pipecrawl updates only when the net changes. This
breaks the current implementation, but I intend on fixing that

Second, I moved our method of getting pipes to the spatial grid
This isn't that great at the moment, but I intend on adding support for
tracking entered/exited cells, which should make this much better

* Much faster pipecrawling processing, niceties

Adds a concept called a cell tracker datum.
It manages a list of cells a passed in bound is "inside", and when
queried will return a list of new cells, and old cells.

Because we only really care about maintaining an absolute window of
"CELLS WE ARE IN" and less about always removing cells we're not in, we
can manage a second window to prevent moving up and down on a cell line
causing a ton of updates.

Uses this concept to optimize pipecrawling significantly, from 3ms per
call before to roughly 0.03ms per call.

Also moves pipecrawl images to their own plane, so they don't overlap ui
elements

* Pipecrawling effects niceties, direction help

You can now move in more then one direction when pipecrawling
This works as expected, if you hold up and left, move up for a while,
and come to a fork, you'll go left

Added some effects to pipecrawling. It'll darken the lighting plane
slightly, so you get a nice effect instead of just fullbright.
Also added a color matrix and drop shadow to the pipe images, this way
they stand out a bit more.

You now glide between pipe moves, rather then moving instantly. This
doesn't effect your actual move rate, but it no longer feels jittery
with say, 60fps

* Bounds

* Fixes runtimes, cache something somethign sonic speed

* Reworks how being interested in the spatial grid is tracked

Rather then checking multiple variables on the atom to consider, we
instead check for the existence of a string key.

This key is used by a list on the spatial grid subsystem to retrive a
cached list of all of the atoms "types"

Doing this requires doing a bit of extra work in
important_recursive_contents code, but it allows us to separate being a
part of the spatial grid from using important recursive contents, which
is very nice.

As a consequence, I've had to unroll some lazylist macros in important
recursive contents logic. It's not ""that"" bad but it's not great
either.

Oh and this adds a slight cost to enter/exit cell, but it's minimal.
Basically, rather then checking for different features of a grid member,
we just iterate the list their string key points to. Very handy

So there's an added cost of a list copy and all, but we save the
headache of more types technically increasing the cost of
addition/removal.

I also made adding/removing from the grid into one "pulbic" proc rather then two
different ones for each operation, because it was starting to get silly

* waaa waa it doesn't compile

* chord -> coord

* Ensures important_recursive_contents is actually emptied on removal

* Removes soul

* Kyler's review

Co-authored-by: Kylerace <kylerlumpkin1@ gmail.com>

* Kyler's review 2

Co-authored-by: Kylerace <kylerlumpkin1@ gmail.com>

* Kyler's review 3

Moves some procs around, improves some documentation, catches a few
small issues

Co-authored-by: Kylerace <kylerlumpkin1@ gmail.com>

* Ventcrawling improvements, performance and visual

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Co-authored-by: Kylerace <kylerlumpkin1@ gmail.com>
This commit is contained in:
SkyratBot
2022-05-09 16:06:38 +02:00
committed by GitHub
parent a5fbfaccbe
commit edfaf90ebf
13 changed files with 535 additions and 148 deletions

View File

@@ -200,6 +200,20 @@
name = "parallax whitifier plane master"
plane = PLANE_SPACE
/atom/movable/screen/plane_master/pipecrawl
name = "pipecrawl plane master"
plane = PIPECRAWL_IMAGES_PLANE
appearance_flags = PLANE_MASTER
blend_mode = BLEND_OVERLAY
/atom/movable/screen/plane_master/pipecrawl/Initialize(mapload)
. = ..()
// Makes everything on this plane slightly brighter
// Has a nice effect, makes thing stand out
color = list(1.2,0,0,0, 0,1.2,0,0, 0,0,1.2,0, 0,0,0,1, 0,0,0,0)
// This serves a similar purpose, I want the pipes to pop
add_filter("pipe_dropshadow", 1, drop_shadow_filter(x = -1, y= -1, size = 1, color = "#0000007A"))
/atom/movable/screen/plane_master/camera_static
name = "camera static plane master"
plane = CAMERA_STATIC_PLANE