Garbage collector slowing down game

0 favourites
  • 8 posts
From the Asset Store
Set of tiles to create a map for top-down games with island theme
  • a quick question Ashley as he's the main brain of this operation :)

    when running a phonegap C2 export through eclipse, in logcat i get garbage collector logs almost every second. we all know that gc uses quite a bunch of processor cycles. do you think it's woth my time to make something like sprite pooling in my C2 game? ie. don't destroy bullets, instead hide them / make them inactive and when needed don't create them, but set their position / active / visible again?

    thanks in advance :)

  • Just a curiosity... How do you recognize garbage collector logs in logcat? I set it to Verbose and still don't find them.

  • GC Concurrent freed something something % :)

  • Ashley has already taken steps to reduce GC through instance reuse and other methods, so C2 does it automatically for you! http://www.scirra.com/blog/76/how-to-write-low-garbage-real-time-javascript

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • yea, i meant, C2 cant know that im gonna be creating 10 bullets every second, so the real question was does it make sense to create like 50 bullets at start of level and like described reuse them?

  • I doubt it, but I guess that's a question for Ashley, as I don't know the specifics.

    You could always try a test and see if it improves things, it shouldn't be too hard to implement.

    Honestly though, I'm not sure you should bother. Even a .capx with 1 sprite that moves around with 8 direction behavior stutters a bit on my machine (that can play most modern games no problem) in FF, chrome and IE. I have a game I'm making that cyles through like a hundred lasers a second and it doesn't stutter any more than the 1 sprite 8 direction test did. You're probably going to get them no matter what you do until browsers improve.

  • Construct 2 automatically recycles objects (and other items) in its engine already. There is nothing to gain by doing this yourself in events.

    Garbage collection is a normal and expected process - it is only a problem when it pauses for a long time (e.g. 100ms+). In fact, lots of regular small garbage collections are usually good news, because many tiny pauses make for better playability than a few long pauses.

  • good, great, got it.

    thanks

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)