Sprites: Difference between revisions

From NeoGeo Development Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
== "Sprites" as defined by SNK ==
== "Sprites" as defined by SNK ==
[[File:Mutnatsprite.png|right|frame|Structure of a grouped sprite.]]


Sprites on the NeoGeo aren't like those on other systems.
Sprites on the NeoGeo aren't like those on other systems.
Line 19: Line 21:
A lot of games contain pre-stretched graphics for sprites which are seen scaled down most of the time (logos in title screens for example).
A lot of games contain pre-stretched graphics for sprites which are seen scaled down most of the time (logos in title screens for example).


== Sprite control banks ==
= Sprite control banks =
 
[[File:Vrammap.png|right|frame|test]]


There are 4 Sprite Control Banks located in VRAM: SCB1, SCB2, SCB3 and SCB4
There are 4 Sprite Control Banks located in VRAM: SCB1, SCB2, SCB3 and SCB4
They respectively start at adresses $0000, $8000, $8200 and $8400. They aren't mirrored in any way.
They respectively start at adresses $0000, $8000, $8200 and $8400. They aren't mirrored in any way.


=== SCB1: Tilemaps ===
== SCB1: Tilemaps ==
SCB1 is $7000 words long, it's used to store the tilemaps and tile attributes of each sprite (448 sprites)
SCB1 is $7000 words long, it's used to store the tilemaps and tile attributes of each sprite (448 sprites)
Adresses $7000 to $7FFF are used by the [[Fix layer]].
Adresses $7000 to $7FFF are used by the [[Fix layer]].
Line 35: Line 39:
{{16BitRegister|[[Palettes|Palette]]|8|?|1|Tile number MSBs|3|3bit [[Auto animation|Auto-anim]]|1|2bit [[Auto animation|Auto-anim]]|1|Vertical flip|1|Horizontal flip|1}}
{{16BitRegister|[[Palettes|Palette]]|8|?|1|Tile number MSBs|3|3bit [[Auto animation|Auto-anim]]|1|2bit [[Auto animation|Auto-anim]]|1|Vertical flip|1|Horizontal flip|1}}


=== SCB2: Shrinking coefficients ===
Autoanim bit priorities ?
 
== SCB2: Shrinking coefficients ==


SCB2 is $200 words long. It's used to specify the shrinking coefficients of each sprite.
SCB2 is $200 words long. It's used to specify the shrinking coefficients of each sprite.
Line 45: Line 51:
Default value: $0FFF
Default value: $0FFF


=== SCB3: Y positions ===
== SCB3: Y positions ==
SCB3 is $200 words long. It's used to specify the sprites's Y position, its link mode ([[Sticky bit]]) and its size (height in tiles).
SCB3 is $200 words long. It's used to specify the sprites's Y position, its link mode ([[Sticky bit]]) and its size (height in tiles).
The actual position is 496-Y, from the top border of the screen.
The actual position is 496-Y, from the top border of the screen.
Line 51: Line 57:
{{16BitRegister|Y position|9|[[Sticky bit]]|1|?|1Sprite size|5}}
{{16BitRegister|Y position|9|[[Sticky bit]]|1|?|1Sprite size|5}}


=== SCB4: X positions ===
== SCB4: X positions ==
SCB4 is $200 words long. It's used to specify the sprite's X position.
SCB4 is $200 words long. It's used to specify the sprite's X position.
The actual position is from the left border of the screen.
The actual position is from the left border of the screen.
Line 57: Line 63:
{{16BitRegister|X position|9|.|7}}
{{16BitRegister|X position|9|.|7}}


[[Category:Video system| ]]
[[Category:Video system]]

Revision as of 09:31, 10 February 2011

"Sprites" as defined by SNK

File:Mutnatsprite.png
Structure of a grouped sprite.

Sprites on the NeoGeo aren't like those on other systems.

They're made of tiles (sometimes called characters) coming from the C ROMs, or from the .SPR files on the NeoGeo CD. Those tiles are always 16x16 pixels in size, and in 4 bits per pixel (128 bytes per tile). Each tile can then use up to 15 colors, one index being used as transparency.

Sprites are vertical strips of tiles, with a fixed width of 1 tile (16 pixels), an adjustable height (up to 32 tiles, 512 pixels). Each sprite has its own tilemap, defining which tile number goes in which place. Sprites can be stuck together horizontally to bypass their width limitation and make huge moveable objects.

Limitations

No more than 96 sprites can be rendered by scanline. Any others will be ignored.

Even if the VRAM has space for 448 sprites, only 384 can be displayed per frame (unmultiplexed).

Contrary to common belief, sprites can't be zoomed. They can only be shrinken. Graphics for sprites then have to made to the biggest size needed. A lot of games contain pre-stretched graphics for sprites which are seen scaled down most of the time (logos in title screens for example).

Sprite control banks

test

There are 4 Sprite Control Banks located in VRAM: SCB1, SCB2, SCB3 and SCB4 They respectively start at adresses $0000, $8000, $8200 and $8400. They aren't mirrored in any way.

SCB1: Tilemaps

SCB1 is $7000 words long, it's used to store the tilemaps and tile attributes of each sprite (448 sprites) Adresses $7000 to $7FFF are used by the Fix layer.

Each sprite has a 64 words table, organized as linear up to down tile/attributes pairs. This means even locations are the tile numbers, and odd ones are attributes.

Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Def Tile number LSBs


Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Def Palette ?Tile number MSBs3bit Auto-anim2bit Auto-animVertical flipHorizontal flip

Autoanim bit priorities ?

SCB2: Shrinking coefficients

SCB2 is $200 words long. It's used to specify the shrinking coefficients of each sprite. The lower byte is the vertical shrinking. $FF is full size. The lower nibble of the upper byte (bits 8 to 11) is the horizontal shrinking. $F is full size.

Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Def HorizontalVertical

Default value: $0FFF

SCB3: Y positions

SCB3 is $200 words long. It's used to specify the sprites's Y position, its link mode (Sticky bit) and its size (height in tiles). The actual position is 496-Y, from the top border of the screen.

Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Def Y position Sticky bit?5

SCB4: X positions

SCB4 is $200 words long. It's used to specify the sprite's X position. The actual position is from the left border of the screen.

Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Def X position .