How do I change it to predominantly use GPU instead of CPU?

0 favourites
  • 9 posts
From the Asset Store
Simplistic hyper-casual game with nature elements. Tap to switch between the 4 elements and reach a better score.
  • Notice that the GPU is basically 0% and the CPU is close to a 100%? Is it possible to make my game run utilizing more of my graphics card rather than my CPU?

  • The gpu is used for rendering... event logic, scripts, etc... is handled by the cpu. Depending on your project, you could get really creative and shove some work towards the gpu, but you need to know how to both program and write shaders.

    Iʻm assuming your project is heavy on logic and light on graphics?

    Without knowing anything about the project, there isnʻt much I can suggest.

  • Yeah I assumed that would be the case. I was just wondering if there was a way to lighten the load on the cpu directly without altering my code.

    EDIT: I found the reason why the CPU was so high: I was using "for each (object)" every tick. I had 700 of said objects! Silly me.

  • Haha, Iʻve been trying to deal with that in my own project right now. Figuring out ways to git rid of foreach when you need to pick objects by uid associated with the current instance.

  • Yeah it's kind of a pain: why can't conditions apply to all objects that it's valid for? For me, "Pick all" doesn't really act the same as "for each object" and it's difficult to tweak the code to make it act the same along with the benefit of lower CPU usage.

  • Yeah it's kind of a pain: why can't conditions apply to all objects that it's valid for? For me, "Pick all" doesn't really act the same as "for each object" and it's difficult to tweak the code to make it act the same along with the benefit of lower CPU usage.

    It really depends on what you are doing with each object after it is picked and what other objects you are referencing. So you have an example in psuedo code you could share?

    Do you use the keyword "self" while writing expressions and events? If not, that would be an important reason things weren't working as you wanted.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yeah it's kind of a pain: why can't conditions apply to all objects that it's valid for? For me, "Pick all" doesn't really act the same as "for each object" and it's difficult to tweak the code to make it act the same along with the benefit of lower CPU usage.

    "Pick all" is mainly used to reset already picked or filtered objects, example,

    object A's picked, do stuff

    subevent pick all objects B's, do stuff.

    or

    objects A's health > 50, do stuff

    subevent pick all object A's, do stuff.

    whereas foreach is used to effect a single instance at a time.

    Also if you were to do

    enemy health > 50

    foreach enemy

    only the enemy with health above 50 would be included in the loop. If you put the foreach at the top them all instances would be picked regardless of their health, but only the enemy with health above 50 would be effected.

  • only the enemy with health above 50 would be included in the loop. If you put the foreach at the top them all instances would be picked regardless of their health, but only the enemy with health above 50 would be effected.

    yeah that was mostly my mistake: I've been doing it the opposite way. Ex:

    For each object:

    If health is < 0{

    }

    And I had like 700 of these objects. No wonder CPU usage was extremely high. Thx for that tip (I didn't know that conditions affect the for each object loop)!

  • Do you use the keyword "self" while writing expressions and events?

    I didn't use this at all! That makes so much more since to use instead calling the sprite!

    I'm not going to share my code because while experimenting with all these tips in this topic, I managed to fix all of my mistakes using "For each object" and "Pick". So it would kind of be a waste of time for you guys to go over it. Your replies really helped me a lot!

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