H2: Graphics presets, OpenGL fallback notice, tested configurations
Presets now tune shadows, cascades, render scale and anti-aliasing: Low (no shadows, 75%, FXAA), Medium (200 m, 2 cascades, FXAA), High (400 m, 4 cascades, MSAA 2x). GameSettings.apply_to_viewport sets the viewport; MatchView.apply_settings sets the sun's cascades. No preset changes how far props or pieces are drawn, so a lower one never shows a player through cover; a test guards it. When Vulkan can't start, Godot falls back to OpenGL (fallback_to_opengl3) and RendererCheck has the main menu say so. tools/capture.sh gains CAPTURE_RENDERER=no_vulkan, which hides the Vulkan driver and expects the fallback. New scenarios quality_low/medium/high draw a match moment with each preset, reviewed in both renderers. docs/PLAY.md lists the presets, renderers, Wayland and hybrid-GPU notes, and the tested configurations, marking each as software-rendered only or not tested. Closes #55 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -44,6 +44,8 @@ func _ready() -> void:
|
||||
_start_browsing()
|
||||
return
|
||||
var windowed: bool = DisplayServer.get_name() != "headless" and not _config.autoplay
|
||||
if windowed and not RendererCheck.fallback_notice().is_empty():
|
||||
print("tidewall: " + RendererCheck.fallback_notice())
|
||||
if windowed and not _config.asked:
|
||||
# The game as a player starts it: the main menu.
|
||||
_open_shell()
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
## H2: tells the player when the game isn't drawing with the renderer it was made for.
|
||||
## Tidewall asks for Forward+ on Vulkan. Where Vulkan can't start (no driver, or an old
|
||||
## GPU), Godot falls back to OpenGL (Compatibility, the project's
|
||||
## fallback_to_opengl3) instead of crashing, and the main menu says so.
|
||||
class_name RendererCheck
|
||||
extends RefCounted
|
||||
|
||||
const NOTICE: String = "Vulkan isn't available here, so Tidewall is drawing with OpenGL instead. It works, but the sea and light may look a little different. An up-to-date graphics driver may bring Vulkan back."
|
||||
|
||||
|
||||
## The notice for this run, or "" when the renderer is the one asked for, the player
|
||||
## chose one on the command line, or nothing is drawn.
|
||||
static func fallback_notice() -> String:
|
||||
if DisplayServer.get_name() == "headless":
|
||||
return ""
|
||||
return notice_for(
|
||||
String(ProjectSettings.get_setting("rendering/renderer/rendering_method", "forward_plus")),
|
||||
RenderingServer.get_current_rendering_method(),
|
||||
OS.get_cmdline_args())
|
||||
|
||||
|
||||
static func notice_for(wanted: String, actual: String, args: PackedStringArray) -> String:
|
||||
if actual.is_empty() or actual == wanted:
|
||||
return ""
|
||||
for arg: String in args:
|
||||
if arg.begins_with("--rendering-method") or arg.begins_with("--rendering-driver"):
|
||||
return ""
|
||||
return NOTICE
|
||||
@@ -0,0 +1 @@
|
||||
uid://duaotpjllo5rf
|
||||
@@ -8,16 +8,23 @@ extends RefCounted
|
||||
|
||||
const DEFAULT_PATH: String = InputSettings.DEFAULT_PATH
|
||||
|
||||
## Graphics quality presets (H2 tunes what each does).
|
||||
## Graphics quality presets (H2; documented in docs/PLAY.md).
|
||||
const QUALITY_NAMES: Array[String] = ["Low", "Medium", "High"]
|
||||
const QUALITY_LOW: int = 0
|
||||
const QUALITY_MEDIUM: int = 1
|
||||
const QUALITY_HIGH: int = 2
|
||||
## Per preset: sun shadow distance in metres (0 = no shadows) and 3D render scale.
|
||||
## Per preset:
|
||||
## shadow_distance how far the sun casts shadows, in metres (0 = no shadows)
|
||||
## shadow_splits the sun's shadow cascades: 1, 2 or 4
|
||||
## render_scale the 3D resolution against the window's
|
||||
## msaa multisample anti-aliasing (a Viewport.MSAA_ value)
|
||||
## fxaa the cheap screen-space anti-aliasing, for presets without MSAA
|
||||
## Nothing here changes what can be seen: trees, rocks and pieces are drawn as far on
|
||||
## every preset, so a lower one never shows a player through cover.
|
||||
const QUALITY: Array[Dictionary] = [
|
||||
{"shadow_distance": 0.0, "render_scale": 0.75},
|
||||
{"shadow_distance": 200.0, "render_scale": 1.0},
|
||||
{"shadow_distance": 400.0, "render_scale": 1.0},
|
||||
{"shadow_distance": 0.0, "shadow_splits": 1, "render_scale": 0.75, "msaa": Viewport.MSAA_DISABLED, "fxaa": true},
|
||||
{"shadow_distance": 200.0, "shadow_splits": 2, "render_scale": 1.0, "msaa": Viewport.MSAA_DISABLED, "fxaa": true},
|
||||
{"shadow_distance": 400.0, "shadow_splits": 4, "render_scale": 1.0, "msaa": Viewport.MSAA_2X, "fxaa": false},
|
||||
]
|
||||
const WINDOW_MODES: Array[String] = ["Windowed", "Fullscreen", "Exclusive fullscreen"]
|
||||
## Frame caps offered, 0 for none.
|
||||
@@ -73,6 +80,19 @@ func render_scale() -> float:
|
||||
return float(QUALITY[quality]["render_scale"])
|
||||
|
||||
|
||||
func shadow_splits() -> int:
|
||||
return int(QUALITY[quality]["shadow_splits"])
|
||||
|
||||
|
||||
## Render scale and anti-aliasing on the viewport the match is drawn in.
|
||||
func apply_to_viewport(viewport: Viewport) -> void:
|
||||
if viewport == null:
|
||||
return
|
||||
viewport.scaling_3d_scale = render_scale()
|
||||
viewport.msaa_3d = QUALITY[quality]["msaa"]
|
||||
viewport.screen_space_aa = Viewport.SCREEN_SPACE_AA_FXAA if QUALITY[quality]["fxaa"] else Viewport.SCREEN_SPACE_AA_DISABLED
|
||||
|
||||
|
||||
func save(path: String = DEFAULT_PATH) -> Error:
|
||||
var config: ConfigFile = ConfigFile.new()
|
||||
# The mouse keeps its own section, as InputSettings has always saved it.
|
||||
@@ -133,8 +153,8 @@ func apply_to_program(tree: SceneTree) -> void:
|
||||
var modes: Array[DisplayServer.WindowMode] = [DisplayServer.WINDOW_MODE_WINDOWED, DisplayServer.WINDOW_MODE_FULLSCREEN, DisplayServer.WINDOW_MODE_EXCLUSIVE_FULLSCREEN]
|
||||
if DisplayServer.window_get_mode() != modes[window_mode]:
|
||||
DisplayServer.window_set_mode(modes[window_mode])
|
||||
if tree != null and tree.root != null:
|
||||
tree.root.scaling_3d_scale = render_scale()
|
||||
if tree != null:
|
||||
apply_to_viewport(tree.root)
|
||||
|
||||
|
||||
## Sets the Master bus, and the Music and Effects buses, making them if they aren't
|
||||
|
||||
@@ -30,6 +30,8 @@ func apply_settings(settings: GameSettings) -> void:
|
||||
if sun != null:
|
||||
sun.shadow_enabled = distance > 0.0
|
||||
sun.directional_shadow_max_distance = maxf(distance, 1.0)
|
||||
var splits: Dictionary = {1: DirectionalLight3D.SHADOW_ORTHOGONAL, 2: DirectionalLight3D.SHADOW_PARALLEL_2_SPLITS, 4: DirectionalLight3D.SHADOW_PARALLEL_4_SPLITS}
|
||||
sun.directional_shadow_mode = splits.get(settings.shadow_splits(), DirectionalLight3D.SHADOW_PARALLEL_4_SPLITS)
|
||||
if print_pass != null:
|
||||
print_pass.visible = settings.print_pass
|
||||
|
||||
|
||||
@@ -324,6 +324,17 @@ func _build_main() -> void:
|
||||
motto.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
motto.add_theme_font_size_override("font_size", FONT_SMALL)
|
||||
column.add_child(motto)
|
||||
var fallback: String = RendererCheck.fallback_notice()
|
||||
if not fallback.is_empty():
|
||||
var notice: Label = Label.new()
|
||||
notice.name = "RendererNotice"
|
||||
notice.text = fallback
|
||||
notice.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
||||
notice.custom_minimum_size = Vector2(460.0, 0.0)
|
||||
notice.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
notice.add_theme_font_size_override("font_size", FONT_SMALL)
|
||||
notice.add_theme_color_override("font_color", Palette.OCHRE_RED)
|
||||
column.add_child(notice)
|
||||
_button(column, "Practice against bots", func() -> void: show_screen("practice"))
|
||||
_button(column, "Join a server", func() -> void: show_screen("join"))
|
||||
_button(column, "Settings", func() -> void: show_screen("settings"))
|
||||
|
||||
Reference in New Issue
Block a user