It is currently Fri Feb 15, 2019 10:41 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 11 posts ] 
Author Message
PostPosted: Sat Jun 13, 2009 1:21 pm 
Offline

Joined: Sat May 23, 2009 4:09 pm
Posts: 6
Hi everyone

I have some questions for you, but thought I should introduce myself first as I am fairly new to NES programming. I've been a fan of the system since I was a kid in the 80s. It was the first system I had, and so it holds a special place for me. I took up collecting classic video games a few years ago, primarily for the NES. I currently have around 200 games for it now, most of which were found "in the wild". I have wanted to make an NES game for a long time now, but have only recently become motivated enough to give it a serious attempt. I have read most of the documents on this site, and studied the message board as well. I also have a good deal of programming experience, and plenty with 8-bit processors.

I've decided to go with a puzzle game for my first try. I figured that would be easiest for me to figure out, as for my game I wouldn't need any scrolling or physics that a platformer might need for example. Also, puzzle games are probably my favorite genre for the NES, so that helps keep me interested. I won't go into the details of the game idea at this point because it is in the very early stages, but think Lolo or Kickle Cubicle, and you will be on the right lines.

So other than some testing I have done to make sure my concept is feasible on the NES, I have been spending my time on my title screen. I thought that would be a good way to get the bugs out of my code for sprites, background, input, animation, and sound/music. I am pleased to say I have most of it working, save for sound effects and music. That is coming up later. I've made an avi for anyone that wants to take a look at what I have done so far. http://www.alpinecom.net/phackmann/nes/rottenroad.avi Please forgive the final walking sequence for the character, as I need to work on that some more.

So, if you have looked at it, I have the title fading in with a blue orb in it. The blue orb is a sprite, and I change the palette values to simulate going from black to blue. I found that the only way I could do it was to shut the PPU off, write to $3F00, and turn the PPU back on. If I didn't shut the PPU off, I found that my background flickered and jumped around, like something was being changed outside of the vblank interval. Is this the proper way to do this, or should I be able to update the palette during the vblank interval? I ask because I suspect there is something else going on that I am not aware of. Also, I have only tested my code in the emulators, not on real hardware.

My other question is that I have found that my code for my title screen animation has become rather long and ugly (I'm writing asm with CA65), and I wondered if there are any recommended tips for handling this sort of thing. For example, managing the starting, running, and stopping of a piece of the animation, making sure the timing is correct, dealing with successive frames of animating a sprite,etc. I realize this is a rather broad question, but I don't know how else to put it. Anything you can recommend on how you do it to keep the code more manageable would be greatly appreciated.

Thanks in advance for the help.

PH


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 13, 2009 2:17 pm 
Offline
Site Admin
User avatar

Joined: Mon Sep 20, 2004 6:04 am
Posts: 3649
Location: Indianapolis
Quote:
So, if you have looked at it, I have the title fading in with a blue orb in it. The blue orb is a sprite, and I change the palette values to simulate going from black to blue. I found that the only way I could do it was to shut the PPU off, write to $3F00, and turn the PPU back on. If I didn't shut the PPU off, I found that my background flickered and jumped around, like something was being changed outside of the vblank interval. Is this the proper way to do this, or should I be able to update the palette during the vblank interval? I ask because I suspect there is something else going on that I am not aware of. Also, I have only tested my code in the emulators, not on real hardware.


It sounds like maybe you weren't resetting the scrolling (both $2006/$2005 registers) after writing the palette during vblank. Because it should work.

Quote:
My other question is that I have found that my code for my title screen animation has become rather long and ugly (I'm writing asm with CA65), and I wondered if there are any recommended tips for handling this sort of thing. For example, managing the starting, running, and stopping of a piece of the animation, making sure the timing is correct, dealing with successive frames of animating a sprite,etc. I realize this is a rather broad question, but I don't know how else to put it. Anything you can recommend on how you do it to keep the code more manageable would be greatly appreciated.


I had problems when I first started, related to the animation data, sequences, etc. by having them mixed in with the code. So it's nice to have the code as general as possible, and make the animations in data stored elsewhere (in an .include file for example). Also when the size of the source gets annoying, I tend to move any completed parts of code into a separate file (which I .include).

If the situation is unique enough to where there's no point in writing a general routine (because of variations), using macros can be a huge help. That way you can reuse the same code with minor changes and much less text in the source.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 13, 2009 2:35 pm 
Offline

Joined: Sat May 23, 2009 4:09 pm
Posts: 6
I will check on the scrolling, from what I have seen, that seems likely. Is it a quirk of the machine that the scrolling needs to be reset all the time?

I have been keeping code in separate files as you suggest. One big file quickly becomes unmanageable. I have also been using macros when appropriate, like I use a couple to save and restore the registers when I enter and leave a subroutine.

So if I am understanding what you are suggesting related to animations, have the animation for each object in a file, essentially a block of bytes that defines how each object moves.

So in pseudocode:

objectid
starting position info
starting time/frame info
direction info (?)
frames per step (?)
ending position info

Something along those lines, and then a more generic rendering engine that manages creation, movement, and deletion of each animation?

PH


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 13, 2009 2:50 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 21093
Location: NE Indiana, USA (NTSC)
PH5 wrote:
I will check on the scrolling, from what I have seen, that seems likely. Is it a quirk of the machine that the scrolling needs to be reset all the time?

The VRAM read/write port (PPUADDR/PPUDATA, $2006/$2007) uses the same register inside the PPU as the scroll position (PPUSCROLL, $2005). So yes, after you upload new data to the PPU, you need to reset the scroll position.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 13, 2009 3:10 pm 
Offline

Joined: Sat May 23, 2009 4:09 pm
Posts: 6
That would explain some of the odd behavior I have seen. Thanks for clearing that up.

PH


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 14, 2009 1:55 pm 
Offline

Joined: Sat May 23, 2009 4:09 pm
Posts: 6
As a follow up, I found out where my problem with the jumping was after a lot of tinkering. Memblers and tepples were correct about resetting the scroll position after writing the palette, but I also needed to clear the PPUADDR by writing 0 to it. I only realized I needed to do that after reading section 53 of Chris Covell's NES Tech FAQ.

Regarding my previous question about animation, I would love to hear some more from anyone with some suggestions on how to proceed. I would like to get this right the first time if I can... er, well second time I guess in my case. :)

Thanks
PH


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 14, 2009 2:45 pm 
Offline
Site Admin
User avatar

Joined: Mon Sep 20, 2004 6:04 am
Posts: 3649
Location: Indianapolis
I don't know how helpful it'd be, but you could use my animation code or get some ideas from it maybe. I posted about it here:
http://nesdev.com/bbs/viewtopic.php?t=493
http://www.parodius.com/~memblers/nes/animate.asm

It may be hard to follow at first, but it definitely has worked well for me (I've used it unchanged in several projects).


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 18, 2009 10:58 am 
Offline

Joined: Sat May 23, 2009 4:09 pm
Posts: 6
That was very helpful Memblers. I have taken on your concept for storing animation routines and I am building off of that. I am still figuring out what I can do with it. I believe it can be a very useful piece of code for managing sprite animation during gameplay too. Thanks very much for the help guys.

:D

PH


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 18, 2009 5:20 pm 
Offline
Site Admin
User avatar

Joined: Mon Sep 20, 2004 6:04 am
Posts: 3649
Location: Indianapolis
You're welcome.

BTW, here's a video with the original test of that code (including the explosion that's mentioned all over the source):
http://www.youtube.com/watch?v=ZQaeivjasw4


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 19, 2009 4:05 pm 
Offline

Joined: Sat May 23, 2009 4:09 pm
Posts: 6
Yep, that explosion looks great. Very smooth. It flows really nicely with the movement of the aircraft.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 07, 2009 9:05 pm 
Offline
User avatar

Joined: Mon Jul 06, 2009 11:32 am
Posts: 2
Location: Bogotá, Colombia
Hello everyone.

I'm a beginner in emulation, actually I don't know how to begin, I know to program in C#, and I like start programming my own emulator, I can learn C++ if it's necessary.

groups like Bloodlust software, or persons like Jabo, who created jNES, I think they are genius of this world, I'm impressed with his habilities.

I like to do this because I like learn and contribute to develop the playstation 2 emulator or Xbox emulators, my target is learn and contribute to others to learn, but at this moment I'm blind in this way because I don't know how to start.

I've readed http://fms.komkon.org/EMUL8/HOWTO.html, but I'm not understanding the idea of the author, should I learn electronic before develop my own emulator? exist any tutorial for dummies? I've readed a lot of websites, and I'm confused yet.

Thanks a lot for your help, and sorry for my bad english.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group