Shuffling meta sprites

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems. See the NESdev wiki for more information.

Moderator: Moderators

User avatar
Bregalad
Posts: 8056
Joined: Fri Nov 12, 2004 2:49 pm
Location: Divonne-les-bains, France

Re: Shuffling meta sprites

Post by Bregalad »

Well, I have zero grudge against you or anyone else - I just find it's a shame you didn't use the "search" function in those specific cases - but if you don't want to use it I guess I can't force you to. It would save you a lot of time as you'd immediately see the existing answers appearing.
User avatar
DRW
Posts: 2225
Joined: Sat Sep 07, 2013 2:59 pm

Re: Shuffling meta sprites

Post by DRW »

Even on a purely factual level your complaint was not entirely justified:

The first thread that you linked only talked about logical organization of sprite order, not the ever changing, evenly distributed algorithm I'm looking for.

The second very short thread had maybe one single post where one possibility was explained a bit. The rest was mostly about slightly different stuff again. Hardly a full solution to my problem.

Besides, what am I supposed to do? Do you expect me to necrobump a seven or five year old thread?
My game "City Trouble":
Gameplay video: https://youtu.be/Eee0yurkIW4
Download (ROM, manual, artworks): http://www.denny-r-walter.de/city.html
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Shuffling meta sprites

Post by tepples »

DRW wrote:Do you expect me to necrobump a seven or five year old thread?
In the past, the preference here appears to have been necro over dupe. That's consistent with the worldview set forth in the classic Flash animation "Posting and You".
User avatar
FrankenGraphics
Formerly WheelInventor
Posts: 2064
Joined: Thu Apr 14, 2016 2:55 am
Location: Gothenburg, Sweden
Contact:

Re: Shuffling meta sprites

Post by FrankenGraphics »

Isn't the sentiment against necroing that the content of the thread is no longer relevant/the original participants are no longer active? In which case, each thread can be individually judged based on its content and knowledge of the users.

Restricting dupes on the other hand seems most important in forums plagued by questions like "when will raspberry pi 4 be released" / "gee, i wish the next raspberry will have x gigs of ram or other features that goes against the foundation's principle to make 35 dollar educational computers widely available" and such? Especially on bostad with active users in the ten to hundred thousands?
User avatar
Bregalad
Posts: 8056
Joined: Fri Nov 12, 2004 2:49 pm
Location: Divonne-les-bains, France

Re: Shuffling meta sprites

Post by Bregalad »

DRW wrote: Besides, what am I supposed to do? Do you expect me to necrobump a seven or five year old thread?
Indeed - you are "supposed" (that means really "encouraged") to look at existing info, and ask about things that remains unclear to you, including possibly necrobump something.
Isn't the sentiment against necroing that the content of the thread is no longer relevant/the original participants are no longer active?
Many active people back then are still active today - many of us had been active here for the last 15 years.
User avatar
FrankenGraphics
Formerly WheelInventor
Posts: 2064
Joined: Thu Apr 14, 2016 2:55 am
Location: Gothenburg, Sweden
Contact:

Re: Shuffling meta sprites

Post by FrankenGraphics »

Precisely - so necroing doesn't seem to cause the same dilemma other boards may experience.
User avatar
dougeff
Posts: 3079
Joined: Fri May 08, 2015 7:17 pm

Re: Shuffling meta sprites

Post by dougeff »

(Necro posts vs new similar post)

My opinion is "you should start a new thread". You get more [new] comments on a new post than a necro one, especially if the same people already commented in the necro post that are still here today.

Another thing...if you are new and have MANY questions, don't start 15 new threads, just continue on one thread.

Edit - added a word, in brackets
nesdoug.com -- blog/tutorial on programming for the NES
User avatar
dougeff
Posts: 3079
Joined: Fri May 08, 2015 7:17 pm

Re: Shuffling meta sprites

Post by dougeff »

Back on topic.

I've tried...
"pick a random starting point each frame" and start filling from there, wrapping around. But not really random, nor just adding 9 each time (I think someone suggested something like that). But step through a list of start points that are preshuffled...0, $80, $20, $a0, $40, $c0, $60, $e0 or similar.

Or,
4 alternative lists of object ordering, for drawing metasprites...
(1,2,3,4,5,6,7,8)
(8,7,6,5,4,3,2,1)
(1,3,5,7,2,4,6,8)
(8,6,4,2,7,5,3,1)

Both were simple and seemed to work.
nesdoug.com -- blog/tutorial on programming for the NES
na_th_an
Posts: 558
Joined: Mon May 27, 2013 9:40 am

Re: Shuffling meta sprites

Post by na_th_an »

I don't have a huge number of metasprites, and I don't usually need Z-order, so

1.- The index of the first metasprite to be processed is incremented each frame, modulus the total number N of sprites, by a prime of N. That way each metasprite in the list gets to be the first in a cycle of N frames.
2.- Then I iterate N times adding M to the current index modulus the total number N of sprites, with M a (different) prime of N. That way the whole list gets processed (i.e. sent incrementally to the OAM copy) in the current frame.

That way the order of metasprites is different enough from frame to frame without having to resort to lookup tables or random numbers.

This method proved useful in systems with a harshed limit of sprites per scanline such the SEGA SG-1000, which only supports 4 monochrome sprites per scanline.
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Shuffling meta sprites

Post by tokumaru »

na_th_an wrote:This method proved useful in systems with a harshed limit of sprites per scanline such the SEGA SG-1000, which only supports 4 monochrome sprites per scanline.
Too bad we can't see the actual effect in the video, since YouTube doesn't offer 60Hz playback for resolutions 480p and lower.
na_th_an
Posts: 558
Joined: Mon May 27, 2013 9:40 am

Re: Shuffling meta sprites

Post by na_th_an »

It is not 100% perfect but it does the job. Of course, with that number of sprites, the game is a blink fest :) You watch it yourself in any SEGA 8-bit emulator (for example Kega Fusion) as the game is free to download from our site or clicky, so no need for crappy youtube videos.
User avatar
rainwarrior
Posts: 8732
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Shuffling meta sprites

Post by rainwarrior »

tokumaru wrote:
na_th_an wrote:This method proved useful in systems with a harshed limit of sprites per scanline such the SEGA SG-1000, which only supports 4 monochrome sprites per scanline.
Too bad we can't see the actual effect in the video, since YouTube doesn't offer 60Hz playback for resolutions 480p and lower.
We don't see the entire flicker sequence, but at least this is a flicker sequence that is long enough and varied enough that it still works when you drop every second frame, so it still looks effective at 30 Hz. (As opposed to various simple techniques with only 2-frame sequences where you end up only seeing half the picture.)
Post Reply