Is there a tool to tell how many tiles I'm using?
Moderator: Stef
-
- Very interested
- Posts: 151
- Joined: Sun Apr 14, 2013 1:19 am
- Location: Auckland, New Zealand
- Contact:
Is there a tool to tell how many tiles I'm using?
I seem to remember seeing screenshots in one of the threads of an app that gives detailed VDP data but I can't find it. Anyone know where I could get it? Want to keep an eye on my tile count.
-
- Very interested
- Posts: 209
- Joined: Sat Sep 08, 2012 10:41 am
- Contact:
Re: Is there a tool to tell how many tiles I'm using?
It depends what qualifies as "using" - all tiles are "in use" at all times I guess. Do you want to keep a counter of how many tiles you've uploaded to VRAM, or determine if a specific art asset is going to fit at compile time?
I'm from an assembler background so mileage may vary, but my game has a static VRAM layout map and a quick n' dirty calculation to show me the size of each of my banks at assembly time:
In C you have the luxury of a better static array syntax and sizeof(), so it should be considerably easier.
As for runtime usage, I guess you could just keep a counter of how many tiles you've copied to VRAM?
I'm from an assembler background so mileage may vary, but my game has a static VRAM layout map and a quick n' dirty calculation to show me the size of each of my banks at assembly time:
Code: Select all
;---------------------------------------------------------
; Bank 0
;---------------------------------------------------------
Tile_Bank0_Size_t: equ vdp_max_tiles
Tile_Bank0_Size_b: equ (Tile_Bank0_Size_t*size_tile_b)
Tile_Bank0_Start: equ (vram_addr_tiles)
;---------------------------------------------------------
rsset Tile_Bank0_Start
Tiles_PixelFontVRAM: rs.b (Tiles_PixelFontSizeB)
Tiles_Player1VRAM: rs.b (tiles_nymn_size_b)
Tiles_MonsterVRAM: rs.b (tiles_monster_size_b)
LevelMapVRAM: rs.b (tiles_lvl1_size_b)
;---------------------------------------------------------
Tiles_Bank0_End: rs.b 0
Tiles_Bank0_Count equ (Tiles_Bank0_End/size_tile_b)
;---------------------------------------------------------
;---------------------------------------------------------
; Bank 1
;---------------------------------------------------------
Tile_Bank1_Size_b: equ 0x1000
Tile_Bank1_Size_t: equ (0x1000/size_tile_b)
Tile_Bank1_Start: equ (vram_addr_plane_a+Tile_Bank1_Size_b) ; Spare space at VDP 0xD000-0xE000
;---------------------------------------------------------
rsset Tile_Bank1_Start
Tiles_Fuzzl1VRAM: rs.b (tiles_fuzzl_size_b)
Tiles_Fuzzl2VRAM: rs.b (tiles_fuzzl_size_b)
Tiles_Leaf1VRAM: rs.b (tiles_leaf_size_b)
Tiles_Leaf2VRAM: rs.b (tiles_leaf_size_b)
Tiles_Leaf3VRAM: rs.b (tiles_leaf_size_b)
Tiles_VinesVRAM: rs.b (tiles_vines_size_b)
Tiles_BoulderVRAM: rs.b (tiles_boulder_size_b*Boulder_MaxEntities)
Tiles_FireflyVRAM: rs.b (tiles_firefly_size_b*Firefly_MaxEntities)
;---------------------------------------------------------
Tiles_Bank1_End: rs.b 0
Tiles_Bank1_Count equ ((Tiles_Bank1_End-Tile_Bank1_Start)/size_tile_b)
;---------------------------------------------------------
inform 0,"-----------------------------------"
inform 0,"VDP tile count (bank 0): %d / %d", Tiles_Bank0_Count,Tile_Bank0_Size_t
inform 0,"VDP tile count (bank 1): %d / %d", Tiles_Bank1_Count,Tile_Bank1_Size_t
inform 0,"-----------------------------------"
if (Tiles_Bank0_Count>Tile_Bank0_Size_t)
inform 2,'VDP tile bank 0 count overflow (count: %d, max: %d)',Tiles_Bank0_Count,Tile_Bank0_Size_t
endif
if (Tiles_Bank1_Count>Tile_Bank1_Size_t)
inform 2,'VDP tile bank 1 count overflow (count: %d, max: %d)',Tiles_Bank1_Count,Tile_Bank1_Size_t
endif
As for runtime usage, I guess you could just keep a counter of how many tiles you've copied to VRAM?
A blog of my Megadrive programming adventures: http://www.bigevilcorporation.co.uk
-
- Very interested
- Posts: 151
- Joined: Sun Apr 14, 2013 1:19 am
- Location: Auckland, New Zealand
- Contact:
Re: Is there a tool to tell how many tiles I'm using?
LOL I didn't even think of that. Easy peasy. I was more thinking of an app I can load my images into to check each image's tile size but really as long as it all fits I'm fine. Haha.BigEvilCorporation wrote:It depends what qualifies as "using" - all tiles are "in use" at all times I guess. Do you want to keep a counter of how many tiles you've uploaded to VRAM, or determine if a specific art asset is going to fit at compile time?
I'm from an assembler background so mileage may vary, but my game has a static VRAM layout map and a quick n' dirty calculation to show me the size of each of my banks at assembly time:
In C you have the luxury of a better static array syntax and sizeof(), so it should be considerably easier.Code: Select all
;--------------------------------------------------------- ; Bank 0 ;--------------------------------------------------------- Tile_Bank0_Size_t: equ vdp_max_tiles Tile_Bank0_Size_b: equ (Tile_Bank0_Size_t*size_tile_b) Tile_Bank0_Start: equ (vram_addr_tiles) ;--------------------------------------------------------- rsset Tile_Bank0_Start Tiles_PixelFontVRAM: rs.b (Tiles_PixelFontSizeB) Tiles_Player1VRAM: rs.b (tiles_nymn_size_b) Tiles_MonsterVRAM: rs.b (tiles_monster_size_b) LevelMapVRAM: rs.b (tiles_lvl1_size_b) ;--------------------------------------------------------- Tiles_Bank0_End: rs.b 0 Tiles_Bank0_Count equ (Tiles_Bank0_End/size_tile_b) ;--------------------------------------------------------- ;--------------------------------------------------------- ; Bank 1 ;--------------------------------------------------------- Tile_Bank1_Size_b: equ 0x1000 Tile_Bank1_Size_t: equ (0x1000/size_tile_b) Tile_Bank1_Start: equ (vram_addr_plane_a+Tile_Bank1_Size_b) ; Spare space at VDP 0xD000-0xE000 ;--------------------------------------------------------- rsset Tile_Bank1_Start Tiles_Fuzzl1VRAM: rs.b (tiles_fuzzl_size_b) Tiles_Fuzzl2VRAM: rs.b (tiles_fuzzl_size_b) Tiles_Leaf1VRAM: rs.b (tiles_leaf_size_b) Tiles_Leaf2VRAM: rs.b (tiles_leaf_size_b) Tiles_Leaf3VRAM: rs.b (tiles_leaf_size_b) Tiles_VinesVRAM: rs.b (tiles_vines_size_b) Tiles_BoulderVRAM: rs.b (tiles_boulder_size_b*Boulder_MaxEntities) Tiles_FireflyVRAM: rs.b (tiles_firefly_size_b*Firefly_MaxEntities) ;--------------------------------------------------------- Tiles_Bank1_End: rs.b 0 Tiles_Bank1_Count equ ((Tiles_Bank1_End-Tile_Bank1_Start)/size_tile_b) ;--------------------------------------------------------- inform 0,"-----------------------------------" inform 0,"VDP tile count (bank 0): %d / %d", Tiles_Bank0_Count,Tile_Bank0_Size_t inform 0,"VDP tile count (bank 1): %d / %d", Tiles_Bank1_Count,Tile_Bank1_Size_t inform 0,"-----------------------------------" if (Tiles_Bank0_Count>Tile_Bank0_Size_t) inform 2,'VDP tile bank 0 count overflow (count: %d, max: %d)',Tiles_Bank0_Count,Tile_Bank0_Size_t endif if (Tiles_Bank1_Count>Tile_Bank1_Size_t) inform 2,'VDP tile bank 1 count overflow (count: %d, max: %d)',Tiles_Bank1_Count,Tile_Bank1_Size_t endif
As for runtime usage, I guess you could just keep a counter of how many tiles you've copied to VRAM?
-
- Very interested
- Posts: 209
- Joined: Sat Sep 08, 2012 10:41 am
- Contact:
Re: Is there a tool to tell how many tiles I'm using?
Retro Graphics Toolkit can tell you the number of unique tiles in a given image, remove duplicates and even dither to reduce: viewtopic.php?f=7&t=1392
It won't work for sprites though since sprite tiles not mapped by ID (unless you keep one sprite per tile).
There's also my own map editing tool which can import images, remove duplicates and show you the resulting size. It's nowhere near RGT with regards to features but hopefully a little more user friendly: viewtopic.php?f=7&t=2259
It won't work for sprites though since sprite tiles not mapped by ID (unless you keep one sprite per tile).
There's also my own map editing tool which can import images, remove duplicates and show you the resulting size. It's nowhere near RGT with regards to features but hopefully a little more user friendly: viewtopic.php?f=7&t=2259
A blog of my Megadrive programming adventures: http://www.bigevilcorporation.co.uk
-
- Very interested
- Posts: 151
- Joined: Sun Apr 14, 2013 1:19 am
- Location: Auckland, New Zealand
- Contact:
Re: Is there a tool to tell how many tiles I'm using?
Awesome, thanks!BigEvilCorporation wrote:Retro Graphics Toolkit can tell you the number of unique tiles in a given image, remove duplicates and even dither to reduce: viewtopic.php?f=7&t=1392
It won't work for sprites though since sprite tiles not mapped by ID (unless you keep one sprite per tile).
There's also my own map editing tool which can import images, remove duplicates and show you the resulting size. It's nowhere near RGT with regards to features but hopefully a little more user friendly: viewtopic.php?f=7&t=2259