Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UpdateList: reduce abstraction to aid debugging #22

Open
kkjamie opened this issue May 7, 2019 · 0 comments
Open

UpdateList: reduce abstraction to aid debugging #22

kkjamie opened this issue May 7, 2019 · 0 comments
Labels
enhancement New feature or request

Comments

@kkjamie
Copy link
Contributor

kkjamie commented May 7, 2019

Context

Right now the UpdateList is a generic thing that can update a series of update functions with the signature void Update(float dt).

Originally it was designed to be an abstract utility, but now since it lives inside the duck-tween library it now serves primary as the heartbeat of the animation system, used within the AnimationDrivers.

Problem

When something goes wrong it's quite difficult to debug since the update function only has an index to identify it, and theres no way to trace it back to which animation or target object it relates to.

Solution

Change the API to instead of taking update functions it can actually take a TimedAnimation and update that directly. Then if there is any issue we have the original object. For more flexibility we could introduce a new interface above it like IUpdateableAnimation or even IDrivableAnimation - to infer it's relationship to AnimationDriver - At that point I'd even consider renaming the update list so it's less abstract sounding and quite clearly the thing that's used within the animation drivers to invoke updates on the animations. The interface contract would require:

  • void Update(float dt). If anything goes wrong we can ToString() the object, and in the implementation (TimedAnimation) we can have a nice ToString that contains the name of the animation and target object... maybe even the from/to/duration/easing properties.

There's even scope for having a scripting define for debugging where we capture a stack trace in the animation constructor and later that can be used to find out where the animation was constructed from.

Potential issues

Some projects maybe using UpdateList for their own purpose. Should these changes be implemented and should those projects wish to update to the latest duck-tween, the update list would not necessarily serve their purpose anyway. I think we shouldn't support that use case since it's strange to borrow from a tween library and grab that util for an entirely different purpose. It may still work if they can just update to implement our new interface, but it still wouldn't necessarily make sense.

@kkjamie kkjamie added the enhancement New feature or request label May 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant