Things suddenly make a lot of sense! I know your SGDK removes duplicate tiles reducing the overall amount of VRAM required.Stef wrote:Exactly ! you were just running out of VRAM.
A nasty fix is just to roll over VRAM, when you rise the memory limit just restart to TILE_USERINDEX (more or less what you did).
The ind variable indicates the tile index (total number of tiles currently in use?). If I wanted things to work properly I'd allocated 540 tiles per frame but I'd be wasting VRAM, which your SGDK is written not to do
Ok so if I have an image that has 540 tiles all the same, I guess your engine reduces this to use 1 tile? If I have a second image that takes 540 tiles, I have 541 tiles in memory.
When I come to load the next image, I have 540 again, I want to place this at the front of the VRAM tile index but I can't because I only allocated 1 tile of VRAM to the first frame and would be overwriting half the second frame if I loaded it there. How do I overcome this? do i simply default the ind to 540 everytime? A big waste of VRAM but I guess it might work? Or do I need to write an algorithm to rearrange the positioning in VRAM? Is that even possible?
I guess your tile-engine may resolve this issue and must track the positions of each image and its tiles in VRAM and rearrange and reallocate them automatically as images are pushed on and off the memory stack?