nesdev.com
http://forums.nesdev.com/

source code for importing NES levels?
http://forums.nesdev.com/viewtopic.php?f=3&t=15577
Page 1 of 2

Author:  renegade74 [ Thu Feb 23, 2017 6:25 pm ]
Post subject:  source code for importing NES levels?

Hello,

I've contacted a programmer who has agreed to code a game for me - which includes imported levels from an old NES title.
I've sent the .nes file.
However, they have stated to me that I need the "source code" to import the levels.
He asks, "How can I change things if I don't have code for it? It won't even let you extract graphics from that, not quality at least. To make modifications in the game there needs to be a backend for it...I get the front end game, but for modifications backend is required.

Could you help make sense of this? I also understand there may be some document(s) available here to help w/ debugging and if I send an emulator, this may solve the issue. I'm not sure if this is what they mean though.

Please understand, this is someone supposedly with knowledge of C++/ C#/ Python/ Java/ Linux/ Database/ VB/ Mobile Platforms and ECommerse plus more.

Thanks very much!

-Jared

Author:  Zepper [ Thu Feb 23, 2017 6:28 pm ]
Post subject:  Re: source code for importing NES levels?

Short and easy. He's not qualified for the duty.

Author:  renegade74 [ Thu Feb 23, 2017 6:39 pm ]
Post subject:  Re: source code for importing NES levels?

you could be right there - I wondered so w/ all that experience....maybe just not a Nintendo programmer, huh?

I think what they want is the instruction map like how the original Super Mario was mapped out for all to see.

could I not send an emulator and some sort of doc on debugging you think?

Author:  tepples [ Thu Feb 23, 2017 6:41 pm ]
Post subject:  Re: source code for importing NES levels?

Try playing through the level while logging all writes to nametables ($2000-$2FFF) that are near the screen edge. This should let you build the nametable data for that level. From there, your programmer should be able to build metatiles, Markov models, or whatever other map compression method he prefers.

That or he's using the correlation between "not having the source code" and "not having the rights" to politely decline what might be copyright infringement.

Author:  dustmop [ Thu Feb 23, 2017 6:50 pm ]
Post subject:  Re: source code for importing NES levels?

That skill set you described isn't really applicable to the problem at hand. Your programmer is correct about needing source code, but no source code is available, in general, for classic nes games. You need someone who is skilled at reverse engineering, and 6502 assembly.

Author:  renegade74 [ Thu Feb 23, 2017 6:51 pm ]
Post subject:  Re: source code for importing NES levels?

don't think its the latter....thanks for suggestions about nametable data....perhaps that will work.

Author:  renegade74 [ Thu Feb 23, 2017 6:56 pm ]
Post subject:  Re: source code for importing NES levels?

thanks for your reply dustmop, can you get the source code from buying the original game on floppy disk how they have them for famicom/NES games? how else are NES games coded over?

Author:  dustmop [ Thu Feb 23, 2017 6:59 pm ]
Post subject:  Re: source code for importing NES levels?

No, source code was never distributed, it would be a trade secret. Also, if the term "source code" means C or C++, it did not exist, most games were / are coded directly in assembly.

Author:  renegade74 [ Thu Feb 23, 2017 7:02 pm ]
Post subject:  Re: source code for importing NES levels?

yeah, they mean to write it in C+...do you know someone with 6502 knowledge?

also, someone just responded on other forum...

"Unfortunately many high level programmers have no idea how things work on low level (although if he know C he should at least understand how pointers work).

But yeah, the way to go would be to use a debugger to understand how the levels are done. Using a debugger you can see the disassembled NES code (which as far as I know be close to the original uncommented source code anyway because I think they were programmed in assembly) and see the graphics on VRAM. It may be worth searching here or on Google to see if someone has documented the level format.

I can't suggest a specific debugging emulator because I've never used one for NES."

Author:  tepples [ Thu Feb 23, 2017 7:12 pm ]
Post subject:  Re: source code for importing NES levels?

renegade74 wrote:
Using a debugger you can see the disassembled NES code (which as far as I know be close to the original uncommented source code anyway because I think they were programmed in assembly)

The assembly language source code of an NES game would have had subroutine names, array names, variable names, comments, and the like. See, for example, Home Alone 2 and Thwaite. If Data Crystal has a page about the game, you can get names out of that.

Quote:
I can't suggest a specific debugging emulator because I've never used one for NES.

The usual suspects are FCEUX and Nintendulator. You might be able to write nametable logging as a Lua extension for FCEUX.

Author:  renegade74 [ Thu Feb 23, 2017 7:16 pm ]
Post subject:  Re: source code for importing NES levels?

Thanks Tepples, getting a wide array of answers here...maybe one route will connect with the coder. Do you program games?

Author:  tokumaru [ Thu Feb 23, 2017 7:19 pm ]
Post subject:  Re: source code for importing NES levels?

It takes someone reasonably familiar with the NES architecture and 6502 assembly to be able to extract something from an .nes file. If your programmer doesn't already know how to do it, it's unlikely he'll want to learn it for this one project.

Using debugging tools in an emulator you can somewhat easily extract the graphics of a level while playing it. You can periodically dump the name tables to files as the screen scrolls, and then piece everything together to get a map describing which tiles go where, and this is something your programmer might be able to use. Unfortunately, that doesn't include any of the collision and object information.

Author:  renegade74 [ Thu Feb 23, 2017 7:23 pm ]
Post subject:  Re: source code for importing NES levels?

I see...do you have interest in this project possibly?

Author:  tepples [ Thu Feb 23, 2017 7:32 pm ]
Post subject:  Re: source code for importing NES levels?

renegade74 wrote:
Do you program games?

Yes. Here are the NES game credits that I deem noteworthy:

  • Director, lead designer, and programmer for Concentration Room, Thwaite, Zap Ruder, RHDE: Furniture Fight, and the Action 53 menu
  • Lead programmer for Haunted: Halloween '85 and The Curse of Possum Hollow, for which I wrote every line of code except the music engine
  • Music engine programmer for Double Action Blaster Guys, Sliding Blaster, and Nova the Squirrel

Author:  renegade74 [ Thu Feb 23, 2017 7:39 pm ]
Post subject:  Re: source code for importing NES levels?

nice, please see PM

Page 1 of 2 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/