Hud

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
vnsbr
Posts: 56
Joined: Sun Feb 17, 2019 5:18 pm
Contact:

Hud

Post by vnsbr »

What is the best/recommended way of doing a static portion of the screen on a scrolling game?(say a HUD for a platformer)
Thanks!
User avatar
Individualised
Posts: 310
Joined: Mon Sep 05, 2022 6:46 am

Re: Hud

Post by Individualised »

That depends on the specifics of your game, what graphics mode you're planning to use, how much/what items you want to display on the HUD etc, there isn't a catch-all answer to this question. We need more details to be able to answer this properly.
User avatar
Dwedit
Posts: 4924
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Re: Hud

Post by Dwedit »

It depends on your requirements.

Many games just used a portion of Layer 3 for the HUD, and overlayed a few sprites on top. This gives you a non-opaque HUD, but has very few colors, and the HUD area can conflict with a possible other use for layer 3.

One example is Castlevania IV, where Layer 3 is used for both the HUD, and a second parallax layer via a horizontal split. Parallax layer does not scroll vertically, so it cannot conflict with the HUD.

If you are willing to have an opaque HUD, then you don't even need to use the same background mode as the rest of the screen. The other part can even be Mode 7.

Or you could build the HUD out of sprites, but that eats away at the number of other sprites you can use.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Hud

Post by tokumaru »

Dwedit wrote: Sun Sep 18, 2022 10:06 amParallax layer does not scroll vertically, so it cannot conflict with the HUD.
Can you change the tilemap address mid-screen and use some other portion of VRAM for the HUD to avoid conflicts caused by scrolling?
93143
Posts: 1717
Joined: Fri Jul 04, 2014 9:31 pm

Re: Hud

Post by 93143 »

Yes, that's easy. It's probably unnecessary too, because of how flexible the SNES is in terms of tile count and tilemap sizes. But you can't use a BG layer for the HUD if the level uses all of the available layers in the same area of the screen the HUD appears in.

Mode 7 is particularly nasty because you only get one layer, so any overlaid HUD must be sprites. Mode 6 has this problem too, but no one uses Mode 6...

...

Technically you can do a vertical split with an H-IRQ, writing to scroll registers and even BGMODE mid-scanline and covering up (most of) any resulting garbage with sprites. This is not recommended if it isn't absolutely necessary, mostly due to the huge CPU cost of that many interrupts. Also, most emulators don't handle it properly, so your audience will be limited. Of the commercial games, AFAIK only Air Strike Patrol does this, and only with scroll registers, only for a tiny portion of the screen, with a huge transparent gap in the affected layer so it doesn't require glitch masking.
creaothceann
Posts: 611
Joined: Mon Jan 23, 2006 7:47 am
Location: Germany
Contact:

Re: Hud

Post by creaothceann »

93143 wrote: Sun Sep 18, 2022 9:19 pm mostly due to the huge CPU cost of that many interrupts
You could set up a V-IRQ at that part of the screen and only then set up H-IRQs for the relevant line(s).
My current setup:
Super Famicom ("2/1/3" SNS-CPU-GPM-02) → SCART → OSSC → StarTech USB3HDCAP → AmaRecTV 3.10
93143
Posts: 1717
Joined: Fri Jul 04, 2014 9:31 pm

Re: Hud

Post by 93143 »

Yes, you could. Like I said, ASP uses this for a small number of scanlines. It's also just for the mission start text, so the CPU load probably isn't all that important anyway.

I use it for a large number of scanlines. I have a 192-line playfield (that's usually Mode 7) next to a Mode 1 sidebar, and my extended VBlank is 58 lines at the moment, so nearly all of the free lines have interrupts. It's pretty brutal; if I hadn't already been using the Super FX I'd never have considered burning that much CPU time just to make a visually faithful port...
User avatar
Individualised
Posts: 310
Joined: Mon Sep 05, 2022 6:46 am

Re: Hud

Post by Individualised »

tokumaru wrote: Sun Sep 18, 2022 8:53 pm
Dwedit wrote: Sun Sep 18, 2022 10:06 amParallax layer does not scroll vertically, so it cannot conflict with the HUD.
Can you change the tilemap address mid-screen and use some other portion of VRAM for the HUD to avoid conflicts caused by scrolling?
Doesn't Super Mario World do this?
Post Reply