Page 1 of 2

Best resources for learning NES programming?

Posted: Tue Jan 11, 2011 8:31 pm
by SatoshiMatrix
Over the last few years I've seen so many great hacks as well as new homebrew games being developed for the NES and the more I think about it, the more I envy such development and wonder how it is done today.

I find myself more and more drawn to classic gaming from the 2600 C64 to the NES and feel rather strongly about learning programming for the NES/Famicom.

I'm currently a journalism student but due to my interests, I'm thinking of switching careers next fall and going into programing.

So of all the resources out there, the question is where to start. What are the best resources for absolute beginners to learn programming on the NES? I'm fairly good with mathematics and am eager to start learning.

Any links, recommended books or general info is much appreciated.

Posted: Tue Jan 11, 2011 8:48 pm
by tepples
Have you programmed for any other system before, in any language?

You can start by having a binge on background material.

Posted: Tue Jan 11, 2011 8:49 pm
by SatoshiMatrix
I've done a tiny bit of programming with the Family BASIC program for the Famicom, but nothing really.

Re: Best resources for learning NES programming?

Posted: Tue Jan 11, 2011 10:17 pm
by tokumaru
SatoshiMatrix wrote:I'm currently a journalism student but due to my interests, I'm thinking of switching careers next fall and going into programing.
Seriously, just stay on journalism. Programming for current stuff is not fun at all. The great majority of programming jobs is for boring business stuff, but even when this is not the case, the tight deadlines will always have you using a shitload of code/libraries made by other people and not coding any of the fun stuff yourself.

If your main goal is to code for these retro platforms, studying programming at college won't help you at all. Not a single person I know that graduated in computer science has the slightest idea of how a game works. Most courses teach only linear programming (where you take some input, do some processing with it, generate an output, and you're done), or at most some event-driven programming (when something happens when the user does something, like click a button). Fact is that none of that prepares you to keep a simulated world constantly working, something essential in an action game.

That said, I'll suggest what I suggest to anyone that doesn't know any assembly yet: download Michal Kowalski's 6502 Simulator. Open a new document, the status and memory windows and start playing. Keep a 6502 reference nearby, and test how every instruction works. That will help you understand how you can move numbers around, branch based on different conditions, thing like that.

Once you are more acquainted with the CPU, you can try coding some meaningful code, like small programs and functions that do multiplication, division, and so on. After that you should be prepared to write NES code and starting to play with the PPU. Do all sorts of experiments with it, drawing backgrounds and sprites. The rest is easy, since by then you'll already be on the right track.

Re: Best resources for learning NES programming?

Posted: Tue Jan 11, 2011 10:53 pm
by clueless
tokumaru wrote:
SatoshiMatrix wrote:I'm currently a journalism student but due to my interests, I'm thinking of switching careers next fall and going into programing.
Seriously, just stay on journalism. Programming for current stuff is not fun at all. The great majority of programming jobs is for boring business stuff, but even when this is not the case, the tight deadlines will always have you using a shitload of code/libraries made by other people and not coding any of the fun stuff yourself.

If your main goal is to code for these retro platforms, studying programming at college won't help you at all. Not a single person I know that graduated in computer science has the slightest idea of how a game works. Most courses teach only linear programming (where you take some input, do some processing with it, generate an output, and you're done), or at most some event-driven programming (when something happens when the user does something, like click a button). Fact is that none of that prepares you to keep a simulated world constantly working, something essential in an action game.

I have to disagree with all of this. Colleges and college students that you are familiar with must suck.

I have a Bachelors of Science degree in Computer Science from the University of Missouri - Rolla (USA). I also have minors in math and history. Most of the hard-core CS students spent their free time coding up games and simulations. I did. I wrote a (working, but sucky) RTS game (was going to be a clone of Command and Conquer) for unix. It ran on bare X11 (no widget kit) or VGALib (this was before SDL was wide-spread) and used TCP and was client/server based (bad design decisions, but hey, it was fun to work on).

The "input -> process -> output" was only taught in the "intro to programming" class (a required freshman weed-out class). The data structures classes were fun. One very memorable assignment was to write a program to solve the "peg solitaire" game using a depth-first recursive solver. For my final senior project, I wrote a miniature C compiler, assembler, linker and virtual machine to run the executables in. From scratch. I didn't copy stuff from the famous "dragon book" (seminal work on compiler design). Designing, coding, testing and demonstrating those things to the professor certainly isn't as simply as stripping a text file and adding up values. These certainly were not brainless coding tasks one would hand to a junior programmer.

My wife also has a CS degree. For her second-level data structures class, the professor had the entire class hack on the source code to a mud to add features.

One of the CS students at UMR wrote his own 3-D graphics implementation on Solaris. It used the raw frame buffer on the server and was VERY FAST. It blew away the speed of opengl on a MITSHM extended X11 display.

UMR was a tough school. Only 30 percent of the incoming freshmen graduated. Most washed out. By the time a UMR student had 60+ credit hours, you knew that they were serious. UMR students were all top of their high school classes which made them highly competitive with each other (place 5000 alpha geeks in one campus and then drop 70% of them, you can see the pressure that this puts on you).

I've met my share of idiot programmers... With college degrees. We won't hire them. Ever. They do exist. But a blanket statement that "graduates in CS haven't the slightest idea how a game works" (I paraphrased you here) is laughable.

UMR spent exactly ONE semester on learning a programming language. When I was a freshman (1994) that was pascal (turbo pascal 7.0 on MS-DOS) (today it is Java or .net, idk which). After that, every CS student was expected to learn any required language with "2 weeks and a manual". The rest of the curriculum was on data structures, cpu micro architecture, AI, language translation, graphics, networking (Understanding the physics of the wave traveling down the wire all the way up to writing tcp servers and measuring network latency / global performance issues), recursive decent parsers, etc... Each professor dictated what language we had to use, and there was a variety (pascal, C, C++, fortran, cobol, x86 asm, ibm 370 asm, shell and/or perl, java, lisp, scheme). I will grant you that the language choices have really bloomed since then.

I am willing to bet that there are a great number of college CS graduates that could create a game (PC or NES). Just like there are students who can't code their way out of a wet paper bag.

A CS degree is NOT a prerequisite for bring a great software developer. It is a path. There are many. But to say that everyone who walks down a given path sucks is totally inaccurate.

If SatoshiMatrix wishes to pursue a CS degree, then good for him. The advise that I would have when picking a degree program at a college is this:

IMHO, you can judge how good a college program is by the count of undergrads who publish research papers (sadly, I did not do this. I was also working two jobs and got married my Junior year, so I had no time to do real research), and how impressive the list of big-name companies that recruit graduates from the college. The later is a direct indication of the refined job market's assessment of the quality of the college / degree program. The former is (one) indication of how much the college encourages pure science (peer review, etc...). Many colleges don't encourage undergrads to publish. Those that do seem to be ahead of the curve in doing research and exposing real science to the undergrads

As for real programming jobs being boring. Yes, they can be. My entire professional career has been writing code for financial companies (payroll software, credit card processing software, file transfer automation / sysadmin scripts). But even in these environments, there is room for fun stuff. Ever write code to use an inverse Fourier transform to look for transaction account fraud? I tinkered with it. We've written neat data visualization stuff too. Data mining is fun.

Posted: Tue Jan 11, 2011 11:33 pm
by tokumaru
Well, maybe Computer Science courses here in Brazil just suck, I wouldn't be surprised. I did study most of the things you listed (data structures, computer architecture, AI, image processing, compilers, etc) but never in much depth, because most students simply couldn't follow, and that really sucked for the few of us who could take a challenge. I had fun and learned stuff in SOME of them, but there was hardly any challenge.

When we were required to program, it was always to solve a single problem, perform a single task (regardless of how complex it is)... It was always a one time thing (I'm counting small web systems as small collections of "one time things" here). For my final project I made a Flash platformer, an action game. The other students that presented their projects on the same day all made boring web/database/business systems, except for one group that made a lame board game (i.e. turn based, requiring user input in order to do anything) in Visual Basic.

I then worked as a web developer in a couple of places, and not a single coworker I tried to talk to knew anything about making programs as interactive as games. I'm guessing that's because in business programming every action is a response to an event (a page request, the click of a button, etc), so none of them knew how to keep a virtual world constantly active.

Hopefully things are better in other parts of the world, but from my experience, if you really expect to learn anything that is not directly related to business programming you have to go after it yourself. All programming that was taught at the university I went to was very superficial and linear, and most students didn't even bother learning, they just made it by cheating most of the time.

That doesn't bother me much, because we live in an era where knowledge is free, the internet has plenty of it, so I can learn whatever I want whenever I want, instead of doing it the archaic way which is physically going to a room full of people where some guy that might or might not know what he's talking about will lecture everyone on a subject that might or might not interest them.

Re: Best resources for learning NES programming?

Posted: Wed Jan 12, 2011 12:30 am
by koitsu
SatoshiMatrix wrote:I'm currently a journalism student but due to my interests, I'm thinking of switching careers next fall and going into programing.
Don't. Stay in journalism. You do not want to enter the CS realm, believe me, at least as a career.

If you want to learn how to do "stuff" on the NES, keep it purely as a hobby. You'll find it to be a heck of a lot more rewarding that cranking out crappy code in some over-abstracted OO environment (*cough* Java *cough*).

I'm giving you this advice as someone who's kept the Parodius network maintained solely as a hobby since 1991, and as someone who's worked in IT since 1994 (and that includes doing software).

Re: Best resources for learning NES programming?

Posted: Wed Jan 12, 2011 9:02 am
by bclifton
SatoshiMatrix wrote:I'm currently a journalism student but due to my interests, I'm thinking of switching careers next fall and going into programing.

So of all the resources out there, the question is where to start. What are the best resources for absolute beginners to learn programming on the NES? I'm fairly good with mathematics and am eager to start learning.

Any links, recommended books or general info is much appreciated.
Before you learn anything about the NES, I'd learn programming in general. There's a lot of concepts you're going to need to understand to be good

I'm not going to tell you what to do or not do. Programming can make a lot of money and it's fun. Hobby programming, like NES dev, can have the fun sucked out of it when work gets really hard (because you'll want to get away from a computer). But I've been programming since 1991 or so and I still can't get enough

I'd recommend starting off with with either C# or C++. You can get the Microsoft IDE Visual Studio here for free.
http://www.microsoft.com/express/Downloads/

You can find lots of great example code on this website:
http://www.codeproject.com/

You're going to want to be really comfortable with just basic stuff, like flow control (if/else, while, for, etc), and data structures (including pointers) before you jump into assembly. I highly recommend Visual Studio above because you can jump into a C# windows forms project and visually see your code working (i.e. breakpoints and debugging, message boxes, drag easy to use controls out)

I have a bunch of hobby projects which I've included source code. Feel free to check these out:
http://www.brianclifton.com/projects

Good luck! If anything I wrote doesn't make sense, let me know and I'll help you figure it out

Posted: Wed Jan 12, 2011 9:32 am
by 3gengames
I think if you've only worked with high-level languages that going to assembly is hard. I'm luck to have started on basic, then to assembly, and then to mess with other stuff high level. I think if your taught high-level like C/C++ first without knowing the technicalities and understanding CPU limitations, you'll have a much harder time. My friend who is in college for programming I asked about maybe programming with for XNA (He said nah) and then I asked about NES. It basically went like "Wow, so limited. I think I'll pass. How much RAM does it even have?" "2K with an 8K additional from the cartridge" "Thats like nothing! I'm so not doing that." >.<

Posted: Wed Jan 12, 2011 9:37 am
by bclifton
3gengames wrote:I think if you've only worked with high-level languages that going to assembly is hard. I'm luck to have started on basic, then to assembly, and then to mess with other stuff high level. I think if your taught high-level like C/C++ first without knowing the technicalities and understanding CPU limitations, you'll have a much harder time. My friend who is in college for programming I asked about maybe programming with for XNA (He said nah) and then I asked about NES. It basically went like "Wow, so limited. I think I'll pass. How much RAM does it even have?" "2K with an 8K additional from the cartridge" "Thats like nothing! I'm so not doing that." >.<
Well, the guy is talking about a career. Understanding low level stuff is great but you don't need it for an entry level job. You can learn it after you're already getting paychecks. I learned ASM for 68k, PowerPC (when I was a mac user) and then 386/486 ASM after I switched to windows. With just a C/C++ background and documentation I was able to figure it out

There are definitely career paths where you need to be able to write microcontroller code and be super low level. Those jobs still exist but most require an EE background

Posted: Wed Jan 12, 2011 9:41 am
by 3gengames
Yeah, some people who are gifted like you can do that, but most people couldn't. It's just over their head sometimes. :P


68K is in tense. Awesome. I can't even grasp that looking over the instruction set. :P And yeah, libraries are crappy to not write but oh well. Not even going to lie, if you want to do game development today, I'd just go the XNA route. If your game is good, it will sell and you'll get money just like a real developer, and you won't have deadlines! Although I guess it is limited some. ;)

Good luck though dude! I want to be a programmer, too. :)

Posted: Wed Jan 12, 2011 11:10 am
by GradualGames
I agree with some of the points brought up and disagree with others. There may be very good reasons for going into the computer science field as a career. Say you want to raise a family: that's kind of expensive. I don't know how most journalism jobs pay (perhaps well, I have no idea), but it's not too hard to make a decent living as a software engineer. So there's at least one very practical reason for doing it as a job.

In terms of college, I went for computer science but I'd take most of the blame for not benefiting from it. I was not a very good student, and at the time I really thought I should be some kind of musician instead of a programmer. On the other hand, most of the classes were ridiculously boring. In some cases they were a joke and not challenging at all, in other cases they were so difficult that most of the class failed every exam and only a curve allowed anybody to pass.

As for the enjoyment factor of professional software development versus hobby development such as making a game for the NES...well I can't really argue here. I haven't done much coding on the job that is anywhere near as fun as coding a game for an old system. But, it can be challenging, and writing code for me is always an interesting and satisfying thing to do even if it isn't as cool as hobby programming.

I've had three software engineering jobs so far and now I'm employed in the embedded systems field. This is probably the closest you can get professionally to something that will feel like coding for an old video game system. There are times it is really fascinating and exciting and other times where it is a drag..probably like all jobs.

In the end only you can make the final decision.

Posted: Wed Jan 12, 2011 6:44 pm
by Ian A
I'm not a very good programmer, so take this advice with a grain of salt, but I think it's way better to work on something you actually want to work on. Grab an assembler, head on over to the Nerdy Nights Tutorials and open up a browser page to 6502 opcodes and have at it. Blargg's NES tutorials are pretty handy references to have too.

If you decide you want to start with a higher level language to grasp the concepts I'd go with something simple. You probably want your first program to be one file and easy for you to follow and understand.

But seriously, you want to work on the NES, so work on the NES.

Posted: Wed Jan 12, 2011 8:23 pm
by Banshaku
Another advice before you make your decision, if you just become "an average programmer" (we're not all Einstein after all) or even if you're a great talent but you're company is just thinking about cutting the cost down, your job could be easily be replaced by some outsourcing company in India or China. It's not because the quality is better, just because it's cheaper. Why pay you a premium when you can get 6 to 10 guys for the same price? This is what is happening at my company and most developers left (or had to go).

So in the current economy, there are risk to go in that field. So before you make that choice, make sure this is really what you want to do in the first place. If you go only for the money... You may be disappointed. There is less CS student for that reason (outsourcing) there days.

Re: Best resources for learning NES programming?

Posted: Wed Jan 12, 2011 9:50 pm
by cpow
clueless wrote: One very memorable assignment was to write a program to solve the "peg solitaire" game using a depth-first recursive solver. For my final
Like this?

And this?

Well actually those are games I built around the solver databases that the solvers I wrote (code linked on the pages). I didn't do them as part of a college assignment, more just to prove I could. I found that recursion was dreadfully slow for the solvers, so I just figured out a better way and coded that up.
clueless wrote: senior project, I wrote a miniature C compiler, assembler, linker and virtual machine to run the executables in. From scratch. I didn't copy stuff from the famous "dragon book" (seminal work on compiler design).
Good god my favorite class in college was compiler design! Hardest freakin' class I ever took. But I still use lex/yacc!
clueless wrote: UMR spent exactly ONE semester on learning a programming language.
Same at UMICH but you could take more. I was fortunate enough to get Pascal and Fortran at the community college, then C at UMICH. My "data structures" experience was "C++ With Data Structures", so learning C++ was the first homework.
clueless wrote: As for real programming jobs being boring. Yes, they can be. My entire professional career has been writing code for financial companies (payroll software, credit card processing software, file transfer automation / sysadmin scripts). But even in these environments, there is room for fun stuff. Ever write code to use an inverse Fourier transform to look for transaction account fraud? I tinkered with it. We've written neat data visualization stuff too. Data mining is fun.
For me the boring parts are washed away when the board I'm working on comes to life and lights start blinking the way I told them to.