User Tag List

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

Thread: Layer causing CPU usage

  1. #1
    Clicker Multimedia Fusion 2

    Join Date
    Aug 2009
    Location
    Finland
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Layer causing CPU usage

    I seem to have a problem with my latest HWA platformer game project. Basically, placing a layer, even just an empty one, below the current bottom-most layer, causes CPU usage to increase a ton every time there's just a few animated objects on screen in runtime. Normally when there's about five enemies on screen, my CPU usage stays below 10% at all times. With the additional layer, CPU usage maxes out and framerate starts going down. 10 enemies is unplayable, whereas I see no slowdown at all normally with 10 enemies.

    This problem happens both in HWA build 249 and 251. I tried to test the game in non-HWA, but it crashes right from the start, so I dunno if it's a HWA-only issue.

    The problem seems to be with the current bottom-most layer, which contains pretty much all the action, aside from HUD elements and such. Placing a layer above/below any other layer makes no difference to CPU usage. And like mentioned earlier, object animations seem to be the biggest factor. Lots of non-animated actives doesn't seem to be a problem, but 5+ makes the CPU burn.

    So, I've tried slimming down things a bit, removed all other layers aside from the gameplay layer and a new empty layer below it. Deleted just about all extensions. What I have left, that are currently needed for the game to function without needing to change the code a lot; Named Variable Object, Array and three Active Pictures (level tilesets are loaded from these at frame start, then not used anymore).

    On the coding side, there's a pretty basic custom platform movement going on, mostly non-fastlooped collision checks, value comparings, a detector for enemies and player, etc. I've never seen that stuff cause problems like this, so I don't see why they would here, especially with just an extra empty layer.

    Blending types I've used include Additive, Simple Mask and XOR, though I think I've tried changing all those to None too.

    I'm running out of ideas here. :/ What could be causing this? Any ideas?

  2. #2
    Clicker Multimedia Fusion 2SWF Export Module

    Join Date
    Sep 2006
    Posts
    1,537
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: Layer causing CPU usage

    to try pinning down exactly what is failing, try unselecting "use fine collision" for all your objects, and see if that improves performance. Try to figure out if this is a problem with the collision mask, especially as you're doing lots of collision events.

  3. #3
    Clicker Multimedia Fusion 2

    Join Date
    Aug 2009
    Location
    Finland
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Layer causing CPU usage

    I generally try to avoid using fine detection for objects that come in quantities, but anyways, I just tried unselecting "use fine collision" for everything. I don't think it made any difference.

    I'd be happy to test anything else you can think of. I suppose I could try and simply remove all collision checks aside from the player movement and see if that makes a difference, but no time right now, but definitely later tonight.

    Would be nice to have other things to try too when I get there though.

  4. #4
    Clicker Multimedia Fusion 2

    Join Date
    Aug 2009
    Location
    Finland
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Layer causing CPU usage

    Actually, I squeezed in a moment to try disabling the collisions for enemies and particles/projectiles. That does seem to stop the CPU spiking.

    So, the question is... what to do now?

    Could level tiles pasted from a tilesets in Active Pictures cause something like this? The levels are quite big and there are a lot of tiles.

  5. #5
    Clicker Multimedia Fusion 2SWF Export Module

    Join Date
    Sep 2006
    Posts
    1,537
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: Layer causing CPU usage

    IIRC, the game will very much slow down if you paste collision backdrops to more than one layer with the way the collision detection is implemented. If you keep all the collisions and all the pasted backdrops from your tilesets on the same layer, it won't be a problem. Maybe unchecking 'paste as obstactle' for the other layers? I personally use text blitters for non-obstactle layers, as that uses much lower memory and doesn't need the collision map at all

  6. #6
    Clicker Multimedia Fusion 2

    Join Date
    Aug 2009
    Location
    Finland
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Layer causing CPU usage

    Hmm, none of the tilesets on the other layers paste as obstacles though. And all objects that are checked for collisions are on that one gameplay layer already, I believe.

    I'm kinda confused about one thing though. When pasting from Active Pictures, there are the options "No effect on collisions" and "Not an obstacle". What's the difference?

    Text Blitters for non-obstacles, huh? I should probably consider trying that.

    Thanks for the hints so far.

  7. #7
    Clicker Multimedia Fusion 2SWF Export Module

    Join Date
    Sep 2006
    Posts
    1,537
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: Layer causing CPU usage

    pasting with no effect on collisions will not change the collision map for that area, iirc. IE if you pasted over an area that was already an obstactle, that obstacle would remain there- you'd just get a graphical change. Meanwhile "Not an obstacle" will overwrite the collision map, making it non-obstacle

  8. #8
    Clicker Multimedia Fusion 2

    Join Date
    Aug 2009
    Location
    Finland
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Layer causing CPU usage

    Ahh, makes sense. Thanks.

  9. #9
    Clicker Multimedia Fusion 2

    Join Date
    Aug 2009
    Location
    Finland
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Layer causing CPU usage

    Ok, it's about the Active Picture for sure. Even with just one tileset, and even if pasted only on one layer, the CPU still spikes. If I remove the Active Picture and the backdrop pasting, no CPU spikes.

    So, now I'm left rather curious if it's an issue with the amount of tiles, or the way they are pasted. Darn.

    (EDIT) I'm guessing it's the way I'm pasting them, now that I've browsed the forums more. I should probably try pasting the common tiles with 'paste image to background' via an Active or something, instead of 'create backdrop'. Would I be on the correct track with that? ;P

  10. #10
    Clicker Multimedia Fusion 2SWF Export Module

    Join Date
    Sep 2006
    Posts
    1,537
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: Layer causing CPU usage

    My game uses nearly 20000 tiles in one stress testing level of 24x24 size, all pasted, and works just fine. And thats with the active picture object. But I remember when messing around with it, I found it utterly killed the frame rate and wasted CPU if I messed up the layering. It had to be on a specific layer in the front or back, display wise.

    Try tinkering around with it a bunch, active picture is the way to go

Page 1 of 2 1 2 LastLast

Similar Threads

  1. What could be causing this?
    By ecoste in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 21st December 2013, 04:57 PM
  2. Layer Object: Moving X and Y of layer is very slow
    By Bipolar_Games in forum Android Export Module Version 2.0
    Replies: 0
    Last Post: 5th April 2013, 02:19 AM
  3. What's causing my game to slow down?
    By Roseweave in forum Multimedia Fusion 2 - Technical Support
    Replies: 8
    Last Post: 12th March 2008, 11:11 PM
  4. Layer Object can't move counters to specific layer
    By JoKa in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 20th November 2007, 12:11 PM
  5. Debugger causing a crash
    By Corentin in forum Multimedia Fusion 2 - Technical Support
    Replies: 8
    Last Post: 28th February 2007, 01:32 PM

Posting Permissions

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