Untitled adventure game, Milestone 1: Scrolling and tools.

A place where you can keep others updated about your NES-related projects through screenshots, videos or information in general.

Moderator: Moderators

User avatar
bleubleu
Posts: 108
Joined: Wed Apr 04, 2018 7:29 pm
Location: Montreal, Canada

Re: Untitled adventure game, Milestone 1: Scrolling and tool

Post by bleubleu »

GradualGames wrote:This looks incredible. Definitely looks like it could replace nesmaker. Are you going to be selling it or is it free/open source?

Also, how do you make your guy go behind walls? I was impressed by that because I never could figure out a good way to do that on my own adventure game (The Legends of Owlia), so I just made it impossible. In Crystalis, they had to severely compromise the palette and have more than one shared color so that you could go behind a house using the background color as green but still have black outlines etc. It was kinda ugly.

My guess is maybe you have a character that always moves on an 8x8 grid and you can just cut him off? I cut off sprites for text boxes by nudging them a max of 4 pixels and then cutting them off at the sprite grid boundary, but never found a nice way to do the same just going behind walls etc.

Very cool stuff.
Thanks. Not planning to sell anything, I'm just having fun and learning. Will definitely put the code up somewhere at some point. Its just too messy now!

To hide the guy i simply have a flag for each metatile that says if it is a "foreground" tile. So I constantly look if the feet of the character are touching a foreground tile, if it is, i render him behind the background.

This look cool, but it has severe limitations.

Most obvious one is that your floor, at least near the areas where you character can be occluded, needs to be of a plain color (i.e. the background color, which is this ugly orange/pink color). So i have these little "brick" tiles on the floor, but I could NOT put one near the bottom wall, otherwise the guy would render behind the brick pattern.

Also, gameplay-wise, I can see how it could be frustrating to die because you were partially occluded and couldnt see what was going on... So for all these reasons I might not keep it. Or I might adapt my level design to mitigate the problems. We will see.

-Mat
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Untitled adventure game, Milestone 1: Scrolling and tool

Post by tepples »

The background doesn't necessarily have to be a plain color. If you have any sprite that matches either the background color or the shape of the background object, you can use what I call impossible triangle priority, a quirk of sprite priority on the NES. To put it short: If sprites' priority bits don't match their OAM order, the background wins.

When you hit a block in Super Mario Bros. 3 and a mushroom sprouts, you have three things mutually overlapping:

1. The block in the background
2. A solid black mask sprite, which is "behind" the block
3. The mushroom sprite, which is "in front of" the block but "behind" the mask sprite, hence the impossible triangle

The mask sprite appears before the mushroom in OAM, so it covers up the mushroom's pixels. But because the mask sprite has the priority bit turned on, any opaque pixels in the background replace the pixels of the mask sprite. Thus the mask sprite cuts a hole in all sprites behind it, allowing the background block to show through. Pillars in Mystery World Dizzy and The Curse of Possum Hollow use the same principle, as do tall pieces of furniture in RHDE: Furniture Fight.

See also:
PPU sprite priority and the entry of SMB3 in Tricky-to-emulate games
User avatar
bleubleu
Posts: 108
Joined: Wed Apr 04, 2018 7:29 pm
Location: Montreal, Canada

Re: Untitled adventure game, Milestone 1: Scrolling and tool

Post by bleubleu »

tepples wrote:The background doesn't necessarily have to be a plain color. If you have any sprite that matches either the background color or the shape of the background object, you can use what I call impossible triangle priority, a quirk of sprite priority on the NES. To put it short: If sprites' priority bits don't match their OAM order, the background wins.

When you hit a block in Super Mario Bros. 3 and a mushroom sprouts, you have three things mutually overlapping:

1. The block in the background
2. A solid black mask sprite, which is "behind" the block
3. The mushroom sprite, which is "in front of" the block but "behind" the mask sprite, hence the impossible triangle

The mask sprite appears before the mushroom in OAM, so it covers up the mushroom's pixels. But because the mask sprite has the priority bit turned on, any opaque pixels in the background replace the pixels of the mask sprite. Thus the mask sprite cuts a hole in all sprites behind it, allowing the background block to show through. Pillars in Mystery World Dizzy and The Curse of Possum Hollow use the same principle, as do tall pieces of furniture in RHDE: Furniture Fight.

See also:
PPU sprite priority and the entry of SMB3 in Tricky-to-emulate games
Wow, this is some cool stuff! I didnt know any of that. I will read the wiki. Thanks!

-Mat
User avatar
dougeff
Posts: 3078
Joined: Fri May 08, 2015 7:17 pm

Re: Untitled adventure game, Milestone 1: Scrolling and tool

Post by dougeff »

tokumaru wrote: The IRQ counter won't work with rendering disabled, which is why I mentioned disabling only one layer (either sprites or background - as long as one of them is enabled, the PPU will function normally, and so should the scanline counter), and bankswitching blank patterns for the other. IIRC, Jurassic Park uses black (not blank - it has black in every palette!) patterns for both layers. Palette swaps mid-screen are notoriously hard to pull off on the NES, very few games did it.
I find this discussion fascinating.

What if you only had BG disabled for the top 8 lines, but sprites on, and you put 8 blank sprites at Y=0. The 8 Sprite limit makes it impossible for any other sprites to show up there.

I'm 90% sure the MMC3 IRQ would work, because it ticks the counter down on the sprite evaluation (I think).

Then rendering on till line 231, then another IRQ, then rendering off at the bottom.

Does anyone see any flaws with this plan?
nesdoug.com -- blog/tutorial on programming for the NES
User avatar
pubby
Posts: 583
Joined: Thu Mar 31, 2016 11:15 am

Re: Untitled adventure game, Milestone 1: Scrolling and tool

Post by pubby »

Can't you just busy-wait with rendering disabled for the top 8 scanlines? Or would that also muck up the IRC counter?
User avatar
bleubleu
Posts: 108
Joined: Wed Apr 04, 2018 7:29 pm
Location: Montreal, Canada

Re: Untitled adventure game, Milestone 1: Scrolling and tool

Post by bleubleu »

dougeff wrote: What if you only had BG disabled for the top 8 lines, but sprites on, and you put 8 blank sprites at Y=0. The 8 Sprite limit makes it impossible for any other sprites to show up there.
I think it would work BUT keep in mind my background color is NOT black. Its that ugly pink/orange on the floor. So you wouldn't get black bars, you would get pink bars!

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

Re: Untitled adventure game, Milestone 1: Scrolling and tool

Post by tokumaru »

I used this technique before, but since timing raster effects at the bottom of the screen without IRQs is pretty hard (if you scroll vertically, guaranteeing a sprite 0 hit is practically impossible), I just masked 16 scanlines at the top of the screen. In the NMI handler, I turned background rendering off, and placed 9 high-priority transparent sprites at the very top of the screen, and waited for the sprite overflow flag to get set. After that, I'd wait 16 scanlines with time code before turning background rendering back on. My main CRT back then used to hide 12 or so scanlines at the top, so there was very little blank space visible, which bothered me much less than scrolling artifacts.
JoeGtake2
Posts: 333
Joined: Tue Jul 01, 2014 4:02 pm

Re: Untitled adventure game, Milestone 1: Scrolling and tool

Post by JoeGtake2 »

Hey there - this is Joe from The New 8-bit Heroes / NESmaker. Just wanted to say...this is fantastic :-)

Great tools, friend! Look forward to seeing what comes from them! We actually have a similar bit flip for hiding behind tiles this way...super cool to see it in yours too! And I'm jealous of how awesome your 4 way scrolling handles! Our scrolling is still pretty clunky to make the rest of the engine fit congruently.

Great work. Love to see the community building things like this. :-)

Joe
User avatar
bleubleu
Posts: 108
Joined: Wed Apr 04, 2018 7:29 pm
Location: Montreal, Canada

Re: Untitled adventure game, Milestone 1: Scrolling and tool

Post by bleubleu »

JoeGtake2 wrote:Hey there - this is Joe from The New 8-bit Heroes / NESmaker. Just wanted to say...this is fantastic :-)

Great tools, friend! Look forward to seeing what comes from them! We actually have a similar bit flip for hiding behind tiles this way...super cool to see it in yours too! And I'm jealous of how awesome your 4 way scrolling handles! Our scrolling is still pretty clunky to make the rest of the engine fit congruently.

Great work. Love to see the community building things like this. :-)

Joe
Oh thanks!

Let me know if I can help with the scrolling. Its been kind of annoying to get it to work, maybe i can save you some time. But I doubt that is plug-an-play since its highly dependent on your data layout.

-Mat
JoeGtake2
Posts: 333
Joined: Tue Jul 01, 2014 4:02 pm

Re: Untitled adventure game, Milestone 1: Scrolling and tool

Post by JoeGtake2 »

Thanks, friend! Yeah, it's not that SCROLLING itself is an issue. Conceptually, we've already made it work fine. It's more that in an attempt for a extremely malleable code base with a consistent front end, it's been SUPER tricky to devise methods for it around that!

Would love to talk to you more about your project and what you're doing...I think it looks fantastic (and amazing art, too!!) Hit me up in an email if you'd like - joe@TheNew8bitHeroes.com
Scrobins09
Posts: 9
Joined: Sun Mar 03, 2019 4:48 pm

Re: Untitled adventure game, Milestone 1: Scrolling and tools.

Post by Scrobins09 »

Any new updates on this game? It's so cute!
Post Reply