Issues with sprite engine and cleaning up
Posted: Fri Oct 19, 2018 5:33 pm
Hi,
In my game I've split up the code into states and try to have each state clean up after its self when it ends.
But I've noticed that if I got between two states quite often that I will eventually blow up the Vram, and this seems to be due to sprites.
So I create my sprites using the spr_addsprite inside a sys_disableinterupts and I then clean up inside another set.
I know that I've not missed any as the check the number of active sprites and they have all been cleared.
I've tried cleaning in the order they were created and the reverse order but after a while I will start getting courrpt graphics and compiling in debug I can see it saying there isn't enough vram.
Message : VDP_allocateSprites(12) success: 45 - remaining = 34
Message : VRAM_alloc(115) failed: no enough free VRAM slot (free = 152)
I've also tried to use the SPR_reset, which in some cases seems to slow the issue down but not always.
I'm sure its something stupid that I'm doing, I just have no idea what.
In my game I've split up the code into states and try to have each state clean up after its self when it ends.
But I've noticed that if I got between two states quite often that I will eventually blow up the Vram, and this seems to be due to sprites.
So I create my sprites using the spr_addsprite inside a sys_disableinterupts and I then clean up inside another set.
I know that I've not missed any as the check the number of active sprites and they have all been cleared.
I've tried cleaning in the order they were created and the reverse order but after a while I will start getting courrpt graphics and compiling in debug I can see it saying there isn't enough vram.
Message : VDP_allocateSprites(12) success: 45 - remaining = 34
Message : VRAM_alloc(115) failed: no enough free VRAM slot (free = 152)
I've also tried to use the SPR_reset, which in some cases seems to slow the issue down but not always.
I'm sure its something stupid that I'm doing, I just have no idea what.