NES development tools: Level/Graphics Editor

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

Shiru
Posts: 1161
Joined: Sat Jan 23, 2010 11:41 pm

Post by Shiru »

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: Select all

 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.
Asteroid
Posts: 14
Joined: Thu Sep 01, 2011 6:56 pm

Post by Asteroid »

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 :)
Asteroid
Posts: 14
Joined: Thu Sep 01, 2011 6:56 pm

Post by Asteroid »

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: Select all

  .rsset $0000  ;;start variables at ram location 0
PPU_DATA 	  = $2007
PPU_ADDR	  = $2006
And I also do:

Code: Select all

  .bank 0
  .org $8000 
unravel:	.incbin "rle.asm"
and in blanking time I simply call the subroutine with:

Code: Select all

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
Shiru
Posts: 1161
Joined: Sat Jan 23, 2010 11:41 pm

Post by Shiru »

.incbin for binaries (*.rle, *.nam, etc), to include other assembly code (*.asm) use .include
Asteroid
Posts: 14
Joined: Thu Sep 01, 2011 6:56 pm

Post by Asteroid »

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.
Asteroid
Posts: 14
Joined: Thu Sep 01, 2011 6:56 pm

Post by Asteroid »

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
Shiru
Posts: 1161
Joined: Sat Jan 23, 2010 11:41 pm

Post by Shiru »

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.
User avatar
GradualGames
Posts: 1106
Joined: Sun Nov 09, 2008 9:18 pm
Location: Pennsylvania, USA
Contact:

Post by GradualGames »

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.
User avatar
Diskover
Posts: 219
Joined: Thu Nov 24, 2011 7:16 am
Contact:

Re: NES development tools: Level/Graphics Editor

Post by Diskover »

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 .
Post Reply