Clean-Up Crew

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

Moderator: Moderators

Drag
Posts: 1615
Joined: Mon Sep 27, 2004 2:57 pm
Contact:

Re: Clean-Up Crew

Post by Drag »

NovaSquirrel wrote:The wiki has example code that takes care of that with an AND and CMP.
Thanks! I had a feeling there was a simple way to trick the carry flag into doing it. :D

Also, TIL what a kotatsu is. We murricans just have couches and coffee tables, optionally with blankets draped over the back of the couch. As a kid, our NES was set up next to the TV, and we'd sit on the floor in front of the TV to play, even though there was a couch, so short controller cables weren't a problem for us, but even if they were, we could just as easily have set it up on the coffee table.

And yeah, I'm definitely going to be Famicom compatible. I didn't know they were particularly common in the nesdev community, I just knew that I'd heard the complaints before.
Drag
Posts: 1615
Joined: Mon Sep 27, 2004 2:57 pm
Contact:

Re: Clean-Up Crew

Post by Drag »

Well, I said any progress, no matter how minor:
cleanup-0.png
cleanup-0.png (1.77 KiB) Viewed 5981 times
The big empty space on the bottom is the status bar, and there won't be any ceiling-based objectives on the top floor because my TV cuts 16 pixels off the top (8 more than this screenshot), and if my TV does that, it must be the case for others too.

It's a rom now. I have some system code that I've reused in several of my abandoned projects, which includes controller handling (tweaked now to also support the Famicom expansion port), metasprite drawing, ppu pipelining, and several nice routines, so I didn't start from zero.

So far, that scene is generated using a script-type level format. It's something like this:
(starting from 0,0) Move down 24 tiles, draw wall (width: 32, height: 1), jump to (10,12), draw staircase(length: 6, right railing: 3, left railing: 1), etc etc etc, end

If you inserted conditionals into something like that, you could do some pretty nifty things for an adventure game.

Anyway, the code sucks, because it started with a plain rectangle drawing routine that just drew using the brick tile. Then that was generalized into drawing any tile, and then the staircase is a clusterfuck of calls to that rectangle drawing routine in order to make fancy staircases with togglable variable length railings. There are some improvements I can make to this to make it less clunky, and I still need to deal with the attribute table, but I've coded for 8 straight hours. :|
User avatar
rainwarrior
Posts: 8734
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Clean-Up Crew

Post by rainwarrior »

I like the railing that curves around. Does that mean you have characters that alternate between going behind and in front of the background, depending on where they are?
Drag
Posts: 1615
Joined: Mon Sep 27, 2004 2:57 pm
Contact:

Re: Clean-Up Crew

Post by Drag »

That's it exactly. There's a software priority map for the screen, and the metasprite drawing routine will check against it to determine what priority to give a sprite tile.
User avatar
Bratwurst
Posts: 24
Joined: Fri Jun 12, 2015 10:20 am

Re: Clean-Up Crew

Post by Bratwurst »

This looks really promising, kindly keep up the good work.
Drag
Posts: 1615
Joined: Mon Sep 27, 2004 2:57 pm
Contact:

Re: Clean-Up Crew

Post by Drag »

cleanup-2.png
cleanup-2.png (1.79 KiB) Viewed 5841 times
Thanks for all of the encouragement so far, past and present. :D

This doesn't look much different from the previous screenshot, but there's more stuff going on behind the scenes. In addition to generating the attribute table, the collision map and the priority map are also generated at this point. The collision map is stored bitpacked (8 horizontal tiles in one byte), planar, and 2 bits per 8x8 cell, expandable to 3 bits, shrinkable to 1 bit, depending on what the level needs. The priority map is also bitpacked, but uses 8x16 cells instead. Since the level data doesn't operate on metatiles, there's the possibility of attribute clash and priority clash (since the background priority is only simulated, the moment a sprite tile touches a high priority cell in the priority map, it switches to BG priority, which can look ugly if this transition doesn't occur overtop a blank tile), but this is easily solvable by leaving spaces where needed.

This is also the full size of the playfield, buildings aren't allowed to be any bigger than this, but they'll look a billion times nicer once they're actually shaped like buildings and once more objects are drawn. Now that the collision information is present, the sprite programming can start. :D I can work on cleaning up and optimizing the code later.
Drag
Posts: 1615
Joined: Mon Sep 27, 2004 2:57 pm
Contact:

Re: Clean-Up Crew

Post by Drag »

cleanup-3.png
cleanup-3.png (2.78 KiB) Viewed 5797 times
I finished up a routine that draws arbitrary things, rather than just simple rectangles. The scene looks a lot better when it's populated, but there's some attribute clash on the two left stairs, under the short railing. Maybe it's forgivable, but I'll explore ways of masking it.

I've also modified my build script so DASM tells me how much space I have left. There's still about 30kb left, but there's no game engine or music engine yet.
Drag
Posts: 1615
Joined: Mon Sep 27, 2004 2:57 pm
Contact:

Re: Clean-Up Crew

Post by Drag »

cleanup_vwalk3.gif
cleanup_vwalk3.gif (1.85 KiB) Viewed 5688 times
Finally got an up/down walking animation I'm happy with. The apron started with no back (seen in an earlier post), leaving the backview too blank. Then, it had a solid back, which looked ok but didn't make a lot of sense as an apron. Finally, this cross-backed apron looked the best.

Progress has been slow because I got lazy. :\ However, I did poke at the code recently; the code for loading a building was written quick and dirty, just to get something that worked. I went back through it and commented it correctly, and also performed a bunch of optimizations that improved loading time and footprint size. Loading time was pretty quick as it was, but now it's a flash, so I'm much happier with it.

There's also a simple routine that draws Bruce and you use the dpad to move him freely around the screen, to test the priority map portion of the code. It works pretty well, but I ran into some other fun gotchas with priority clash. The end effect will be worth working around the issues though. Basically, the moment a sprite tile touches a high priority BG tile, the sprite tile flips into low priority mode so it can slide behind the BG tile. The problem was that the up/down animations were made assuming the top portion of Bruce's head can just be moved back and forth physically as a tile optimization. However, that means his head will overlap the high-priority railings at the top of staircases, hiding half his head behind the stairs every other frame! There's a couple ways to fix it though, one is ignoring the priority map while going up/down stairs (but not other things, like stepladders, because his head needs to go behind ceiling lamps), which is a feature already coded. The other is changing the sprite so the head bobs are included in the graphics rather than having two tiles that bob back and forth physically.

And yeah, their names are Bruce and Roy. Some fun trivia can be that they were almost named Pipi and Pupu, as indicated in the OP. :P


In more personal news, I'm in the process of kickstarting a career change so I can finally leave retail and persue programming full-time, like I've worked so hard to prepare for. This game project has stayed in the back of my mind ever since starting it, and even if progress is miniscule and far between, I hope my drive to work on this doesn't die before it has a chance to be completed.
User avatar
Myask
Posts: 965
Joined: Sat Jul 12, 2014 3:04 pm

Re: Clean-Up Crew

Post by Myask »

Drag wrote: There's also a simple routine that draws Bruce and you use the dpad to move him freely around the screen, to test the priority map portion of the code. It works pretty well, but I ran into some other fun gotchas with priority clash. The end effect will be worth working around the issues though. Basically, the moment a sprite tile touches a high priority BG tile, the sprite tile flips into low priority mode so it can slide behind the BG tile.
Did you consider using the fact that the priority bits aren't true Z-ordering, like SMB3 does? That is, when there's a sprite that's to be "behind", a sprite that's to be "in-front", and a non-BG-colored pixel in the tilemap...both sprites are put behind. (Not sure, does this only work if the "behind" sprite is nontransparent?)

This would use some extra sprite data and OAM space, though.
User avatar
thefox
Posts: 3134
Joined: Mon Jan 03, 2005 10:36 am
Location: 🇫🇮
Contact:

Re: Clean-Up Crew

Post by thefox »

Myask wrote:Did you consider using the fact that the priority bits aren't true Z-ordering, like SMB3 does? That is, when there's a sprite that's to be "behind", a sprite that's to be "in-front", and a non-BG-colored pixel in the tilemap...both sprites are put behind. (Not sure, does this only work if the "behind" sprite is nontransparent?)
Yes, the "behind" sprite has to have a non-transparent pixel, and a higher priority (= lower sprite index) than the "in-front" sprite.
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi
Drag
Posts: 1615
Joined: Mon Sep 27, 2004 2:57 pm
Contact:

Re: Clean-Up Crew

Post by Drag »

The trick SMB3 uses when Mario enters pipes? Yes, I considered that, but since most priority clash issues can be fixed by leaving a space of 1 blank tile between low priority and high priority BG objects, I figured I wouldn't need to go that far. Plus, I'd need mask sprites that are in the shape of the various BG objects, and would need to store extra data in RAM for which mask shape to use in each location. (There's no tilemap or metatile map in RAM, it's only a map of physical attributes, otherwise it'd be doable) It's not a bad idea though, and given more memory, I probably would've done it.

Having Bruce ignore the priority map while on stairs also makes sense because he wouldn't need to be behind anything until he's reached the top of the staircase, and also helps with animations like if he were shoved down the stairs, he'd have been shoved in front of anything, which is good because his sprite would likely be wider during the animation.
User avatar
Jedi QuestMaster
Posts: 688
Joined: Thu Sep 07, 2006 1:08 pm
Location: United States
Contact:

Re: Clean-Up Crew

Post by Jedi QuestMaster »

Nice to see progress (no matter how slow). But that back sprite looks slightly odd.
Drag wrote:Image
It looks like the front of a shirt vest. How about making the straps thinner, like this?
http://www.nicnacnoo.com.au/images/deta ... m-Back.jpg
But without the bow in the back.
Drag
Posts: 1615
Joined: Mon Sep 27, 2004 2:57 pm
Contact:

Re: Clean-Up Crew

Post by Drag »

That's the exact thing I was going for, actually. :P You're right though, the straps needed to be thinner:
cleanup_vwalk4.gif
cleanup_vwalk4.gif (976 Bytes) Viewed 5628 times
Hopefully that looks less like the front of a shirt? A few weeks ago, the problem was it looking too much like a weird bikkini. :P Also, in a higher resolution, he'll have actual criss-cross straps on his back; there's just not enough resolution to reliably depict it here.
M_Tee
Posts: 430
Joined: Sat Mar 30, 2013 12:24 am
Contact:

Re: Clean-Up Crew

Post by M_Tee »

Love the lightbulb changing animation. A lot of character there.

Earlier you mentioned an inconsistency between the vertical walking and horizontal walking animations. That may be because in the vertical walk, the character rotates his head side-to-side, but in the horizontal walk, he bobs it front-and-back, implying that the character has a different walking style between the two directions. Not a big deal, though (especially if vertical walk is only used for stairs because people would walk differently on stairs than on flat footing.)

Anyway, looking forward to seeing more progress as it comes along.
User avatar
Myask
Posts: 965
Joined: Sat Jul 12, 2014 3:04 pm

Re: Clean-Up Crew

Post by Myask »

Drag wrote:That's the exact thing I was going for, actually. :P You're right though, the straps needed to be thinner:
Also, in a higher resolution, he'll have actual criss-cross straps on his back; there's just not enough resolution to reliably depict it here.
Yeah, it did look kind of like a brassiere or tank-top.
I disagree that there isn't enough resolution (though, NTSC problems may spite me). Here's my attempt:
Attachments
Thinner straps! Thinner!
Thinner straps! Thinner!
cleanup_vwalk_myask5.gif (479 Bytes) Viewed 5554 times
Post Reply