Deleted
Deleted Member
Posts: 0
|
4x4
Sept 14, 2009 9:03:29 GMT -5
Post by Deleted on Sept 14, 2009 9:03:29 GMT -5
Anybody that has tips / experience regarding how to approach 4x4 pixel based tiles? For example, is there any way to combine the data of 4 ( 4x4 ) tiles to use with a single ( 8x8 ) tile draw?
Thanks ~
|
|
|
4x4
Sept 15, 2009 8:25:04 GMT -5
Post by Mairtrus on Sept 15, 2009 8:25:04 GMT -5
I did something like that like a year ago, but I think I did it different from what you are asking for. You need to combine 4 8x8 tiles with the 4x4 upper left side painted? Or they are, specifically, 4x4 tiles?
|
|
|
4x4
Sept 15, 2009 12:16:59 GMT -5
Post by jlf65 on Sept 15, 2009 12:16:59 GMT -5
Tiles on the Genesis are 8x8 (or 8x16 for interlace). Making a 4x4 tile means your "pseudo" tile fits 2x2 in a hardware tile. That means to use real hardware tiles, you need pow(N,4) hardware tiles, where N is the number of pseudo-tiles you have. The number goes up VERY quickly, so it's not practical. Instead, you need to setup a fake framebuffer mode and draw the 4x4 tiles into the framebuffer... which defeats the whole purpose of trying to do tiles. You need to keep your pseudo-tile dimensions as a multiple of the hardware tiles - 8x8, 16x16, 32x8, etc. Sub-multiples can only realistically be done by using a framebuffer.
|
|
Deleted
Deleted Member
Posts: 0
|
4x4
Sept 15, 2009 13:22:14 GMT -5
Post by Deleted on Sept 15, 2009 13:22:14 GMT -5
Thanks for the replies guys. As you mention jlf65, the number of possible combinations of 4x4 tiles parsed into 8x8 hardware tiles grows exponentially .. Perhaps it would be a better idea to write a small windows application that can generate a 8x8 based tilesheets from only desirable 4x4 tile combinations instead of letting the Megadrive itself do the work ( and try to use 8x8 / 16x16 etc. tiles as much as possible obviously ). Just to illustrate the problem, a mere number of six 4x4 tiles can already generate a staggering number of combinations. Four combinations out of the 1000+ possible ... Thanks again ~
|
|
|
4x4
Sept 15, 2009 13:36:05 GMT -5
Post by jlf65 on Sept 15, 2009 13:36:05 GMT -5
That would probably be better. You don't need ALL permutations of 2x2 pseudo-tiles, just the ones you use. The Tile Editor should be able to handle that. So do 4x4 at the art level, then 8x8 in the program.
|
|
|
4x4
Sept 15, 2009 20:42:51 GMT -5
Post by walker7 on Sept 15, 2009 20:42:51 GMT -5
The best thing you can do with 4x4 tiles is to define them in the ROM (or RAM) and then, use a subroutine that points to a place that uses 16-bit indices to tell which four 4x4 tiles to use, and combine them into a single 8x8 tile. For 16x16 tiles, just make it so it loops four times.
If moon's tiles are labeled like this (with 6 being a blank tile): 0 1 2 3 4 5
Then the entire 4x4 tile map would be: 0 2 1 6 5 0 4 6 5 3 2 1 3 2 2 4
I'll come up with a subroutine later.
|
|
Deleted
Deleted Member
Posts: 0
|
4x4
Sept 17, 2009 7:30:20 GMT -5
Post by Deleted on Sept 17, 2009 7:30:20 GMT -5
Looking forward to your subroutine walker7 Will be interesting to see how fast / slow it is. This game seems to make use of something similar .. and they've got quite a loading / pause moment when the tiles are drawn
|
|
|
4x4
Sept 17, 2009 9:23:21 GMT -5
Post by Mairtrus on Sept 17, 2009 9:23:21 GMT -5
Here is a not-so-elegant-but-fully-functional method: For N=0 to 3 For T=0 to 6 step 2 TileDest((N [and] 1)+((N [and] 2)<<2)+T)=TilesOrig(Orig(N)<<2+(T>>2)) next T next N TilesOrig is a (not necesarily dimensioned) array wich contains the 4x4 tiles stored in 4 integers. Example: dataint $1111 ' Tile 1 dataint $1111 dataint $1111 dataint $1111 TileDest is a 32 bytes (16 Integers) array where the final Tile is stored when it's processed. Orig is an array that contains the numbers of tiles within TilesOrig wich will be used to create the 8x8 tile. Once your tile is created, you can load it on the VRAM doing this: fake FakedTile,TileDest loadtiles FakedTile,1,<Tile Destination in Video Memory> So, for create 1 tile, your code should be like this(with a total absence of comments ): Dim TilesOrig() as Integer at Data_Tiles Dim Orig(3) as Integer Dim TileDest(15) as Integer
For N=0 to 3 For T=0 to 6 step 2 TileDest((N [and] 1)+((N [and] 2)<<2)+T)=TilesOrig(Orig(N)<<2+(T>>2)) next T next N
pallettes Pal_Tiles,0,0,16 fake FakedTile,TileDest loadtiles FakedTile,1,300 end
Pal_Tiles: DATAINT $0000,$00EE,$0E0E,$000E,$0EE0,$00E0,$0E00,$0888 ' Pallette: 0 DATAINT $0CCC,$0088,$0808,$0008,$0880,$0080,$0800,$0EEE
Data_Tiles: dataint $1111 ' Tile 1 dataint $1111 dataint $1111 dataint $1111 dataint $2222 ' Tile 2 dataint $2222 dataint $2222 dataint $2222 dataint $3333 ' Tile 3 dataint $3333 dataint $3333 dataint $3333 dataint $4444 ' Tile 4 dataint $4444 dataint $4444 dataint $4444 SideNote: For this example, the Orig array had the values 0,1,2 and 3.
|
|