From 8cbce5d86a9e2192deff7febe4ee17cb08cc6ae4 Mon Sep 17 00:00:00 2001 From: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com> Date: Fri, 5 Jul 2024 00:13:14 -0700 Subject: [PATCH 1/4] Adds a wider span for layers without mixup with planes The existing multiplier is lower then layer values encoraged by byond, so it breaks easy. Hopefully a larger value will help here. --- internal/app/render/bucket/level/chunk/unit/unit.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/app/render/bucket/level/chunk/unit/unit.go b/internal/app/render/bucket/level/chunk/unit/unit.go index 0d223c9a..4ce26519 100644 --- a/internal/app/render/bucket/level/chunk/unit/unit.go +++ b/internal/app/render/bucket/level/chunk/unit/unit.go @@ -91,7 +91,10 @@ func countLayer(p *dmmprefab.Prefab) float32 { plane, _ := p.Vars().Float("plane") layer, _ := p.Vars().Float("layer") - layer = plane*10_000 + layer*1000 + // Way larger then the "logical" max of (max normal layer value) + (max effect layer value) -> (4999) + (20000) + const layer_max = 100000 + + layer = plane * (layer_max + 1) + layer*1000 // When mobs are on the same Layer with object they are always rendered above them (BYOND specific stuff). if dm.IsPath(p.Path(), "/obj") { From 239a078af9435cf5647e7bfee160f4710ebd0680 Mon Sep 17 00:00:00 2001 From: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com> Date: Fri, 5 Jul 2024 00:18:29 -0700 Subject: [PATCH 2/4] let's lower that down to make INF less likely --- internal/app/render/bucket/level/chunk/unit/unit.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/app/render/bucket/level/chunk/unit/unit.go b/internal/app/render/bucket/level/chunk/unit/unit.go index 4ce26519..35c03877 100644 --- a/internal/app/render/bucket/level/chunk/unit/unit.go +++ b/internal/app/render/bucket/level/chunk/unit/unit.go @@ -92,7 +92,7 @@ func countLayer(p *dmmprefab.Prefab) float32 { layer, _ := p.Vars().Float("layer") // Way larger then the "logical" max of (max normal layer value) + (max effect layer value) -> (4999) + (20000) - const layer_max = 100000 + const layer_max = 40000 layer = plane * (layer_max + 1) + layer*1000 From ba7590948bf4a894ba1d0d5fea1527279251743f Mon Sep 17 00:00:00 2001 From: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com> Date: Fri, 5 Jul 2024 00:33:16 -0700 Subject: [PATCH 3/4] fuckoff big number --- internal/app/render/bucket/level/chunk/unit/unit.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/app/render/bucket/level/chunk/unit/unit.go b/internal/app/render/bucket/level/chunk/unit/unit.go index 35c03877..c75961d0 100644 --- a/internal/app/render/bucket/level/chunk/unit/unit.go +++ b/internal/app/render/bucket/level/chunk/unit/unit.go @@ -92,7 +92,7 @@ func countLayer(p *dmmprefab.Prefab) float32 { layer, _ := p.Vars().Float("layer") // Way larger then the "logical" max of (max normal layer value) + (max effect layer value) -> (4999) + (20000) - const layer_max = 40000 + const layer_max = 40000 * 1000 layer = plane * (layer_max + 1) + layer*1000 From f1531ea3b3ca759a951123d5c5b591a6bbf681c7 Mon Sep 17 00:00:00 2001 From: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com> Date: Fri, 5 Jul 2024 00:39:17 -0700 Subject: [PATCH 4/4] offset strategy --- .../app/render/bucket/level/chunk/unit/unit.go | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/internal/app/render/bucket/level/chunk/unit/unit.go b/internal/app/render/bucket/level/chunk/unit/unit.go index c75961d0..6e6c125f 100644 --- a/internal/app/render/bucket/level/chunk/unit/unit.go +++ b/internal/app/render/bucket/level/chunk/unit/unit.go @@ -91,10 +91,22 @@ func countLayer(p *dmmprefab.Prefab) float32 { plane, _ := p.Vars().Float("plane") layer, _ := p.Vars().Float("layer") - // Way larger then the "logical" max of (max normal layer value) + (max effect layer value) -> (4999) + (20000) - const layer_max = 40000 * 1000 + // Layers can have essentially effect values added onto them + // We should clip them off to reduce the max possible layer to like 4999 (likely far lower) + const BACKGROUND_LAYER = 20_000 + const TOPDOWN_LAYER = 10_000 + const EFFECTS_LAYER = 5000 + if layer > BACKGROUND_LAYER { + layer -= BACKGROUND_LAYER + } + if layer > TOPDOWN_LAYER { + layer -= TOPDOWN_LAYER + } + if layer > EFFECTS_LAYER { + layer -= EFFECTS_LAYER + } - layer = plane * (layer_max + 1) + layer*1000 + layer = plane*10_000 + layer*1000 // When mobs are on the same Layer with object they are always rendered above them (BYOND specific stuff). if dm.IsPath(p.Path(), "/obj") {