You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I encountered this issue while implementing periodic spawns of rollback-aware NPCs : each new RollbackSynchronizer still has a _latest_state set to -1 by the time _before_loop is first called, causing the _resim_from variable to be -1 for the corresponding _rollback call and thus resimulating everything from the start of the game (or history size, I didn't check, but it was tanking my FPS hard).
I worked around this by adding a _record_initial_tick function and calling it from process_settings as follows:
func _record_initial_tick(tick: int):
# Broadcast state we own
if not _auth_state_props.is_empty():
var initial_state = {}
for property in _auth_state_props:
initial_state[property.to_string()] = property.get_value()
if initial_state.size() > 0:
_latest_state = max(_latest_state, tick)
_states[tick] = PropertySnapshot.merge(_states.get(tick, {}), initial_state)
# Record state for specified tick ( current + 1 )
if not _record_state_props.is_empty() and tick > _latest_state:
_states[tick] = PropertySnapshot.extract(_record_state_props)
It's more of a hack at this point but it works. I would be interested if there were a preferred solution to this.
The text was updated successfully, but these errors were encountered:
Good catch, ideally new nodes should start their history from their spawn tick. Thanks for providing a workaround as well! It's pretty sensible at first glance, but I'll look into it further.
I encountered this issue while implementing periodic spawns of rollback-aware NPCs : each new
RollbackSynchronizer
still has a_latest_state
set to -1 by the time_before_loop
is first called, causing the_resim_from
variable to be -1 for the corresponding_rollback
call and thus resimulating everything from the start of the game (or history size, I didn't check, but it was tanking my FPS hard).I worked around this by adding a
_record_initial_tick
function and calling it fromprocess_settings
as follows:It's more of a hack at this point but it works. I would be interested if there were a preferred solution to this.
The text was updated successfully, but these errors were encountered: