Page 1 of 1
Newbie's first Pong game
Posted: Fri Aug 28, 2009 5:02 pm
by jstout
I'm a known rom editor around some circles and often lurker around here. I am wanting to learn more on the NES core so I started by writing a simple game of pong (1 or 2 Players).
The game and source code:
http://www.geocities.com/ffguru2001/pong.zip
Controls: Start Pauses and A starts play
I would appreciate any feedback especially with anything in the source code that I'm missing or really screwed up with on the NES. Thanks in advance.
Posted: Sun Aug 30, 2009 3:24 am
by Memblers
I'd say this is one of the better, maybe the best NES Pong homebrew I've seen. The code looks pretty clean to me, you buffered VRAM writes and seem to have done everything appropriately. I did notice on FCEU at least that the title screen does a little jump when the game is reset, I'd say that's a pretty minor issue that not many people would notice.
Code: Select all
.define BALL_XSPEED $10
.define BALL_YSPEED $11
.define BALL_WIDTH #$04
.define BALL_HEIGHT #$04
That's one thing I've never seen before in the defines, the use of # for absolute values. I guess it's a personal preference that I always use the # in the code rather than in the defined value, so that's totally legal and everything, I'd just think that could potentially be confusing down the road if it was used a lot (since it makes it a different opcode, which is a major difference if you ever get into cycle-counting). I tend to use more lowercase letters for variable names, and all caps for defined absolute values. But it's pretty clear that you've done the research and know what you're doing, heheh.
I'd go so far as to say that the source code structure you used is a rather excellent example for NES newbies to follow.
Posted: Sun Aug 30, 2009 7:18 am
by Ealdor
I'd go so far as to say that the source code structure you used is a rather excellent example for NES newbies to follow.
Agree, thanks for share the source code.
And good work, i just spend an hour trying to defeat the computer

. There are some things that can be improved but looks very nice.
Posted: Sun Aug 30, 2009 12:29 pm
by jstout
Memblers wrote:I did notice on FCEU at least that the title screen does a little jump when the game is reset, I'd say that's a pretty minor issue that not many people would notice.
I guess it's a personal preference that I always use the # in the code rather than in the defined value, so that's totally legal and everything, I'd just think that could potentially be confusing down the road if it was used a lot (since it makes it a different opcode, which is a major difference if you ever get into cycle-counting).
Thanks, I checked out the title screen on a soft reset at the slowest speed and there was some very quick garbage shown. I had the code set the scroll after loading the title nametable and it cleaned it up so I have a feeling that would remove the bounce you saw as well.
I understand what you mean with how it could get confusing. With the small amount of defines I didn't have a problem but with a larger game I definitely should go with setting the # in the code as you suggested.
Posted: Tue Sep 01, 2009 8:33 pm
by Banshaku
The code in general is fine. My only personal comment is that I would separate it in multiple files like data in a specific module, utility functions in one, constants in a specific include file etc. It just make things easier. The only thing is that it make the compilation/linking "harder" in a way but with a proper makefile this wouldn't be an issue.