#166-#173: plainer words, a point to shoot at, and a catalog that says when it is broken
Eight tickets. The last one is the interesting one. #166 - PLAINER DIALOG. Every spoken line rewritten: the nine prologue lines and all twenty quest brief/done pairs. Mostly splitting em-dash subclauses into sentences and dropping the literary register ("hulls" -> "ships", "That is our hands back" -> "That frees us for other work"). Same meaning, same voice. #167 - NOTHING ANNOUNCED TWICE. Quests carry an `important` flag; seven of the twenty have it, and they are the search for the World Ship. A quest handed out with its goal ALREADY met is now credited in silence unless it is one of those - no brief, no answer, both signals still fired and the index still moved, so it appears ticked in the objectives panel. The chain used to stop the game to set a task the player had already done, then stop it again to congratulate them on it. #168 - THE KEYBOARD CAN ANSWER A DIALOG. The rule the ticket asks for (still arriving, show it all; already whole, move on) was already the rule for a click since #149, but a key press reached the banner and did nothing - and this game is played with WASD and a mouse. Touch, click and key now go through one door. Modifiers alone and auto-repeat echoes are not presses. #169 - A LOADING SCREEN. A press raises a cover, and the load happens after it has been on screen for a frame, so the wait is something the player is watching. Deliberately still a blocking load: load_threaded_request() comes back FAILED for these scenes, reporting text-parse errors that load() does not produce, because the global class names and preloads they reach each other through are not resolvable off the loading thread. A progress bar is not worth a menu that sometimes refuses to start the game, and the web build ships with thread support off anyway. Further presses while loading are ignored - on the web a button fires on PRESS, so an impatient double tap costs nothing to make and used to build the world twice. #170 - THE PICTURE BEFORE THE CAPTION. The prologue's first line was up before the scene had finished arriving, so the game opened STOPPED (#128) over a convoy nobody had seen yet. It flies for three seconds first. #171 - THE CONTROLS FOLLOW WHAT IS BEING HELD. is_touchscreen_available() asks whether a touch COULD arrive, and in a browser that is yes on any laptop whose panel reports touch support - so the web build put thumb sticks over a screen being played with a mouse, and switched mouse aiming off on the machine it exists for. The reading is now the last input actually used, it lives in GameState so the sticks and the guns cannot disagree, and it is two-way: nothing can strand a tablet, because the gesture that needs the controls is the gesture that brings them back. A touch suppresses mouse evidence for a second, so the click Godot manufactures out of a tap is not mistaken for a mouse. #172 - AIM AT A PLACE. Every gun was handed the same direction, so a fleet firing at something threw a sheet of parallel bolts past either side of it and only the middle hull could hit - worse the wider the formation. Guns now take a POINT and each hull works out its own heading to it, so the fleet's fire converges. The mouse already had a place and was flattening it into a bearing; a pushed stick names the point at the guns' reach along it, so touch loses nothing. The assist (#89) still bends a shot onto an enemy, now per hull and around that hull's own heading. The aim guide stops at the point and marks it. #173 - AND THE ONE THAT EXPLAINS ITSELF. "In the web export version the fleet can not store any resources" is not a web bug. It is the third time the Godot editor's .tres writer has quietly dropped a property it thought was default-valued: InterceptorVesselDefinition losing `capabilities` leaves cargo_capacity at 20 and takes away the "cargo" claim that fleet_cargo_capacity() actually gates on, so the hold is zero and nothing can be mined or carried. That is the symptom, word for word. test_definitions_intact caught it in the suite. What it could not do is catch it in a BUILD - an export is taken from the working tree at whatever moment the editor last touched it, which is exactly when the damage is done and exactly where nobody is running tests. The checks move to core/CatalogCheck.gd and now run at startup in every build as well as in the test, from the same function. On the web push_error lands in the on-page log web_shell.html mirrors, which is the only error a phone can read. The tree is intact today, so a fresh export should restore the hold. The point of the change is that the next time it is not, the build says so. Full suite green at 154/154. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0139MmxRAJSUe1j77kftAWv3
This commit is contained in:
parent
3fcc26c8bc
commit
0fad1dd155
24 changed files with 1372 additions and 286 deletions
126
ui/LoadingScreen.gd
Normal file
126
ui/LoadingScreen.gd
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
class_name LoadingScreen
|
||||
extends Control
|
||||
|
||||
# Forgejo #169: "create a loading screen after clicking on the main menu
|
||||
# buttons."
|
||||
#
|
||||
# Pressing Play used to do nothing visible for as long as the scene took to
|
||||
# build - several seconds in a browser - and a button that does nothing reads
|
||||
# as a button that was not pressed, so the player presses it again. The whole
|
||||
# job of this is to answer the press immediately: a cover over the menu, the
|
||||
# name of what is being opened, and a bar that moves.
|
||||
#
|
||||
# Two things make the answer immediate rather than merely eventual:
|
||||
#
|
||||
# 1. It goes up BEFORE the load starts, and the load waits for it to have
|
||||
# been on screen for a frame or two (see `frames_shown` and
|
||||
# MainMenu._process). A screen raised in the same frame as a blocking
|
||||
# load is a screen nobody ever sees.
|
||||
# 2. The bar reports nothing it does not know. The load is one blocking call
|
||||
# (see MainMenu._process for why it is not a threaded one), so there is
|
||||
# no progress to report and the bar does not pretend there is: it is a
|
||||
# sweep, which says "working" without claiming to say how far.
|
||||
#
|
||||
# A Control built in code rather than a scene: it is one panel of geometry
|
||||
# with nothing to author, and building it here keeps MainMenu.tscn - which the
|
||||
# player's own editor touches - out of the change.
|
||||
|
||||
const BACKDROP: Color = Color(0.01, 0.02, 0.06, 0.94)
|
||||
const GLOW: Color = Color(0.42, 0.86, 0.95)
|
||||
const TEXT: Color = Color(0.82, 0.94, 1.0)
|
||||
const MUTED: Color = Color(0.52, 0.66, 0.76)
|
||||
const TITLE_SIZE: int = 44
|
||||
const SUBTITLE_SIZE: int = 24
|
||||
const BAR_WIDTH: float = 520.0
|
||||
const BAR_HEIGHT: float = 16.0
|
||||
const BAR_GAP: float = 46.0
|
||||
# The travelling band inside the bar, and how much of the bar it covers.
|
||||
const SWEEP_SECONDS: float = 1.2
|
||||
const SWEEP_WIDTH: float = 0.22
|
||||
|
||||
var title_label: Label
|
||||
var subtitle_label: Label
|
||||
# How many frames this has been up and running. MainMenu waits for this before
|
||||
# it starts the blocking part - see the note above. Counted in _process rather
|
||||
# than in _draw so the count still advances under the headless renderer, where
|
||||
# nothing paints and a test would otherwise wait for ever.
|
||||
var frames_shown: int = 0
|
||||
|
||||
var _elapsed: float = 0.0
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
# Covers whatever is behind it and swallows nothing: the menu's buttons
|
||||
# check for a modal themselves (see IconButton._blocked_by_modal), and
|
||||
# MainMenu refuses a second press while a load is running anyway.
|
||||
mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
set_anchors_preset(Control.PRESET_FULL_RECT)
|
||||
title_label = _make_label("LOADING", TITLE_SIZE, TEXT)
|
||||
subtitle_label = _make_label("", SUBTITLE_SIZE, MUTED)
|
||||
resized.connect(_layout)
|
||||
_layout()
|
||||
|
||||
|
||||
func _make_label(text_value: String, font_size: int, colour: Color) -> Label:
|
||||
var label := Label.new()
|
||||
label.text = text_value
|
||||
label.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
label.add_theme_font_size_override("font_size", font_size)
|
||||
label.add_theme_color_override("font_color", colour)
|
||||
label.add_theme_color_override("font_outline_color", Color(0.01, 0.02, 0.06, 0.95))
|
||||
label.add_theme_constant_override("outline_size", 3)
|
||||
label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
label.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
|
||||
add_child(label)
|
||||
return label
|
||||
|
||||
|
||||
# What is being opened, in the player's words rather than a file name.
|
||||
func begin(what: String) -> void:
|
||||
if subtitle_label != null:
|
||||
subtitle_label.text = what
|
||||
|
||||
|
||||
func _bar_rect() -> Rect2:
|
||||
var width: float = minf(BAR_WIDTH, maxf(size.x - 120.0, 40.0))
|
||||
return Rect2(Vector2((size.x - width) * 0.5, size.y * 0.5 + BAR_GAP),
|
||||
Vector2(width, BAR_HEIGHT))
|
||||
|
||||
|
||||
func _layout() -> void:
|
||||
if title_label == null:
|
||||
return
|
||||
title_label.position = Vector2(0.0, size.y * 0.5 - float(TITLE_SIZE) * 1.4)
|
||||
title_label.size = Vector2(size.x, float(TITLE_SIZE) * 1.4)
|
||||
subtitle_label.position = Vector2(0.0, size.y * 0.5)
|
||||
subtitle_label.size = Vector2(size.x, float(SUBTITLE_SIZE) * 1.6)
|
||||
queue_redraw()
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
_elapsed += delta
|
||||
frames_shown += 1
|
||||
queue_redraw()
|
||||
|
||||
|
||||
func _draw() -> void:
|
||||
draw_rect(Rect2(Vector2.ZERO, size), BACKDROP)
|
||||
|
||||
var bar: Rect2 = _bar_rect()
|
||||
draw_rect(bar, Color(GLOW, 0.14))
|
||||
# A band travelling the length of the bar. It stops moving while the load
|
||||
# blocks, which is honest - the whole engine has stopped - and it is the
|
||||
# thing that says "working" on the frames either side of that.
|
||||
var head: float = fposmod(_elapsed, SWEEP_SECONDS) / SWEEP_SECONDS
|
||||
var band: float = bar.size.x * SWEEP_WIDTH
|
||||
var x: float = bar.position.x + (bar.size.x + band) * head - band
|
||||
var left: float = maxf(x, bar.position.x)
|
||||
var right: float = minf(x + band, bar.end.x)
|
||||
if right > left:
|
||||
draw_rect(Rect2(Vector2(left, bar.position.y),
|
||||
Vector2(right - left, bar.size.y)), Color(GLOW, 0.8))
|
||||
|
||||
NeonDraw.draw_glowing_path(self, PackedVector2Array([
|
||||
bar.position, Vector2(bar.end.x, bar.position.y), bar.end,
|
||||
Vector2(bar.position.x, bar.end.y), bar.position,
|
||||
]), Color(GLOW, 0.8), 0.7, 0.5)
|
||||
1
ui/LoadingScreen.gd.uid
Normal file
1
ui/LoadingScreen.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://dneh3kfa08bv8
|
||||
|
|
@ -32,6 +32,25 @@ const STATUS_HEIGHT: float = 70.0
|
|||
@onready var dev_label: Label = $UI/DevModeLabel
|
||||
@onready var status_label: Label = $UI/StatusLabel
|
||||
|
||||
# #169: what is being opened, and the cover that says so. Empty path means
|
||||
# nothing is loading, which is also what stops a second press starting a
|
||||
# second scene - on the web a button fires on PRESS (see IconButton), and an
|
||||
# impatient double tap on Play would otherwise build the world twice.
|
||||
const LOADING_SCREEN = preload("res://ui/LoadingScreen.gd")
|
||||
# How the player is told what they are waiting for. Keyed by scene path so a
|
||||
# new entry cannot go in without a name to put on the screen.
|
||||
const SCENE_NAMES: Dictionary = {
|
||||
"res://world/Main.tscn": "Entering the convoy lane",
|
||||
"res://surface/PlanetSetupEditor.tscn": "Opening the map editor",
|
||||
}
|
||||
# The load only starts once the cover has been up for a frame or two. One
|
||||
# would do; two is cheap and removes any argument about whether the first one
|
||||
# reached the screen.
|
||||
const COVER_FRAMES: int = 2
|
||||
|
||||
var loading_path: String = ""
|
||||
var loading_screen: Control = null
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
# #148: the theme starts here, at the first screen, and keeps playing
|
||||
|
|
@ -93,6 +112,11 @@ func _layout_stack() -> void:
|
|||
|
||||
|
||||
func _on_play_pressed() -> void:
|
||||
# Checked here as well as in _start: this one has a side effect, and a
|
||||
# second press while the first is still loading must not wipe the game
|
||||
# that first press already set up (#169).
|
||||
if loading_path != "":
|
||||
return
|
||||
GameState.reset_new_game()
|
||||
_start("res://world/Main.tscn")
|
||||
|
||||
|
|
@ -102,21 +126,71 @@ func _on_play_pressed() -> void:
|
|||
# there was no way to tell which part failed. Split out, each step can say so
|
||||
# - and a scene change that fails otherwise leaves the menu up, which looks
|
||||
# exactly like an unpressed button.
|
||||
#
|
||||
# #169: and now it does not look like anything else either. The press raises a
|
||||
# loading screen straight away and the load itself happens over the following
|
||||
# frames, driven from _process below, so the wait is something the player is
|
||||
# watching rather than a menu that has stopped responding.
|
||||
func _start(scene_path: String) -> void:
|
||||
if loading_path != "":
|
||||
return
|
||||
loading_path = scene_path
|
||||
status_label.text = ""
|
||||
loading_screen = LOADING_SCREEN.new()
|
||||
$UI.add_child(loading_screen)
|
||||
loading_screen.begin(String(SCENE_NAMES.get(scene_path, scene_path.get_file())))
|
||||
|
||||
|
||||
# The load itself is still the ordinary blocking one, deliberately.
|
||||
#
|
||||
# ResourceLoader.load_threaded_request() was the obvious alternative and it
|
||||
# does not work here: asked for these scenes it comes back FAILED, with the
|
||||
# text-scene parser reporting errors ("Parse Error ... Rock.tscn:9", "Could
|
||||
# not resolve external class member PROFILES") that the same files do not
|
||||
# produce through load(). The project's scripts and scenes reach each other
|
||||
# through global class names and preloads, and that resolution is not
|
||||
# available off the loading thread. A progress bar is not worth a menu that
|
||||
# sometimes refuses to start the game - and the web build could not have used
|
||||
# the threaded path anyway, since it ships with thread support off.
|
||||
#
|
||||
# So what the cover buys is honest and worth having on its own: the press is
|
||||
# answered instantly, the player is told what is opening, and the frame that
|
||||
# blocks happens with something on the screen rather than behind a menu that
|
||||
# has stopped responding.
|
||||
func _process(_delta: float) -> void:
|
||||
if loading_path == "":
|
||||
return
|
||||
# Nothing blocking until the cover is actually up - see LoadingScreen's
|
||||
# own note. This is the whole reason the load waits for a frame at all.
|
||||
if loading_screen == null or loading_screen.frames_shown < COVER_FRAMES:
|
||||
return
|
||||
var scene_path: String = loading_path
|
||||
loading_path = ""
|
||||
var packed: PackedScene = load(scene_path)
|
||||
if packed == null:
|
||||
status_label.text = "Could not load %s" % scene_path.get_file()
|
||||
_abandon_loading("Could not load %s" % scene_path.get_file())
|
||||
return
|
||||
var scene: Node = packed.instantiate()
|
||||
if scene == null:
|
||||
status_label.text = "Could not build %s" % scene_path.get_file()
|
||||
_abandon_loading("Could not build %s" % scene_path.get_file())
|
||||
return
|
||||
get_tree().root.add_child(scene)
|
||||
get_tree().current_scene = scene
|
||||
queue_free()
|
||||
|
||||
|
||||
# A failed load must leave a working menu behind, not a cover over a screen
|
||||
# with nothing coming.
|
||||
func _abandon_loading(message: String) -> void:
|
||||
if loading_screen != null:
|
||||
loading_screen.queue_free()
|
||||
loading_screen = null
|
||||
status_label.text = message
|
||||
|
||||
|
||||
func _on_dev_mode_pressed() -> void:
|
||||
if loading_path != "":
|
||||
return
|
||||
# Guarded as well as hidden. Visibility is presentation; this is the rule.
|
||||
if not is_developer_build():
|
||||
status_label.text = "Dev mode only runs from Godot"
|
||||
|
|
|
|||
|
|
@ -35,6 +35,10 @@ extends Control
|
|||
# is not a flourish: without it, a player who clicks quickly through two
|
||||
# lines never sees the second one at all, and the whole point of #127 was
|
||||
# that lines wait for the reader.
|
||||
#
|
||||
# #168 says the same rule out loud - still arriving, show it all; already
|
||||
# whole, move on - and extends it to the KEYBOARD, which had no way in at
|
||||
# all. See _is_advance_press.
|
||||
|
||||
signal dismissed
|
||||
|
||||
|
|
@ -263,13 +267,35 @@ func _process(delta: float) -> void:
|
|||
queue_redraw()
|
||||
|
||||
|
||||
# #168: what counts as "go on". A tap, a left click, or a key.
|
||||
#
|
||||
# The rule the ticket asks for was already the rule for a click (#149) - a
|
||||
# press finishes a line still arriving, a press on a finished line moves to
|
||||
# the next - but the game is played on a desktop with WASD and a mouse, and
|
||||
# a keyboard press reached nothing at all. Sitting behind a dialog pressing
|
||||
# space is the most obvious thing a player can do, so the keyboard now goes
|
||||
# through the same one door every other press does (dismiss()).
|
||||
#
|
||||
# Modifiers alone are not a press: holding shift before typing must not eat
|
||||
# a line. Neither is an auto-repeat echo - a held key would otherwise run
|
||||
# the whole queue out in a second.
|
||||
func _is_advance_press(event: InputEvent) -> bool:
|
||||
if event is InputEventScreenTouch:
|
||||
return event.pressed
|
||||
if event is InputEventMouseButton:
|
||||
return event.pressed and event.button_index == MOUSE_BUTTON_LEFT
|
||||
if event is InputEventKey:
|
||||
if not event.pressed or event.echo:
|
||||
return false
|
||||
return not (event.keycode in [KEY_SHIFT, KEY_CTRL, KEY_ALT, KEY_META,
|
||||
KEY_CAPSLOCK, KEY_NUMLOCK, KEY_SCROLLLOCK])
|
||||
return false
|
||||
|
||||
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
if current == "":
|
||||
return
|
||||
var pressed: bool = (event is InputEventScreenTouch and event.pressed) \
|
||||
or (event is InputEventMouseButton and event.pressed \
|
||||
and event.button_index == MOUSE_BUTTON_LEFT)
|
||||
if not pressed:
|
||||
if not _is_advance_press(event):
|
||||
return
|
||||
# A dismissed line eats the press: it must not also be steering the
|
||||
# fleet or firing something on the way through.
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ func _refresh() -> void:
|
|||
if quest.is_empty():
|
||||
heading_label.text = "NOTHING OUTSTANDING"
|
||||
quest_label.text = "The list has run out."
|
||||
objective_label.text = "The search does not stop because there is nothing left to tick off."
|
||||
objective_label.text = "The search goes on, even with nothing left to tick off."
|
||||
count_label.text = ""
|
||||
progress = Vector2i(1, 1)
|
||||
else:
|
||||
|
|
|
|||
Loading…
Reference in a new issue