Newcomer to NES programming

A place for your artistic side. Discuss techniques and tools for pixel art on the NES, GBC, or similar platforms.

Moderator: Moderators

Post Reply
User avatar
Alp
Posts: 223
Joined: Mon Oct 06, 2014 12:37 am

Re: Newcomer to NES programming

Post by Alp »

Nameguy wrote:Thank you. I'll guess there needs to be one song for each of those maps and the title theme? Does anyone know the maximum/average size of NROM music? SMB had 6 songs.
I'm not too sure about the music size in an NROM game, but I do know that repeated sections of songs can be stored as "patterns", and played back using a timer. Compressing the sound data a decent bit.
Nameguy wrote: I entered that code into the SFX tool but I'm not sure if this is what it's supposed to sound like.
Hmm... That's about right. I could have sworn the pitch was slightly higher, but oh well.
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Newcomer to NES programming

Post by tepples »

How much music can you fit into 3K? Listen.
lidnariq
Posts: 10677
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: Newcomer to NES programming

Post by lidnariq »

Nameguy wrote:Does anyone know the maximum/average size of NROM music? SMB had 6 songs.
Having made Driar's NROM build: 40KiB of game consisting of: 8 KiB of music data, 8 KiB of music replayer, 6 KiB of CHR data, 5 KiB of main engine code, 11 KiB of level data, and 2 KiB for opening and closing titles.
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Newcomer to NES programming

Post by tepples »

Thwaite (NROM-128 with CHR ROM, 5 songs)
  • 343 bytes sound effect engine
  • 128 bytes period table
  • 556 bytes music engine
  • 983 bytes sound data, incl. music sequences, instruments, and sound effects
Total: 2010 bytes (12.3% of PRG ROM)

RHDE: Furniture Fight (NROM-256 with CHR RAM, 2 songs)
This uses a newer version of my music engine, supporting more effects such as arpeggio, instrument envelopes, and patterns with larger pitch range.
  • 380 bytes sound effect engine
  • 128 bytes period table
  • 907 bytes music engine
  • 1030 bytes sound data
Total: 2445 bytes (7.46% of PRG ROM)
User avatar
thefox
Posts: 3139
Joined: Mon Jan 03, 2005 10:36 am
Location: Tampere, Finland
Contact:

Re: Newcomer to NES programming

Post by thefox »

lidnariq wrote:
Nameguy wrote:Does anyone know the maximum/average size of NROM music? SMB had 6 songs.
Having made Driar's NROM build: 40KiB of game consisting of: 8 KiB of music data, 8 KiB of music replayer, 6 KiB of CHR data, 5 KiB of main engine code, 11 KiB of level data, and 2 KiB for opening and closing titles.
This is not an "average" case for NROM music, though. MUSE (the sound engine used in Driar, written by me) is pretty generic and was not really written with non-banking mappers in mind, so it's typically possible to get smaller results with engines where the feature-set is stripped or configurable; or where you have the option of hand-optimizing the audio data.
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi
Nameguy
Posts: 15
Joined: Sun Nov 02, 2014 3:27 pm

Re: Newcomer to NES programming

Post by Nameguy »

thefox wrote:This is not an "average" case for NROM music, though. MUSE (the sound engine used in Driar, written by me) is pretty generic and was not really written with non-banking mappers in mind, so it's typically possible to get smaller results with engines where the feature-set is stripped or configurable; or where you have the option of hand-optimizing the audio data.
Is it possible to estimate a minimum code length for a certain feature set?
For just vibrato, volume control and duty control (no envelopes)?
User avatar
Alp
Posts: 223
Joined: Mon Oct 06, 2014 12:37 am

Re: Newcomer to NES programming

Post by Alp »

tepples wrote:How much music can you fit into 3K? Listen.
Damn! That is impressive for 3KB! :shock:
thefox wrote:MUSE (the sound engine used in Driar, written by me) is pretty generic and was not really written with non-banking mappers in mind, so it's typically possible to get smaller results with engines where the feature-set is stripped or configurable; or where you have the option of hand-optimizing the audio data.
Hand-optimizing is what I was referring to, by the mention of sound patterns, as that's how tracker music works. Though, with trackers, they optimize the data for you. I've been optimizing the hell out of my map data, so optimizing sound doesn't really seem too daunting a task, at this point.
Nameguy
Posts: 15
Joined: Sun Nov 02, 2014 3:27 pm

Re: Newcomer to NES programming

Post by Nameguy »

Alp wrote:Hand-optimizing is what I was referring to, by the mention of sound patterns, as that's how tracker music works. Though, with trackers, they optimize the data for you. I've been optimizing the hell out of my map data, so optimizing sound doesn't really seem too daunting a task, at this point.
I've done this one pattern (two variations) using no effects or instruments. FT says the song data is 827 bytes.
Attachments
cqtest2.nsf
(6.55 KiB) Downloaded 170 times
User avatar
Alp
Posts: 223
Joined: Mon Oct 06, 2014 12:37 am

Re: Newcomer to NES programming

Post by Alp »

Nameguy wrote: I've done this one pattern (two variations) using no effects or instruments. FT says the song data is 827 bytes.
Oh! Very nice! ...good job on the optimization!

I've been having some... problems, with optimizing the snake boss for 8x8 sprites. I've revised the sprite so many different ways, and it will STILL cause flickering. Ah, screw it. I'll make him a gleeok-ish dragon, that breathes fire.

I've been kind of irritated at my transition to 8x8 sprites, and while it does give me freedom to add more, it's a pain for ONE freakin' enemy! I did this mock-up of what an 8x16 mapper-based version of this game, would look like. Maybe one day... Image

Cat Quest 3! :P
Last edited by Alp on Sat May 21, 2016 2:44 pm, edited 1 time in total.
User avatar
tokumaru
Posts: 12106
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Newcomer to NES programming

Post by tokumaru »

Alp wrote:Image
Great job with the perspective! A lot of people fail miserably at representing perspective in a system that absolutely can't do accurate perspective, but this is very pleasing to the eye.
User avatar
Alp
Posts: 223
Joined: Mon Oct 06, 2014 12:37 am

Re: Newcomer to NES programming

Post by Alp »

tokumaru wrote: Great job with the perspective! A lot of people fail miserably at representing perspective in a system that absolutely can't do accurate perspective, but this is very pleasing to the eye.
Thanks! I had actually drawn a much smaller 3x4 version of that house, for the NROM Cat Quest, until I realized that I could fit everything, but the house into the CHR. Oops. :oops:

A question related to my "future projects", which will remain as art projects for now. What is the most optimal mapper set-up for a bank-swapped homebrew game? Nothing fancy. Just extra CHR, maybe a few extra KBs for extra map data. I'm not really too sure. It would be helpful to know art-wise, at least. >.>
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Newcomer to NES programming

Post by tepples »

The most flexible is CHR RAM, and whether you use UNROM or something more complex depends on whether you want highly complex raster effects and whether you want save RAM.
User avatar
Alp
Posts: 223
Joined: Mon Oct 06, 2014 12:37 am

Re: Newcomer to NES programming

Post by Alp »

tepples wrote:The most flexible is CHR RAM, and whether you use UNROM or something more complex depends on whether you want highly complex raster effects and whether you want save RAM.
I gave CHR-RAM a proper read-up, and wow! You can dynamically load tile data into a tilebank? I wasn't aware of that!

...and here I was, going to have copies of the Rabbit Knight from that platformer copied across each sprite bank of the CHR! Zelda II does that. That certainly saves me some graphical space! Also, good to know that, for the technically more advanced version of Cat Quest, as well.

No. I won't need fancy raster effects. Reading a compiled list, they do seem helpful, in some cases. But not something I would need. At least, not for anything at the moment.
User avatar
tokumaru
Posts: 12106
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Newcomer to NES programming

Post by tokumaru »

Alp wrote:I gave CHR-RAM a proper read-up, and wow! You can dynamically load tile data into a tilebank? I wasn't aware of that!
The beauty of CHR-RAM is that, like any regular RAM, it can be freely modified. The only constraint is that you can't touch it while the image is rendering (the same way you can't touch other parts of VRAM), so during gameplay you're limited to changing the amount of tiles possible during VBlank, which aren't that many. At 16 bytes per tile, you can realistically update only 4 to 8 tiles during VBlank each frame while still having time left for other updates, such as sprites, name tables, palettes, and so on. During screen transitions, when you can disable rendering and keep the screen blank for a few frames, you have enough time to set up your pattern tables however you want.

BTW, most other game consoles (Game Boy, Master System, Genesis, SNEs, etc.) are always like that, with tiles stored in RAM as opposed to ROM, only this RAM is *inside* the console. For some reason (most likely to make the console cheaper), Nintendo chose to put this memory outside the Famicom. This made it possible for carts to use either ROM or RAM for tiles, allowing developers to use what suited their games better.
No. I won't need fancy raster effects. Reading a compiled list, they do seem helpful, in some cases. But not something I would need. At least, not for anything at the moment.
Then the best thing to do is stick to simple discrete mappers, like UxROM or BNROM, which provide simple PRG-ROM bankswitching and CHR-RAM.
Sik
Posts: 1589
Joined: Thu Aug 12, 2010 3:43 am

Re: Newcomer to NES programming

Post by Sik »

tokumaru wrote:BTW, most other game consoles (Game Boy, Master System, Genesis, SNEs, etc.) are always like that, with tiles stored in RAM as opposed to ROM, only this RAM is *inside* the console. For some reason (most likely to make the console cheaper), Nintendo chose to put this memory outside the Famicom. This made it possible for carts to use either ROM or RAM for tiles, allowing developers to use what suited their games better.
Given that until then all consoles* either used registers or framebuffers (SG-1000 would use tilemaps and sprites, but it was launched the same day as the Famicom), it's not that surprising that the NES hardware has oddities like that. The NES was modeled after the popular arcades of the time, and those used ROM to store the graphics, so I would assume Nintendo used ROM just because that's what everybody was doing at the time. Why later systems modeled after arcades went with RAM I'm not sure, I guess that by then arcade ROMs became so big that it'd have been unfeasible to let console games require so much.

(*well, except the Vectrex which used vector graphics)
Post Reply