Hello coronalabs members,
I am trying to improve my game and see that the major lag spikes come from the parallax background that i have made.
I am using graphics 2.0 and load many background images (4 depth layers with each 4 images). I am using 768x512 images and rescale them to 960x640 with imageRect function. My texture memory is around 16 for the background images.
I have few questions through:
To avoid any stuttering i need to lazy load the images on createScene, but i do not know how to do it the best way. I see 2 possible options, preload as imagesheet so with graphics.newImageSheet and when a image is needed create it with display.newImageRect from the imageSheet and remove when the image is scrollign out of the screen. THe other way is to just use display.newImageRect on all images and make the offscreen invisible, when they are needed to make it visible and make the images that go offscreen invisible.
I used the last way before but somehow i get stuttering on some older devices (Xperia U) and also small stutters on new devices (nexus 4). I think the problem is duo the big redraw time??
I have done some research and found a topic on these forums that some changes were made with graphics 2.0 and that one of the solutions could be to use display.setDefault( “preloadTextures”, true) but this didn’t change anything for me.
So i wonder how to create a parallax scrolling background that have alot of layers and high resolution images but still to run smooth?
PS: it does not matter when i use 60 fps or 30 fps, stuttering is still occuring both ways.
I like how game apps as jetpack joyrider are running very smooth on old devices and hopefully this performance could be reached with coronalabs as well
Many thanks
Rusfighter