Soften battlefield grid and guard text visibility

This commit is contained in:
2026-06-20 09:53:52 +09:00
parent 91aa912c61
commit 21246c602f
2 changed files with 114 additions and 16 deletions

View File

@@ -100,6 +100,8 @@ func _init() -> void:
_check_generated_terrain_textures(failures)
_check_generated_terrain_feature_textures(failures)
_check_scene_texture_loading(failures)
_check_map_overlay_softness(failures)
_check_core_text_visibility(failures)
_check_hud_focus_text(failures)
_check_ancient_ui_theme(failures)
_check_opening_prologue_presentation(failures)
@@ -3235,6 +3237,102 @@ func _check_scenario_background_texture_loading(failures: Array[String]) -> void
scene.free()
func _check_map_overlay_softness(failures: Array[String]) -> void:
var scene = BattleSceneScript.new()
if not scene.state.load_battle("res://data/scenarios/001_yellow_turbans.json"):
failures.append("could not load battle scene state for map overlay softness")
scene.free()
return
var grass_fill: Color = scene._terrain_fill_color(Vector2i(1, 1), "G", true)
if grass_fill.a > 0.070:
failures.append("background-backed grass fill should stay subtle, got %.3f" % grass_fill.a)
var water_fill: Color = scene._terrain_fill_color(Vector2i(1, 1), "W", true)
if water_fill.a > 0.086:
failures.append("background-backed water fill should avoid blocky square color, got %.3f" % water_fill.a)
var grid_color: Color = scene._map_grid_color(true)
if grid_color.a > 0.010:
failures.append("background-backed grid should be nearly invisible, got %.3f" % grid_color.a)
var fallback_grid: Color = scene._map_grid_color(false)
if fallback_grid.a > 0.24:
failures.append("fallback grid should not become a harsh square net, got %.3f" % fallback_grid.a)
var grass_texture: Color = scene._terrain_texture_modulate(Vector2i(3, 4), "G", true)
if grass_texture.a > 0.235:
failures.append("background-backed grass texture should blend into the high-res map, got %.3f" % grass_texture.a)
var town_texture: Color = scene._terrain_texture_modulate(Vector2i(7, 5), "T", true)
if town_texture.a > 0.310:
failures.append("background-backed town texture should signal terrain without tiling loudly, got %.3f" % town_texture.a)
var fallback_texture: Color = scene._terrain_texture_modulate(Vector2i(3, 4), "G", false)
if fallback_texture.a < 0.50:
failures.append("fallback terrain texture should remain readable without a background, got %.3f" % fallback_texture.a)
scene.free()
func _check_core_text_visibility(failures: Array[String]) -> void:
var scene = BattleSceneScript.new()
scene._ready()
_check_readable_text_control(failures, scene.title_caption_label, "title campaign name", 26)
_check_readable_text_control(failures, scene.title_subtitle_label, "title subtitle", 13)
var title_feature: Node = scene.title_screen_root.find_child("TitleStoryFeaturePanel", true, false) if scene.title_screen_root != null else null
if title_feature == null:
failures.append("title text visibility check could not find story feature panel")
else:
_check_readable_text_control(failures, title_feature.find_child("TitleStoryFeatureTitle", true, false) as Control, "title story feature title", 14)
_check_readable_text_control(failures, title_feature.find_child("TitleStoryFeatureBody", true, false) as Control, "title story feature body", 10)
_check_readable_text_control(failures, scene.title_start_button, "title start button", 12)
_check_readable_text_control(failures, scene.title_load_button, "title load button", 12)
_check_readable_text_control(failures, scene.title_settings_button, "title settings button", 12)
scene._show_opening_prologue()
_check_readable_text_control(failures, scene.opening_prologue_title_label, "opening title", 16)
_check_readable_text_control(failures, scene.opening_prologue_body_label, "opening body", 13)
_check_readable_text_control(failures, scene.opening_prologue_step_label, "opening step", 11)
_check_readable_text_control(failures, scene.opening_prologue_next_button, "opening next button", 12)
_check_readable_text_control(failures, scene.opening_prologue_skip_button, "opening skip button", 11)
if not scene.state.load_battle("res://data/scenarios/001_yellow_turbans.json"):
failures.append("could not load battle scene state for text visibility")
scene.free()
return
scene._hide_opening_prologue()
scene.battle_started = true
scene.briefing_panel.visible = false
scene.result_panel.visible = false
scene._update_hud()
_check_readable_text_control(failures, scene.status_label, "top turn status", 11)
_check_readable_text_control(failures, scene.objective_label, "top objective", 11)
_check_readable_text_control(failures, scene.campaign_status_label, "top campaign status", 11)
var lines := scene._normalized_dialogue_lines([{"speaker": "Cao Cao", "display_speaker": "조조", "text": "영천으로 향한다. 백성이 빠져나갈 길을 연다."}])
scene.active_dialogue_lines = lines
scene.active_dialogue_index = 0
scene._render_dialogue_line()
_check_readable_text_control(failures, scene.dialogue_speaker_label, "dialogue speaker", 14)
_check_readable_text_control(failures, scene.dialogue_text_label, "dialogue body", 13)
scene.free()
func _check_readable_text_control(failures: Array[String], control: Control, context: String, min_font_size: int) -> void:
if control == null:
failures.append("%s text control missing" % context)
return
var text := ""
if control is Label:
text = str((control as Label).text).strip_edges()
elif control is Button:
text = str((control as Button).text).strip_edges()
else:
failures.append("%s should be a label or button for text visibility checks" % context)
return
if text.is_empty():
failures.append("%s should not render empty text" % context)
var font_size := control.get_theme_font_size("font_size")
if font_size < min_font_size:
failures.append("%s text should stay readable: font size %d < %d" % [context, font_size, min_font_size])
var font_color := control.get_theme_color("font_color")
if font_color.a < 0.72:
failures.append("%s text should not be transparent: %s" % [context, str(font_color)])
func _check_hud_focus_text(failures: Array[String]) -> void:
var scene = BattleSceneScript.new()
if not scene.state.load_battle("res://data/scenarios/001_yellow_turbans.json"):
@@ -4802,8 +4900,8 @@ func _check_terrain_and_unit_presentation(failures: Array[String]) -> void:
failures.append("fallback terrain fill should be stronger than background fill")
var background_texture_modulate: Color = scene._terrain_texture_modulate(Vector2i(0, 0), "G", true)
var fallback_texture_modulate: Color = scene._terrain_texture_modulate(Vector2i(0, 0), "G", false)
if background_texture_modulate.a < 0.22:
failures.append("background terrain texture should be visible enough to make generated cells read as art: %.3f" % background_texture_modulate.a)
if background_texture_modulate.a < 0.18:
failures.append("background terrain texture should still leave a visible terrain hint over high-res art: %.3f" % background_texture_modulate.a)
if background_texture_modulate.a >= fallback_texture_modulate.a:
failures.append("background terrain texture should stay lighter than fallback terrain texture")
if scene._map_grid_color(true).a >= scene._map_grid_color(false).a: