High CPU and Memory Usage [?]

This forum is currently in read-only mode.
From the Asset Store
High Low is a casino game using luck and points accumulation.
  • Here is the code for my entire .cap. There are three objects: two 32x32 sprites and one array object.

    http://pub.gamingw.net/39880/procgen1.jpg

    As you can see there isn't much to it, but despite this I am getting fairly high CPU and memory usage from this.

    With all events enabled.

    29mb 13% - Linear

    31mb 19% - Point

    With the third event disabled (others enabled).

    8mb 1% - Linear

    11mb 1% - Point

    With the second event disabled (others enabled).

    13mb 3% - Linear

    13mb 4% - Point

    These numbers may not seem startling to you, but they do for me. My specs are an E8200 2.66GHz Core2Duo and an 8800GT 512mb. This problem becomes exponentially worse the more I add to it. I don't understand why it requires 30mb and 20% of the CPU when it isn't running any events. Unlimited framerate is disabled so it's not like it's rendering the screen a bajillion times a second or anything.

    As it stands this would be unusable for me. Trying to create anything beyond simple applications would quickly tax my cpu and probably blow a ram chip out of the DIMM.

    The version I am running is 98.9, so not an unstable release.

  • Those events will run every tick, if you don't want them to, set a variable or use functions, so they only run once.

  • Those events will run every tick, if you don't want them to, set a variable or use functions, so they only run once.

    Then what is the purpose of "trigger once"?

    EDIT: This seems to have helped. It reduced it to 5% and 18mb. This still seems somewhat high for a program that isn't really doing anything, but maybe that's just the nature of the beast.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • > Those events will run every tick, if you don't want them to, set a variable or use functions, so they only run once.

    >

    Then what is the purpose of "trigger once"?

    Yeah, I guess I'm not getting this either... a trigger once on it's own should literally only trigger once, yes?

  • Should be:

    Always

    Trigger once

  • Should be:

    Always

    Trigger once

    Could you explain that to me? Why is it setup like so?

    I've changed to functions, though. Now if I could just get help figuring out where I went wrong with my events I'd be on my way, haha.

  • Trigger once's description reads "fires once while true"

    Always is always true

    so

    Always

    Trigger once

    will fire once and then never again because Always will stay being true.

  • 'Always' generally has no effect when added to existing events. So:

    Always

    Trigger once

    is identical to simply having

    Trigger once

    on its own.

  • 'Always' generally has no effect when added to existing events. So:

    Always

    Trigger once

    is identical to simply having

    Trigger once

    on its own.

    What does trigger once even do then?

    Also, is it normal to still have 5-7% cpu usage even when your program is idling? I looked more carefully and memory usage still increases by about 4kb every couple seconds (relatively inconsequential for now, but if someone was playing a game for hours...). Nothing is even occurring in the program!

    EDIT: I've done further testing and found that most other .caps that aren't extensive (I ran the zelda scrolling and some particle ones) only use up 0-1% CPU with, for example, particles bouncing all over the place and all sorts of calculations being done PER TICK. My program doesn't seem to be doing anything after it generates a layout (which it is still doing incorrectly), but uses 5% CPU? What??

  • Trigger once is usually used in conjuction with another condition. For example:

    +If 'variable' equals 0
    +Trigger Once
        -Add 1 to 'variable2'[/code:382s0g7h]
    If the first condition comes out true, then the action within will only be performed once.  However, if the first condition later evaluates to false, then the action will trigger again as soon as the first condition is once again true, starting the cycle over.
    
    If you want the events under the trigger once conditions to only be run at the start of the layout, it would be better to put them as sub events to the start of layout condition.
    
    EDIT: [url=http://files.getdropbox.com/u/917406/triggeronce.cap]Here's an example[/url] showing what I just described.
  • What linkman said. Trigger once only runs where you have repeated conditions which go on/off in cycles, mainly collisions.

    It's normal for some CPU to be being used even when idle, don't worry about it.

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