Fireball. Garbage Collection.

  • Hi i was just reading about the Garbage Collection.

    In my game you can cast spells.

    Right now i am just thinking of, Create Fireball. On hit Destroy Fireball.

    But now after reading about Garbage Collection..

    1. Should i create the fireball from the start and just make it invisible and move it around?

    2. Will the Invisible Fireball affect the Framerate?

    3. Is it a bad idea to have the fireball have a tail made of Particles?

  • 1. C2 already recycles instances for you, and attempts to minimize GC as much as possible automatically for you as described here: http://www.scirra.com/blog/76/how-to-write-low-garbage-real-time-javascript

    2. Not unless you have a ton of them and/or you're processing a lot of logic on them.

    3. Not at all.

  • 1.Thx 2.Thx 3. Thx

    <img src="smileys/smiley17.gif" border="0" align="middle" />

    Yes, that is the one i read. But i wasn't sure, because it said that the GC was "reduced".

    But if the Recycling is that good, would it be safe to create a fireball every time i cast the spell?

  • Sure. It's not like you're going to cast 1000 fireballs a second, right? :P

  • Plenty - you don't have to worry when creating a few instances. A few hundred or thousand on the other hand, depending on your computer you might start noticing pauses.

  • <img src="smileys/smiley17.gif" border="0" align="middle" />

    Nah probably not a few 1000 ^^

    But i might need to cut my game up into quite a few layers hehe.

    Do Buildings, trees and other object affect this as well? Things that do get created while loading and don't spawn while playing.

    Edit:

    I'm reading about the WebGL right now, that should help? Do i need to activate it?

  • Go for it. It'll fall back to default if it is not supported, anyway.

  • Alright ^^

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The blog post on garbage collection was really aimed at plugin/behavior developers, as well as general Javascript programmers. From within C2, you don't really need to worry about GC at all. We've already done all the work to minimise GC.

  • The blog post on garbage collection was really aimed at plugin/behavior developers, as well as general Javascript programmers. From within C2, you don't really need to worry about GC at all. We've already done all the work to minimise GC.

    I love when other people do the work

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