Page 1 of 1

front-most sprite drop out

Posted: Sat Mar 25, 2017 1:38 pm
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.

Re: front-most sprite drop out

Posted: Sun Apr 02, 2017 3:38 pm
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

Re: front-most sprite drop out

Posted: Mon Apr 03, 2017 1:42 am
by calima
That sounds an awful lot like bubble sort, one of the slowest sorting algos.

Re: front-most sprite drop out

Posted: Mon Apr 03, 2017 8:49 pm
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.