Good evening all. For the last couple of months, I’ve been working on my first real game project using corona. At first, I was throwing spites left and right and the performance was horrible. I studied the docs and took as much advice as possible on sprite sizes, sprite sheets, etc. Now, the performance is much better, but I have another problem.
In my game, it has a world map similar to Candy Crush, with each level marked by a sprite. The problem is, I have 200 + levels, each with a marker. When I draw them on the map, much memory is used up. I have made the markers as small as possible. When the user selects a level to play, I transition to a new scene, called the level_scene. In the enterScene function, I have the following code:
storyboard.removeAll()
This is supposed to eliminate all the textures in the other views if I am not mistaken. However, the performance of the game in the level_scene is terrible, and I have reason to believe it is because memory is still overloaded from the map scene. In fact, when I limit the number of the markers on the map to 3, the level_scene runs smoothly.
I’ve been running this method every second to check memory consumption:
local function checkMemory()
collectgarbage( “collect” )
local memUsage_str = string.format( “MEMORY = %.3f KB”, collectgarbage( “count” ) )
print( memUsage_str, "TEXTURE = "…(system.getInfo(“textureMemoryUsed”) / (1024 * 1024) ) )
end
Why does the memory consumed by a previous scene affect the current one? Has anyone had a similar issue?