A Simple NES Game
Moderator: PC Supremacists
- Light-Dark
- 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
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
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
- superLED
- 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
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?
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?
- dandymcgee
- 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
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!
- superLED
- 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
I'm working on it right now.dandymcgee wrote:Video would be cool for those of us (me) too busy (lazy) to install an emulator.
- superLED
- 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
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)
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)
- Light-Dark
- 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
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.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 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
- dandymcgee
- 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
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!
- Light-Dark
- 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
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 timedandymcgee 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.
<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
Re: A Simple NES Game
Having been toying with the gameboy, I completely agree with you. And good work man :DLight-Dark wrote: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 timedandymcgee 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.
- Light-Dark
- 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
Thanks man! I wish you luck with your gameboy endeavors!eatcomics wrote: Having been toying with the gameboy, I completely agree with you. And good work man :D
<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
- Falco Girgis
- 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
You sadistic fuck.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.
It already has no floating point numbers... Emulating trig functions is going to be rape.
- Light-Dark
- 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
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.Falco Girgis wrote:You sadistic fuck.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.
It already has no floating point numbers... Emulating trig functions is going to be rape.
<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
- Falco Girgis
- 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
Agreed.Light-Dark wrote: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.Falco Girgis wrote:You sadistic fuck.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.
It already has no floating point numbers... Emulating trig functions is going to be rape.
- Light-Dark
- 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
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
- dandymcgee
- 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
Haha, nice work dude. Thanks for the video too!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.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!