Need help with frame rate in mobile.

0 favourites
  • 14 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Hi there guys!

    Well, I finally got an Android device, so I was very excited in porting my creations for mobile, but I am facing a lot of trouble with the frame rate <img src="{SMILIES_PATH}/icon_e_sad.gif" alt=":(" title="Sad">

    The game I am trying to port is Penguin Slide! (I uploaded it on Scirra Arcade. If you want to take a look: http://www.scirra.com/arcade/action/12443/penguin-slide)

    I used the Infinite Runner demo as a reference for some coding and asset design decisions, but I already changed some properties and file sizes (which caused some undesired changes on the game visuals, such as the thin ice texture)

    • changed the background, that was a huge tile with the same size from the screen (480x640). it was divided into the thin ice and the snow borders (3 tiles, 64x64px)
    • set Collision to 'No' to every object, except the penguin. The ice blocks and the popsicles only have it turned on while on screen.
    • pixel rounding, WebGL to On, Sampling to Point, Clear Background to No and every layout's all layers' transparent to Yes

    Now I am taking a look at the code. I am using some 'Every Tick' events, and using timescale as well. If they are directly responsible for the game running so slow, I don't know, but since they are key elements to the game, I don't know how to recreate this mechanic in another way.

    Could you guys give me a hand and take a look at the code? I am trying everything but I am not getting much progress.

    Thanks in advance, fellows!

  • Anyone?

  • What does your debug read in terms of collision count. I'm sure you can make the game without the need for collision checks. Try using the overlapping event and disable collisions for everything. The particles object is known to reduce fps count. Test test test in debug.

    Honestly it's easier to read an event sheet from a capx file. You can pm the capx if you want, i have some free time atm

  • What does your debug read in terms of collision count. I'm sure you can make the game without the need for collision checks. Try using the overlapping event and disable collisions for everything. The particles object is known to reduce fps count. Test test test in debug.

    Honestly it's easier to read an event sheet from a capx file. You can pm the capx if you want, i have some free time atm

    Edited the topic with the .capx

    Thanks man!

  • Here you go.

    I have completely removed the need for collisions in your game. I added events where you compare positions for the penguins and the block and Popsicle. Added comments so you can get an idea how i did it.

    You seem to have a snow hitbox items which i don't know what it's used for. I left it as it is but it had collisions enabled and it will effect performance.

    You can definitely improve more by yourself. Check the forums, tutorials, destroy objects that are not needed on screen, reduce the particle numbers in your particle object if you can it's a known performance downer

    If you can add a blue outline to the score text, makes it easier to read

    Get back with how much better fps you get

  • Thanks Pandy! I'll study the changes you did to the code.

    Do you think that it is necessary to replace the every tick events with anything else?

    I've been testing using like this

    every second => add (block.bullet.speed*0.6)*dt

    instead of the current every tick event, but it doesn't work. the idea was creating a equation that could make the proportional amount of checks but every 1 second instead of 60 times a second

  • Ha sorry but i'll need more time to understand how all those variables play together. You can keep trying new ways and testing. That's the best way to learn.

    If the game works as it is i wouldn't really bother with trying to optimize the event sheets. The performance gains you'll get is really negligible compared to the gains you'll get from removing unnecessary events, objects, collisions etc.

    If you are gonna use cocoonjs, export the project with version 1.4.7 rather than their 2.0.0 beta. Performance is definitely better in the older version.

    If the game works as it should at 60 fps on mobile, publish it and then iron out your event sheet for future updates.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hey, I liked your game. Simple but fun.

  • Ha sorry but i'll need more time to understand how all those variables play together. You can keep trying new ways and testing. That's the best way to learn.

    If the game works as it is i wouldn't really bother with trying to optimize the event sheets. The performance gains you'll get is really negligible compared to the gains you'll get from removing unnecessary events, objects, collisions etc.

    If you are gonna use cocoonjs, export the project with version 1.4.7 rather than their 2.0.0 beta. Performance is definitely better in the older version.

    If the game works as it should at 60 fps on mobile, publish it and then iron out your event sheet for future updates.

    Pandy, your solution gave a huge improvement to the frame rate. I couldn't get less than 30 fps and that is great!

    But, there is something weird ocurring only on mobile. Sometimes the penguin just passes through the popsicles/ice blocks, without anything happening.

    That is really weird, I spent the whole Sunday trying to figuring out what is happening, but no success until now

    Hey, I liked your game. Simple but fun.

    Thanks man, I have hope that I will be able to port it to mobile. But it's being really hard. I wonder how must be design bigger games with C2 for mobile. ;/

  • I think i`ll give up. I`m really frustrated with this.

  • That's weird. Does it only occur on mobile? or does the penguin pass right through in desktop as well? Does it happen for the popsicles too?. You exporting using cocoonjs?.

    It seems fine when i tested on my android.

    You sure you didn't change the code, The for each block loop is still present right.

  • That's weird. Does it only occur on mobile? or does the penguin pass right through in desktop as well? Does it happen for the popsicles too?. You exporting using cocoonjs?.

    It seems fine when i tested on my android.

    You sure you didn't change the code, The for each block loop is still present right.

    Amazingly yes. It only occurred on mobile. What is happening is that randomly the Penguin is passing through ice blocks and popsicles as well.

    The only thing different I did was changing some collision points that were different from what you set up (you changed it to bottom instead of middle, but forgot to do the same in other objects frames, such as the left and right penguin frames)

    I exported the game using Cocoon JS (Which by the way worked way better than Crosswalk), and the device I am using is the Samsung Galaxy Tab 3 Mini.

    One thing that I was thinking about is if setting the Every X Seconds from the blocks/popsicle generator to "0.5" has something to do with it.

  • Hi! I am also going through similar situation... frame rate is low (from 26 to 37) ... but the game is playable on Desktops. But when I try it on Android or iOS things get really ugly

    Here's my topic... and the game idea is also simple as yours.

    I think in my case, managing many collisions is a big issue (at least 16 objects).

  • hi

    1-you dont need to disable all object collisions (you will complicate script event and probably affect performance)

    you just need to disable collisions with object that enter in collisions

    2-enable collisions if object is on screen is not necessare try to find something else

    because when object are out side screen (layout) , their collisions are not checked (try it by your self , 2 object make them move from screen to outside , and set some collisions between them and see the inspictor

    you will see that if the 2 object are outside , the collisions check to go 0 without disabling or enabling anythings

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