Issue with sprite batches - mysterious flashing tiles

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
sisyphu2
Prole
Posts: 17
Joined: Mon Sep 28, 2020 3:15 pm

Issue with sprite batches - mysterious flashing tiles

Post 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!
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Google Adsense [Bot] and 17 guests