Page 1 of 1

Issue with sprite batches - mysterious flashing tiles

Posted: Sat Jun 12, 2021 4:53 pm
by sisyphu2
Hi all

Looking for some help with mysterious flashing tiles in my game.

It's a strategy game with a grid based map. The map has several layers (terrain, resource, territorial borders, fog of war, etc). For efficiency the map is rendered as 5 distinct sprite batches (each sprite batch contains one of the layers so it can be refreshed without having to totally refresh all the other layers).

The problem: every now and again one or two of the tiles (sometimes many at the same time) are flashing or flickering slightly for a moment which is very weird and unsightly. For example a clear grass tile suddenly flickers black and then back to grass. Or a whole line of tiles suddenly flickers. Then it all returns to normal. I even have some play throughs with no weird behaviour at all.

I want to know what could be the cause. Is there something wrong with rendering multiple sprite batches on top of each other in löve? Has anyone ever encountered such behaviour themselves with sprite batches?

Of course there could be something else going on (i.e. not sprite batch related) but prior to using spritebatches I used canvases to do the multilayered rendering which ended up being far too inefficient for the amount of drawing that needed to be done and the issue only started once I had changed it over to spritebatches.

I welcome any thoughts on this and can dig out relevant code if needed.

Thanks all!

Re: Issue with sprite batches - mysterious flashing tiles

Posted: Sat Jun 12, 2021 5:42 pm
by GVovkiv
Source code?