Skip to content

Solution for displaying 8-bit games with texture-based renderers #1376

@ivan-mogilko

Description

@ivan-mogilko

Problem

Currently 8-bit games may be run by Direct3D/OpenGL renderers pretty much fine, so long as they don't have any dynamic palette changes. Dynamic palette changes may not get reflected on screen in time, because there's no proper mechanism for forcing object texture update when this happens.

Potential solutions

Palette is changed in script using functions: CyclePalette and SetPalRGB , and also by directly editing palette array and then calling UpdatePalette() which syncs that array with the internal palette. Because in any case there will be a function call, these may serve as a trigger for update.

The most straightforward approach may be forcing every current texture to update from the source sprite when the palette change is detected. All the textures prepared for the game objects has to be redrawn from the sprites and corresponding cached bitmaps (for objects and characters).

However, this may not be the most efficient method. While some games may have occasional color change, others feature continuous palette cycling as a way to create full-screen animations. In the second case every single one of the currently displayed textures would have to be repainted over with the new palette every frame for this to work.

An alternate and more interesting approach is to implement a palette-emulating shader. If this is done, then only the shader has to be recreated (or nothing at all - if the shader accepts a palette array as an argument). This supposedly will have many times better perfomance, and easier to maintain, as the shader will be applied to everything uniformly so no changes are going to be required if we introduce more object textures.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ags3related to ags3 (version with full backward compatibility)context: 8-bit gfxrelated to 8-bit games with paletted gfxtype: enhancementa suggestion or necessity to have something improved

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions