EmuCR Feeds
Email Us

I've figured out and implemented RAM based priorities in Lord of Gun. Before, sprites were drawn above all tilemaps, and tilemaps were incorrectly ordered with respect to each other (see previous post).

Here's a side by side comparison:
EmuCR:Luca Elia WIP - Lord Of Gun
EmuCR:Luca Elia WIP - Lord Of Gun
EmuCR:Luca Elia WIP - Lord Of Gun
EmuCR:Luca Elia WIP - Lord Of Gun
EmuCR:Luca Elia WIP - Lord Of Gun
EmuCR:Luca Elia WIP - Lord Of GunThe way priorities work on this hardware, lordgun.c, i.e. how the order of the various layers of graphics is decided, is similar to that of the blitter based IGS games in igs011.c.

There are 64k of priority RAM. Each 16-bit word contains one of five values, that map to the five layers (4 tilemaps + sprites). For each screen pixel, the opacity of the layers and their priority are translated to an address in priority RAM, and the pixel of the layer specified by priority RAM at that address is sent to the screen.

This is the most flexible solution as it allows for rather funky priority schemes and masking effects. Also note that sprite-sprite priorities are decided according to the sprite list order, and are thus orthogonal to sprite-tile and tile-tile priorities, allowing for even more flexibility.

To form the priority RAM address, first the opacity of each layer is stored in one of the 5 low order bits (0 = opaque, 1 = transparent). Then, and this is where it gets more complicated than on the other hardware, three of the layers, and sprites, also specify a per tile priority level (0-7), thus contributing 3 additional bits * 4 layers, that go in the remaining high order bits of the priority RAM address.

Actually, that's too many address bits for 64k of RAM, so one of those layers is limited to only 1 bit of priority level instead of 3.

With this scheme in place, graphics are correct AFAICT, and some scrolling levels, like the jungle one above, exhibit a nice layered parallax effect now.


Source: www.lucaelia.com/mame.php



Random Related Topic Refresh Related Topic

Random Related Topic Loading...

0 Comments

Post a Comment

Can't post a comment? Try This!