Quantcast
Channel: nesdoug
Viewing all 88 articles
Browse latest View live

NES Screen Tool BMP Import

$
0
0

The latest version of NES Screen Tool has improved BMP import features. I’m going to give them a try. The BMP must be a color indexed, 16 color, or 256 color. I think 16 color works better.

I found this image somewhere on the internet. I reduced the image to 256×240.

girlB

Using GIMP, first I adjusted the levels, especially the midtones, so they will not wash out.

girl2B

My first attempt, I darkened the background and then converted to NES color (I previously made a custom palette using the NES palette). Then, Image/Mode/Indexed, and chose the NES palette. Then I Image/Mode/RBG. Then I Image/Mode/Indexed, Optimize to 16 color. Here’s what we have…

girlX

Then, I imported to NES Screen Tool, with only ‘lossy’ checked. This is what I got.

girlX2

Ugh. Not great. Try again. Took the Original Image (256×240), leveled, with a darkened background…

girl3B

Image/Mode/Grayscale, then Image/Mode/RGB. Then I selected the Pencil Tool (or brush), and changed it’s mode to ‘color’ and selected a Orange color, and recolored the gray image like a duotone. (I also adjusted the levels again).

girl4B

Now…Image/Mode/Indexed, chose NES palette. Image/Mode/RGB. Image/Mode/Indexed, optimized for 4 color. Image/Mode/RGB. Image/Mode/Indexed, optimized for 16 color. (The NES Screen Tool seems to do better if you have the final in 16 colors).

Girl6B

This is what the final version looks like in GIMP. Let’s import BMP from NES Screen Tool again (only ‘lossy’ checked)…

Girl7B

Much better.

Next time I’m going to import this as a background, compressed as an RLE file.

 



Import Full Background as RLE

$
0
0

Continuing with the neslib examples, I will import a full background (with rendering off) from a RLE compressed nametable.

Last time, I successfully imported a BMP into NES Screen Tool (the newest version, with ‘lossy’ on). I saved the .chr graphics file. Then, I exported the nametable as a compressed RLE with a .h extension.

(note, I had to remove 1 used tile from the .chr, because the RLE code won’t work with 256 unique tiles on screen. See, I made one of the tiles an X, and removed references to it on the nametable, then saved the RLE, and resaved the CHR)

Also, I cut and pasted the palette, from NES Screen Tool…palette/put to clipboard/C data. And, pasted into the .c file.

In the crt0.s file, I had to edit the CHR segment to include the “Girl2.chr” file. In the C code, I had to import the “Girl2.h” (our RLE compressed background data).

Step 1, set a nametable address to start from.

vram_adr(NAMETABLE_A);

Step 2, uncompress the BG data, by sending a pointer to the data to this function…

vram_unrle(Girl2);

(if you open the Girl2.h file, the array of chars is called ‘Girl2’).

And, then turn on rendering. (the scroll position is still set to the default, nametable #0, X and Y are 0,0).

ppu_on_all();

And, compile. Here’s what we have…

lesson23

I find that flat tones (Anime style) works well for NES images.

Here’s the source code…

http://dl.dropboxusercontent.com/s/1ozfna9ro09qz8n/lesson23.zip

 


Update Aug 2017 / CFG files

$
0
0

I made some minor code changes to lesson21, lesson22, and lesson23, to fix potential bugs. Specifically added LDX#0 in the NMI code and on rand8(). Also, touched up the face on lesson23.

And, I made some more changes…to the same .zip files. I changed all the .cfg files.

cc65 CFG Files for the most common mappers

http://dl.dropboxusercontent.com/s/0m4p4xh2ae51axm/CFG.zip

Includes-

AXROM, BNROM, CXROM, MMC1, MMC2, MMC3, MMC5, NROM, and UNROM.

 

 


Sprites, Again

$
0
0

Ok, with neslib, you will be loading the OAM (sprite) buffer. It will automatically send them to the PPU during v-blank. The only thing you need to do, is keep track of the index into the OAM buffer.

unsigned char sprid;

Oh, and I clear the OAM at the top of every frame.

oam_clear();

(Alternatively, you could call oam_hide_rest(); at the end of all sprite drawing code.)

 


 

To send 1 sprite, you use this function.

oam_spr(unsigned char x,unsigned char y,unsigned char chrnum,unsigned char attr,unsigned char sprid); // it returns a char, the current index #

sprid = oam_spr(X_position, Y_position, 0, 0, sprid);

chrnum is the tile #. attr is which palette 0-3 (and H and/or V flipping).

 


 

I made some metasprites with NES Screen Tool 2.3. And used the ‘Metasprite/Put single metasprite to clipboard as C’ option, and pasted it into a .c file. Notice that I only made the left half of the sprite graphics, because the right half is just a mirror image of the left, and you can flip sprite tiles.

SpriteCHR

Then, to put a metasprite into the OAM buffer…

oam_meta_spr(unsigned char x,unsigned char y,unsigned char sprid,const unsigned char *data); // it returns a char, the current index #

sprid = oam_meta_spr(X_position2, Y_position, sprid, metasprite);

…where ‘metasprite’ is an array of chars that represents the sprites used, and their relative positions.

So, here’s the code. I’m shifting the position of each sprite object by adding 1 to it’s Y position each frame. You use ppu_wait_nmi() to wait for the beginning of the next frame.

lesson24

http://dl.dropboxusercontent.com/s/92m5gikr51emf9d/lesson24.zip

 


Sprite Collision, and Controllers

$
0
0

OK, I kind of copied the idea from Shiru’s example code. Controller 1 controls the yellow sprite. Controller 2 controls the blue sprite. The background color changes when a collision is detected.

CONTROLLER READS. I changed this. Normally, with neslib, you have to pass the controller read to a variable, and do a seperate function to get new button presses (trigger mode). I feel it would save zero-page RAM if you could access those internal variables directly.

So normally you would…

pad1 = pad_poll(0); // reads controller 1

I changed it so you do this…

pad_poll(0); // reads controller 1

…then to access the read value, you use the PAD_STATE variable. And to use the new button pressed value, you use the PAD_STATET variable. Example.

if(PAD_STATE & PAD_LEFT){ }

would do something if LEFT is pressed on controller 1.

if(PAD_STATET & PAD_LEFT){ }

would do something if LEFT is pressed this frame, but not the last frame. A new press.


 

You should read the controller at the beginning of each frame. (Or not, if your game logic takes 2 frames to complete, and you want a consistent controller value across both frames.).

For 2 player, you need to make sure you read the 2nd controller.

pad_poll(1); // reads controller 2


 

For the sprite collision, I wrote some ASM code, that expects 2 pointers to structs who’s first 4 bytes are ordered like this…

struct BoxGuy {

unsigned char X;

unsigned char Y;

unsigned char width;

unsigned char height;};

It returns 0 if no collision, and 1 if collision. It’s slightly buggy at the edges of the screen. This is the function…

unsigned char CheckCollision(struct BoxGuy* one, struct BoxGuy* two);

 

NOTE – it could have been written in C. Something like this…

unsigned char CheckCollision (struct BoxGuy* one, struct BoxGuy* two){
  if (((one->X + one->width) > two->X) &&
  ((two->X + two->width) > one->X) &&
  ((one->Y + one->height) > two->Y) &&
  ((two->Y + two->height) > one->Y)){
     return 1;
  }
  else {
     return 0;
  }
}

But, I tested that, and it runs twice as slow as the ASM version (478 cycles vs. 255 cycles). I’m assuming that a much more complex game will need to do lots of sprite collision checks. Hmm. Maybe I should make this even more efficient?

So, anyway, if collision == true, change the background color, else, change it back. You can change 1 color with this function.

pal_col(unsigned char index,unsigned char color);

pal_col(0, 0x30); // 0 is the first color in the palette array, 0x30 is white.

Here’s the code.

lesson25

http://dl.dropboxusercontent.com/s/qdkz26l9n3rpx6y/lesson25.zip

 

Interesting side note. Notice how the yellow box is always in front of the blue box. That is because the yellow box was loaded first into the buffer. It has a higher priority. If the blue box was loaded first, it would be on top.


Sprite BG Collision, Pong

$
0
0

So, I wrote the simplest game possible. Pong with walls. The ball bounces off the walls (and the paddles)

The first thing I did was make everything in NES Screen Tool. Saved the CHR, saved the BG as a RLE .h file. Saved the Paddles as Metatiles.

Then I made a collision MAP. I just did this by hand. I could have used Tiled and saved the map as a .csv, but it was quicker just to type the map out as an array of zeroes and ones. 1 = the ball will collide with the BG. 0 = the ball will pass through it. Each entry represents a 16×16 block on the screen.

Now, I wanted a random start point and direction for the ball, but I needed a way to get a random seed. I decided to have it spin in a while loop, and count how many loops before a button is pressed on Controller 1.

while (!pad_poll(0)){
  ++Seedy;
} // Seedy is an int, 2 bytes

set_rand(Seedy);

Now rand8() will give us some actually random numbers.

 

Each frame, the ball’s speed are added to the ball’s position. First X, then check collisions, then Y, then check collisions. If the change in X caused a collision, then I reverse the X speed. If the change in Y caused a collision, then I reverse the Y speed.

X example…

KeepIt = Ball.X;
Ball.X += Ball_X_Speed;
index = (Ball.Y & 0xf0) + (Ball.X >> 4);
if (MAP[index]){
  Ball_X_Speed = 0 - Ball_X_Speed;
  Ball.X = KeepIt;
}

If the ball goes past the paddle, I have it pause for 2 seconds. It counts down frames, until the pause variable is zero, then it respawns the ball with new random direction and position.

I didn’t add a scoreboard. I just wanted to keep it as simple as possible, to show how sprites can collide with the background. It, of course, isn’t really colliding with the background tiles, but rather an array (MAP) that represents the positions of the wall within the room.

Here’s the example code.

lesson26

http://dl.dropboxusercontent.com/s/1a20e1s1pd00ntg/lesson26.zip

 


Add Music, Famitracker

$
0
0

I wrote some (terrible) songs and sound effects in Famitracker. So, first the songs. Put all songs in the same Famitracker file (adding songs in the module properties). I wrote another page on the limitations of the famitone music engine. Basically, no effects allowed except looping backwards (the Bxx effect, where xx is the frame number).

Export all the songs as a text export, and then process the .txt with text2data (command line program). Make sure to include the -ca65 tag.

Sound effects were put on another Famitracker file. Again, each sound effect on a unique song, using module properties to add another song. You can use any kind of sound effect (I think). But there is an annoying limitation on the length of sound effects. You can actually get around that limitation, by rewriting the famitone.s source (but I can’t show you that rewrite, because it’s not open source code. Sorry.) I have a habit of ending each sound effect with — cut sound and then C00 end of song (on separate lines). I believe this properly ends the sound effect.

Anyway, save all the sound effects as 1 FTM file. Process it with ftm2data (with the -ca65 tag).

Include the music data, in crt0, right after the label music_data: and include the SFX data in crt0 after sounds_data. The crt0 I have, will automatically initialize (set up some pointers) the data, during startup.

Now…use music_play(0); to start the first song. You pass it the song number, starting with 0, of course. If the song number is too high, music will stop. (That’s not the rigtht way to make music stop, btw).

To pause the music, use music_pause(1). To unpause, use music_pause(0). To stop the music (and lose your place in the song) use music_stop().

To trigger a sound effect, use sfx_play(unsigned char sound,unsigned char channel). I didn’t enable (in crt0) more than 1 sound effect channel, but you can, if you want some sound effects to have priority over the others. Notice, I have Square Channel 2 blank in the songs, and exclusively use Square Channel 2 for sound effects. That’s so they don’t collide. If you put song parts on the same channel as the sound effect, make sure you use a less important song part, so the main melody doesn’t cut out every time a sound effect plays.

I just remembered. I have previously used a modified version of famitone.s…but I think I’m using the original verion here. I may change that in the future. No worries. Just make sure the volume of sound effects stays at least as loud as the music channel…or else it won’t play. In a modified version (not here) sound effects always had priority over music, regardless of volume.

That’s it. Easy. The song’s suck, but I didn’t want to spend much time on this. Here’s the example code. Pong, with sound and music (but still no scoreboard).

http://dl.dropboxusercontent.com/s/m02sq4hfod15dct/lesson27.zip

 


Scrolling

$
0
0

By request, I made a scrolling game engine, with BG collisions. I was supposed to use neslib, but I made so many changes, and basically did 90% of the meat in ASM, that it’s not really a lesson in C. Sorry.

I’m going to have to come back and explain lots of things. I made it way too complicated…so basically, I created a huge top-down all-direction scrolling game engine.

I think I’m going to have to make a simpler one, for my next page (a little later).

Here’s the mess of code, that probably still has bugs in it. I recommend speeding up the emulation, it’s a bit slow.

http://dl.dropboxusercontent.com/s/wapes71qfp3gvxx/lesson28.zip

lesson28

 



How to make a coloring book page from any image.

$
0
0

Using GIMP. Open the image.

Gnome

Color / Desaturate

Gnome2

Filters / Edge-Detect / Edge…

I just used whatever was standard settings = Sobel, 2.0, Smear.

Gnome3

Color / Invert

Gnome4

Color / Curves

Put a dot near the middle and then drag the right side up.

Gnome6

Gnome5

Lets put a border on it.

-Select All

-Select / shrink, 3 pixels

-Select / invert selection

-Pencil Tool, choose black, draw over the edge

Gnome7

Change print size. Image / print size / 8″ wide (or 10.5″ tall).

And print your coloring book page.

 


NES Podcast

$
0
0

Just a shout out to KHAN Games (Kevin Hanley, @atonofglaciers ) and Sole Goose Productions (Beau, @SoleGoose ) for their recent and ongoing Podcasts.

The Assembly Line discusses all aspects of NES homebrewing, and live interviews with homebrewers. I’ve listened to them, and rate it a “must listen” broadcast for anyone programming the NES, or just anyone interested in games and game production.

I’ve found multiple links…I think these all work.

https://itunes.apple.com/us/podcast/the-assembly-line-an-nes-homebrew-podcast/id1247222547

https://m.soundcloud.com/user-463768680

https://player.fm/series/the-assembly-line-an-nes-homebrew-podcast

https://play.google.com/music/m/Il7yhrcfqbuejnfyh24a2dlpp7y?t=The_Assembly_Line_An_NES_Homebrew_Podcast

Good stuff guys. Looking forward to more.

 


Vigilante Ninja 2, Post-Mortem

$
0
0

Hello.

 

It’s been a while since I finished my big NES game. While it took me 2 years to complete, it could have been done in 1 year, if I focused on it 100% of the time. The game is still available in a limited release, btw. But enough time has passed to reflect on the development process.

 

VIGD2 Purple Cape Man.
My first game I made, “Purple Cape Man, Vigilante Ninja”, was programmed with NESASM. Someone suggested I make a sequel, which became Vigilante Ninja 2, which is entirely unlike the first game in every way.

Vigilante Ninja 2 was programmed with ASM6 (except the music engine, was programmed in cc65/ca65). Graphics were YY-CHR and level design in Tiled (with a custom python script I wrote to compress each level). The design process could have been much better, since it still required lots of cutting and pasting. So, level editing was very slow.

vig2_lv4-1 Vigilante Ninja 2.

What went right?

The music.

Probably the best part of the game. Originally, I wrote a temporary song for the demo, and had planned to write a song for every level. Luckily, estlib was kind enough to write songs for me, which are excellent.

He used more sound effects than any famitone version could handle, so I had to use the full famitracker driver…and again…lucky for me that Shiru wrote a version of famitone to compliment the full famitracker driver.

There is still a small, rare bug that I was unable to diagnose and solve. The main downside to using an unfamiliar sound engine. Occasionally, when you start level 4, the main melody doesn’t play for a few seconds. But the bass line plays. It doesn’t sound “wrong”, but it was.

Some of the graphics.

At the start, I had no idea what I was doing, or even what style I wanted. I actually redid the level 1 graphics 3-4 times, and completely redrew the hero. A fellow homebrewer informed me that the graphics of my game were crap, so I kept trying to improve them.

vigN_Old

vigN_Old2
vigN_Old3
Vig2New

By the end, especially level 4, I had my flow, and the graphics actually started to click. Many of the enemies in level 5 (fire, ghost) are my favorites.

Vig2-Lv5

The process of sketching on paper, and drawing in GIMP, then YY-CHR didn’t change. But, I got better at it over time. I wish I had put more effort into animating. Nearly every enemy only has 2 animation frames. And I had plenty of blank tiles I could have used.

Special thanks again to Nicolas Betoux for drawing the title screen graphics. Paired with the excellent title screen music (by estlib), it really made my little homebrew feel like a real NES game.

The throwing weapons.

One of the more fun parts of the game is collecting different weapons and using them. Oddly, I got complaints that you had unlimited shots, so I (very late) added a power bar, which drains if you use too many weapons. I’m still not satisfied with this hacky solution, since it just slows the game down (especially fighting a boss).

Most of the game engine.

Vigilante Ninja 2 scrolls pretty smoothly, without bugs. The NMI code got a little spaghetti like at the end, when I added bank switching. All the level testing was done with NROM sized roms, even through level 5. I made 2 separate level 5 test ROMs, 1 for level, 1 for boss.

In the end, when I finally switched to MMC3, I put in what I called “trampolines” in the main fixed bank, which switched (for example) the music code and data banks in and started the music engine. But it wasn’t so easy, and the bank switching code is ugly and hacky. But I suppose everything is working… so it’s good enough… just don’t expect to reuse the code in a year and understand what everything is doing.

What didn’t work?

The Sprite system.

I didn’t plan the sprite object system well. Pretty much just used static addresses in the OAM buffer, which made the size and shape of enemies very inflexible and difficult to change. And, I used an entirely different 256 bytes of RAM just for sprite shuffling, which was a huge waste of memory. (NES has only about 2000 bytes of usable RAM).

The worst part of it, was I didn’t use variable names in the original code, just address numbers. And, so much time passed before I revisited the object code, that I barely knew what the numbers meant. I wanted to change things, but I would have had to rewrite a thousand lines of code, so I kept the original terrible system.

I rewrote part of it for the hero, just so I could layer sprites (the sword). I wanted to change the look of coins and make them bigger, but I painted myself into a corner, and couldn’t change a little thing without rewriting everything. So, my biggest regret is not starting with a better sprite code.

The gameplay.

Looking back, there is very little difference between the different sub-levels. Sure, the graphics and enemies change from level to level, but I could have done 100 little things to make each sub-level feel interesting. Hidden things. Changes in graphics. More interactive elements. A specific goal (collect all X, kill all X’s, avoid X). A special throwing weapon only found in room 23. A secret 1 up, if you do X.

Basically, just run from the left to the right, and don’t die. Not great.

Enemy AI.

Probably the weakest point of the game. Most enemies walk left and right. A few fly in right to left. Shoot them, get a standard reward.

Level 3 has the most interesting enemies. The spider can climb any wall, and always follows you. I think (at least in early versions) if you slowly walk right, the spider can climb on top of the ceiling and follow you pretty far.

The bat (not the boss), was an attempt at a more aggressive enemy, who loops around attacking you. However, he’s a bit buggy if you move a certain way. Never quite got him right.

Vig2-Bat

The bees (level 4) chase you, fly just above you, and try to sting you. It’s all timed a certain way, that it pretty much always misses you trying to sting. I had to slow them down, as they were damn hard to get away from or hit.

But, nearly all the rest just slowly walk around, and disappear if they wander just a bit too far left. Also a failure, not keeping off screen coordinates, so he could walk back on screen after that.

The Ending.

I wish I had done a more elaborate ending. It’s just 1 screen of text, and then the credits. I had room for more graphics, I could have done some more graphic story…maybe related to that magic sword I kept talking about.

Marketing.

I really dropped the ball here. I barely made an effort to advertise the game development. I had a thread over at nesdev forums, and mentioned it on my blog. But, almost no one from the nesdev forum asked me for a copy of the game. I guess buyers don’t visit there.

I didn’t make boxes, or print booklets, etc. I could have printed T-shirts. I could have traveled to game conventions. Or tried to contact all the used game stores within an hour drive of my house. But, I didn’t.

When I finally did mention the game to buyers, it was right after the release of Ninja II, a completely different homebrew game with a similar name…which I think caused some confusion.

Actually, the entire concept… making a sequel to a lousy game that no one played, and making it completely different, was confusing. Several people asked me “where is Vigilante Ninja 1?” Well, it’s called ‘Purple Cape Man’, and it’s not the same game. I had a few people ask me, “if he’s a vigilante, why is he fighting squirrels and bunnies?” I think a different name and concept would have helped.

Conclusions…

In 2 years, I learned a lot. Made a full sized NES game. Put it on a cartridge (thanks infinite NES lives), and gamers around the world are playing it. I’ll say partial success. There have been so many great NES homebrew releases lately, that have really raised the bar. Perhaps people would be better off buying Haunted Halloween, or Twin Dragons, or Lizard. I’d be ok with that.

And I’m still making games. Maybe the next game will be the one everyone remembers. Only time will tell. Back to the work I go.


A List of NES Homebrew Games

$
0
0

As a NES homebrewer, I have been lucky enough to meet some great people, and play lots of interesting games. The past few years have been huge in the NES homebrew community, and I feel like next year will be even bigger.

This is my list of favorite NES homebrew games. Several of these I haven’t played yet because several of these aren’t completed yet. Which is why I think 2018 is going to be a great year for NES gaming.

I didn’t want to list “top 10” or “top 20″…and piss someone off, so I listed them sort-of alphabetically.

 

 

2nd Dimension

-AO

01AO

This is an interesting puzzle game. Imagine a 2x1x1 block that has to be tipped over in exactly the right directions to make it through to the goal.

(Also available from 2nd Dimension is Get Em Gary – which is like “Wrecking Crew and Fix-It Felix Jr”, programmed by Sly Dog Studios)

http://www.second-dimension.com/

 

 

Alp

Most people will probably not know who Alp is, but he was working on an awesome Zelda-like game called “Cat Quest“. We will probably never see that game made, but Alp is still (not-so) secretly working on NES games, and they look damn good. The Cat Quest project seems to have morphed into a game called Transamnia (possibly NSFW). Here’s a beautiful screenshot.

-Transamnia (? formerly Cat Quest)

03Trans

And a game I’m personally excited about is Cotton & Candy, a platformer. Excellent work Alp. Hopefully these games will be made available…someday?

-Cotton & Candy

02CottonCandy

@Alp317

 

 

Brad Smith (Rainwarrior)

This is a big one that has been in the works for a while…and is almost done (as of late 2017). In Lizard, Canadian programmer / musician Brad Smith has made a very big open-exploration world…well 2 parallel worlds connected by doors. You play as a little person wearing a lizard costume. If you find a different costume, you gain new abilities. There are lots of little secrets in this game (big head mode, bad eye mode, a talking moose). Tons of interesting details in this game should keep you occupied for weeks.

-Lizard

04Lizard

http://lizardnes.com/

 

 

Chris Cacciatore

Still a work in progress, in Nebs n Debs you play as a little girl with an Octopus hat on. A Megaman style platformer, you can dash across gaps and collect diamonds. This was a winner of the 2016 Nesdev competition. Very high quality.

-Nebs n Debs

05NebsDebs2

@cacciatc
(I don’t think he has an official website) There’s a link to the demo at the bottom of the first post here…

http://nintendoage.com/forum/messageview.cfm?catid=22&threadid=169549

 

 

 

Diskover / RetroNES Software

I guess this one had a very limited cartidge release, since it didn’t meet it’s crowdfunding goals (I think he said he made a few copies for his friends). Banketh is Diskover’s first game, which is a top-down adventure game (like Star Tropics). I hope we get to see the full game released some day.

-Banketh

39Banketh

The Demo is here…

http://www.retrones.net/juegos-homebrew/banketh-video-game

Diskover recently announced he is porting The Sword of Ianna to the NES. Here’s a screenshot of what that will look like.

41Sword

 

Doug Fraker

I, of course, made a game, which is available on cartridge. It’s a fighting platformer. And I’m working on another project. Stay Tuned.

-Vigilante Ninja 2

31VigilanteNinja

https://nesdoug.com/2016/05/05/update-games-im-working-on/

 

 

Glutock / Broke Studio

Another winner of the 2016 Nesdev game competition, and also a work in progress from France. In Twin Dragons, you play as two dragons named Dinky & Minky. You can play as either one. A great looking platformer with excellent music. If you eat a hot pepper, you can breathe fire. If you eat a popsicle, you can breathe ice. Probably my favorite NES game. Maybe.

-Twin Dragons

07TwinDragons

http://www.brokestudio.fr/en/front-page-en/

 

 

Gradual Games

I really wanted to mention both games. Nomolos: Storming the Catsle (yes that’s cat…sle) is a fun platformer fighter game (like Zelda II), featuring a cat knight. It deserves to be on this list, but I prefer The Legend of Owlia. Which is kind of like a Link to the Past style adventure game. You carry an Owl, which can attack and get things and has several other abilities. And, apparently they are working on a 3rd game, which should be done next year.

-The Legend of Owlia

08Owlia

http://www.gradualgames.com/

It should also be mentioned that Gradual Games made a music engine that other people have used to get music in their NES games (StarKeeper, Dushlan and Mystic Searches). AND, Gradual Games has developed a Virtual Machine for porting NES games to play on PCs without an emulator (Get ’em Gary and Eskimo Bob). Check out the Github pages.

https://github.com/gradualgames

 

 

Infinite NES Lives

Action 53 (2 volumes), are multicarts from the entries into the 2011 and 2014 nesdev competitions. There are so many cool games on these cartridges, but I wanted to highlight a few…Streemerz is like Bionic Commando (you shoot out a rope which pulls you up), with lots of blocks to avoid that kill you. I wanna flip the sky is a reverse gravity platform puzzle with tons of spiked floors. You will die a lot in that game. Love Story is a sword fighting action platformer. Sir Abadol (from Mojon Twins) is another action platformer, with puzzle elements (locked doors and find keys). Very fun. And many more games that I didn’t have enough room to mention. Here’s a list…

http://wiki.nesdev.com/w/index.php/Action_53

More about Mojon Twins in a second. I will also mention Shiru later…he contributed the most games to the Action 53 set.

Volume One –

-Streemerz – The Fox

10Streemerz

-I Wanna Flip The Sky! – Tom Livak

11Flip

Volume Two –

-Love Story – Tom Livak

12LoveStory

-Sir Abadol – Mojon Twins

13SirAbadol

http://www.infiniteneslives.com/products.php

Some of the games are available to play for free…
http://www.nesworld.com/article.php?system=nes&data=neshomebrew

 

 

KHAN Games

Kevin Hanley has programmed several NES games, including a famous Frogger port. I should mention the ‘Larry and the Long Look for a Luscious Lover‘ port, which is worth playing, but not technically a homebrew. (I guess?). Some of his games are available from RetroUSB…like Study Hall, which is a bit like a harder version of Donkey Kong Jr. No, there isn’t any math.

My favorite KHAN game is The Incident, which is a Sokoban style top-down puzzle with moving boxes.

-The Incident

15Incident

http://www.khangames.com/store/home/8-the-incident-complete-in-box.html

-Study Hall

14StudyHall

http://www.retrousb.com/index.php?cPath=30

 

 

Lucasz Kur

Lucasz Kur is a Polish NES programmer, who is sometimes working with Brazilian graphic artist, Marcelo Barbosa (Tcheco in the Castle of Lucio). I don’t know everything that he’s worked on but definitely these games. Lucky Penguin isn’t finished, but you can play a demo from nesdev forum. http://forums.nesdev.com/viewtopic.php?p=201167

-Lucky Penguin

16LuckyPenguin

-Cowlitz Gamers’ 2nd Adventure

17Cowlitz

The Cowlitz 2nd Adventure game had a limited cart release this year, and I heard it sold out in minutes. I haven’t played it, but it looks very nice. Lucasz Kur also programmed Inversion. Here’s a link to that…
https://www.romhacking.net/homebrew/44/

 

 

Mega Cats Studio

Mega Cats has hit the ground running with 10+ NES games developed (or almost done) in just a few years.

-Justice Duel
-Creepy Brawlers
-Creepin it Real
-Expedition*
-Little Medusa
-Almost Hero
-City Trouble*
-Log Jammers
-Dushlan*

I ran into Mega Cats at a game convention, and played 2 of their games. Nice. I’m most excited about Little Medusa, which reminds me of Kickle Cubicle and Zelda. Apparently it’s finished, or will be soon. I’m going to have to play some of the other games before I can really comment on them.

*(It’s been brought to my attention that City Trouble, Dushlan, and Expedition were not developed by Mega Cats, just published by them).

18LittleMedusa

https://megacatstudios.com/

 

 

Miau (Morphcat)

Morphcat submitted the Super Bat Puncher demo for one of the nesdev competitions (2011). I’ve heard many people tell me it is one of the best NES homebrews. I’ve been told that Morphcat won’t be making a full game from it…but he and Nicolas Betoux are making a 4-player haunted adventure, yet untitled, which showcased in the game museum in Berlin. I’ve been unable to find much about the game (not even a title) but here’s a screen shot.

19Untitled

Super Bat Puncher is a fast-moving platform game, with a cat that punches bats…and walls to get a boost.

-Super Bat Puncher

20BatPuncher

http://morphcat.de/superbatpuncher/

 

 

Mojon Twins

I can’t count how many games na_th_an has programmed. 50? Maybe. Some of the best were submitted to the 2016 nesdev competition. Very good games. Here’s a list of great games. I think they are all available on their website (mostly in Spanish). Caution, some NSFW images.

http://www.mojontwins.com/juegos_mojonos/

-Sir Abadol (remastered)
-Super UWOL
-Lala the Magical
-Cheril the Goddess
-Wo Xiang Niao Niao
-Jet-Paco

My favorite is Lala the Magical, about a witch girl who can create temporary platforms to stand on. Hard, but fun.

21Lala

Cheril the Goddess is similar, except that you can temporarily fly sometimes. On a side note, Wo Xiang Niao Niao means “I need to pee pee”. It is a fun game where you jump and bounce off enemies. Check out their games, which are all free to play.

 

 

Nova Squirrel

Nova contributed several games to the Action 53 set. He is currently working on a game, called Nova the Squirrel, featuring a spunky little green squirrel. It is a unique platform game, with lots of clever block puzzles. I have no idea when it will be finished, but it looks cool.

-Nova the Squirrel

22Nova

http://novasquirrel.com/
@BushytailSkwirl

 

 

Optomon

Pyronaut is programmed by Optomon (graphics by M-tee). It looks a lot like Metroid, and I hope it will be finished one day. “Due to commitments on smaller scale works and increasingly busy personal lives, M-tee and I have halted work on Pyronaut indefinitely, with the intention of resuming work on it in the future.”

23Pyronaut

http://optovania.com/dsk/mod_pyronaut.html

Optomon is also working on a game called Rollie, which looks promising. You might have heard about him from his excellent work on Metroid Rogue Dawn.

M-Tee is working on a game called Isolation right now, with KHAN. It looks like a point and click game (like Maniac Mansion). There isn’t a demo yet.

23_B_Isolation

 

 

Piko Interactive

Piko Interactive (I think) is better known for developing SNES homebrew games. They have released 2 NES games as well. Quest Forge is my favorite. It’s a bit like a top-down adventure game, like Zelda. Piko also got the rights to several unreleased NES and SNES games (not really homebrews), which they now produce.

-Quest Forge

24Quest

https://www.pikointeractive.com/index.html

 

 

Shiru

-Alter Ego
-LAN Master
-Many Other Games (see Action 53 above)

From Russia, Shiru has been contributing to the nesdev community for years with his open source game library and NES Screen Tool app. He has developed for multiple retro consoles. Several of his games are included in the Action 53 game sets. I think the most fun game (which is not in Action 53) is Alter Ego. It is a port of a VX Spectrum homebrew by Denis Grachev. It’s sort of a ladder and platform game, and you have a shadow self that mirrors your moves. You can switch places with him, and collect all the items. It’s fun. It has excellent music as well.

25AlterEgo

https://www.romhacking.net/homebrew/1/

-Lan Master

Also check out Lan Master, if you like puzzles.

40LanM

https://www.romhacking.net/homebrew/2/

Shiru made some games for Retroscribe / Greeting Carts. Blow Em Out, Beer Slinger, and Perfect Pair (limited edition). I’ve been told the company was under new management, but still running. You could get personalized games, with a private message at the end of the game. Great as a birthday gift.

http://www.retroscribe.com/

 

 

Sivak

This is the big one. If you play one NES homebrew game, play Battle Kid. It’s THAT good. If you like Megaman, you will like Battle Kid. Find keys, gain abilities, fight monsters. It’s fun, but also very hard. Both available from Retro USB.

http://www.retrousb.com/index.php?cPath=30

-Battle Kid 1 + 2

26BattleKid

 

 

Sly Dog Studios

Sly Dog has been busy making NES games for years. Over a dozen games. I think my favorite is The Mad Wizard, which the full game is now available to play for free. You play as the wizard, and gain abilities as you adventure through the woods and caves on your way to fight Amondus the Summoner. You don’t jump. The wizard can slowly levitate, and as you gain abilities…higher and further. This is part of a 3 game series. The gameplay on the other games are completely different, though.

Sly Dog also programmed Get’em Gary for 2nd Dimension (see above) and Black Box Challenge for Hagens Alley. I’m not sure if Black Box is completed.

-Mad Wizard

27MadWizard

https://slydogstudios.org/
http://www.second-dimension.com/shop/
Black Box Challenge – NES Homebrew (Kickstarter Regular Edition)

 

 

Sole Goose Productions

Besides Swords and Runes (Adventure) and 0-to-X (2048 number puzzle), there is Spook-o’-tron. I think it was just finished for Halloween 2017. It’s kind of a top down ‘bullet hell’ shooter game, like Smash TV. At the time of writing this, I haven’t been able to find it or play it.

-Spook-O-Tron

28Spook

 

 

Spoony Bard

Tomas is from Canada, and new this year with his first NES release, Eskimo Bob. It’s a platformer with wrap around scrolling and a snowy theme. Cute artwork. Great first game. Looking forward to more games down the road.

-Eskimo Bob

29Eskimo

http://www.eskimobob.com/

 

 

Tepples (Damian Yerrick)

Tepples has been making cool NES games for a long time. He has been very involved in the nesdev community, and has released several NES tools / etc. (and soon some SNES tools), including a music driver (pently).

http://pineight.com/

For the last 2 years, he has raised the bar for NES homebrew games. He and Retrotainment (Cash In Culture Stores) developed Haunted Halloween 85 and 86. Spooky themed action platformers with excellent boss fights. Punch some zombies and ghosts. Eat candy and soda. Lots of movie references. The music in 86 is great, and it features parallax scrolling effects.

-Haunted Halloween 85-86

30Haunted86

-Full Quiet

And they are working on another game for next year, Full Quiet, which looks cool, from what little I’ve seen.

https://cashinculture.3dcartstores.com/

 

 

I left Star Keeper off my list. I know other people frequently put is on their top lists, but I know almost nothing about the programmer, except that he’s from China. And it doesn’t seem to be available anywhere to play.

Honorable Mentions…

8-bit Hero’s Mystic Searches (coming soon)
http://austinmckinley.com/8bit/the-game.html

32Mystic

 

Kira Kira Star Night
http://kirakira-star-night.riki2riki.com/en/

33Kira

 

Retro City Rampage/ROM City Rampage (I haven’t seen any actual NES gameplay, but I know that the game was ported to the NES, and I think carts exist)
https://www.vblank.com/RetroCityRampage/

34ROMCITY

 

Rekt, by Vectrex (coming soon)
http://nintendoage.com/forum/messageview.cfm?catid=22&threadid=171212

35REKT

 

Star Versus, by Dustmop
http://starversus.com/

36StarVersus

 

Blade Buster
https://www.romhacking.net/homebrew/24/

38Blade

 

Indivisible, by Kasumi
https://kasumi.itch.io/indivisible
37IndivisibleB

 

Too Soon to talk about, but maybe good…one day…
-Unnamed 3d raycaster game (think Doom), by 

Sorry if you weren’t mentioned, homebrewers. Too many great games to list them all. If you want to read more about NES Homebrews, you should check out Jeff Wittenhagen’s book on the subject, NES Oddities & the Homebrew Revolution.

HAGEN'S ALLEY AVAILABLE BOOKS!

Please let me know if I made any mistakes, or if there is some awesome NES homebrew game that should be on this list, but isn’t.

famitone 3.2 / annotatecc65

$
0
0

Hey everybody. In 2016, I wrote a version of famitone music library that allowed the volume column and all notes. Recently, I fixed the major bug that it had in processing more than 1 song. text2vol replaces text2data. I should be used with the nsf2data (v1.15 by Shiru 04’17). See Shiru’s website to download that.

Here is the link to my (unofficial) update. Source code included.

http://dl.dropboxusercontent.com/s/l6sahxaz2qty52m/famitone3.2.zip

 

In the future…

I also wrote a version that allows the 1xx,2xx, and 4xx effects…pitch rise, pitch fall, and vibrato. I shelved it when my last update had a major bug…but now that I fixed that bug, I should be able to finish this later this year.

Shiru would say, “why not just use the full famitracker driver”. That, of course, is also available on his website.

https://shiru.untergrund.net/code.shtml

But, the full famitracker code is huge. Almost 4x as big a ROM footprint as famitone2. My famitone3.2 is only slightly larger than famitone2…though I did gut the PAL note table. Sorry. I didn’t use it. You could probably put it back in.

Hope this is useful to somebody.

 

annotatecc65

In an unrelated note, my friend dustmop wrote a python script that inserts the cc65 source code into the debugging files for FCEUX. I haven’t used it yet, but it looks cool. Check it out.

https://github.com/dustmop/annotatecc65

 

Jammin Honey

$
0
0

Here’s my entry to the nesdev 2017 game competition. Jammin Honey. You play as Honey, and have to battle your way through 30 levels of slime monsters and fire breathing bullies and spiked floors. Collect enough notes to clear the level. 10,000 pts for a bonus life. 3 levels of difficulty.

JamminHoneyTitle

One cool feature, is, you can customize Honey’s outfit and guitar colors.

JamminHoneyOption1

JamminHoneyOption2

JamminHoneyGame

I tried to make it feel like an early old-school game. Like the kind you would see at the arcade around 1982-3. Here’s a free download. Enjoy!

http://dl.dropboxusercontent.com/s/3gkv6onxfxypt53/JamminHoney.nes

Controls –

left/right – run

up/down – climb ladders

start – pause

B – strum the guitar to attack

A – jump

.

Also, I wrote some game genie codes for this game…

-no bees – PEUYNYAA

-start with 10 lives – PEUNVYAA
-start with 20 lives – ZEUNVYAA
-start with 30 lives – LEUNVYAA

-start at level 10 – PEKNOYAE
-start at level 15 – TEKNOYAE
-start at level 20 – LOKNOYAA
-start at level 25 – AOKNOYAE
-start at boss (level 30) – IOKNOYAE

.

What does 2018 hold for me?

I will probably be quiet and not write many posts here. But, I am working hard on another NES game that will end up on a cartridge. Still too soon to mention any details, unfortunately. Stay tuned.

And, 2019? SNES homebrew, maybe. Time will tell.

 

PPU writes during rendering.

$
0
0

I’m going to do some experiments today. Writing to the PPU during rendering.

Normally, you never want to do this. The NES was designed so that you write to the PPU during v-blank or when rendering is off. Let’s see what happens, with the ultimate goal of changing 1 color mid-screen without ruining the picture.

Here’s a simple asm6 template code.

ppu01

With a timed loop that waits till we are definitely not in v-blank. I’m trying to write an X near the top left. Emulators have been disappointing on these tests, so I have to go right to actual hardware (US NTSC top loader to a flat screen TV).

lda #$20 
sta $2006 
lda #$42 
sta $2006 
lda #4 ;is an X 
sta $2007

ppu02

What’s happening here, is writing twice to 2006 during rendering has overwritten the scroll registers and misaligned the screen. Also, our X is nowhere near the top left. The last point, is where emulators failed accuracy…some of them DID put the X on the top left.

So, let’s try to fix that. After writing the X, we will then write a new 2006 2006 to try to realign the screen…and time the write near the far right of the screen to reduce visible glitches.

lda #$20 
sta $2006 
lda #$42 
sta $2006 
lda #4 ;is an X 
sta $2007 

lda #$20 
sta $2006 
lda #$a0 
sta $2006

ppu03

The write is still not going to the right place, nor is it an X. And the 3 is squished at the top, as it is skipping a scanline. Let’s try turning rendering off…doing the write…turn rendering on…fix scroll with 2 2006 writes. I also had to move the scanline wait a little.

lda #$20 
sta $2006 
lda #0 
sta $2001 ;rendering off
lda #$42 
sta $2006 
lda #4 ;is an X 
sta $2007 
lda #$1e 
sta $2001 ;rendering on
lda #$20 
sta $2006 
lda #$a0 
sta $2006

ppu04

Ok, that seems to work, except with some noticeable glitches. Perhaps better timing could reduce that as well. I’m not too concerned about that right now…so on to using the same setup to change a color. I want all numbers below the 2 to be red.

First I have to write $30 (white) to the text palette during NMI, so the top stays white…then rendering off…change color…rendering on…fix scroll.

lda #$3f 
sta $2006 
lda #0 
sta $2001 ;rendering off
lda #$03 
sta $2006 
lda #$16 ;red 
sta $2007 
lda #$1e 
sta $2001 ;rendering on
lda #$20 
sta $2006 
lda #$a0 
sta $2006

ppu05

Not perfect. The top of the 3 is still white.

ppu06

Moving the split up is not enough, since that will just cut the top of the 3 off. We must do a fancy 2006 2005 2005 2006 write, about 2 scanlines earlier. See the nesdev wiki on x/y scroll splits…

https://wiki.nesdev.com/w/index.php/PPU_scrolling#Split_X.2FY_scroll

lda #$3f 
sta $2006 
lda #0 
sta $2001 ;rendering off
lda #$03 
sta $2006 
lda #$16 ;red 
sta $2007 
lda #$1e 
sta $2001 ;rendering on

lda #0 
sta $2006 
lda #40 
sta $2005 
lda #0 
sta $2005 
lda #$a0 
sta $2006

ppu07

That seems to be working. There are still some noticeable glitches though. Probably, this could be improved. Maybe another day I will try to hide it. But even still, timing THIS fragile is dangerous. This is all done with timed loops. What if something interrupts us?

I added a DMC sample to fire every second. The DMC channel, when ON, steals cycles from the CPU to read a byte…which ruins perfectly times loops.

ppu08

So, if you used a MMC3 scanline counter, and could time this to perfection…you could make mid-screen changes beyond just scroll shifts. But, it could be error prone. Many of my tests ended with the PPU writes going to the wrong address. Rendering needs to be off, meaning you should only do this on a blank part of the screen.

 

Here’s the source code. In 6502 asm for the asm6 assembler. Caution, I just wrote / rewrote some of this code (especially the controller read code) and it hasn’t been thoroughly tested.

download

Furthermore…I forgot that turning rendering off makes sprites behave erratically. This sort of thing may only be possible on screen with no sprites. I will have to test this some more.

 


NES Graphics

$
0
0

This is not a “best graphics on the NES” list. Just some games that I think are very good. I was going to point out some of the weaker artwork, but that seemed a little hypocritical, since I have a tough time making good looking pixel art myself. So, none of “they should have done this different”. Just good art pictures.

Starting with my favorites. I really like the graphics team over at Technos. The people who did River City Ransom, also made some similar looking games, like…

01SuperDB

Super Dodge Ball

02Crash

Crash N The Boys: Street Challenge

.

Here’s some other games in no particular order.

03Kick

Kick Master

04Joe

Joe & Mac

05NinjaG3

Ninja Gaiden III

07Shadow

Shadow of the Ninja

08BatmanROJ

Batman – Return of the Joker

09Chuuka

Chuka Taisen

10felix

Felix the Cat

11KirbyB

Kirby’s Adventure

12Fire

Fire ‘N Ice

13Gimmick

Gimmick!

14Ufouria

Ufouria (Hebereke)

15Chip2

Chip ‘N Dale Rescue Rangers 2

16Stanley

Stanley: The Search for Dr. Livingston

17LittleSB

17LittleS

Little Samson (2 images)

18Bucky

Bucky O’Hare

19VicePD

Vice: Project Doom

20Moon

Moon Crystal

21Conquest

Conquest of the Crystal Palace

22Shatterhand

Shatterhand

23GunNac

Gun Nac

24LittleNemo

Little Nemo: The Dream Master

25Gargoyle

Gargoyle’s Quest II

27MM2

Megaman 2

26MM6

Megaman 6

29Castle3

Castlevania III

30Double3

Double Dragon III: The Sacred Scrolls

31Gradius2

Gradius II

32Radia

Radia Senki: Reimmeihen. This is probably the best looking RPG produced on the NES… well, Famicom anyway. Good work, Tecmo.

Sorry about the quality of some of these pictures. They are screencaps of videos. It would have taken me forever to play all these games to the right point to get better pictures.

I’m sure I left some games out. Lot’s of Disney games look very good. If you feel like a game is missing, and definitely should be in this list, feel free to leave a comment.

Backup / PDF archive

$
0
0

Since I plan to make major changes to this tutorial, I thought it would be appropriate to make an archive of the old version. Also, you can view this stuff offline (lots of PDF files).

(still a work in progress)

Introduction – nesdoug

1. Getting Started – nesdoug

2. how cc65 works – nesdoug

3. Our first program – nesdoug

http://dl.dropboxusercontent.com/s/1oxcgi4t1m4ifzj/lesson1.zip

4. What_s a V-blank_ – nesdoug

http://dl.dropboxusercontent.com/s/c3fbfranz5gcafk/lesson2.zip

5. A little color – nesdoug

http://dl.dropboxusercontent.com/s/tqp6s3odgurieep/lesson3.zip

6. Sprites – nesdoug

http://dl.dropboxusercontent.com/s/v2wl2aa5gbrjmad/lesson4.zip

7. Input – nesdoug

http://dl.dropboxusercontent.com/s/zeubcy1ojyxbrgb/lesson5.zip

8.Sprite Collisions – nesdoug

http://dl.dropboxusercontent.com/s/dps1glbmy04onxx/lesson6.zip

9. Drawing a full background – nesdoug

http://dl.dropboxusercontent.com/s/e7mktrwqblyb6zr/lesson7.zip

10. Background Collisions – nesdoug

http://dl.dropboxusercontent.com/s/usbt4evqf4bn41y/lesson8.zip

http://dl.dropboxusercontent.com/s/w3fvsw93e4wwb20/lesson8B.zip

http://dl.dropboxusercontent.com/s/dxiohi67uheaazk/lesson8C.zip

11. Scrolling – nesdoug

http://dl.dropboxusercontent.com/s/g5vnwnzn7q1pa9j/lesson9.zip

12. Basic Platformer – nesdoug

http://dl.dropboxusercontent.com/s/silvjdalw8vx5ib/lesson10.zip

13. Sprite 0 Trick _ Debugging – nesdoug

http://dl.dropboxusercontent.com/s/fzu98ygo8land19/fceux_symbols3.py?dl=1

http://dl.dropboxusercontent.com/s/0v8aos6rt6kfghi/fceux_symbols4.py?dl=1

http://dl.dropboxusercontent.com/s/08oibyhciz6woi7/lesson11.zip

14. Intro to Sound – nesdoug

15. Adding music – nesdoug

http://dl.dropboxusercontent.com/s/4cl6dqvrzuyq2eq/lesson12.zip

16. Adding Sound Effects – nesdoug

http://dl.dropboxusercontent.com/s/q5fvtis646lmh18/lesson13.zip

17. Planning a Game – nesdoug

18. Game Coding – nesdoug

http://dl.dropboxusercontent.com/s/vcnifnoooflgilq/spacy.zip

19. Game Coding 2 – nesdoug

http://dl.dropboxusercontent.com/s/fczfdpahrdgb7rl/spacy2.zip

20. Game Coding 3 – nesdoug

http://dl.dropboxusercontent.com/s/70f89x9viu4r8mw/Spacy4.zip

21. Credits and Thanks – nesdoug

22.More – nesdoug

23. Using DMC Sounds – nesdoug

http://dl.dropboxusercontent.com/s/eo92hyp4ms5mqhs/lesson18.zip

24. MMC3, Bank-switching, IRQs – nesdoug

http://dl.dropboxusercontent.com/s/1435iwsn62kixvg/lesson20.zip

25. Importing a MIDI to Famitracker – nesdoug

26. ASM Basics – nesdoug

27. ASM part 2 – nesdoug

28. ASM part 3 – nesdoug

29. ASM part 4 – nesdoug

30. ASM part 5 – nesdoug

My Neslib Notes – nesdoug

Neslib Example Code – nesdoug

http://dl.dropboxusercontent.com/s/5p8o0umed5k10r5/lesson21.zip

http://dl.dropboxusercontent.com/s/cupgyz9bg8ibjny/lesson22.zip

NES Screen Tool BMP Import – nesdoug

Import Full Background as RLE – nesdoug

http://dl.dropboxusercontent.com/s/1ozfna9ro09qz8n/lesson23.zip

Update Aug 2017 _ CFG files – nesdoug

http://dl.dropboxusercontent.com/s/0m4p4xh2ae51axm/CFG.zip

Sprites, Again – nesdoug

http://dl.dropboxusercontent.com/s/92m5gikr51emf9d/lesson24.zip

Sprite Collision, and Controllers – nesdoug

http://dl.dropboxusercontent.com/s/qdkz26l9n3rpx6y/lesson25.zip

Sprite BG Collision, Pong – nesdoug

http://dl.dropboxusercontent.com/s/1a20e1s1pd00ntg/lesson26.zip

Add Music, Famitracker – nesdoug

http://dl.dropboxusercontent.com/s/m02sq4hfod15dct/lesson27.zip

Scrolling – nesdoug

http://dl.dropboxusercontent.com/s/wapes71qfp3gvxx/lesson28.zip

famitone 3.2 _ annotatecc65 – nesdoug (and famitone 4)

http://dl.dropboxusercontent.com/s/l6sahxaz2qty52m/famitone3.2.zip

http://dl.dropboxusercontent.com/s/b5mob6f9br78goz/famitone4.zip

PPU writes during rendering. – nesdoug (asm code)

http://dl.dropboxusercontent.com/s/hfhrazfvvspzrja/PPUwrites.zip

 

Update, bug fix

$
0
0

There was a minor bug in the neslib example code that I used for 8 different files. In crt0.s in the reset (startup) code, it failed to turn off the APU frame counter IRQ. This won’t cause a problem if interrupts are disabled, but if IRQs were turned on it would fire an IRQ at inappropriate times.

Specifically these lines were missing…

ldx #$40
stx $4017

which is actually written like this in the source code, now.

ldx #$40
stx CTRL_PORT2

If you were using the crt0.s file from any of my source codes, you should redownload the file.

I also edited several other source code files in insignificant ways. It shouldn’t cause any problems, unless I accidentally filled the .zip file incorrectly, before reposting to dropbox.

.

These are NOT the major revisions that I mentioned. I have plans to rewrite the tutorial completely, and make it shorter and simpler and use the neslib, to make it more compatible with code that other people are writing. Standardization is the goal.

 

15. Music

$
0
0

I wrote a page a while back about the NES Audio.

https://nesdoug.com/2015/12/02/14-intro-to-sound/

But, mostly you shouldn’t have to know that much about the sound registers. We are going to use Famitracker to write the music and Famitone 2 v1.15 to play the music. I have been including the famitone code in every example, so that it’s already in place for you. All you have to do is to include the music data file in crt0.s right below music_data:

I’m not the best famitracker musician, so maybe you should watch a tutorial about using it, like this one.

 

I like this tool chain, but famitone2 has some limitations.

  1. No volume column.
  2. Allowed notes are C-1..D-6, Note Cut
  3. Only Volume, Arpeggio, and Pitch sequences
  4. All instruments should have a volume envelope assigned
  5. no Duty sequence
  6. 64 instruments max
  7. no fx except Tempo Fxx, Looping backwards Bxx, and ending the frame early D00
  8. Up to 17 sub songs in a file

Because there is no volume column, you might want to make a few instruments of different max volume.

Put every song into the same file, use “module properties” to add a song.

18_FT

Once everything is done, export a txt file. You need to process this file with famitone2 program text2data.exe. Use the command line, and add the -ca65 switch so that our assembler won’t have any problems reading it. I left all the files in /MUSIC if you want to see what they look like.

18_FT2

I wrote 2 songs and imported them into the platformer game.

music_play(0) plays the first song.

music_play(1) plays the second song.

Press “start” to switch between the songs.

The neslib code automatically updates the audio registers to match the song. At the end of the nmi code, FamiToneUpdate is called, once per frame.

If you need to, you can pause the song music_pause(1) and unpause the song music_pause(0). And you can stop the song altogether music_stop().

Oh, and one more side note. I wrote a function that allows you to change the speed of the music with your code. Normally, you could only set the speed inside the famitracker file. But, what if you wanted to speed it up for a boss fight, or slow it down if you are in some stunned state? Well, now you can easily do that with this function…

set_music_speed()

Lower numbers mean faster, bigger means slower. 6 is the default.

https://github.com/nesdoug/18_Music

.

.

On a side note, there are other music drivers.

Pently, has been used in a few games, and might be good for you if you like to write your music with a sheet music tool. It uses a descriptive language. Music Macro Language (MML) or LilyPond can be used.

https://github.com/pinobatch/pently

.

ggsound is another options. NESmaker is using it. I am not familiar enough to give details.

https://github.com/gradualgames/ggsound

.

The full famitracker driver is another option, but it’s very large, and a bit slower than other drivers. You can get it from shiru’s example file.

https://shiru.untergrund.net/files/src/cc65_neslib_famitracker.zip

Or you could look at cppchriscpp’s example code, which uses it, I think (?).

https://github.com/cppchriscpp/nes-starter-kit/tree/master/source/neslib_asm/ft_drv

.

I also wrote 2 unofficial updates to famitone, which I talk about here.

https://nesdoug.com/2018/09/05/links-and-misc/

 

 

 

16. Sound effects

$
0
0

Even if you have no music talent, you might be able to make some cool sound effects. Music is nice, but sound effects make if feel like a real game.

Again, open famitracker. You can use mostly all the fx and any notes. Put all the sound effects in 1 file, each as its own “song”. Add a song in module properties…

18_FT

Try to write the music so pulse channel 1 or triangle play the main melody. And then use pulse channel 2 (or noise channel) for sound effects. That way they don’t collide. If you are having problems with sfx cutting out, you could also try to make the sound effects volume louder than the music (at least a little bit). I actually made my sfx quieter than the music, but louder than the Square 2 channel, where most of the sfx play.

They should be rather short. End every effect with C00, and put the C00 on its own line.

Save. Now, export to NSF file.

19_FT

Open the command prompt and use nsf2data with the -ca65 option. I’m using famitone 2 v1.15. The sound effect code changed in the last update, so use 1.15 to make the data.

Include the sounds data in crt0.s under sounds_data:, and make sure FT_SFX_ENABLE is set at the top, and also that FT_SFX_STREAMS is 1. The init code will initialize our sound effects. Having 1 stream means that only 1 sfx can play at once.

We just need to call the sound effects like…
sfx_play(sfx,channel). Channel means stream, use channel = 0, since we have only 1 activated.

If you want 2-4 streams defined, you could set a channel to 1,2,3. Higher having higher priority. I would caution against having too many, they might conflict. I have used 2 before.

I made it so that jump calls sfx_play(SFX_JUMP, 0). B button plays a noise sfx, and Select button plays a “ding” sfx. I’m going to use that for coin collecting, later.

Start still changes the song.

https://github.com/nesdoug/19_SFX/blob/master/platformer3.c

https://github.com/nesdoug/19_SFX

 

Viewing all 88 articles
Browse latest View live