perf: harden runtime for weaker hardware

This commit is contained in:
Rijad Zuzo
2026-08-12 10:02:45 +02:00
parent cd29da95e0
commit 34428d836a
47 changed files with 2164 additions and 243 deletions
+14
View File
@@ -47,19 +47,33 @@ func _run() -> void:
)
var wolf_visual: Node3D = combat_view.hostiles[wolf.get_combatant_id()]
var sword_definition := SimulationItems.get_weapon(SimulationIds.ITEM_SWORD)
_check(
is_equal_approx(controller.attack_range, sword_definition.reach),
"Player targeting and simulation authority should share the sword definition reach"
)
player.global_position = wolf_visual.global_position + Vector3(-2.0, 0.0, 0.0)
player.look_at(wolf_visual.global_position, Vector3.UP)
player.rotation.x = 0.0
simulation_manager.update_player_combatant(player.global_position)
var wolf_health: float = wolf.get_health()
controller.call("_perform_attack")
_check(
wolf.get_health() < wolf_health,
"A player sword strike should damage the hostile wolf through the simulation"
)
var hit_tween: Tween = wolf_visual.get("_flash_tween") as Tween
wolf.set_position(wolf.get_position() + Vector3(0.1, 0.0, 0.0))
_check(
wolf_visual.get("_flash_tween") == hit_tween,
"An injured hostile should not replay its hit flash for a position-only state update"
)
var struck := 0
for _attempt in 6:
if not wolf.is_alive():
break
controller.call("_advance_timers", sword_definition.attack_cooldown)
simulation_manager.advance_player_combat_time(sword_definition.attack_cooldown)
controller.call("_perform_attack")
struck += 1
await process_frame