From 415afe19f5d221a9b6f52288e0ee1702e305d1c8 Mon Sep 17 00:00:00 2001 From: Siphonight Date: Mon, 16 Nov 2026 12:37:03 +0100 Subject: [PATCH] =?UTF-8?q?Outil=20de=20test=20:=20LS=5FSEED=20pour=20repr?= =?UTF-8?q?oduire=20une=20map=20proc=C3=A9durale=20pr=C3=A9cise?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Le seed est loggué à chaque génération (MapManager.loadProceduralMap) « pour reproduire une map fautive », mais aucun injecteur n'existait : reproduire la map d'un gamelog utilisateur (ex : seed=1794824738987 du P1 v0.15.1, ennemis figés) exigeait un patch à la main — impossible sans modifier le code entre deux tests. LS_SEED suit le pattern LS_LEVEL (Game.java) : variable d'env lue à la construction du MapConfig, invalide/absente = seed temps réel (comportement normal inchangé). --- .../lostsector/map/procedural/MapConfig.java | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/lost-sector/src/main/java/com/ezardlabs/lostsector/map/procedural/MapConfig.java b/lost-sector/src/main/java/com/ezardlabs/lostsector/map/procedural/MapConfig.java index 60af9ad..bb6718a 100644 --- a/lost-sector/src/main/java/com/ezardlabs/lostsector/map/procedural/MapConfig.java +++ b/lost-sector/src/main/java/com/ezardlabs/lostsector/map/procedural/MapConfig.java @@ -47,7 +47,26 @@ public class MapConfig { this.minMapHeight = (int)((-3 * MapManager.TILE_SIZE) + MapManager.PROC_START_POS.y); this.maxMapHeight = (int)((3 * MapManager.TILE_SIZE) + MapManager.PROC_START_POS.y); - this.proceduralSeed = System.currentTimeMillis(); + /* + * LS_SEED (env) : reproduire une map procédurale PRÉCISE — le seed + * est loggué à chaque génération (MapManager.loadProceduralMap) + * précisément POUR reproduire les maps fautives des gamelogs + * utilisateur, mais aucun injecteur n'existait : la reproduction + * exigeait un patch à la main. Outil de test/dev, même pattern que + * LS_LEVEL (Game.java). Absent/invalide = seed temps réel + * (comportement normal). + */ + String seedEnv = System.getenv("LS_SEED"); + if (seedEnv != null && !seedEnv.isEmpty()) { + try { + this.proceduralSeed = Long.parseLong(seedEnv.trim()); + } catch (NumberFormatException e) { + GameLog.w("LS-MAP", "LS_SEED invalide ('" + seedEnv + "'), seed temps réel utilisé"); + this.proceduralSeed = System.currentTimeMillis(); + } + } else { + this.proceduralSeed = System.currentTimeMillis(); + } spawnSegments = new HashMap<>(); mainSegments = new HashMap<>();