mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-13 16:02:27 +00:00
fix: ignore pre-history prediction acknowledgements
This commit is contained in:
@@ -73,6 +73,7 @@ const RING_SIZE := 128
|
||||
var _ring_seq: PackedInt32Array = PackedInt32Array()
|
||||
var _ring_entry: Array = []
|
||||
var _has_recorded := false
|
||||
var _first_recorded_seq := -1
|
||||
|
||||
var newest_recorded_seq := -1
|
||||
var last_acknowledged_seq := 0
|
||||
@@ -94,6 +95,7 @@ func begin_epoch() -> void:
|
||||
_ring_seq[i] = -1
|
||||
_ring_entry[i] = null
|
||||
_has_recorded = false
|
||||
_first_recorded_seq = -1
|
||||
newest_recorded_seq = -1
|
||||
last_acknowledged_seq = 0
|
||||
resync_required = false
|
||||
@@ -106,6 +108,8 @@ func begin_epoch() -> void:
|
||||
func record(seq: int, action: ShipAction, state: NetBodyState, contact_window: bool = false) -> bool:
|
||||
var overflowed_now := false
|
||||
if not _has_recorded or seq > newest_recorded_seq:
|
||||
if not _has_recorded:
|
||||
_first_recorded_seq = seq
|
||||
if seq - last_acknowledged_seq > RING_SIZE:
|
||||
# Only the LEADING edge of an episode counts: resync_required is
|
||||
# still true for every subsequent tick of the same stall, and
|
||||
@@ -140,6 +144,8 @@ func record(seq: int, action: ShipAction, state: NetBodyState, contact_window: b
|
||||
func record_unsimulated(seq: int, action: ShipAction) -> bool:
|
||||
var overflowed_now := false
|
||||
if not _has_recorded or seq > newest_recorded_seq:
|
||||
if not _has_recorded:
|
||||
_first_recorded_seq = seq
|
||||
if seq - last_acknowledged_seq > RING_SIZE:
|
||||
overflowed_now = not resync_required
|
||||
resync_required = true
|
||||
@@ -289,6 +295,11 @@ func compare_authoritative(seq: int, authoritative: NetBodyState) -> Dictionary:
|
||||
|
||||
|
||||
func _missing_status(seq: int) -> String:
|
||||
# The server starts its acknowledgement clock at sequence 0, while the
|
||||
# first local post-step prediction is normally sequence 1. This is a normal
|
||||
# startup boundary, not a lost ring entry and must not trigger a hard snap.
|
||||
if not _has_recorded or seq < _first_recorded_seq:
|
||||
return "warmup_not_recorded"
|
||||
if _has_recorded and seq <= newest_recorded_seq - RING_SIZE:
|
||||
return "missing_evicted"
|
||||
return "missing_not_recorded"
|
||||
|
||||
Reference in New Issue
Block a user