Dragging Display Group Performance

Hey Everyone,

I have a question I have created a 50x50 map using images that I have put into a display group. When I drag and move the group is seems to be much slower than it should? I am aware the this is 2500 images but I assumed putting all of the image into a display container and moving that container would have no performance issues at all not matter the size of my map.

Do you have any suggestions to improve this? Here is the code I am using to move the group.

function group:touch( event )

    if event.phase == “began” then

        self.markX = self.x    – store x location of object

        self.markY = self.y    – store y location of object

    elseif event.phase == “moved” then

        local x = (event.x - event.xStart) + self.markX

        local y = (event.y - event.yStart) + self.markY

        

        self.x, self.y = x, y    – move object based on calculations above

    end

    

    return true

end

group:addEventListener( “touch”, group )

Have you checked to see if you get frame drops when moving?

when running the app on my LG G3 I get 60fps when only a few images are on screen, when I drag the screen around and more images are shown it goes down to 9fps and when I leave the map in full view I only get 30fps. 

I find it really odd that when nothing is happening I am loosing half of my fps? Also my texture memory is only 2.6MB

Bump

It’s weird displaying images lowers my FPS, I am not doing anything else on screen. If anyone has ideas I would greatly appreciate it.

Well, 2500 images is alot, especially when doing fast movement etc. (every time all objects need to be updated, those in view also need be rendered)

Have you tried packing all tiles in a snapshot and move the snapshot around?

https://docs.coronalabs.com/guide/graphics/snapshot.html

2500 imagines is a lot I know, however once all the images are loaded I still get a 30 FPS drop even when I am not moving them or anything. It’s just odd that images are lowering my FPS when nothing else is happening on screen, no moving or animation at all.

I will try the snapshot idea, thank you!

tried snapshots, they use way too much texture memory. a 1300x1300 snapshot uses 20mb of memory! that’s only a 5x5 tile map. I think this would have helped my FPS but it uses way too much memory…

Translate should be faster to move objects. Also as far as i know, moving a group is not the same as moving a single object. They are still independent objects inside, you can remove then, change them. Its more like moving a table of objects but done internally. Still all positions of that table (group) needs to be updated. Why not create a potion of your map and while moving create and remove whatever you need in the way? The same way tableview works.

I realize now moving a group just moves all 2500 of my images at the same time it still has to move each picture. Basically what I want to do now is take a picture of my completed map and update it when a change is made that way I am just moving a single image around.

I don’t think corona can take a capture of the entire map because of culling. It only creates the images that are on screen so when I try to capture my display group I only get the images that are shown.

Have you checked to see if you get frame drops when moving?

when running the app on my LG G3 I get 60fps when only a few images are on screen, when I drag the screen around and more images are shown it goes down to 9fps and when I leave the map in full view I only get 30fps. 

I find it really odd that when nothing is happening I am loosing half of my fps? Also my texture memory is only 2.6MB

Bump

It’s weird displaying images lowers my FPS, I am not doing anything else on screen. If anyone has ideas I would greatly appreciate it.

Well, 2500 images is alot, especially when doing fast movement etc. (every time all objects need to be updated, those in view also need be rendered)

Have you tried packing all tiles in a snapshot and move the snapshot around?

https://docs.coronalabs.com/guide/graphics/snapshot.html

2500 imagines is a lot I know, however once all the images are loaded I still get a 30 FPS drop even when I am not moving them or anything. It’s just odd that images are lowering my FPS when nothing else is happening on screen, no moving or animation at all.

I will try the snapshot idea, thank you!

tried snapshots, they use way too much texture memory. a 1300x1300 snapshot uses 20mb of memory! that’s only a 5x5 tile map. I think this would have helped my FPS but it uses way too much memory…

Translate should be faster to move objects. Also as far as i know, moving a group is not the same as moving a single object. They are still independent objects inside, you can remove then, change them. Its more like moving a table of objects but done internally. Still all positions of that table (group) needs to be updated. Why not create a potion of your map and while moving create and remove whatever you need in the way? The same way tableview works.

I realize now moving a group just moves all 2500 of my images at the same time it still has to move each picture. Basically what I want to do now is take a picture of my completed map and update it when a change is made that way I am just moving a single image around.

I don’t think corona can take a capture of the entire map because of culling. It only creates the images that are on screen so when I try to capture my display group I only get the images that are shown.