Problems with masks

When I tried to use masks to avoid that same problem, it created others like when I went to position the pieces off the puzzle so people could drag them on.

What I did to make it easy for me was to put a print in my drag handler that printed out the X and Y of the piece when I stopped moving it. I would them drag it to where it belonged on the screen and wrote down the X, Y from the print and used that to determine my landing spot. I could map out my puzzle pieces in a matter of minutes with this technique.
[import]uid: 199310 topic_id: 33484 reply_id: 133842[/import]

Hi scottadelman.

I am also developing a puzzle game and today during tests in a device (Galaxy S) I faced that same problem: after having a lot of pieces (all made with masks) in the screen the game starts to have lag (that lag was not noticed in the Corona Simulator). You can see my puzzle screen here: http://www.adventuresofanentrepreneur.net/uploads/1/3/0/1/13010621/7525428_orig.jpg?1

After running some tests, I discovered that it is a problem with fps and not memory. That problem gets worse with high resolution images. My default puzzle images are 480x270 and I not noticed much lag. But if I use images with more resolution like 2560x1920, the lag appears after having a number of pieces in the screen.

Just to give you some numbers, with my default images (480x270), my puzzle game starts with ~30 fps and when all pieces are in the screen, the fps goes down to 15-20fps. If I use high resolution images, the fps goes from ~30fps to ~5fps.

So, one “solution” is to decrease the image resolution (by the way, anyone knows a lua code to reduce a the resolution of image? I really do not want to use the screenshot solution…).

Just to register, during my tests, I also noticed how the use of masks increases the memory usage (that in my case did not create the problem, but I got scared with the numbers). In my case, if I use a mask file of 2kg, the used memory goes up by 700kb! Since my puzzle has 35 pieces (35 masks), just make the math… At least the Corona does not load my puzzle image 35 times (it only loads it once).

I hope that my case helps you in some way and I would love to hear from corona staff about the mask memory consumption and the impact in the fps (since scottadelman said that without the masks the games runs normal)

rsc [import]uid: 181011 topic_id: 33484 reply_id: 138229[/import]

Hi scottadelman.

I am also developing a puzzle game and today during tests in a device (Galaxy S) I faced that same problem: after having a lot of pieces (all made with masks) in the screen the game starts to have lag (that lag was not noticed in the Corona Simulator). You can see my puzzle screen here: http://www.adventuresofanentrepreneur.net/uploads/1/3/0/1/13010621/7525428_orig.jpg?1

After running some tests, I discovered that it is a problem with fps and not memory. That problem gets worse with high resolution images. My default puzzle images are 480x270 and I not noticed much lag. But if I use images with more resolution like 2560x1920, the lag appears after having a number of pieces in the screen.

Just to give you some numbers, with my default images (480x270), my puzzle game starts with ~30 fps and when all pieces are in the screen, the fps goes down to 15-20fps. If I use high resolution images, the fps goes from ~30fps to ~5fps.

So, one “solution” is to decrease the image resolution (by the way, anyone knows a lua code to reduce a the resolution of image? I really do not want to use the screenshot solution…).

Just to register, during my tests, I also noticed how the use of masks increases the memory usage (that in my case did not create the problem, but I got scared with the numbers). In my case, if I use a mask file of 2kg, the used memory goes up by 700kb! Since my puzzle has 35 pieces (35 masks), just make the math… At least the Corona does not load my puzzle image 35 times (it only loads it once).

I hope that my case helps you in some way and I would love to hear from corona staff about the mask memory consumption and the impact in the fps (since scottadelman said that without the masks the games runs normal)

rsc [import]uid: 181011 topic_id: 33484 reply_id: 138229[/import]