Opened 5 years ago

Last modified 3 years ago

#150 accepted enhancement

Support for a sprite layer

Reported by: sdsnatcheralpha@… Owned by: Thomas Bernard
Priority: major Milestone: 2.9
Component: GrafX2 Version: 2.6
Keywords: Cc:

Description

GrafX2 has support for layers, but it would be nice if a special type of layer able to handle sprite restrictions could be added.

Sprites are used on many platforms (C64, MSX1/2/2+, etc) to hide the color-bleeding, enhancing image quality.

Change History (7)

comment:1 by Philip Linde, 4 years ago

Sprite restrictions seem a bit harder to define than e.g. the restrictions of the plain hi-res mode of the C64. It boils down not only to how many sprites and at what sizes you can display them per line or screen, using how many colors, but also, in some complex image schemes, how quickly and when you can reuse a sprite to draw it again some lines later.

I think that such a special layer might be better solved generally as a "restricted layer" where each drawing operation is verified using a selectable Lua script. For a simple single color sprite overlay this could for example be a layer attached to a script that simply check that the non-transparent data fits in the available sprite slots of the machine. This way it is extensible by the user and can be applied generally to a wide range of image schemes and platforms.

comment:2 by PulkoMandy, 4 years ago

I'm not sure it's reasonable to do this isn realtime. I thought about it for Amstrad CPC "rasters" (palette changes in sync with the display hardware) and the outcome is, it's good enough to implement only a relaxed partial check of the constraints, and then have more restrictive check when exporting the picture to a specific format, or even just let the developer trying to usethe picture figure things out and iterate.

You can however use a lua script bound to a shortcut, that can easily be triggered, and highlights tho errors (for example by marking them with a specific color in an extra layer). With complex enough constraints, this "check" (rather than "enforce") mode ends up easier to use, because grafx2 wouldn't do a great job at reducing tour drawing tothe hardware constraints in the best way.

comment:4 by Thomas Bernard, 4 years ago

well using an additional layer for sprites is already possible.
we may introduce sprite restriction but that is not easy.
If I'm thinking about the C64, there are 8 sprites which are either monocolor, or multicolor (3 colors)
Multicolor sprites have 1 color specific for the sprite and 2 which are common

The way GrafX2 is implemented it would be nearly impossible to allow monocolor sprites on a multicolor background :(

comment:5 by Thomas Bernard, 4 years ago

Milestone: 2.7
Owner: changed from pulkomandy to Thomas Bernard
Status: newaccepted

The MSX .SC2 file loader does load sprites to the layer 2.

I should try to do the same for C64.

Saving will be tricky...

comment:6 by PulkoMandy, 4 years ago

Milestone: 2.72.8

comment:7 by PulkoMandy, 3 years ago

Milestone: 2.82.9
Note: See TracTickets for help on using tickets.