From a11c3c42163684cce726462f995e7af9553c36bd Mon Sep 17 00:00:00 2001 From: yairm210 Date: Tue, 27 May 2025 07:50:04 +0300 Subject: [PATCH] Warn of rendering performance problems for split atlases --- .../ruleset/validation/RulesetValidator.kt | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/core/src/com/unciv/models/ruleset/validation/RulesetValidator.kt b/core/src/com/unciv/models/ruleset/validation/RulesetValidator.kt index 0f1c7ccb61..093502a3d3 100644 --- a/core/src/com/unciv/models/ruleset/validation/RulesetValidator.kt +++ b/core/src/com/unciv/models/ruleset/validation/RulesetValidator.kt @@ -129,6 +129,7 @@ class RulesetValidator(val ruleset: Ruleset) { checkMisspelledFolders(folder, lines) checkImagesFolders(folder, lines) checkUnknownJsonFilenames(folder, lines) + warnSplitAtlasesPerformanceDegradation(folder, lines) } private fun checkMisspelledFolders( @@ -193,18 +194,31 @@ class RulesetValidator(val ruleset: Ruleset) { ) { val jsonFolder = folder.child("jsons") if (!jsonFolder.exists()) return - + for (file in jsonFolder.list("json")) { if (file.name() in RulesetFile.entries.map { it.filename }) continue var text = "File ${file.name()} is in the jsons folder but is not a recognized ruleset file" val possibleMisspellings = getPossibleMisspellings(file.name(), RulesetFile.entries.map { it.filename }) - if (possibleMisspellings.isNotEmpty()) + if (possibleMisspellings.isNotEmpty()) text += "\nPossible misspelling of: " + possibleMisspellings.joinToString("/") lines.add(text, RulesetErrorSeverity.OK) } } + private fun warnSplitAtlasesPerformanceDegradation( + folder: FileHandle, + lines: RulesetErrorList + ) { + if (folder.child("game2.png").exists()){ + lines.add( + "Your images are being generated into multiple atlas files - this can cause lag for players. " + + "Please consult https://yairm210.github.io/Unciv/Modders/Images-and-Audio/#rendering-performance on how to improve rendering performance.", + RulesetErrorSeverity.WarningOptionsOnly, sourceObject = null + ) + } + } + private fun addModOptionsErrors(lines: RulesetErrorList, tryFixUnknownUniques: Boolean) { // Basic Unique validation (type, target, parameters) should always run.