Skip to content

World.drawStaticSprites optimization #6

@martindrapeau

Description

@martindrapeau

Currently, that function redraws the background every world x/y change up to 60 times a second. Takes up a lot of time to do so when the world is panned. On older computers and tablets, the fps is reduced.

Instead, we could increase the background canvas by a buffer (say 2 tiles larger and taller). When the world x/y changes slightly, we will not need to redraw - but instead just perform a copy of the panned region.

For Super Mario, I estimate this strategy would cause a redraw only once per second instead of 60.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions