NES development tools: Level/Graphics Editor

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
NES development tools: Level/Graphics Editor
by on (#83709)
hello everyone

I've made my way through most of the nerdy nights tutorials, and as I delve deeper into learning how to program the NES and the game making process, I just had a few questions about how backgrounds/levels and sprite animations are done.

In particular, from the Nerdy Nights Week 6 tutorial, I see that the way he made a background was by writing a whole bunch of "db" statements for the nametable and attribute table. However, I've also been going over the source code of programs available on this site(e.g Bomber4k), and no programs I've seen have anything like a long list of "db" statements.

So I was wondering what graphics tools are used to develop backgrounds. Right now I am using YYCHR to draw the tiles etc, but are there other tools? While randomly browsing nes homebrew on youtube, I found this:

http://www.youtube.com/watch?v=E9c_iyxOIKA

so it seems like there are tools that facilitate the background making process and integrating that into one's program.

I've looked at the tools on this site, but if someone could please go over the best tools available, and a few general words about how they work that would be great. I can definitely generate all the hundreds of "db" statements manually, but I want to check if there are better ways.

much thanks in advance
-asteroid

by on (#83710)
NES screen tool by Shiru for screens. Very good tool.

by on (#83712)
I used "Nes Grafic Editor" for palete\metatiles\level work.
No, not the one from video. There's another "Nes Grafic Editor".
http://www.forum.emunes.pl/index.php?topic=3349.0
But, it's in Polish only.Maybe I'll ask to translate it to english.
Anyway, for current project I'm using MapEd Pro.It misess some options, but it can make 2x2 metatiles.
For drawing Grafics I use Tile molester-IMO it's best GFX editor.

by on (#83713)
YY-Chr is way better then Tile Molester, check it out Denine. But yeah, YY-Chr if you want to do graphics stuff.

by on (#83716)
I use YY-Chr to create my CHR banks and a PC/PSP program I made myself to create levels and other sorts of data. (Tables, static screens, etc)

Project P (an old game made by the maker of Super Bat Puncher) also used a custom built editor: http://www.youtube.com/watch?v=DjYeB604a1s

Edit: SivakD of Battle Kid apparently wrote his editor in Visual Basic. He said so in the comments of the above video.

I think most sufficiently advanced NES homebrew games have their levels created with custom PC editors, since it's very hard to make a good program that can meet the needs of all types of NES homebrew. The second you want a type of compression or whatever else that's outside the scope of the available programs, you have to do it yourself.

by on (#83720)
thanks again kasumi and 3gen.

yeah, I'm still obviously in the very beginning stages of NES programming, so I'm taking my time to learn the ropes of all the tools necessary to create a game. Still a bit confused though.

I've played around with the NES Screen Tool mentioned above, and I understand the basic gist of it. But as I wrote previously, in a few of the sample source code programs I've seen, I never see a long list of "db" statements for the background. So while going over the NES Screen Tool, I still don't understand how I would integrate it's output with my program. The only thing I see is an option to "save the nametable and attributes to the clipboard as ASM". So is that what the program does? I make a background using a tileset, and then simply copy and paste the resulting ASM code into my program? But when I look at the source for Bomber4k, I don't really see anything like a bunch of "db" statements. So maybe he's using a better method? To be honest, the background creation/integration process still baffles me, so if anyone could give a general outline of the steps involved, maybe using the nes screen tool, I would really appreciate it.

thanks for your help
-asteroid

by on (#83721)
Well, when you save the file, you can save it as raw data [.bin] and then use a program like this to upload it:

Code:
ScreenToScreen:
  ASL A
  TAX
  LDA ScreenPointersLow,X
  STA BulkTransfer
  LDA ScreenPointersHigh,X
  STA BulkTransfer+1
  LDA $2002
  LDA #$20
  STA $2006
  LDA #$00
  STA $2006
  LDX #$04
  LDY #$00
ScreenToScreenLoop:
  LDA [BulkTransfer],Y
  STA $2007
  INY
  BNE ScreenToScreenLoop
  INC BulkTransfer+1
  DEX
  BNE ScreenToScreenLoop
  RTS


Where the variable BulkTransfer is in Zeropage, and the other 2 are pointer tables to the ROM location that the screens data starts at. Then there's RLE which I've never messed with it out of NESSt so I can't help you with that, but if you feel you can do it, try to read through and learn the code to upload the screen to see if you understand it. If not, I'd advise you to write your own. Code is good to learn from, but if you just take it without understanding it's limits and such, you'll break it and you'll be less behind on your knowledge. :P ;)

by on (#83728)
In NESst you can save nametable as *.rle, then just incbin that file and use the unrle code to unpack it in VRAM directly.
Re: NES development tools: Level/Graphics Editor
by on (#83729)
Asteroid wrote:
So I was wondering what graphics tools are used to develop backgrounds. Right now I am using YYCHR to draw the tiles etc, but are there other tools?

You can also use (the latest version of) YY-CHR for drawing backgrounds (similar to Shiru's NES Screen Tool), as long as you're fine with being limited to a single screen (no scrolling) and no metatiles (unless you write your own tool to pack the data).

Quote:
so it seems like there are tools that facilitate the background making process and integrating that into one's program.

Most of these tools haven't been publicly released. The only reasonably flexible map editor I know is here http://nesdev.com/bbs/viewtopic.php?t=7111, but its user interface is not the best.

by on (#83730)
Kasumi wrote:
I think most sufficiently advanced NES homebrew games have their levels created with custom PC editors, since it's very hard to make a good program that can meet the needs of all types of NES homebrew. The second you want a type of compression or whatever else that's outside the scope of the available programs, you have to do it yourself.

True to an extent, but I think a generic map editor is within realm of possibility. It should have configurable metatile sizes and support for export plugins. It's just pretty unlikely that anybody is so passionate about map editors to come up with something really good and generic and release it to the public (which takes a lot of extra work, documentation etc). Generalization itself of course takes a lot of extra work as well, so for most people it's not worth doing it just to get a pat on the back...

by on (#83731)
There are general map editors around, actually, but not much people ever heard of them.

For me, making a custom level editor (if necessary for a project) takes about one day, or less, if one of old editors is similar enough to be easily modified. Making plugins or converters for a general map editor would take probably the same amount of time.

by on (#83735)
thefox wrote:
I think a generic map editor is within realm of possibility. It should have configurable metatile sizes and support for export plugins.

Good luck making an export plug-in for an object list format like that used by games like Super Mario Bros., Super Mario Bros. 3, and Super Mario World. Such a tool would need to recognize groups of metatiles that can be represented as a rectangular object. This is one reason

One way to handle object lists is to emulate the game's level decoder. There are three ways to do this:
  • Translate the level decoder into C with some custom preprocessor. Display objects with resize handles, then redecode the affected portion of the map when an object changes.
  • Use an emulator to run the game's decoder and put resize handles on all the objects, then redecode the affected portion of the map when an object changes. NESICIDE might be useful for this because it's organized as a library, or you could write it in Lua for FCEUX.
  • Just make the editor for the NES and have it operate on a level definition in PRG RAM.

by on (#83756)
tepples wrote:
thefox wrote:
I think a generic map editor is within realm of possibility. It should have configurable metatile sizes and support for export plugins.

Good luck making an export plug-in for an object list format like that used by games like Super Mario Bros., Super Mario Bros. 3, and Super Mario World. Such a tool would need to recognize groups of metatiles that can be represented as a rectangular object.

TBH when talking about a generic editor I really meant "generic metatile based editor", which I think also is what most people need.

by on (#83760)
I tried (meta-tile based) and to make it generic for everything and have some intuitive UI requires quite a lot of foresight. If I had the time and the will, yes it would be possible. The time is no more (so is for making games too) so it was put on indefinite old.

By now, since there is no design document, I would have no idea about my current code base :)

by on (#83782)
okay...spent the last couple of hours diving into this again, with some mixed results. I want to be sure I'm doing this correctly. Here is what I tried...but I'm still unable to load my background.

1) I made a simple background for my pong game using the NES Screen Tool and saved the nametable and attribules as an RLE. My background is shown below:

Image

2) I included the rle file as shiru mentioned by adding it in my bank 1.
This is shown below:
Code:
  .bank 1
  .org $E000
level:      .incbin "PongBG.rle"


3) I added the unrle subroutine code as given by shiru. It's included when I downloaded the NES Screen Tool.

4) In my NMI section, as per the instructions given by shiru to call his subroutine, I added the following to unpack my background data. I unpack the 1KB of background and attribute data, which is why my counters run 256*4 times. Each byte of data is unpacked and placed in PPU_DATA, so I write that to the PPU. My code is shown below:

Code:
LoadBackground:
  LDA $2002             ; read PPU status to reset the high/low latch
  LDA #$20
  STA $2006             ; write the high byte of $2000 address
  LDA #$00
  STA $2006             ; write the low byte of $2000 address
 
  LDA #$00
  sta counterLo       ; put the loop counter into 16 bit variable
  LDA #$00
  sta counterHi
 
  LDX #LOW(level)
  LDY #HIGH(level)
 
OuterLoop: 
InsideLoop:
  jsr unrle
  LDA PPU_DATA
  STA $2007
  inc counterLo
  LDA counterLo
  CMP #$00
  BNE InsideLoop
  inc counterHi
  LDA counterHi
  CMP #$04
  BNE OuterLoop


The results are unsuccessful. Perhaps I'm doing it wrong? I can still move my paddle around, but now my ball has disappeared. Furthermore, my background does not load. Any help here would be highly appreciated. I'm not sure how efficient/reliable or suggested using RLE is, but I figured I would give it a try. I might also try the MapEdPro suggested by thefox. Still having difficulty understand how to integrate backgrounds into my program without the use of long "db" statements, so any further comments/help there would also be great.

thanks once more
-asteroid

by on (#83783)
unrle unpacks whole block of data and writes everything to PPU_DATA. To unpack a nametable, you need to call it only once.

I.e., do that once before your game loop (in blanking time):

Code:
 lda #$20
 sta PPU_ADDR
 lda #$00
 sta PPU_ADDR

 ldx #LOW(level)
 ldy #HIGH(level)
 jsr unrle


The PPU_ADDR and PPU_DATA are $2006 and $2007, it is just more convient to use their names instead of addresses.


Also, if you don't need RLE, you can just save your nametable as *.nam, and incbin this file - it is plain unpacked nametable in usual format, you just need to load it to VRAM with a loop.

by on (#83784)
wow...that makes sense. Thanks shiru, really appreciate the speedy response. And thanks for the great screen tool also.

okay, time for me to work on my game some more :)

by on (#84031)
Argh, once again, I'm probably overlooking something very simple. But I still can't get the RLE code to work. I was able to load my background by saving it as *.nam and then reading loading the bytes. So that worked okay, but I would like to get RLE working since it would save some space if I were ever to make a larger game.

It seems straightforward, and I know it is, and yet....still no success.

At the top, below the ines lines, I do
Code:
  .rsset $0000  ;;start variables at ram location 0
PPU_DATA      = $2007
PPU_ADDR     = $2006


And I also do:
Code:
  .bank 0
  .org $8000
unravel:   .incbin "rle.asm"


and in blanking time I simply call the subroutine with:
Code:
LoadBackground:
  ldx #LOW(level)
  ldy #HIGH(level)
  jsr unrle


Where level is the lable to my *.rle file (i.e, level: .incbin "bgtest.rle") But I keep getting a "jsr unrle undefined symbol in operand field" error. Any clues?

thanks

by on (#84032)
.incbin for binaries (*.rle, *.nam, etc), to include other assembly code (*.asm) use .include

by on (#84033)
thanks shiru,

I feel like a total idiot. I'm trying my best to learn as much as possible, so sorry for any dumb questions I may ask.

by on (#84034)
btw, just wanted to say how awesome your RLE subroutine is. Unpacked, my background was 1KB. But using your RLE compression, it was reduced to only 112 bytes! That's incredible!

thanks again shiru

by on (#84039)
RLE works well only when you have a lot of the same tiles in a row. I.e. if you fill whole screen with the same tile, it packs in just few bytes. However, if you fill whole screen with the same 2x2 metatile, result will be a bit larger than unpacked screen, because in this case there is no repeating tiles in a row at all. So it is only suitable for rather simple screens, but very easy to depack. When you have more complex screens, other more complex algorithms works better, but they are slower and needs additional RAM to work.

by on (#84457)
I've been so busy for so long I missed this. The link you posted at the top is my video...those are custom tools I've made. I've shared them privately with individuals. Send me a PM if you'd like to try them, but from what I can tell shiru has provided publicly a very similar solution, and is probably converging on a broader range of needs than my tools by now.
Re: NES development tools: Level/Graphics Editor
by on (#173124)
Asteroid wrote:
hello everyone

I've made my way through most of the nerdy nights tutorials, and as I delve deeper into learning how to program the NES and the game making process, I just had a few questions about how backgrounds/levels and sprite animations are done.

In particular, from the Nerdy Nights Week 6 tutorial, I see that the way he made a background was by writing a whole bunch of "db" statements for the nametable and attribute table. However, I've also been going over the source code of programs available on this site(e.g Bomber4k), and no programs I've seen have anything like a long list of "db" statements.

So I was wondering what graphics tools are used to develop backgrounds. Right now I am using YYCHR to draw the tiles etc, but are there other tools? While randomly browsing nes homebrew on youtube, I found this:

http://www.youtube.com/watch?v=E9c_iyxOIKA

so it seems like there are tools that facilitate the background making process and integrating that into one's program.

I've looked at the tools on this site, but if someone could please go over the best tools available, and a few general words about how they work that would be great. I can definitely generate all the hundreds of "db" statements manually, but I want to check if there are better ways.

much thanks in advance
-asteroid


Denine wrote:
I used "Nes Grafic Editor" for palete\metatiles\level work.
No, not the one from video. There's another "Nes Grafic Editor".
http://www.forum.emunes.pl/index.php?topic=3349.0
But, it's in Polish only.Maybe I'll ask to translate it to english.
Anyway, for current project I'm using MapEd Pro.It misess some options, but it can make 2x2 metatiles.
For drawing Grafics I use Tile molester-IMO it's best GFX editor.


Incredible son These two programs . The bad thing is that it seems that no longer are for Download :evil:

Could someone put again to the download?

Thank you .