Page 1 of 2

A Simple NES Game

Posted: Fri Feb 01, 2013 11:09 am
by Light-Dark
So this week I had more free time than usual so a couple of days ago I started on a small side project to learn more about the NES and programming for it. Over the span of the past few days I have learned quite a bit about the NES's custom 6502, it's strange little graphics processor the PPU and it's APU. This is what has come out of it. It's nothing to complex, the title screen explains everything except the fact that you have to keep moving, if you stop for about 5 seconds it will kill you. The graphics were all drawn by me (you can really tell) however the music was not composed by me, points if you can recognize the title screen music!

Also on a side note here are some links for anyone who is interested in getting started developing for the NES:
http://nesdev.com/
http://nintendoage.com/forum/messagevie ... eadid=7155

Re: A Simple NES Game

Posted: Fri Feb 01, 2013 3:51 pm
by superLED
Pretty nice! I have wanting to make a NES game since I first started programming. Maybe I'm experienced enough now to make something simple.

There is a strange animation when I try to push the character out of the screen.
I guess you draw the character before you check if he's outside of the screen and then change position and animation-frame.
Try to do all the logic and stuff before drawing anything, maybe?

Looks like the whole pattern repeats. Did you yourself decide exactly where and which direction each thing would go, then repeat the pattern?

Re: A Simple NES Game

Posted: Fri Feb 01, 2013 5:25 pm
by dandymcgee
Video would be cool for those of us (me) too busy (lazy) to install an emulator.

Re: A Simple NES Game

Posted: Fri Feb 01, 2013 5:30 pm
by superLED
dandymcgee wrote:Video would be cool for those of us (me) too busy (lazy) to install an emulator.
I'm working on it right now.

Re: A Simple NES Game

Posted: Fri Feb 01, 2013 5:46 pm
by superLED
Here is the video:


Sorry for the bad quality. Just wanted to quickly put something up there.
The thing in the top left corner is a program I made to visualize controller input (played this game with a SNES controller)

Re: A Simple NES Game

Posted: Fri Feb 01, 2013 8:49 pm
by Light-Dark
superLED wrote:Pretty nice! I have wanting to make a NES game since I first started programming. Maybe I'm experienced enough now to make something simple.

There is a strange animation when I try to push the character out of the screen.
I guess you draw the character before you check if he's outside of the screen and then change position and animation-frame.
Try to do all the logic and stuff before drawing anything, maybe?

Looks like the whole pattern repeats. Did you yourself decide exactly where and which direction each thing would go, then repeat the pattern?
To answer the first part, there is a interupt in the NES , the NMI, which when enabled is called every frame and when drawing you have the drawing at the top of the NMI label and then input polling usually comes next and then logic. But that's not why the flickery animation thing happens when leaving the screen, the reason for that is the original bottom and right border checks were being really annoying and I said fuck it and made it call the move left or move up sub routines.

To answer the second part, yes the projectile's pattern is hard coded but I made it slightly more dynamic, at the end of the cycle it adds the last cycles starting position with the byte that holds the button pressed data ( nes controller convienently has 8 buttons), it then consults a timer to set it's current speed and it's current speed affects which part of the pattern it's at. An example would be at about 5 speed it reverses direction by subtracting instead of adding the speed to the X.

And man if you have enough motivation and patience to read through tutorials and learn the NES's memory system and 6502 assembly go for it! It's one of the more popular consoles to hombrew for and there is actuallly a hombrew platformer series that is commercially available called battlekid by 'Sivak'!

Re: A Simple NES Game

Posted: Fri Feb 01, 2013 10:50 pm
by dandymcgee
Thanks for the video, this is really cool! Music is awesome and game is great for a first go. Would be cool to some more movement patterns like sine waves or spirals.

Re: A Simple NES Game

Posted: Sat Feb 02, 2013 2:51 am
by Light-Dark
dandymcgee wrote:Thanks for the video, this is really cool! Music is awesome and game is great for a first go. Would be cool to some more movement patterns like sine waves or spirals.
Thank you, I think my next project with the NES will be a little more ambitious, a platformer. Now i'd just like to say one thing when it comes to programming for the NES or programming in any really low level language. Diagrams and/or pseudo code help tremendously when planning out how you're going to write say a meta tile compression/decompression system which brings me to my next point when doing this your chances of writing good error free code are higher and thus it possibly eliminates a couple frustrating hours of debugging assembly and let me say something there is nothing more satisfying than seeing something working properly the first or second time :)

Re: A Simple NES Game

Posted: Mon Mar 18, 2013 2:37 pm
by eatcomics
Light-Dark wrote:
dandymcgee wrote:Thanks for the video, this is really cool! Music is awesome and game is great for a first go. Would be cool to some more movement patterns like sine waves or spirals.
Thank you, I think my next project with the NES will be a little more ambitious, a platformer. Now i'd just like to say one thing when it comes to programming for the NES or programming in any really low level language. Diagrams and/or pseudo code help tremendously when planning out how you're going to write say a meta tile compression/decompression system which brings me to my next point when doing this your chances of writing good error free code are higher and thus it possibly eliminates a couple frustrating hours of debugging assembly and let me say something there is nothing more satisfying than seeing something working properly the first or second time :)
Having been toying with the gameboy, I completely agree with you. And good work man :D

Re: A Simple NES Game

Posted: Fri Mar 29, 2013 12:20 pm
by Light-Dark
eatcomics wrote: Having been toying with the gameboy, I completely agree with you. And good work man :D
Thanks man! I wish you luck with your gameboy endeavors!

Re: A Simple NES Game

Posted: Fri Apr 19, 2013 4:58 pm
by Falco Girgis
dandymcgee wrote:Thanks for the video, this is really cool! Music is awesome and game is great for a first go. Would be cool to some more movement patterns like sine waves or spirals.
You sadistic fuck.

It already has no floating point numbers... Emulating trig functions is going to be rape.

Re: A Simple NES Game

Posted: Fri Apr 19, 2013 5:18 pm
by Light-Dark
Falco Girgis wrote:
dandymcgee wrote:Thanks for the video, this is really cool! Music is awesome and game is great for a first go. Would be cool to some more movement patterns like sine waves or spirals.
You sadistic fuck.

It already has no floating point numbers... Emulating trig functions is going to be rape.
Ahahaha yeah, you're WAY better off just programming a sine-wave-like pattern yourself, it's certainly possible as shown by the Medusa heads in Castlevania.

Re: A Simple NES Game

Posted: Fri Apr 19, 2013 5:23 pm
by Falco Girgis
Light-Dark wrote:
Falco Girgis wrote:
dandymcgee wrote:Thanks for the video, this is really cool! Music is awesome and game is great for a first go. Would be cool to some more movement patterns like sine waves or spirals.
You sadistic fuck.

It already has no floating point numbers... Emulating trig functions is going to be rape.
Ahahaha yeah, you're WAY better off just programming a sine-wave-like pattern yourself, it's certainly possible as shown by the Medusa heads in Castlevania.
Agreed.

Re: A Simple NES Game

Posted: Sat Apr 20, 2013 8:19 pm
by Light-Dark


I was bored so I decided to implement a sine-wave-like pattern into "Avoid The Square" it increases in speed each time it finishes a "wave cycle" and when it reaches a certain speed it resets the speed.

Re: A Simple NES Game

Posted: Sun Apr 21, 2013 9:37 am
by dandymcgee
Light-Dark wrote:

I was bored so I decided to implement a sine-wave-like pattern into "Avoid The Square" it increases in speed each time it finishes a "wave cycle" and when it reaches a certain speed it resets the speed.
Haha, nice work dude. Thanks for the video too!