Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Serious game-breaking issues with Graphics 2.0 Migration
Started by dionny Nov 30 2013 04:57 PM

16 replies to this topic
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

dionny

[GLOBAL: userInfoPane.html]
dionny
  • Observer

  • 5 posts
  • Corona SDK

To start off, we are running on Corona public build 2013.2076

We have fully completed a proper Graphics 1.0 => Graphics 2.0 migration (we are not using 1.0 compatibility mode) and our game runs smoothly on the Corona simulator.

 

The problem: When running on an actual device (have tested Galaxy S3, Galaxy Note 2), our game gets slower and slower the more we play. We have a basic world/level system in place, and the more levels we complete in a session, the laggier the game gets. After about 5 levels, it is unplayable.

 

Notes:

  • This does not occur with Corona public build 2013.1202.
  • This occurs with Corona public build 2013.2076 on Graphics 1.0 Compatibility Mode.
  • We utilize fairly large images throughout our application.

This is a current game-breaker for us, as we require 2076+ which fixes several other iOS7 issues we were previously experiencing with 1202.

 

Any thoughts?

 

Thanks



[TOPIC: post.html]
#2

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,246 posts
  • Enterprise

Have you checked your memory allocations?



[TOPIC: post.html]
#3

dionny

[GLOBAL: userInfoPane.html]
dionny
  • Observer

  • 5 posts
  • Corona SDK

Thank you for your reply.

 

Yes, we are monitoring both regular memory and texture memory. They both return to baseline (amount upon entering scene) after destroying the scene. 

 

We just tried this:

http://forums.coronalabs.com/topic/41407-resolved-graphics-20-bad-performance-image-loading/?p=216086

 

After applying this workaround, everytime the user transitions to a new level, everything seems to reset and move quickly again. However, if the user spends time within the level moving around for a long time, it starts to slow down drastically. Again, none of this behavior is exhibited prior to 2.0.



[TOPIC: post.html]
#4

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,246 posts
  • Enterprise

Do you have anti-aliasing on in your config.lua?

 

Rob



[TOPIC: post.html]
#5

dionny

[GLOBAL: userInfoPane.html]
dionny
  • Observer

  • 5 posts
  • Corona SDK

No, anti-aliasing is not enabled. I tried enabling it and seeing the same results.



[TOPIC: post.html]
#6

Christopher Bishop

[GLOBAL: userInfoPane.html]
Christopher Bishop
  • Contributor

  • 416 posts
  • Corona SDK

@dionny, are you by any chance using a full size image as the background image? ie: 1024x768, 2048x2048 etc. ?



[TOPIC: post.html]
#7

dionny

[GLOBAL: userInfoPane.html]
dionny
  • Observer

  • 5 posts
  • Corona SDK

The background image we are using is 760x1140.



[TOPIC: post.html]
#8

Christopher Bishop

[GLOBAL: userInfoPane.html]
Christopher Bishop
  • Contributor

  • 416 posts
  • Corona SDK

The only reason I ask is because I had a similar issue and it turned out to be the background image (for what reason i have no idea)... 

 

What I ended up doing was going into photoshop and slicing it into 12 different images and then just created a function that was LoadBackground() and all it did was tile those images to create the background and my performance issues went away.

 

Not sure if that would resolve your problem but for me it solved it and because I have sub games within games and all with their own backgrounds it reduced my load and build up lag like you are talking about.

 

But I do know what you are talking about and texMem and Mem look fine but something just churns like (redrawing or something) let my app run over night and by morning you couldn't even click on anything, switched to tiling background and wham all issues gone!



[TOPIC: post.html]
#9

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,246 posts
  • Enterprise

You will probably need to file a bug report and include your project (well as minimal of a project that shows the performance problem) so we can try and track it down.

 

Rob



[TOPIC: post.html]
#10

mslack

[GLOBAL: userInfoPane.html]
mslack
  • Contributor

  • 230 posts
  • Corona SDK

Dionny,

 

I finally decided to take the plunge into Graphics 2.0 ... conversion went smoothly ... tedious but smooth.

 

Then i started testing ... all was well till i had played for 40 minutes or so then things started slowing down more and more.

 

Same game no changes other than the 2.0 required conversions for position and fill color but the performance over time is a non-starter.

 

Did you ever figure out a solution Dionny?

 

 

Reading the threads on this it is not clear to me that adding display.setDefault( "preloadTextures", true/false )  would have any effect as my issue is not the same as those reporting lags on starting up their game.

 

Really appreciate any insights.

 

Cheers,

m



[TOPIC: post.html]
#11

jstrahan

[GLOBAL: userInfoPane.html]
jstrahan
  • Corona Geek

  • 1,925 posts
  • Corona SDK

@dionny
you said your checking memory. are you checking during games play or only during scene change?

[TOPIC: post.html]
#12

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,246 posts
  • Enterprise

@mslack can you check your memory usage as well?



[TOPIC: post.html]
#13

mslack

[GLOBAL: userInfoPane.html]
mslack
  • Contributor

  • 230 posts
  • Corona SDK

memory is fine ... it does not grow.  Keep in mind that as i said all i did was do a minimal migration dealing with setReferencePoint issues and setTextColor -> setFillColor.

 

Prior to the migration the app could run for hours without any degradation.  Now after playing for 20-30 minutes it gets very sluggish.

 

My texture memory starts at 13083700 then goes to 15186036 after i start the game then never changes.

 

My memory utilization always comes back down to the same value.

 

So i am quite sure i do not have any memory leaks.  Things just start slowing down after 20-30 minutes of play.

 

This is NOT the case when using build 1260.

 

I noticed the slowdown was really bad for TextCandy so i commented that all out but same result ... i can see a jerkey screen ... like it runs fine for about 1 second then stops for about 100 ms and cycles like that continuously.

 

The longer i play the longer that lag becomes.

 

Any clues would be most welcome.



[TOPIC: post.html]
#14

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,246 posts
  • Enterprise

Are you checking your Lua memory (using collectgarbage("count"))  This is expressed in KB of memory.  You could be leaking there that wouldn't show up in texture memory.

 

Rob



[TOPIC: post.html]
#15

Bryan01

[GLOBAL: userInfoPane.html]
Bryan01
  • Enthusiast

  • 95 posts
  • Corona Staff

@dionny. Please try the latest public release as we've made a few bug fixes and changes to image loading

@mslack. Which version of Corona are you using, and are you using a compatibility layer for text candy? Can you provide a sample project that demonstrates the issue?

[TOPIC: post.html]
#16

mslack

[GLOBAL: userInfoPane.html]
mslack
  • Contributor

  • 230 posts
  • Corona SDK

Think it was a memory leak but here is the interesting part ... this really bad chunk of code i wrote about 2 years ago when i was first getting into Corona was the culprit :


It was getting called lots .. every time someone touched the screen.
Sometimes in this game you have to think for an extended period of time and people were unhappy with their screens timing out.

However, this code leaks. Don't think it was leaning prior to my jump from 1030 build to 2153 builds.

Thanks for all the guidance ... here is the leaking code ... may be something corona wants to look into.
 

system.setIdleTimer(false)
if (self.removeIdleTimerTimer ~= nil) then        timer.cancel(self.removeIdleTimerTimer)
end
self.removeIdleTimerTimer = timer.performWithDelay(240000,    
function ()
         system.setIdleTimer(true)
         self.removeIdleTimerTimer = nil
     end )


[TOPIC: post.html]
#17

illusioncodellc

[GLOBAL: userInfoPane.html]
illusioncodellc
  • Observer

  • 1 posts
  • Corona SDK

To follow up (this is Dionny),

 

With the latest public build, the performance problem took longer to manifest itself (could play for about 15 minutes before it got overwhelmingly bad). I decided to thoroughly test the game for any memory leaks and found a huge problem with the legacy sprite library (prior to Graphics 2.0).

 

Important: After public build 2076, the legacy sprite library does not free used memory even with proper disposal techniques. After replacing all uses with the new sprite library, the performance-over-time of my game improved five-fold.

 

Just a thought. You guys should consider fully deprecating the old library so that users are forced to move to the new sprite libraries in order to avoid this problem with other customers.

 

Regards.




[topic_controls]
[/topic_controls]