Controlled sprite flicker

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Controlled sprite flicker

Post by tokumaru »

Sumez wrote:Did anyone ever reverse engineer Dynamite Batman/Return of the Joker? I'd love to know which method they used.
I don't know if it does anything special... I does flicker a lot, but I guess we don't care on account of every sprite and background looking so awesome.

I'm also impressed by how Felix the Cat is able to have overlaid weapons and vehicles with a budget of only 7 sprites per scanline (the right edge of the screen has a column of high priority sprites hiding scrolling glitches) and still look as good as it does.
User avatar
rainwarrior
Posts: 8734
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Controlled sprite flicker

Post by rainwarrior »

Sumez wrote:
rainwarrior wrote: Though, you could deal with that easily by reversing every 2 frames instead of every frame, or doing some pattern like 01001011.
I'd consider leaving a sprite invisible for more than one successive frame much more detrimental than a 30hz flicker rate.
If I'm making an NES game, I'm designing it for a CRT, not for YouTube, and a sprite disappearing for a single frame on a CRT will not flicker as clearly, and usually just appear like it goes partly transparent. Lose it for two frames in a row, and the flickering will be much more apparent.
Well, it's up to you whether you care about YouTube, etc. but a lot of people like to experience games through Twitch, YouTube, etc. and the effect of alternating frames is that one of them just doesn't get seen. If you're complaining about 2 frames in a row of invisible character on a CRT, the stream version gets 100 invisible frames in a row instead, one of these problems is dramatically more apparent.

My ideal suggestion though is reordering all the characters' drawing every frame, that way the alternation is more randomized and distributed across all the sprites. The quoted suggestion is just a compromise for having only 2 orders.
User avatar
nesrocks
Posts: 563
Joined: Thu Aug 13, 2015 4:40 pm
Location: Rio de Janeiro - Brazil
Contact:

Re: Controlled sprite flicker

Post by nesrocks »

That is a non issue if you upload it at 60 fps. Tasvideos.org has been uploading them at that refresh rate for many years now. It's the standard and the flickering is represented perfectly.
https://twitter.com/bitinkstudios <- Follow me on twitter! Thanks!
https://www.patreon.com/bitinkstudios <- Support me on Patreon!
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Controlled sprite flicker

Post by tepples »

That's fine for videos that you post on your own website. But If people are watching on YouTube, as opposed to on your own website, a substantial fraction of those people will be watching at 30 fps. This is because YouTube has a policy of downconverting 60 fps video to 30 fps unless all of these are true:
  1. The viewer's computer can decode 720p60 in real time.
  2. The viewport is big enough for 720p.
  3. The viewer's Internet connection can support data rates typical of 720p60.
  4. The video was uploaded in 720p or larger.
I've owned several laptops and smartphones that failed A (decoding rate) and B (display size). Some users here connect to the Internet through satellite or DSL, which may not be able to meet C (sustained data rate), particularly once a cellular or satellite ISP starts charging overage fees. As for D (source size), the NES itself is incapable of outputting 720p unless modded with the Hi-Def NES kit (which I do not own), and I was under the impression that capturing 720p60 required a far beefier device than capturing 240p60 or 480i30.
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Controlled sprite flicker

Post by tokumaru »

I too wouldn't want to compromise anything in the game itself because of how other people may or may not share videos of my game. If was making a video myself, I would maybe put a disclaimer somewhere, stating that the video might not be a faithful representation of the game depending on the viewer's hardware and configurations, but I can't worry about what everyone else in the internet might do. Some people don't even know how to properly capture game footage, and end up with abysmal irregular frame rates (and capture software watermarks).
User avatar
rainwarrior
Posts: 8734
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Controlled sprite flicker

Post by rainwarrior »

Well, whether or not you care about how a lot of people will see your game footage, that's up to you, I was merely trying to point out the existence of this problem, and some ways it can be addressed. If it's not a problem you're concerned with then don't solve it.

Though I don't really think of more distributed/quasi-randomized cycling as a "compromise", but I say that because I'm only considering flicker to mitigate unavoidable sprite overlap here.

That's a different case than intentional 50% transparency (alternating frames), even though they're both subject to that same 30Hz problem. I would definitely agree that the trying to accommodate that must result in some sort of compromise (e.g. a suitable 30Hz substitute for the text of Batman's intro would be difficult). As an alternative to that, 33% or 66% transparency as a cycle of 3 frames can work well for some purposes (and falls back nicely to a half-speed cycle of 3 on 30hz), but YMMV.
User avatar
battagline
Posts: 152
Joined: Wed Sep 05, 2018 11:13 am
Location: Colorado
Contact:

Re: Controlled sprite flicker

Post by battagline »

rainwarrior wrote: Well, it's up to you whether you care about YouTube, etc. but a lot of people like to experience games through Twitch, YouTube, etc. and the effect of alternating frames is that one of them just doesn't get seen. If you're complaining about 2 frames in a row of invisible character on a CRT, the stream version gets 100 invisible frames in a row instead, one of these problems is dramatically more apparent.
Does Youtube default to 30fps? I'm pretty sure you can do 60fps on youtube. If there an emulator setting that just ignores the 8 sprites per scanline limit? It seems to me that would provide a better experience if you're not playing on actual hardware
A few of my web games
https://www.embed.com
Or if you're bored at work
https://www.classicsolitaire.com
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Controlled sprite flicker

Post by tepples »

battagline wrote:Does Youtube default to 30fps? I'm pretty sure you can do 60fps on youtube.
YouTube allows 60 fps only under the conditions that I described above. If you can suggest how to ensure that the uploaded file and the vast majority of viewers meet the requirements, I'd be interested to read your suggestion.
User avatar
rainwarrior
Posts: 8734
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Controlled sprite flicker

Post by rainwarrior »

battagline wrote:Does Youtube default to 30fps? I'm pretty sure you can do 60fps on youtube. If there an emulator setting that just ignores the 8 sprites per scanline limit? It seems to me that would provide a better experience if you're not playing on actual hardware
Emulators do often have that option, but many games rely on the 8 sprite limit to hide stuff too. Depends what games you want to play but it makes many of them worse because of that.

With YouTube you will just have to expect that a significant amount of people (probably the majority) will be watching in 30fps, whether or not you uploaded at 60fps. There's really nothing you can do to change that reality.

With Twitch there's similar problems but here's an example where despite broadcasting from OBS at 60fps it was not capable of syncing with the emulator and you get a very erratic effect. That's very common, really, and people often use OBS to capture video for non-streaming stuff like YouTube uploads too.

It might technically be possible to capture it cleanly from OBS with very careful settings, but basically nobody is going to figure that out. Even people who stream for a living have this problem all the time with NES / retro games that do alternating frame effects. (...and of course, a lot of people are going to be watching it at 30fps anyway, whether or not you got the source version right.)

Anyway, maybe easier to just decide this is an acceptable problem and ignore it, like some people are suggesting, but to me it's worth considering.


Curiously, I was looking at a few older games just for examples and discovered several commercial era NES game that uses 30Hz alternation when you take damage instead of 60Hz, including Super Mario Bros. 3 and Mega Man 2. I don't think they were able to see the future of YouTube and streaming, but I think probably they thought 60 didn't look flickery enough to communicate the effect so they inentionally slowed it down. ;) SMB2 has an interesting progression from 15Hz to 30Hz to 60Hz when you take damage, indicating roughly how close you are to regaining solidity. Swamp Thing goes as low as 7.5Hz on damage!
User avatar
Banshaku
Posts: 2417
Joined: Tue Jun 24, 2008 8:38 pm
Location: Japan
Contact:

Re: Controlled sprite flicker

Post by Banshaku »

I was looking at other games and especially in the case of mega man, when the characters dies, it will show 8 circles that will grow. At is biggest, 1 circle uses 8 sprites, which means you are already at 64 if you want to show all of them. The only way to show the explosion and other entities would seems to alternate every 30hz when over the limit, which would flicker and in the video case make some part disappear.

In my own engine I'm not handling such events yet so this is one problem that I will need to figure out sooner or later ^^;;;
User avatar
Sumez
Posts: 919
Joined: Thu Sep 15, 2016 6:29 am
Location: Denmark (PAL)

Re: Controlled sprite flicker

Post by Sumez »

rainwarrior wrote: Curiously, I was looking at a few older games just for examples and discovered several commercial era NES game that uses 30Hz alternation when you take damage instead of 60Hz, including Super Mario Bros. 3 and Mega Man 2. I don't think they were able to see the future of YouTube and streaming, but I think probably they thought 60 didn't look flickery enough to communicate the effect so they inentionally slowed it down.
This kind of goes back to the comment I made earlier - there's a very big difference between sprite flickering and an intentional blinking effect. 30hz looks like the sprite blinking in and out of existance, which is what you want it to when taking damage - it just works better as feedback for the player.

Meanwhile with sprite flickering, you want it to look like the sprite is still there even when the console doesn't draw it. We've been used to talk about the NES as a console where sprites flicker all the time, but back in the days before emulation I rarely heard anyone bring attention to the fact. Basically, as long as you stick to 60hz flickering at worst, it's not really that noticeable on most CRTs with a high persistence (which is especially common on cheaper models).
User avatar
gauauu
Posts: 779
Joined: Sat Jan 09, 2016 9:21 pm
Location: Central Illinois, USA
Contact:

Re: Controlled sprite flicker

Post by gauauu »

rainwarrior wrote: Emulators do often have that option, but many games rely on the 8 sprite limit to hide stuff too. Depends what games you want to play but it makes many of them worse because of that.
The Atari emulator Stella has a feature called "simulate posphor" that smooths out 30Hz flickering into a steady slightly-faded image. Do any of the popular NES emulators have something like that? It seems like that would solve a lot of the problems: 30Hz videos would still display correctly. Purposely faded characters (ie if you took damage) would still look slightly different, and games that rely on the 8-sprite limit would still function correctly.
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Controlled sprite flicker

Post by tokumaru »

The problem with that setting is that "posphor" doesn't look like that at all. Stella shows steady 50% transparency when there's 30Hz flicker, but that's not how CRTs behave, you can see the flickering on a real TV. I think it's a completely inaccurate simulation created just to make sprite multiplexing techniques easier on the eyes.

Also, a setting like that would look terrible combined with scrolling, IMO. Backgrounds would look blurred with every little movement.
User avatar
gauauu
Posts: 779
Joined: Sat Jan 09, 2016 9:21 pm
Location: Central Illinois, USA
Contact:

Re: Controlled sprite flicker

Post by gauauu »

tokumaru wrote:The problem with that setting is that "posphor" doesn't look like that at all. Stella shows steady 50% transparency when there's 30Hz flicker, but that's not how CRTs behave, you can see the flickering on a real TV. I think it's a completely inaccurate simulation created just to make sprite multiplexing techniques easier on the eyes.
On my TV, flickering looks somewhere in between what Stella does, and what 30Hz on a monitor does. You can see some flicker, but not nearly what you'd see on a monitor with an emulator.

Also, a setting like that would look terrible combined with scrolling, IMO. Backgrounds would look blurred with every little movement.

That's a good point. Although you could theoretically enable it only for sprites.
User avatar
Bregalad
Posts: 8056
Joined: Fri Nov 12, 2004 2:49 pm
Location: Divonne-les-bains, France

Re: Controlled sprite flicker

Post by Bregalad »

tokumaru wrote:I too wouldn't want to compromise anything in the game itself because of how other people may or may not share videos of my game. If was making a video myself, I would maybe put a disclaimer somewhere, stating that the video might not be a faithful representation of the game depending on the viewer's hardware and configurations, but I can't worry about what everyone else in the internet might do. Some people don't even know how to properly capture game footage, and end up with abysmal irregular frame rates (and capture software watermarks).
Not to mention those who simply enlarge retro games in 16:9 and doesn't even notice how wrong this looks... And this is not a rare phenomenon by any mean.

The only "proper" way to scale a 60FPS game into 30FPS (or lower) video would be to average frames, that is, if a sprite is flickering at 60 FPS it should look transparent on the video, which is correct. Having it either be solid or disapearing is wrong.

Regarding to the original question... There is lots of different techniques and strategies to achieve sprite flickering, it really depends on the game, whether you have sprite priority within metasprites, and whether priority between metasprites is important. In the major game engine I developed priorities within metasprites are not important, but priorities between metasprites are important, so I always draw metasprites in the same order, but reverse the order of individual sprites within metasprites.
Post Reply