Jump to content

Rendering: Difference between revisions

No edit summary
No edit summary
Line 18: Line 18:
By default, the text rendering canvas has the 'alpha' flag set to true, meaning its background is transparent. This means the tile's background color and cell protections are re-drawn for every frame and are not cached. In non-transparent mode, the 'alpha' flag is set to false, meaning the background along the text is cached. Thus the tile's background is not redrawn for every frame. This mode also has the added consequence of text having subpixel rendering, which may make the text look crisper on LCD screens.
By default, the text rendering canvas has the 'alpha' flag set to true, meaning its background is transparent. This means the tile's background color and cell protections are re-drawn for every frame and are not cached. In non-transparent mode, the 'alpha' flag is set to false, meaning the background along the text is cached. Thus the tile's background is not redrawn for every frame. This mode also has the added consequence of text having subpixel rendering, which may make the text look crisper on LCD screens.


==Queued Rendering==
==Queued rendering==
As of June 2023, the rendering process started to use a queue for the rendering of the tiles. Prior to the update, the page would freeze if the user did performance-intensive tasks like show or hide the grid while zoomed all the way out. The update allowed the user to use the page normally while large rendering batch jobs complete in the background. Each frame is allowed 16 milliseconds of rendering time, allowing the user to continue using the client as tiles are being rendered. This allowed for more possibilities, like smooth zooming.
As of June 2023, the rendering process started to use a queue for the rendering of the tiles. Prior to the update, the page would freeze if the user did performance-intensive tasks like show or hide the grid while zoomed all the way out. The update allowed the user to use the page normally while large rendering batch jobs complete in the background. Each frame is allowed 16 milliseconds of rendering time, allowing the user to continue using the client as tiles are being rendered. This allowed for more possibilities, like smooth zooming.


==Shift Optimization==
==Shift optimization==
Blitting tiles to the screen, while a very simple operation, takes a lot of time when there are thousands of tiles on the screen. This results in a choppy scrolling experience. This can happen when the page is zoomed out too far. The solution is to shift the content of the main canvas according to how far the user has scrolled. The tiles on the edge of the screen are then blitted individually. This is only enabled automatically when the user zooms out past 50%.
Blitting tiles to the screen, while a very simple operation, takes a lot of time when there are thousands of tiles on the screen. This results in a choppy scrolling experience. This can happen when the page is zoomed out too far. The solution is to shift the content of the main canvas according to how far the user has scrolled. The tiles on the edge of the screen are then blitted individually. This is only enabled automatically when the user zooms out past 50%.


Line 59: Line 59:
=== w.render(redraw): ===
=== w.render(redraw): ===
Blits all tiles onto the screen. Must be called when the world position changes.
Blits all tiles onto the screen. Must be called when the world position changes.
If the redraw parameter is set to true, then it's equivalent to calling w.redraw().