front-most sprite drop out

Discussion of hardware and software development for Super NES and Super Famicom. See the SNESdev wiki for more information.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
Post Reply
psycopathicteen
Posts: 3140
Joined: Wed May 19, 2010 6:12 pm

front-most sprite drop out

Post by psycopathicteen »

I wonder if there is a way to have non-overlapping sprites switch priorities so that "back-most" sprites appear to drop out first when they're not overlapping. The problem is it would need ~8000 collisions per frame, unless you sort the sprites out by region, or check if there is any drop out to begin with. I still think it would be extremely slow anyway.
psycopathicteen
Posts: 3140
Joined: Wed May 19, 2010 6:12 pm

Re: front-most sprite drop out

Post by psycopathicteen »

I thought of another way to do this. For each sprite check collision with every previous sprite going down, swapping it with it's previous sprite, until it finds an overlapping sprite, then do the same with the next sprite.

Take this sequence:
12345

Let's say 2 and 4 overlap, and 1 and 3 overlap.

2 does not overlap 1
21345

3 overlaps 1

4 does not overlap 3 and 1, but overlaps 2
24135

5 does not overlap any of them
52413
calima
Posts: 1745
Joined: Tue Oct 06, 2015 10:16 am

Re: front-most sprite drop out

Post by calima »

That sounds an awful lot like bubble sort, one of the slowest sorting algos.
psycopathicteen
Posts: 3140
Joined: Wed May 19, 2010 6:12 pm

Re: front-most sprite drop out

Post by psycopathicteen »

I just found this information.

https://wiki.superfamicom.org/snes/show/Sprites

Apparently if the there is more than 32 sprites on a line the rear-most sprites drop out, but if there's more than 34 8x1 slivers per line, the front-most sprites drop out. If this is accurate, then that means I can avoid dropping front sprites by doubling front sprites.
Post Reply