It is currently Wed Nov 22, 2017 12:43 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: NES tile format
PostPosted: Wed Aug 15, 2012 6:49 am 
Offline

Joined: Tue Jul 10, 2012 1:37 pm
Posts: 54
Hello Everyone,
I am making a tile editor and tile map editor that currently only supports the sega genesis.
The way it works is it stores a true color tile and it will automatically reduce it to the selected palette (There will be a choice of dithering algorithms or no dithering at all right now it only supports floyd steiburg).
I do not know of any editors that are able to do this and I was thinking about just how useful this technology is and I realized that this should not be limited to just one platform.
Alot of retro game systems use a tile and a palette so I would not have to re-invent the wheel.
Another advantage is when making a cross platform game there would be no need to rework the graphics
and speaking of not having to redo graphics another advantage of this is if you need to add a last minute tile and there are no good color to use all you would have to do is add the tile and the palette can automatically adjust it's self (it will be able to automatically find an optimal palette for the tiles).
Sorry if this ended up as an advertisement I was trying to describe the program it will be free and open source.
So I was just wondering how the NES stores the palette and tiles and what are the RGB values for the palette on the sega genesis they are simply in steps of 36.
As you can tell I am much more familiar with the sega genesis hardware than the NES hardware.
Also plane mapping is plane mapping a byte or a word that stores what each tile goes where and nothing else? On the sega genesis plane mapping has a few flags like which palette row to use and if the tile is flipped either vertically or horizontally or both and a priority bit.


Top
 Profile  
 
 Post subject: Re: NES tile format
PostPosted: Wed Aug 15, 2012 7:02 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19239
Location: NE Indiana, USA (NTSC)
The "correct NES palette" is a very complex problem for people used to RGB. The video signal is generated directly in the composite domain, with hue in steps of 30 degrees in the YUV plane and four predefined brightnesses per hue. Different TVs decode them differently (which is also a problem with RGB VDPs, but composite encoding and decoding have historically been glossed over on most of those systems). This topic should get you started on what's involved.

The tile format itself is a lot simpler, but it's planar, not packed. If you've ever looked at Game Boy or SMS tiles, you should have no trouble figuring out planar. The palette consists of one background color, four sets of three colors for the background, and four sets of three colors for the sprites. Each background color set is assigned to a 16x16 pixel (2x2 tile) area, not an individual 8x8 pixel tile like on the Genesis, Super NES, GBC, and GBA, so tiles have to be reassigned to color sets on a 16x16 pixel basis, not 8x8, which is why so many NES games had background objects the size of the Image blocks in Super Mario Bros. series.


Top
 Profile  
 
 Post subject: Re: NES tile format
PostPosted: Wed Aug 15, 2012 7:21 am 
Offline

Joined: Tue Jul 10, 2012 1:37 pm
Posts: 54
Thank you It seems like it should not be too hard to add support for the NES. Hope to finish my program soon.
Edit: I was browsing the wiki and you call them name tables I called them plane mapping in my post sorry about that. Well either way thanks for the helpful link I am reading more about the PPU right now.


Top
 Profile  
 
 Post subject: Re: NES tile format
PostPosted: Wed Aug 15, 2012 9:43 am 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10117
Location: Rio de Janeiro - Brazil
The name tables (plane mapping) have 1 byte per tile, so they hold just tile indexes and nothing more. There's no priority control for background tiles and they can't be flipped, but a separate table (the attribute table) is used to specify what palettes are used for which tiles. Each byte in the attribute table selects 4 palettes for an area of 4x4 tiles, where each 2x2 tiles uses the same palette. There's one mapper though, the MMC5 (it's very complex and was used in very few games), which has a special mode that allows individual tiles to use any of the 4 palettes. Maybe you want to consider supporting that mapper in your application.


Top
 Profile  
 
 Post subject: Re: NES tile format
PostPosted: Wed Aug 15, 2012 12:47 pm 
Offline
User avatar

Joined: Mon Feb 07, 2011 12:46 pm
Posts: 932
There is also 8tools and Famitile. You can make your own if you don't like these other ones much (that is why I wrote Famitile so you can write another one if you dislike 8tools and Famitile), but these others are also free and open source software. I may include the feature of automatically reducing and finding optimal palette in my program too if I know best algorithm so thank you.

(About RGB palettes: Famitile has the default palette of VirtuaNES built-in, although perhaps it would be a good idea to allow RGB palettes to be loaded as well. I do not know if the 8tools nametable editor supports this, but the 8tools tile editor you can enter any RGB colors you want to. My suggestion for your program is perhaps include a default palette for NES and also allow loading custom RGB palettes.)

_________________
.


Top
 Profile  
 
 Post subject: Re: NES tile format
PostPosted: Wed Aug 15, 2012 1:46 pm 
Offline

Joined: Tue Jul 10, 2012 1:37 pm
Posts: 54
I am glad to hear that you are adding that feature to famitile I do not want to reinvert the wheel but you editor seems to be totally different then mine.
My program is GUI based and written using c++ and FLTK (good gui library) for the gui stuff
Image
You can either edit the tile directly by clicking on the palette bar and click on the tile (right) or select an rgb value and click on the left tile and then the right tile will update. I picked a color that would caused alot of dithering artifacts on purpose even with all the artifacts it looks good when zoomed out all the way. Also thank you for the advice on how to work with an NES palette I never thought about using a palette file I thought about calculating the rgb values real time but using a file does seem like the better option. How would that work? How would my program know how to convert NES palette values to rgb values to the correct palette entry from the file?


Last edited by nintendo8 on Wed Aug 15, 2012 3:55 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: NES tile format
PostPosted: Wed Aug 15, 2012 3:30 pm 
Offline
User avatar

Joined: Mon Feb 07, 2011 12:46 pm
Posts: 932
nintendo8 wrote:
I am glad to hear that you are adding that feature to famitile I do not want to reinvert the wheel but you editor seems to be totally different then mine. I did not understand what was going on.
My program is GUI based and written using c++ and FLTK (good gui library) for the gui stuff
And that is the same reason I suggest that we can both make up the program, and there can be other programs with similar features; to use whatever is preferred by a different user! (At least the file formats are common enough.) Yours is a proper GUI, mine is more like vi

Quote:
Also thank you for the advice on how to work with an NES palette I never thought about using a palette file I thought about calculating the rgb values real time but using a file does seem like the better option. How would that work? How would my program know how to convert NES palette values to rgb values to the correct palette entry from the file?
What I did is just import the palette (in the format described on the wiki under .pal) from VirtuaNES and converted it into a C header file, although it ought to allow external files to be loaded to (I will add it and you should probably add feature like that too).

So basically, you have the NES palette with sixteen entries (actual NES requires entry 0, 4, 8, and 12 to be the same as each other), and then select whether you are using 0/1/2/3, 4/5/6/7, 8/9/10/11, or 12/13/14/15 for editing so still only four colors per tile and thirteen colors per screen.

You should support at least standard NES nametables, although you can add support for MMC5 nametables as well if you want to (Famitile does support both standard and MMC5 nametables; 8tools appears to support only standard nametables but tepples can reply if I am wrong about this).

_________________
.


Top
 Profile  
 
 Post subject: Re: NES tile format
PostPosted: Fri Aug 17, 2012 2:52 pm 
Offline

Joined: Tue Jul 10, 2012 1:37 pm
Posts: 54
So it seems that the palette is more complicated then I thought I used the code from the link posted earlier viewtopic.php?f=3&t=8209
and here is what I got
Image
I am aware that the NES only does 4 colors per row I just wanted to see what all the colors look like at the same time I will fix it soon.
This All the colors of the NES without setting the emphasis bits my program does support emphasis bits I hope people will understand that when they save the palette and use it in a NES program that the emphasis bits won't be set and it has nothing do with the palette file. They need to set them manually as emphasis bits is global.


Top
 Profile  
 
 Post subject: Re: NES tile format
PostPosted: Fri Aug 17, 2012 3:05 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19239
Location: NE Indiana, USA (NTSC)
It appears you have the hues out of order.


Top
 Profile  
 
 Post subject: Re: NES tile format
PostPosted: Sun Aug 19, 2012 7:22 am 
Offline

Joined: Tue Jul 10, 2012 1:37 pm
Posts: 54
Ok I fixed that hues glitch now on to add tiles support.


Top
 Profile  
 
 Post subject: Re: NES tile format
PostPosted: Sun Aug 19, 2012 9:52 pm 
Offline
User avatar

Joined: Fri Dec 30, 2011 8:37 am
Posts: 6
Location: Moscow, Russia
nintendo8 wrote:
I am aware that the NES only does 4 colors per row I just wanted to see what all the colors look like at the same time I will fix it soon.
This All the colors of the NES without setting the emphasis bits my program does support emphasis bits I hope people will understand that when they save the palette and use it in a NES program that the emphasis bits won't be set and it has nothing do with the palette file. They need to set them manually as emphasis bits is global.


Why is the "emphasis bits" a slider? Shouldn't it be arranged as four checkboxes instead? (sort of [ ] B/W [ ] Red [ ] Green [ ] Blue)


Top
 Profile  
 
 Post subject: Re: NES tile format
PostPosted: Tue Aug 21, 2012 4:22 am 
Offline
User avatar

Joined: Sat Mar 26, 2011 1:06 pm
Posts: 79
Location: Germany
usr_share wrote:
Why is the "emphasis bits" a slider? Shouldn't it be arranged as four checkboxes instead? (sort of [ ] B/W [ ] Red [ ] Green [ ] Blue)

Edit: This next part is total bogus
From what I know the emphasis bits cannot be combined on the NES, so checkboxes could confuse people into thinking that this can be done. On a slider you can only have one option selected at a time. However I would recommend making a drop down menu for the color emphasis and a checkbox for the monochrome option like this:
Code:
Color emphasis:
> Red
> Green
> Blue

Monochrome Mode []


Of course when Monochrome Mode is selected the drop down menu for the color emphasis needs to be inactive.
Edit2: At least that would make sense, if the NES PPU didn't behave differently. Thanks to thefox and usr_share for the reminder!


Last edited by Grumskiz on Wed Aug 22, 2012 7:10 am, edited 2 times in total.

Top
 Profile  
 
 Post subject: Re: NES tile format
PostPosted: Tue Aug 21, 2012 4:48 am 
Offline
User avatar

Joined: Mon Jan 03, 2005 10:36 am
Posts: 2981
Location: Tampere, Finland
Grumskiz wrote:
From what I know the emphasis bits cannot be combined on the NES, so checkboxes could confuse people into thinking that this can be done.

Not true, they can be combined just fine. (FYI: FCEUX doesn't emulate this part right, it only allows one of the emphasis bits to affect the output.)

_________________
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: kkfos.aspekt.fi


Top
 Profile  
 
 Post subject: Re: NES tile format
PostPosted: Tue Aug 21, 2012 8:16 am 
Offline
User avatar

Joined: Fri Dec 30, 2011 8:37 am
Posts: 6
Location: Moscow, Russia
Grumskiz wrote:
From what I know the emphasis bits cannot be combined on the NES, so checkboxes could confuse people into thinking that this can be done.


They can. In fact, some developers have their games set all the emphasis bits -- this makes the colors quite a bit darker.

Quote:
Of course when Monochrome Mode is selected the drop down menu for the color emphasis needs to be inactive.


They don't. Quoting the wiki's "PPU registers" page,
Quote:
In either case, the tint bits are applied after grayscale, which means they still tint the gray image.


-- that is, the tint bits can be enabled (and will make sense) even in grayscale mode.


Top
 Profile  
 
 Post subject: Re: NES tile format
PostPosted: Tue Aug 21, 2012 8:20 am 
Offline

Joined: Thu Mar 02, 2006 12:30 pm
Posts: 169
Also remember that the emphasis bits on RGB PPUs shoot that color component up to 100%.

_________________
Read my blog! The Incoherent Ramblings of a Lowly Geek


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 1 guest


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