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

Early prototype: track and replay sprite property changes #24044

Merged
merged 8 commits into from Aug 2, 2018

Conversation

joshlory
Copy link
Contributor

@joshlory joshlory commented Aug 2, 2018

Sample usage:

  1. Click "Run" and wait a few seconds.
  2. Run replay(__mostRecentGameLabInstance); in the console.

image

I'm only tracking a few properties (x, y, tint) so far.

@joshlory
Copy link
Contributor Author

joshlory commented Aug 2, 2018


for (let prop of trackedProps) {
const descriptor = Object.getOwnPropertyDescriptor(sprite, prop) || {};
Object.defineProperty(sprite, prop, {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This would be a great place to use an ES6 Proxy but unfortunately it's not supported in IE11 😕.

@balderdash
Copy link
Contributor

Are you sure this is the level at which you want to log/replay data? My impression was that we would log input events, and just rerun the student's code against that.

@joshlory
Copy link
Contributor Author

joshlory commented Aug 2, 2018

No, not sure yet 😄. I think that approach could work well also, if we can align input events to a specific frame (for deterministic playback). Track that I press the screen at location x, y on frame n vs. after m seconds.

How does scrubbing backwards work in that approach?

@balderdash
Copy link
Contributor

That's a good question. I suppose scrubbing backwards is a lot easier if you actually have a recording of the world's state at every frame. I think ultimately we'll want to store both sets of data?

@joshlory joshlory merged commit 367d0e1 into staging Aug 2, 2018
@joshlory joshlory deleted the time-turner branch August 2, 2018 22:53
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.

None yet

2 participants