Need help with game lagging on phone...

  • I've got some lagging issues with my autorunner game when I'm testing on my phone. I've used both Ludei and Crosswalk and I get issues with both. The game is still playable but the lag is an issue as it's noticeable.

    I was hoping someone would be willing to take a look at the events in my capx and help me with this lag issue. I'm still learning so I would be grateful if someone more experienced could tell me where I'm going wrong or what I can improve.

    I can't post my capx here as the capx file is too big and I don't think I can PM as my reputation needs to be 500, but I could email it if anyone is willing.

    I'm nearly done with my game so it's annoying I've got this problem

    I know it may be a bit much to ask but hope someone can help.

  • I'll take a look for you. Well never mind I can't help you due to restrictions also. My Skype is nlaakald.

    Save the game as a single file and please replace the graphics with just basic colored shapes. Zip it and contact me via Skype. This will decrease size and protect your content.

  • Cheers mate, appreciate it. What I've done with my capx is change the sprites with ones from the internet rather than coloured shapes just for this as I wanted it as similar to my actual capx as possible with regards to character animation, just in case there's something with that that needs improving.

    I don't have Skype though and have no idea if I can still send to your Skype somehow. Do you mind if I send it via email if you don't mind providing your email address?

  • Just joined Skype, probably be easier that way. Have no idea it works yet

    I've sent you a contact request and i'll send the file soon.

    Thanks again.

  • You might be using up too much memory:

    Make sure your sprites & tiled backgrounds are power of 2 , especially your background: make it no bigger than 512x512

    Also make sure things are being deleted when & where they're suppose to be (right when they are no longer of use) .

  • i think its all about your capx and even sheet however ...

    -read performance manual (avoid every tick, enable physics / behaviors / collisions = important only when it is necessaire)

    -read dont waste your memory tutorial (avoid transparent spaces, optimize your images etc ...)

    -if you use ads ... dont show it when the game is runing (show then only in start layout/ game over .... loading status)

    -use family and groups (that help me a lot ... believe me)

    -pixel rounding to on , webgl to off , sampling to point (spacially for pixalized game),switch all to low quality

    and more others tricks and tweks ... it depend on your game

  • EyezWidee , matrixreal . Thanks for the replies, I'll take what you've said on board.

    I've read the manuals and tried to incorporate those tips into my game, to be honest most of the things you've guys suggested i have done so (i think). I do however have some images bigger than 512x512 for my background, i've tried using a smaller image size but it doesn't come out right so i left those.

    I'm thinking it may be something with my event sheets which could be improved which is why i've asked for help. If you guys are willing to take a look at my capx and see if there are any issues, then that would be great.

  • then post your capx and we will try to find what go wrong

  • I can't as i mentioned in the first post that the file is too big for me to post it here. I can send it via email if thats OK?

  • try to replace different sprite with simple square and post it

  • i hade same performance problems as you in the begining ,here are some performance tips :

    • manually make your collision polygons and reduce the points if possible.
    • don't make very big objects , i know when you are a begginer you just drop 2000x1000 image to be a backdround

    just split it for example the background for the sky used a tiled background using small 32x32 single color image.

    and the backgrounds element as sprites for examples the trees and clouds and moutains each one of them in a sprite , that would be usefull to make parallax too to make the game looks nice.

    • reduce the loops and timed events as much as you can , when you know the score will change only when action happens for example player passes an obstacle , there is no need to make everytick set text....that uses a lot of the devices resources with no need.
    • if you need an object with 64*64 size don't make 256*256 then scale it down in the editor thats not helpful to save the platform resources.
    • try not to make more than 20 sprites in a single layout. if you need something to be used in another layout don't make another oobject just use that one, to minimise the number of used assets and the app size and the loading time.
    • don't use text object use sprite-font instead.
    • some proprities are helpful , like pixel rounding , enabling opengl , not clearing background, fullscreen scaling.
    • try not to make more than 100 event in eventsheet.
    • there are some very helpful features in C2 like importing eventsheet into other layout. and making groupes and functions when you don't need some event tests to happen yet just put them in a inactive groupe and activate them when needed the same for function when you need some some actions to happen in my conditions just put them in a fonction and call it when you need it.
    • use as less physic as you can you know it need a lot of mathematic calculations.

    and finally in export process don't forget to compress Png even brute compression isn't bad C2 suggests normal compression because it takes less times i didn't have problems with brute compression. and don't export to phonegap it kills the game performance.

    when you make project be sure to do all the above and i'm sure it's going to be fine.

    ohh i mostly forgot , don't forget to destroy objects outside of layout or when it not needed anymore. some people spawn a lot of objects like in autorunner the obstacles will randomly generated and keep moving until they leave the layout view. it's not helpful at all t have 100 ojects keep moving to the infinity , and the apps makes the calculations for them while you don't need them anymore.

    i hope this helpful , i'm sure you have read the performance tips in the tutorial but i have mentoned other things that might be very helpfull too.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The next power of two value after 512x512 is 1024x1024 after that 2048x2048 etc..

    Anything over 512x512 is gonna (just check in debug mode, notice how much cpu is beeing used and what is taking up the most memory) .

    you can also do stuff like 512x256 and such if it helps maintain , and if its still looking distorted change your game to pixel rounding: ON & sampling to Point

  • Thanks for the replies, i've tried the power of 2 for my background but my background sizes are a bit awkward, as i have 4 different sprites for my background working as a parallex. Each one of these has a width of 960 but different heights (my game layout is 960,540). This could seem a little confusing so rather than attempt to try explain, i'll just post a capx.

    With this capx, i've stripped my game down completely. I've changed the sprites from my game to random ones i've found on the net. This is more or less my game but i've taken some things out, but the main parts such as platform movement etc are there. I've actually left the sizes of the sprites so that its as similar as my actual capx as it can get.

    Would be grateful for any help.

  • Anyone?

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