Does multiplication with big numbers take more CPU? [Solved]

0 favourites
  • 2 posts
From the Asset Store
Geometry Fresh
$20 USD
80% off
Addition, subtraction and multiplication are supported. Endless replayability.
  • I am testing a game concept for mobile, on very weak cpus. While doing that i noticed a strange behavior.

    Creating and destroying the same objects over a while creates some kind of overhead which eats more and more CPU!

    And that goes without haveing more objects on the screen. After letting the generator run for like 4 minutes the game becomes on playable on mobile.

    Does anyone have an idea what this could be? I checked everything and there is nothing filling up or anything that could cause this behavior.

    In the beginning the object creation takes about 1% CPU and after a few minutes its already 6-7%

    The objects get destroyed when they behind the player, there are never more than 130 objects on the screen.

    The only possible cause for me would be multiplying bigger numbers for position, could that be the issue?

    This is the complete object creation code (no, the array does not have more than a few entrys at any given time, as long as the cpu can keep up:

    This is how it looks like: gyazo.com/0abb10141bf6ac799fbfa26df554f4fd

    This is the CPU Usage on a ryzen after 10 minutes: gyazo.com/6beed8369ee3aa9d22a9397f9a7076f9

    What am i doing wrong here?

    Kind regards

    Patrick

    Quick update: I removed the distance calculation from the single objects and do it now in the beginning once for all objects. it takes like no cpu time at all even after Minutes of running. So something with the object creation / Placement must be wrong here...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I Finally found it shortly after posting here: So in short: For some reason the array is filling up and i did not notice... so over time the array becomes bigger and bigger and generates the level millions of blocks in front of the player... Finally i found the reason for the lag haha :D

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