That's exactly why I mentioned the "appeal" of RNG-based flickering, but there aren't many cases where there are more than 16 sprites per scanline in the game I'm doing. I don't think those happen in other games either, except maybe games that can have huge or long sprites (Like Godzilla and Adventure Island)tokumaru wrote:The main problem with simply inverting the order is that the sprites in the middle of the list are always disfavored, never having a chance to be at the top of OAM, meaning they'll flicker more than the others, or even disappear completely, if more than 16 sprites are lined up.
Changing order of meta sprites per frame
Moderator: Moderators
- Vectrex2809
- Posts: 97
- Joined: Mon Jul 14, 2014 6:05 am
- Location: Tokyo, Japan
Re: Changing order of meta sprites per frame
Re: Changing order of meta sprites per frame
But those steps should complete much faster than steps where something is drawn. So yes, there's some overhead but not too much.DRW wrote:With tepples' method, I see this as the problem:
if objid >= 6: continue
This means that the loop might go longer than necessary, doing steps where nothing is processed at all.
Premature optimization is a root cause of all kinds of evil. Make it work, then make it fast.Is there one that gives the best results and is also the fastest? Or do I have to do a comrpomise between speed and equal distribution of the sprite entries in the various frames?
- rainwarrior
- Posts: 8062
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
Re: Changing order of meta sprites per frame
I did address this exact case in my earlier post:DRW wrote:The problem though in this case is: The index increment uses a modulo. But this is only fast if you have 2, 4, 8, 16 etc. items, right?
But this isn't necessarily a given in my case. What if I have five characters?
i = (i+p) % 5
This only takes 3-6 more cycles than a bitwise AND, probably not a deal-breaker.rainwarrior wrote:Any modulo will work, the key word is relatively prime. Any number relatively prime to the modulo can be used for the increment. For 5 that is: 1,2,3,4.
Powers of 2 are convenient for modulo, but non-power of 2 can work OK:Code: Select all
i += p; if (i >= 5) i-= 5;
Re: Changing order of meta sprites per frame
Oops. Sorry, I've overlooked this. Yeah, you're right. This one would work.rainwarrior wrote:I did address this exact case in my earlier post:
Alright, thanks for your help. I guess I'll try it all out a bit and then I decide which version I take for my game.
Available now: My game "City Trouble".
Website: https://megacatstudios.com/products/city-trouble
Trailer: https://youtu.be/IYXpP59qSxA
Gameplay: https://youtu.be/Eee0yurkIW4
German Retro Gamer article: http://i67.tinypic.com/345o108.jpg
Website: https://megacatstudios.com/products/city-trouble
Trailer: https://youtu.be/IYXpP59qSxA
Gameplay: https://youtu.be/Eee0yurkIW4
German Retro Gamer article: http://i67.tinypic.com/345o108.jpg