create complex upgrade system?

  • Hi, so I created a upgrade system for my game and it works quite fine, on PC (i7 7700k) it takes 7% in debug, on iphone 8 - 5% according to gamebench which is strange, I guess it is pretty powerful phone. But I tested it on 5S and it is a little bit laggy. So I started to ask myself, if there is a better approach or not.

    Basically I have multiple buttons and sprite texts for each upgrade. In realtime I check if item is upgrading and if it is I show time left. If not and I click on button, I check if you have enough money, if yes I save timecode and start upgrade. I use dictionary that saves to localstorage as json. For buttons and texts I use object variables. I change button frames based on its states.

    Also I have multiple vessels to upgrade, and when you switch that vessel, all info will update accordingly.

    So I wanted to start a discussion, is my system CPU heavy or not? Is this approach correct? What i your approach to upgrade system? I tried to google this, but without luck. Maybe I just dont know what to google exactly :)

  • Are you using any effects? Even simple effects can be very slow on mobile (at least on Android).

    There could be many other reasons why your game is slow.

    See how many collision checks are performed in debug mode. (anything under 100.000 per second should be fine).

    Check if you have any heavy events that are executed on every tick. Or maybe you are spawning too many objects and not destroying them. Also, try "Profile" tab in Debug mode.

  • Are you using any effects? Even simple effects can be very slow on mobile (at least on Android).

    There could be many other reasons why your game is slow.

    See how many collision checks are performed in debug mode. (anything under 100.000 per second should be fine).

    Check if you have any heavy events that are executed on every tick. Or maybe you are spawning too many objects and not destroying them. Also, try "Profile" tab in Debug mode.

    Thanks for reply!

    I don't use any effects, only 1 layer with two objects and blending mode (force own texture).

    Collisions are under 1.000 per second, when special event occurs the top number is 20.000 per second, but only for few seconds. I usually have 20-100 objects on scene, spawning new and destroying old.

    Heavy events I believe I have a few. I tried to optimize as much as I could but I believe that my game is indeed event heavy. I'm using lerp a lot for smooth movement of player and camera. Also I'm lerping lots of variables for smooth rendering of hp bars etc. I'm also using values straight from dictionary (should I load them to variables? I tested and it made no visible effect but dunno).

    Some of my events are math heavy, for example spawning of enemies. Enemy name and coordinations are in array + even then I random thos values in certain range. I use bullet on almost all objects also, and quite a lot of litetweens and sine behaviors. Still, I tried to turn off all the things one by one, but there was no major impact on cpu usage.

    Also it is worth to say that the game runs smooth, only iphone 5s gets hot and lags in menu a little bit, not in game. I will be testing android version later.

    Does anybody has experience with how cpu heave are math calculations like "lerp(GameSpeed, ((250+Depth/25)+BoostSpeed)*(playerSpeed/10), 0.3)"

    I just feel like I have pretty well optimized game for what it is, just want to be sure and hopefully clarify some thing, get other devs experience :)

  • From my experience, "Force own texture" setting can also cause ~10-15 fps drop on a low-end mobile.

    But yeah, you are probably right, its all the calculations and behaviors that are constantly using CPU. I kind of have the same problem in my game, not sure if anything can be done about it. I added an event that disables some non-essential visual features (particles, blend modes etc.) when the fps is too low.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • For anyone who is interested, 1 force own texture layer with 2 objects (I basically used it as a mask for light effect with quite big png 800x800) on iphone 8 takes 12% of gpu alone. So right now I'm down from 36% of gpu usage to 24% on iphone 8 and iphone 5s is not hot that fast and that much anymore.

    Sadly I have trouble to measure gpu usage with iphone 5 to get more accurate numbers.

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