Prepare alpha 11 with online diagnostics
This commit is contained in:
1 parent
d53467baf2
commit
4d9e6d9185
14 files changed
+550
-77
No files matched your search
@@ -12,13 +12,13 @@ const ENGLISH_UI := {
|
||||
"KOOPERATIVE VERTEIDIGUNG": "COOPERATIVE DEFENSE", "ZWEI KOMMANDANTEN • EIN GEMEINSAMER REAKTOR": "TWO COMMANDERS • ONE SHARED REACTOR",
|
||||
"GEMEINSAMER REAKTOR": "SHARED REACTOR", "SCHNELLES SPIEL": "QUICK MATCH", "RAUM BEITRETEN": "JOIN ROOM",
|
||||
"RAUM ERSTELLEN": "CREATE ROOM", "MIT KI-PARTNER": "WITH AI PARTNER", "FREUNDESLISTE": "FRIENDS",
|
||||
"FREUNDE EINLADEN": "INVITE FRIENDS", "AKTUALISIEREN": "REFRESH", "KENNUNG KOPIEREN": "COPY PLAYER ID",
|
||||
"FREUNDE EINLADEN": "INVITE FRIENDS", "AKTUALISIEREN": "REFRESH", "NAMEN KOPIEREN": "COPY NAME",
|
||||
"ANFRAGE SENDEN": "SEND REQUEST", "EINLADEN": "INVITE", "ENTFERNEN": "REMOVE", "ZURÜCKZIEHEN": "WITHDRAW",
|
||||
"ANNEHMEN": "ACCEPT", "ONLINE": "ONLINE", "OFFLINE": "OFFLINE", "IM SPIEL": "IN GAME",
|
||||
"ANFRAGE GESENDET": "REQUEST SENT", "ANFRAGE ERHALTEN": "REQUEST RECEIVED", "BLOCKIERT": "BLOCKED",
|
||||
"Noch keine Freunde oder offenen Anfragen.": "No friends or pending requests yet.",
|
||||
"Eindeutige Spielerkennung eingeben": "Enter unique player ID",
|
||||
"Füge Freunde über ihre eindeutige Spielerkennung hinzu. Beide müssen die Anfrage bestätigen.": "Add friends using their unique player ID. Both players must confirm the request.",
|
||||
"Spielername eingeben": "Enter player name",
|
||||
"Füge Freunde über ihren Spielernamen hinzu. Beide müssen die Anfrage bestätigen.": "Add friends by player name. Both players must confirm the request.",
|
||||
"Kein Chat: Einladungen enthalten nur einen Raumcode, keine freie Nachricht.": "No chat: invites contain only a room code, never a custom message.",
|
||||
"PRIVATEN RAUM BEITRETEN": "JOIN A PRIVATE ROOM", "GIB DEN SECHSSTELLIGEN CODE DEINES MITPILOTEN EIN": "ENTER YOUR PARTNER'S SIX-CHARACTER CODE",
|
||||
"BUCHSTABEN UND ZAHLEN • GROSS-/KLEINSCHREIBUNG IST EGAL": "LETTERS AND NUMBERS • CASE DOES NOT MATTER",
|
||||
@@ -42,12 +42,13 @@ const ENGLISH_UI := {
|
||||
"RW %.0f • %s": "RANGE %.0f • %s", "LUFT": "AIR", "BODEN": "GROUND", "LUFT + BODEN": "AIR + GROUND",
|
||||
"EINZELZIEL": "SINGLE TARGET", "FLÄCHE 76": "AREA 76", "PLASMA-FLÄCHE 92": "PLASMA AREA 92", "EMP-FLÄCHE 118 · ALLE": "EMP AREA 118 · ALL",
|
||||
"PIERCING-STRAHL": "PIERCING BEAM", "LUFT-EINZELZIEL": "AIR SINGLE TARGET",
|
||||
"DEINE SPIELERKENNUNG: %s": "YOUR PLAYER ID: %s", "EINLADUNG VON %s ANNEHMEN": "ACCEPT INVITE FROM %s",
|
||||
"Anfrage an %s gesendet.": "Request sent to %s.", "Spielerkennung nicht gefunden oder Anfrage fehlgeschlagen.": "Player ID not found or request failed.",
|
||||
"DEIN SPIELERNAME: %s": "YOUR PLAYER NAME: %s", "EINLADUNG VON %s ANNEHMEN": "ACCEPT INVITE FROM %s",
|
||||
"Anfrage an %s gesendet.": "Request sent to %s.", "Spielername nicht gefunden oder Anfrage fehlgeschlagen.": "Player name not found or request failed.",
|
||||
"Mehrere Spieler haben diesen Namen. Bitte einen eindeutigen Namen verwenden.": "Multiple players have this name. Please use a unique name.",
|
||||
"Anfrage bestätigt.": "Request accepted.", "Bestätigung fehlgeschlagen.": "Could not accept request.",
|
||||
"Einladung gesendet.": "Invite sent.", "Einladung fehlgeschlagen oder gerade erst gesendet.": "Invite failed or was sent too recently.",
|
||||
"Anfrage zurückgezogen.": "Request withdrawn.", "Freund entfernt.": "Friend removed.", "Aktion fehlgeschlagen.": "Action failed.",
|
||||
"Spielerkennung kopiert.": "Player ID copied.", "Keine Serververbindung. Bitte später erneut versuchen.": "No server connection. Please try again later.",
|
||||
"Spielername kopiert.": "Player name copied.", "Keine Serververbindung. Bitte später erneut versuchen.": "No server connection. Please try again later.",
|
||||
"Freundesliste konnte nicht geladen werden.": "Could not load friends.",
|
||||
"Privater Raum %s: Freunde mit EINLADEN direkt benachrichtigen.": "Private room %s: use INVITE to notify friends directly.",
|
||||
"MITSPIELER": "PARTNER", "REAKTORLEBEN %02d • GETRENNTE RESSOURCEN": "REACTOR HEALTH %02d • SEPARATE RESOURCES",
|
||||
@@ -362,10 +363,6 @@ var coop_side_button := Rect2(916, 14, 140, 54)
|
||||
var online_projectiles: Array[Dictionary] = []
|
||||
var online_snapshot_elapsed := 0.0
|
||||
var online_snapshot_interval := 0.1
|
||||
var online_frame_stall_count := 0
|
||||
var online_frame_stall_report_ms := 0
|
||||
var online_apply_max_us := 0
|
||||
var online_apply_report_ms := 0
|
||||
var room_code_input := ""
|
||||
var profile_name_input := ""
|
||||
var profile_message := ""
|
||||
@@ -438,8 +435,8 @@ func _create_friend_name_input() -> void:
|
||||
friend_name_line_edit = LineEdit.new()
|
||||
friend_name_line_edit.position = friend_name_rect.position + Vector2(10, 3)
|
||||
friend_name_line_edit.size = friend_name_rect.size - Vector2(20, 6)
|
||||
friend_name_line_edit.max_length = 40
|
||||
friend_name_line_edit.placeholder_text = _ui("Eindeutige Spielerkennung eingeben")
|
||||
friend_name_line_edit.max_length = 20
|
||||
friend_name_line_edit.placeholder_text = _ui("Spielername eingeben")
|
||||
friend_name_line_edit.text_submitted.connect(func(_value: String) -> void: _add_friend_from_input())
|
||||
add_child(friend_name_line_edit)
|
||||
friend_name_line_edit.hide()
|
||||
@@ -477,13 +474,18 @@ func _refresh_friends() -> void:
|
||||
|
||||
|
||||
func _add_friend_from_input() -> void:
|
||||
var username := friend_name_line_edit.text.strip_edges()
|
||||
if username.is_empty():
|
||||
var player_name := friend_name_line_edit.text.strip_edges()
|
||||
if player_name.is_empty():
|
||||
return
|
||||
var ok: bool = await online_manager.add_friend_by_username(username)
|
||||
friends_message = _ui("Anfrage an %s gesendet.") % username if ok else _ui("Spielerkennung nicht gefunden oder Anfrage fehlgeschlagen.")
|
||||
var result: Dictionary = await online_manager.add_friend_by_display_name(player_name)
|
||||
var ok := bool(result.get("accepted", false))
|
||||
if ok:
|
||||
friends_message = _ui("Anfrage an %s gesendet.") % String(result.get("display_name", player_name))
|
||||
friend_name_line_edit.clear()
|
||||
elif String(result.get("error", "")) == "ambiguous":
|
||||
friends_message = _ui("Mehrere Spieler haben diesen Namen. Bitte einen eindeutigen Namen verwenden.")
|
||||
else:
|
||||
friends_message = _ui("Spielername nicht gefunden oder Anfrage fehlgeschlagen.")
|
||||
queue_redraw()
|
||||
|
||||
|
||||
@@ -502,7 +504,7 @@ func _friend_row_action(friend: Dictionary) -> void:
|
||||
|
||||
|
||||
func _can_invite_friends() -> bool:
|
||||
return friend_return_mode == "matchmaking" and multiplayer_manager.matchmaking_mode == "private_host" and multiplayer_manager.matchmaking_state == "hosting" and not multiplayer_manager.private_room_code.is_empty()
|
||||
return friend_return_mode == "matchmaking" and multiplayer_manager.matchmaking_mode == "private_host" and multiplayer_manager.matchmaking_state in ["hosting", "lobby"] and not multiplayer_manager.private_room_code.is_empty()
|
||||
|
||||
|
||||
func _create_promo_code_input() -> void:
|
||||
@@ -596,13 +598,8 @@ func _promo_reward_label(reward: String) -> String:
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
elapsed += delta
|
||||
if coop_online_mode and delta > 0.2:
|
||||
online_frame_stall_count += 1
|
||||
var now_ms := Time.get_ticks_msec()
|
||||
if now_ms - online_frame_stall_report_ms > 10000:
|
||||
print("ONLINE DIAG frame_stall_ms=%d count=%d" % [roundi(delta * 1000.0), online_frame_stall_count])
|
||||
online_frame_stall_report_ms = now_ms
|
||||
online_frame_stall_count = 0
|
||||
if coop_online_mode:
|
||||
online_manager.record_online_frame(delta)
|
||||
if status_timer > 0.0:
|
||||
status_timer -= delta
|
||||
if game_mode == "playing" or (game_mode == "paused" and coop_online_mode):
|
||||
@@ -660,6 +657,8 @@ func _spawn_enemy() -> void:
|
||||
var health_scale := _enemy_health_scale(wave, is_boss) * enemy_strength_multiplier
|
||||
var has_shield := bool(data.get("default_shield", false)) or (wave >= 4 and randf() < minf(0.42, 0.10 + wave * 0.018 + selected_difficulty * 0.06))
|
||||
var max_shield_hp: float = data.hp * health_scale * 0.55 if has_shield else 0.0
|
||||
if is_boss and wave == 5:
|
||||
max_shield_hp *= 0.5
|
||||
var route_id := 0
|
||||
var route := path_points
|
||||
if coop_mode:
|
||||
@@ -1259,8 +1258,8 @@ func _handle_pointer(position: Vector2, is_touch := false) -> void:
|
||||
elif friend_add_button.has_point(position):
|
||||
_add_friend_from_input()
|
||||
elif friend_copy_button.has_point(position) and online_manager.session != null:
|
||||
DisplayServer.clipboard_set(String(online_manager.session.username))
|
||||
friends_message = _ui("Spielerkennung kopiert.")
|
||||
DisplayServer.clipboard_set(account_manager.display_name)
|
||||
friends_message = _ui("Spielername kopiert.")
|
||||
else:
|
||||
for index in mini(friend_action_buttons.size(), online_manager.friends.size()):
|
||||
if friend_action_buttons[index].has_point(position):
|
||||
@@ -1483,8 +1482,9 @@ func _toggle_coop_side() -> void:
|
||||
pending_touch_build_position = Vector2(-1, -1)
|
||||
camera_offset.x = COOP_WORLD_WIDTH - SCREEN.x if camera_offset.x < 1.0 else 0.0
|
||||
cursor_position = cursor_screen_position + camera_offset
|
||||
var side_name := "PARTNER-SEITE" if coop_online_mode else "KI-SEITE"
|
||||
_show_status(side_name if camera_offset.x > 0.0 else "DEINE SEITE")
|
||||
var viewing_right := camera_offset.x > 0.0
|
||||
var viewing_own_side := (viewing_right and _local_credit_slot() == 1) or (not viewing_right and _local_credit_slot() == 0)
|
||||
_show_status("DEINE SEITE" if viewing_own_side else ("PARTNER-SEITE" if coop_online_mode else "KI-SEITE"))
|
||||
|
||||
|
||||
func _start_coop_ai_game() -> void:
|
||||
@@ -1549,6 +1549,7 @@ func _start_coop_online_game(player_slot: int) -> void:
|
||||
game_speed = 1.0
|
||||
tutorial_step = 3
|
||||
camera_offset.x = COOP_WORLD_WIDTH - SCREEN.x if local_player_slot == 1 else 0.0
|
||||
online_manager.set_diagnostic_slot(local_player_slot, local_player_slot == 1)
|
||||
ads_manager.begin_mission()
|
||||
_apply_online_snapshot(multiplayer_manager.latest_snapshot)
|
||||
_show_status("ONLINE-KOOP BEREIT • DU VERTEIDIGST %s" % ("RECHTS" if local_player_slot == 1 else "LINKS"))
|
||||
@@ -1782,6 +1783,8 @@ func _toggle_pause() -> void:
|
||||
func _game_over() -> void:
|
||||
if game_mode != "playing":
|
||||
return
|
||||
if coop_online_mode:
|
||||
online_manager._finish_match_diagnostics("game_over")
|
||||
if endless_mode:
|
||||
_endless_run_complete()
|
||||
return
|
||||
@@ -2325,14 +2328,7 @@ func _apply_online_snapshot(snapshot: Dictionary) -> void:
|
||||
selected_tower_index = -1
|
||||
if bool(snapshot.get("game_over", false)) and game_mode == "playing":
|
||||
_game_over()
|
||||
online_apply_max_us = maxi(online_apply_max_us, Time.get_ticks_usec() - apply_start_us)
|
||||
var now_ms := Time.get_ticks_msec()
|
||||
if online_apply_report_ms == 0:
|
||||
online_apply_report_ms = now_ms
|
||||
elif now_ms - online_apply_report_ms >= 10000:
|
||||
print("ONLINE DIAG max_apply_us=%d enemies=%d towers=%d" % [online_apply_max_us, enemies.size(), towers.size()])
|
||||
online_apply_max_us = 0
|
||||
online_apply_report_ms = now_ms
|
||||
online_manager.record_snapshot_apply(Time.get_ticks_usec() - apply_start_us, enemies.size(), towers.size())
|
||||
|
||||
|
||||
func _update_online_interpolation(delta: float) -> void:
|
||||
@@ -2360,6 +2356,8 @@ func _handle_online_event(event: Dictionary) -> void:
|
||||
match String(event.get("type", "")):
|
||||
"wave_complete":
|
||||
_show_status("WELLE %d ABGEWEHRT +%d" % [int(event.get("wave", wave)), int(event.get("bonus", 0))])
|
||||
if int(event.get("wave", wave)) >= MAX_WAVES:
|
||||
online_manager._finish_match_diagnostics("victory")
|
||||
"partner_left":
|
||||
_show_status("VERBINDUNG ZUM PARTNER VERLOREN")
|
||||
"command_rejected":
|
||||
@@ -2382,7 +2380,7 @@ func _load_audio_settings() -> void:
|
||||
ui_language = "de"
|
||||
_apply_master_volume()
|
||||
if friend_name_line_edit:
|
||||
friend_name_line_edit.placeholder_text = _ui("Eindeutige Spielerkennung eingeben")
|
||||
friend_name_line_edit.placeholder_text = _ui("Spielername eingeben")
|
||||
|
||||
|
||||
func _ui(text: String) -> String:
|
||||
@@ -2394,7 +2392,7 @@ func _set_ui_language(value: String) -> void:
|
||||
return
|
||||
ui_language = value
|
||||
if friend_name_line_edit:
|
||||
friend_name_line_edit.placeholder_text = _ui("Eindeutige Spielerkennung eingeben")
|
||||
friend_name_line_edit.placeholder_text = _ui("Spielername eingeben")
|
||||
_save_audio_settings()
|
||||
queue_redraw()
|
||||
|
||||
@@ -2661,8 +2659,9 @@ func _prepare_draw_geometry() -> void:
|
||||
var center := Vector2(x_index * GRID_SIZE + GRID_SIZE * 0.5, y_index * GRID_SIZE + GRID_SIZE * 0.5)
|
||||
if not _is_in_build_zone(center) or _is_in_reactor_zone(center) or _is_path_cell(center):
|
||||
continue
|
||||
var cell_side := 1 if center.x > COOP_MIRROR_X else 0
|
||||
build_cell_cache.append({"rect": Rect2(center - Vector2(34, 34), Vector2(68, 68)),
|
||||
"partner": coop_mode and center.x > COOP_MIRROR_X})
|
||||
"partner": coop_mode and cell_side != _local_credit_slot()})
|
||||
draw_geometry_dirty = false
|
||||
|
||||
|
||||
@@ -2761,7 +2760,7 @@ func _draw_build_grid() -> void:
|
||||
|
||||
func _draw_tower(tower: Dictionary) -> void:
|
||||
var size: float = 74.0 + (tower.level - 1) * 4.0
|
||||
if coop_mode and int(tower.get("owner", 0)) == 1:
|
||||
if coop_mode and int(tower.get("owner", 0)) != _local_credit_slot():
|
||||
draw_circle(tower.pos, size * 0.54, Color(1.0, 0.56, 0.20, 0.18))
|
||||
draw_arc(tower.pos, size * 0.54, 0.0, TAU, 28, Color(1.0, 0.70, 0.34, 0.72), 2.0)
|
||||
draw_set_transform(tower.pos - camera_offset, tower.angle, Vector2.ONE)
|
||||
@@ -3253,13 +3252,13 @@ func _draw_friends() -> void:
|
||||
_draw_button(friends_back_button, "< ZURÜCK", false, Color("26394a"))
|
||||
_draw_button(friends_refresh_button, "AKTUALISIEREN", false, Color("24516a"))
|
||||
draw_string(font, Vector2(0, 105), _ui("FREUNDESLISTE"), HORIZONTAL_ALIGNMENT_CENTER, 1600, 40, Color("c7f5ff"))
|
||||
var own_username := String(online_manager.session.username) if online_manager.session != null else "OFFLINE"
|
||||
draw_string(font, Vector2(260, 169), _ui("DEINE SPIELERKENNUNG: %s") % own_username, HORIZONTAL_ALIGNMENT_LEFT, 740, 18, Color("8ff4ff"))
|
||||
_draw_button(friend_copy_button, "KENNUNG KOPIEREN", false, Color("285568"))
|
||||
var own_name: String = account_manager.display_name if account_manager != null else "OFFLINE"
|
||||
draw_string(font, Vector2(260, 169), _ui("DEIN SPIELERNAME: %s") % own_name, HORIZONTAL_ALIGNMENT_LEFT, 740, 18, Color("8ff4ff"))
|
||||
_draw_button(friend_copy_button, "NAMEN KOPIEREN", false, Color("285568"))
|
||||
draw_rect(friend_name_rect, Color(0.01, 0.035, 0.065, 0.98), true)
|
||||
draw_rect(friend_name_rect, Color("4ab8d1"), false, 2.0)
|
||||
_draw_button(friend_add_button, "ANFRAGE SENDEN", false, Color("185f68"))
|
||||
draw_string(font, Vector2(260, 292), _ui("Füge Freunde über ihre eindeutige Spielerkennung hinzu. Beide müssen die Anfrage bestätigen."), HORIZONTAL_ALIGNMENT_LEFT, 1090, 15, Color("9fdce9"))
|
||||
draw_string(font, Vector2(260, 292), _ui("Füge Freunde über ihren Spielernamen hinzu. Beide müssen die Anfrage bestätigen."), HORIZONTAL_ALIGNMENT_LEFT, 1090, 15, Color("9fdce9"))
|
||||
draw_rect(Rect2(220, 315, 1160, 455), Color(0.01, 0.035, 0.065, 0.96), true)
|
||||
draw_rect(Rect2(220, 315, 1160, 455), Color("39788e"), false, 2.0)
|
||||
friend_action_buttons.clear()
|
||||
|
||||
Reference in new issue
Block a user