Tiles allocation - For tilemap and sprites

SGDK only sub forum

Moderator: Stef

Post Reply
masteries
Newbie
Posts: 4
Joined: Thu Jul 30, 2020 3:33 pm

Tiles allocation - For tilemap and sprites

Post by masteries » Mon Sep 07, 2020 10:11 am

Greetings,

I am dealing with huge detailed dinamically loaded maps (each time you advanced 8 pixels, its a horizontal scrolled game, the backward tilemap column is updated with new tiles and displayed as the new forward column).

But I detected I don´t have enough tilemap memory for 320x208 screen (the last 8 pixels is an out screen column that is the one to be updated on the fly), if I load more tiles, these are loaded into sprite tile memory by a tiny amount. Sometimes there are few or no duplicated tiles. The displayed map is based on load the tiles for the 40 on screen tile columns and update these tiles as needed, using a 320x208 VRAM memory space, or 320x216 to enable movement to the left and right.

Also, the 96 tiles used for font letters are not needed in my game; I can free up these to bring additional 96 tiles as sprite tile data.

How can I reallocate the VRAM memory reserved for map tiles and sprite data?

Thanks in advance,

Stef
Very interested
Posts: 3056
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: Tiles allocation - For tilemap and sprites

Post by Stef » Tue Sep 08, 2020 8:59 am

Sprites tiles are allocated by the sprite engine so using SPR_initEx(..) allow you to define the VRAM allocated for sprite tile data.
Unfortunately you cannot easily free font tiles, so what you can do is to erase it with fixed tiles used for HUD or any others static stuff for instance.

masteries
Newbie
Posts: 4
Joined: Thu Jul 30, 2020 3:33 pm

Re: Tiles allocation - For tilemap and sprites

Post by masteries » Wed Sep 09, 2020 3:09 pm

Stef wrote:
Tue Sep 08, 2020 8:59 am
Sprites tiles are allocated by the sprite engine so using SPR_initEx(..) allow you to define the VRAM allocated for sprite tile data.
Unfortunately you cannot easily free font tiles, so what you can do is to erase it with fixed tiles used for HUD or any others static stuff for instance.
Thanks Stef,

But I tested drawing 16x24 sprites, with a SPR_initEx(392) , but I can only draw 43 sprites at once... it appears that the font sprite space can be overwritten...

Displaying the VDP memory using Gens emulator, I detected that there is a huge non used VRAM memory space,
from tile 0x0664 to 0x071F

How can I reallocate start address space for sprites, font, PlanA, PlanB via VDP_setBPlanAddress() and these sort of functions? In order to increase the available memory for sprites,

Post Reply