A Simple NES Game

Anything related in any way to game development as a whole is welcome here. Tell us about your game, grace us with your project, show us your new YouTube video, etc.

Moderator: PC Supremacists

User avatar
Light-Dark
Dreamcast Developer
Dreamcast Developer
Posts: 307
Joined: Sun Mar 13, 2011 7:57 pm
Current Project: 2D RPG & NES Platformer
Favorite Gaming Platforms: NES,SNES,N64,Genesis,Dreamcast,PC,Xbox360
Programming Language of Choice: C/++
Location: Canada

A Simple NES Game

Post 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
<tpw_rules> LightDark: java is a consequence of inverse moore's law: every 18 months, the average program will be twice as slow. therefore, computers always run at the same percevied speed. java's invention was a monumental step
Image
User avatar
superLED
Chaos Rift Junior
Chaos Rift Junior
Posts: 303
Joined: Sun Nov 21, 2010 10:56 am
Current Project: Engine
Favorite Gaming Platforms: N64
Programming Language of Choice: C++, PHP
Location: Norway

Re: A Simple NES Game

Post 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?
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: A Simple NES Game

Post by dandymcgee »

Video would be cool for those of us (me) too busy (lazy) to install an emulator.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
User avatar
superLED
Chaos Rift Junior
Chaos Rift Junior
Posts: 303
Joined: Sun Nov 21, 2010 10:56 am
Current Project: Engine
Favorite Gaming Platforms: N64
Programming Language of Choice: C++, PHP
Location: Norway

Re: A Simple NES Game

Post 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.
User avatar
superLED
Chaos Rift Junior
Chaos Rift Junior
Posts: 303
Joined: Sun Nov 21, 2010 10:56 am
Current Project: Engine
Favorite Gaming Platforms: N64
Programming Language of Choice: C++, PHP
Location: Norway

Re: A Simple NES Game

Post 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)
User avatar
Light-Dark
Dreamcast Developer
Dreamcast Developer
Posts: 307
Joined: Sun Mar 13, 2011 7:57 pm
Current Project: 2D RPG & NES Platformer
Favorite Gaming Platforms: NES,SNES,N64,Genesis,Dreamcast,PC,Xbox360
Programming Language of Choice: C/++
Location: Canada

Re: A Simple NES Game

Post 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'!
<tpw_rules> LightDark: java is a consequence of inverse moore's law: every 18 months, the average program will be twice as slow. therefore, computers always run at the same percevied speed. java's invention was a monumental step
Image
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: A Simple NES Game

Post 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.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
User avatar
Light-Dark
Dreamcast Developer
Dreamcast Developer
Posts: 307
Joined: Sun Mar 13, 2011 7:57 pm
Current Project: 2D RPG & NES Platformer
Favorite Gaming Platforms: NES,SNES,N64,Genesis,Dreamcast,PC,Xbox360
Programming Language of Choice: C/++
Location: Canada

Re: A Simple NES Game

Post 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 :)
<tpw_rules> LightDark: java is a consequence of inverse moore's law: every 18 months, the average program will be twice as slow. therefore, computers always run at the same percevied speed. java's invention was a monumental step
Image
User avatar
eatcomics
ES Beta Backer
ES Beta Backer
Posts: 2528
Joined: Sat Mar 08, 2008 7:52 pm
Location: Illinois

Re: A Simple NES Game

Post 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
Image
User avatar
Light-Dark
Dreamcast Developer
Dreamcast Developer
Posts: 307
Joined: Sun Mar 13, 2011 7:57 pm
Current Project: 2D RPG & NES Platformer
Favorite Gaming Platforms: NES,SNES,N64,Genesis,Dreamcast,PC,Xbox360
Programming Language of Choice: C/++
Location: Canada

Re: A Simple NES Game

Post 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!
<tpw_rules> LightDark: java is a consequence of inverse moore's law: every 18 months, the average program will be twice as slow. therefore, computers always run at the same percevied speed. java's invention was a monumental step
Image
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Re: A Simple NES Game

Post 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.
User avatar
Light-Dark
Dreamcast Developer
Dreamcast Developer
Posts: 307
Joined: Sun Mar 13, 2011 7:57 pm
Current Project: 2D RPG & NES Platformer
Favorite Gaming Platforms: NES,SNES,N64,Genesis,Dreamcast,PC,Xbox360
Programming Language of Choice: C/++
Location: Canada

Re: A Simple NES Game

Post 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.
<tpw_rules> LightDark: java is a consequence of inverse moore's law: every 18 months, the average program will be twice as slow. therefore, computers always run at the same percevied speed. java's invention was a monumental step
Image
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Re: A Simple NES Game

Post 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.
User avatar
Light-Dark
Dreamcast Developer
Dreamcast Developer
Posts: 307
Joined: Sun Mar 13, 2011 7:57 pm
Current Project: 2D RPG & NES Platformer
Favorite Gaming Platforms: NES,SNES,N64,Genesis,Dreamcast,PC,Xbox360
Programming Language of Choice: C/++
Location: Canada

Re: A Simple NES Game

Post 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.
<tpw_rules> LightDark: java is a consequence of inverse moore's law: every 18 months, the average program will be twice as slow. therefore, computers always run at the same percevied speed. java's invention was a monumental step
Image
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: A Simple NES Game

Post 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!
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
Post Reply