User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 15

Thread: Garbage Collection

  1. #1
    Clicker Fusion 2.5 DeveloperiOS Export Module

    Join Date
    Dec 2008
    Posts
    101
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Garbage Collection

    For a while now, I've been seriously bothered by random CPU spikes in some levels of my game. They don't appear to have a pattern to them...without warning, my FPS will shoot down from 50 to about 10 or 20 for a few seconds, then jump back up. It's really annoying.

    After testing a lot of possibilities for what could be causing it, I've come to the conclusion that it has to be the garbage collector. The objects that are causing the strain are little red blips that I use to simulate a laser beam that bounces off of mirrors and things. Needless to say, it takes hundreds of these little objects every second to create the appearance of one contiguous beam. To save CPU, I set the lasers to only fire the hundreds of little beams if the main character is relatively close to them, but even then, there are hundreds of objects being created and destroyed every second. As a result, I theorize, my computer has to keep running the garbage collector, which badly hurts the framerate.

    Does anyone have any suggestions on how to make my program use memory more efficiently?

  2. #2
    Clicker Multimedia Fusion 2SWF Export Module
    Jacob's Avatar
    Join Date
    Jul 2007
    Location
    Second pixel to the right
    Posts
    3,208
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you can find the coordinates of the vertices in the bouncing laser, you could use the Surface object and draw lines which would be far more efficient that tons of small actives

  3. #3
    Clicker Fusion 2.5 DeveloperiOS Export Module

    Join Date
    Dec 2008
    Posts
    101
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The coordinates are dynamic, and the laser is supposed to be blocked by any background object or Obstacle-qualifier object in its path. That may be too complicated.

    Also, I don't know where to download the Surface Object.

  4. #4
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export Module
    Jaffob's Avatar
    Join Date
    May 2008
    Location
    USA
    Posts
    1,833
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    For downloading extensions: http://clickteam.info/ev/ev_setup.exe

    I would use a single active object for the beam. You can use fastloops to calculate where the beam should hit and stop. Here's an example I made awhile ago, hopefully it will help.

    http://community.clickteam.com/showthread.php?t=60712

  5. #5
    Clicker Fusion 2.5 DeveloperiOS Export Module

    Join Date
    Dec 2008
    Posts
    101
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's a neat example, but my laser is much more complicated than that. It needs the ability to bounce off of mirrors, and the mirrors need to be able to rotate. Also there need to be multiple instances of the laser.

  6. #6
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)
    King_Cool's Avatar
    Join Date
    Aug 2008
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by fawfulfan View Post
    That's a neat example, but my laser is much more complicated than that. It needs the ability to bounce off of mirrors, and the mirrors need to be able to rotate. Also there need to be multiple instances of the laser.
    There probably is a better way of doing this than shooting 100ds of small Active wich represent Laser Beam.
    I think Jaffobs suggestiong is good ( havent viewed the example ).

    Im sure there are better ways of handeling this.
    If any sudden bright ideas strike me regarding this i will make an example and explain how it can be done in an alternative way.

  7. #7
    Clicker Fusion 2.5 Developer

    Join Date
    Jul 2008
    Location
    UK
    Posts
    1,341
    Mentioned
    16 Post(s)
    Tagged
    0 Thread(s)
    You might wish to follow the related discussion here:
    http://www.create-games.com/forum_po...95578&show=all

    I posted a couple of examples - a very buggy one using scaled & rotated actives for beam segments, and a slightly less buggy one using the surface object.

  8. #8
    Clicker Fusion 2.5 DeveloperiOS Export Module

    Join Date
    Dec 2008
    Posts
    101
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Those are neat...but can it be made to support multiple lasers at once? I'll need the ability to have 10 or 20 lasers in the same level.

  9. #9
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Eliyahu's Avatar
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    1,523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Will the levels be tile-based?

  10. #10
    Clicker Fusion 2.5 DeveloperiOS Export Module

    Join Date
    Dec 2008
    Posts
    101
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Eliyahu View Post
    Will the levels be tile-based?
    Not sure what you mean. The levels consist mainly of Quick Backdrops, Backdrops, and Actives.

Page 1 of 2 1 2 LastLast

Similar Threads

  1. OpenGL collection
    By Min in forum Extension Development
    Replies: 226
    Last Post: 1st January 2014, 11:36 PM
  2. Garbage Collection For IOS
    By sinister in forum iOS Export Module Version 2.0
    Replies: 1
    Last Post: 25th August 2011, 10:49 AM
  3. Help with garbage collection?
    By Pixelthief in forum Lua Scripting
    Replies: 33
    Last Post: 4th September 2009, 12:34 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •