What do we want in a tutorial?

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems. See the NESdev wiki for more information.

Moderator: Moderators

Post Reply
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

What do we want in a tutorial?

Post by tepples »

Nerdy Nights is a huge improvement over the tutorials that preceded it (GBAGuy, etc.) But it has come to my attention in this topic that even it has room for improvement. What might the outline of a new tutorial look like? And would it be a good or bad idea to rely on libraries for things like linker script, system init, nametable clearing, and gamepad reading, without explaining them in the first lesson?

I'm guessing it'd start like this:

Chapter 1: Gathering tools
Installation of ca65, GIMP, and tile converter would need to be described separately for apt-based Linux, yum-based Linux, OS X, and Windows

Chapter 2: Hello World
  1. Immediate mode and PPU addressing: Turn the screen green
  2. Indexed addressing and looping: Display "Hello World"
  3. Subroutines: Display "Hello World" at different positions
  4. More looping: Display a pattern of "Hello World"
  5. Indirect indexed addressing: Display multiple strings
  6. Reading the controller (using a library): Display one set of strings, then another
  7. Wrap-up: Text file viewer
Chapter 3: A bouncing ball
  1. Clearing and filling OAM: Display a circle
  2. Position variables and waiting for vblank: Move the circle
  3. Position comparison: Limiting the circle's movement
  4. Velocity variables: Bounce the circle off the walls
  5. Nametable updating: Displaying the state of the controller
  6. Binary to decimal conversion and nametable updating: Displaying the position of the circle
  7. Reading the controller and 2D movement: Control the circle's direction
  8. Acceleration and subpixel math: Give the circle some momentum
Other chapters: Air hockey game, Brick breaking game, Platforming, Scrolling, Sound effects, Music

Any leaps too far in the pacing?
Sik
Posts: 1589
Joined: Thu Aug 12, 2010 3:43 am

Re: What do we want in a tutorial?

Post by Sik »

Random thought: what would happen if it focused first on sprites and later on backgrounds? (at least having sprites alone you can make some minimal games, but having backgrounds alone will limit your choices more)
User avatar
dougeff
Posts: 3078
Joined: Fri May 08, 2015 7:17 pm

Re: What do we want in a tutorial?

Post by dougeff »

Will there be a primer on ASM language, or will this be explained as you go? I think alot of people get confused with CMP instructions.

Also, I like a wiki kind of approach, with links to further information on each page.
nesdoug.com -- blog/tutorial on programming for the NES
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: What do we want in a tutorial?

Post by tepples »

Sik wrote:Random thought: what would happen if it focused first on sprites and later on backgrounds? (at least having sprites alone you can make some minimal games, but having backgrounds alone will limit your choices more)
What kind of game could be made with only sprites? You'd probably need a background to 1. define where the sprites are allowed to go (such as top and bottom walls in Pong) and 2. display the score. Even if you could do so with only sprites, I conjecture that doing so with a background would be easier to understand.
dougeff wrote:Will there be a primer on ASM language, or will this be explained as you go?
Both. The installation chapter will link to the list of 6502 tutorials if the user wants to learn assembly language in another environment first. But each instruction and each addressing mode will be explained as it's first used. This is why I've broken "Hello World" down the way I did.
User avatar
darryl.revok
Posts: 520
Joined: Sat Jul 25, 2015 1:22 pm

Re: What do we want in a tutorial?

Post by darryl.revok »

I'm really glad you're doing this. If there's anything I can do to help with the project, I'd be happy to do so. If the pace ends up feeling too fast, you could always break up the lessons you have planned.

I'll throw out a few ideas in no particular order:

Disambiguation of the flags and the operands that use them. As long as I thought BEQ was "branch on equal", I wasn't really understanding what that operand did. I had several CMP #$00 commands which were totally redundant.

Perhaps some collision detection with the other objects in the ball game.

Stack usage. I don't think this ever gets covered in Nerdy Nights, not even to protect your registers during NMI.

Optimization of code. This would be a later tutorial, but I think it would be helpful to address general ways to improve programming for the system, perhaps as a wrap-up. Sometimes writing efficient code in assembly is much different than a higher level language, and sometimes a new potential developer may not have experience with programming at all. You could show some ways to replace operands with others that take less clock cycles, as well as structure, such as creating unrolled loops, something that you'd almost never do with a higher language, and why/when you would do things like that in assembly. I'm putting together a spreadsheet of the operands, and their various clock cycles and byte lengths if that's useful for a download file.

This is probably covered all too well in other articles online, but general best practices in programming would be useful for anyone like myself who hasn't had classical training. Conventions for naming variables, commenting on code, indenting, structuring blocks of code might be helpful. Just a link to another article would be plenty.

Nerdy Nights doesn't really go into animation. This might be useful, especially for someone who's never programmed before.

Programming enemy AI perhaps. That would be a more advanced topic.

For me, and I'd imagine a lot of people, I can read stuff a lot but it doesn't usually click until I do it a few times. I'm not really sure how this information would come in to play, as it would be the reader's responsibility to read, practice, and then come back and reread, but maybe you could pose completing a program and then review the completion in the next article. Nerdy Nights gives incomplete programs but doesn't really go over and say, "let's review that task and see how you did"

Operands that confused me most at the start:
AND, OR, EOR - The first thing I tried to do with one of these was to:

Code: Select all

CMP #$xx
AND #$nn
That obviously didn't work. I thought about these commands from their higher-level language uses. I had to look at and break down the functions of the seven logic gates in a very simple manner before I actually got this.
BIT - This kind of goes with the last one, as those without assembly experience probably won't be used to the idea of directly working with the 1s and 0s of a byte. Most people who really use computers probably know a bit is a 0 or 1, and that a byte is 8 bits, but how just those two options create a functioning computer system didn't really start to come in for focus for me until I started doing this.
Anything to do with the flags - I didn't get these at first, and I feel like it helped a lot to understand that every branch instruction is checking these flags. In a higher level language, you're controlling all of your branching with variable values, but here, all of the variable values are controlling the flags which control your program flow. I think because of that they deserve more attention than they get.
User avatar
mikejmoffitt
Posts: 1353
Joined: Sun May 27, 2012 8:43 pm

Re: What do we want in a tutorial?

Post by mikejmoffitt »

tepples wrote:
Sik wrote:Random thought: what would happen if it focused first on sprites and later on backgrounds? (at least having sprites alone you can make some minimal games, but having backgrounds alone will limit your choices more)
What kind of game could be made with only sprites? You'd probably need a background to 1. define where the sprites are allowed to go (such as top and bottom walls in Pong) and 2. display the score. Even if you could do so with only sprites, I conjecture that doing so with a background would be easier to understand.
Baby's first pong game is best done using the top and bottom borders as the boundary, and foregoing score entirely - for this, sprites are fine. The goal isn't to make a fun, complete, NTSC-safe-zoned game (I know that last bit was going to get mentioned), but just to get people familiar with the idea of putting a few elements together.
Pokun
Posts: 2675
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: What do we want in a tutorial?

Post by Pokun »

Tepple's example looks pretty good so far. If there's something to criticize I would say that it looks like it takes an awful long time before you can make a game lol. But I don't know how long each lesson is. And if they properly teach you how to make structured code it may be worth it.
The other thing is that you are using ca65 (newbies might want to make their first ROM as fast as possible lol).

Also I wonder what you mean by reading the controller by using a library? Aren't you teaching how to program everything by themselves? Or are you covering controller reading later?

For sound, I don't really have anything to complain about in the Nerdy Nights sound tutorial that Metal Slime wrote, as the sound engine he teaches you to make is quite versatile. Except that he never finished it. He is still missing how to use the DPCM channel, any expansion sound channel and PAL compatibility. He also mentioned something about sound effects and more advanced drums in his next lesson that never came. I guess he was going to introduce the DPCM channel there.

For animation, there are nothing in Nerdy Nights but NA has other tutorials here: http://nintendoage.com/forum/messagevie ... adid=33287.

I think teaching assembly as you teach how to program the NES is fine. That's how I learned 6502 after all.
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: What do we want in a tutorial?

Post by tepples »

Pokun wrote:The other thing is that you are using ca65 (newbies might want to make their first ROM as fast as possible lol).
Lesson 1 would get people to the point where they can build a working ROM from a source zipfile. This is intentionally a more complex program than the first program of lesson 2 because I want to exercise more of the toolchain (ca65, ld65, Python, Pillow, GNU Make, GNU Coreutils) to prevent problems later.
Also I wonder what you mean by reading the controller by using a library? Aren't you teaching how to program everything by themselves? Or are you covering controller reading later?
A later lesson would explain what goes on in nrom128.cfg (linker script), nrom.s (iNES header), init.s (init code), pads.s (controller reading), and ppuclear.s (OAM and nametable clearing), which come with the template.
User avatar
dougeff
Posts: 3078
Joined: Fri May 08, 2015 7:17 pm

Re: What do we want in a tutorial?

Post by dougeff »

I think lesson 1 should be a warning about how game development is going to suck up hundreds of hours of your life, and after months of frustrations and bug fixes, you will still have a game that's only 1/100th as good as most of the commercial games of that era. And if that's ok with you...here's how to make a game. ;)

I'm kidding, I love this stuff, even the annoying technical documents.
nesdoug.com -- blog/tutorial on programming for the NES
User avatar
dougeff
Posts: 3078
Joined: Fri May 08, 2015 7:17 pm

Re: What do we want in a tutorial?

Post by dougeff »

I see your tutorial is going to have Python. Would you say that Python is easier to use than C++? I only know C++, Pascal, and JavaScript, oh and 6502 ASM, which I learned back in high school because we had an Apple II.
nesdoug.com -- blog/tutorial on programming for the NES
psycopathicteen
Posts: 3140
Joined: Wed May 19, 2010 6:12 pm

Re: What do we want in a tutorial?

Post by psycopathicteen »

Code examples that make everything look easier than it really is.
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: What do we want in a tutorial?

Post by tepples »

dougeff wrote:I see your tutorial is going to have Python. Would you say that Python is easier to use than C++? I only know C++, Pascal, and JavaScript, oh and 6502 ASM, which I learned back in high school because we had an Apple II.
Because the NES cannot read PNG files, we first need to convert them to a format that the NES understands. I could make data conversion tools in PHP, JavaScript, Pascal, or C++ instead, but then we'd have to install PHP, Node, Free Pascal, or GCC in chapter 1.

In my experience, Python is easy to install on both Windows and Debian, and I imagine it's just as easy on Fedora, FreeBSD, or OS X. One thing it has over C++ is memory safety. Like JavaScript, Python has exceptions instead of "undefined behavior", which means it's harder to shoot your own sit bone than in C++.
User avatar
dougeff
Posts: 3078
Joined: Fri May 08, 2015 7:17 pm

Re: What do we want in a tutorial?

Post by dougeff »

Ok, I'll give it a try...a little later...the next programming language I want to learn is ASM for the SNES. It's your tutorial, so do it with the tools you're most comfortable with.
nesdoug.com -- blog/tutorial on programming for the NES
User avatar
nicklausw
Posts: 376
Joined: Sat Jan 03, 2015 5:58 pm
Location: ...
Contact:

Re: What do we want in a tutorial?

Post by nicklausw »

If you're going to teach beginners with ca65, that might as well be a tutorial on its own...(although I suppose config files are the only thing you'd HAVE to comprehend).

2 questions about python:
1. What version do you use?
2. How to install Pillow on Windows?
Pokun
Posts: 2675
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: What do we want in a tutorial?

Post by Pokun »

tepples wrote:
Also I wonder what you mean by reading the controller by using a library? Aren't you teaching how to program everything by themselves? Or are you covering controller reading later?
A later lesson would explain what goes on in nrom128.cfg (linker script), nrom.s (iNES header), init.s (init code), pads.s (controller reading), and ppuclear.s (OAM and nametable clearing), which come with the template.
I see, that makes perfect sense.
tepples wrote:
dougeff wrote:I see your tutorial is going to have Python. Would you say that Python is easier to use than C++? I only know C++, Pascal, and JavaScript, oh and 6502 ASM, which I learned back in high school because we had an Apple II.
Because the NES cannot read PNG files, we first need to convert them to a format that the NES understands. I could make data conversion tools in PHP, JavaScript, Pascal, or C++ instead, but then we'd have to install PHP, Node, Free Pascal, or GCC in chapter 1.

In my experience, Python is easy to install on both Windows and Debian, and I imagine it's just as easy on Fedora, FreeBSD, or OS X. One thing it has over C++ is memory safety. Like JavaScript, Python has exceptions instead of "undefined behavior", which means it's harder to shoot your own sit bone than in C++.
Still if you made it in C++ you could just include a binary for Windows users and they wouldn't have to install anything at all. For Linux users it shouldn't be any harder than installing Python (plus Python extension for bitmaps) and they are likely already setup.
Post Reply