Skip to content

feat: refactor tick interpolator to server pattern#602

Open
albertok wants to merge 3 commits into
foxssake:mainfrom
albertok:interpolation-server
Open

feat: refactor tick interpolator to server pattern#602
albertok wants to merge 3 commits into
foxssake:mainfrom
albertok:interpolation-server

Conversation

@albertok

Copy link
Copy Markdown
Contributor

Switch tick interpolation to use server pattern while keeping all original contracts.

Added unit and perf tests.

@elementbound elementbound left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

Comment thread addons/netfox/servers/interpolation-server.gd Outdated
static var _logger := NetfoxLogger._for_netfox("InterpolationServer")

## Register an interpolation group for a TickInterpolator node
func register_interpolation_group(group_id: int, root: Node, properties: Array[String], enabled: bool, enable_recording: bool) -> void:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could limit the registration method to registering a property on a subject ( Node ), and manage the rest with setter methods ( e.g. set_recording(subject: Node, enabled: bool) ). Internally, the bool flags could be handled as _Sets, e.g. if a node is in the _recording_enabled set, then recording is enabled, otherwise not.

( The reason I keep referring to subjects instead of nodes is that there's a chance netfox will support recording, syncing, interpolating, etc. properties on any object, not just nodes )

Comment thread addons/netfox/servers/interpolation-server.gd Outdated
Comment thread addons/netfox/servers/interpolation-server.gd Outdated
if Engine.is_editor_hint():
return

NetworkTime.before_tick_loop.connect(_before_tick_loop)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could separate the pre- and post tick loop activities into discrete methods ( e.g. _clear_teleports(), _apply_target_state(), _record_next_state() ), and call them from NetworkTime.

Same rationale as with interpolate()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might leave this one for now. I'd have to mess with NetworkTime

Comment thread addons/netfox/servers/interpolation-server.gd Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love to see it!

@elementbound

Copy link
Copy Markdown
Contributor

Supersedes #539

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants