meta-meta-sprites

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
meta-meta-sprites
by on (#192819)
As I've said at least once before, my dynamic sprite engine still has one limitation left, and that is it can't duplicate a sprite pattern within a meta-sprite without also duplicating it in VRAM. I'm using a linked list VRAM slot system, where the slots in VRAM link to each other (also with sprite attributes copied for easy indexing), so duplicated meta-sprites can find copies of themselves in VRAM. However, a sprite cannot be reused multiple times within the same meta-sprite, and a sprite cannot be reused in two separate meta-sprites.

So what I'm going to do is give each object it's own RAM table of entry points to the linked list so that it is possible to use the same sprite or batch of sprites more than once per object.
Re: meta-meta-sprites
by on (#192844)
Your multiplexing the sprites? using HDMA chains down the screen?
Re: meta-meta-sprites
by on (#192854)
Oziphantom wrote:
Your multiplexing the sprites? using HDMA chains down the screen?


No, I'm swapping out graphics from VRAM depending on what's being animated onscreen. I want to add crushing pillars that has spikes on the bottom, and a brick pattern in the middle and top. For the brick body I should stack several 32x32 sprites on top of each other with the same pattern. Unfortunately, my dynamic animation engine was designed for players and enemies, which don't need repeating sprite patterns, so if I use it for a crushing pillar, my animation engine will treat it as a really big character and waste VRAM on it, when it should need just one copy of the brick pattern.


Attachment:
brick crusher example.png
brick crusher example.png [ 6.42 KiB | Viewed 2227 times ]


The thing on the left is a brick crusher. The thing in the middle is how much memory it will take up if every part of the brick crusher is stored in VRAM separately. The thing on the right is how much memory it will take up if it can recycle sprite patterns.
Re: meta-meta-sprites
by on (#192857)
ah you are fixing the duplication of Tile data in VRAM not Sprite Settings in VRAM. Got it, I was thinking you were trying to avoid using the same sprite settings again and again to have repeated sprites...
Re: meta-meta-sprites
by on (#192888)
I just figured out something. Because I'm using 32x32 and 16x16 sprites, not every entry in the linked list would be used. So I can use the blank spaces for "repeat sprites" where instead of using the index as the CHR bits, it uses the CHR bits from the previous sprite. All I need to do is add a 3rd "sprite size" value that represents a repeated sprite.

Edit: HEY, GOT THIS WORKING ON MY FIRST TRY! AWESOME!
Re: meta-meta-sprites
by on (#192955)
psycopathicteen wrote:
not every entry in the linked list would be used.

Why are you using linked lists if you're having a fixed size?

This doesn't sound like meta-meta-sprites, just having part of the data of a metasprite being an index into a table rather than a full copy of said data.
Re: meta-meta-sprites
by on (#192967)
Myask wrote:
psycopathicteen wrote:
not every entry in the linked list would be used.

Why are you using linked lists if you're having a fixed size?

When did I say anything about having a fixed size?

It's kind of hard to explain, but my engine makes a temporary copy of the metasprite data in the form of a linked list, in order to keep track of where in VRAM the sprites of the meta-sprites are. Each onscreen metasprite is a different chain in the linked list, but it can't chain back to a previous tile without getting stuck in an infinite loop.