Bay 12 Games Forum

Dwarf Fortress => DF Suggestions => Topic started by: Savok on August 16, 2007, 09:28:00 pm

Title: Graphics (sorry, my skill does not lie in the making of
Post by: Savok on August 16, 2007, 09:28:00 pm
While this topic probably has been talked about before at length, I've just joined and I'm bad at search.

Why must object tilesets have sizes in multiples of four? I have a 9x9 tileset that I'd like to have a certain font style for that would work very poorly with creatures.

Title: Re: Graphics (sorry, my skill does not lie in the making of
Post by: Core Xii on August 16, 2007, 09:59:00 pm
Who said they have to be in multiples of four?
Title: Re: Graphics (sorry, my skill does not lie in the making of
Post by: Eagle of Fire on August 16, 2007, 10:04:00 pm
That's what is said on the wiki anyways...

quote:
Note: Due to the way the game loads graphic files, all .bmp file dimensions should be in multiples of 4. Graphical errors may result if this is not the case.
Title: Re: Graphics (sorry, my skill does not lie in the making of
Post by: Fieari on August 16, 2007, 10:17:00 pm
I don't know exactly why, though I suspect it has to do with the scaling code.  At any rate, you can still make 9x9 tiles by increasing the size of each tile till you get a multiple of four... in this case, 36x36 for each tile.  The game will shrink it for you, and it'll look 9x9 to you, so long as you set the correct window size in the init file.
Title: Re: Graphics (sorry, my skill does not lie in the making of
Post by: Zaratustra on August 16, 2007, 10:24:00 pm
OpenGL limitations, I believe.
Title: Re: Graphics (sorry, my skill does not lie in the making of
Post by: 0x517A5D on August 16, 2007, 10:34:00 pm
quote:
Originally posted by Savok:
<STRONG>Why must object tilesets have sizes in multiples of four?</STRONG>

It's because the game wants them stored in bitmap files.  Microsoft bitmap format (*.bmp, magic number 4D42) is not well-documented.  One of the quirks is that the horizontal width of an image needs to be a multiple of four, or some of the programs that use them break in strange ways.

Since the format used for tilesets has 16 characters horizontally, the tileset image width will always be a multiple of four.

The limitation is not on the individual tiles in the set, as far as I can determine, so I do not think you have to scale up to 36x36 tiles.

Really, I think you don't need to worry about it at all.

0x517A5D

Title: Re: Graphics (sorry, my skill does not lie in the making of
Post by: utunnels on August 16, 2007, 10:35:00 pm
Maybe a texture must be in a size of 'power of 2' in some video cards.

[ August 16, 2007: Message edited by: utunnels ]

Title: Re: Graphics (sorry, my skill does not lie in the making of
Post by: 0x517A5D on August 17, 2007, 01:29:00 pm
quote:
Originally posted by utunnels:
<STRONG>Maybe a texture must be in a size of 'power of 2' in some video cards.</STRONG>

Yes, I remember something about that for cards that are now several generations old.  But as far as I can tell, textures are not in use at all.  Nor are shaders.  Nor polygons, even.

All that's going on is that a character-size block is "blit"-transfered from the tileset, colored, and "blit" transfered again to the proper location in the window.  Pixel shaders might be used to do this, but I believe it more likely that it's done manually by the program.

If this is correct, texture limitations shouldn't matter.

0x517A5D

Title: Re: Graphics (sorry, my skill does not lie in the making of
Post by: Savok on August 17, 2007, 03:42:00 pm
Ok, thanks for the help.

Attempting to make a 9x9 object tileset...

Title: Re: Graphics (sorry, my skill does not lie in the making of
Post by: Shades on August 17, 2007, 04:57:00 pm
It depends if Toady has dealt with the issue in the code or not, basically opengl textures must be sized in a power of two (2,4,8,16,32 etc) however I don't know how he loads the textures so it may just be that the whole image file has to be that way and not the individual tiles, or it may be that it's being resized correctly internally and doesn't matter.

:)

Title: Re: Graphics (sorry, my skill does not lie in the making of
Post by: Savok on August 17, 2007, 08:11:00 pm
I tried making 36x36 tiles, and they resized to 9x9.

Problem solved.