Skip to content

Change time value passed to :on-tick #9

@jarcane

Description

@jarcane

At present, the time argument to the :on-tick handler is a DOMHighResTimeStamp, indicating the number of ms since time origin (https://developer.mozilla.org/en-US/docs/Web/API/DOMHighResTimeStamp#The_time_origin).

It's been suggested, and indeed so far in experience, that this is a less than useful value.

One proposal instead has been to return the delta between the current time stamp, and that of the previous frame. This would enable the user to time the distance between frames and this value could be more useful for some purposes.

Another option that occurred to me during development of the demo is to provide either in its place or as an additional argument, the count of the current frame since initialization. The demo as it is counts frames manually in a few places for different mechanics, and it might've been less fiddly to implement if the game provided the frame value already. That said, this might not be that useful and I dunno if overflow would be something to worry about here.

Feedback appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is neededquestionFurther information is requested

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions