How to reduce the number of crashes (mobile)

  • matrixreal No a container layout is the best practice you can use because to create a object it has to be somewhere in your project if you have a container layout the images are only loaded when used or else for some objects i.e bullets you would have to put them somewhere in your project that is a active layout using memory that doesnt need to be used

    i prefer to put object on every layout (put them on layout but outside layer) and add for example an destroy outside layout behaviour ... this will optimise performance if you have to create them ... (read performance tips by ashley)

    or maybe i don't understand how you create this "container" layout .... ???

    maybe its a layout without even sheet ?

  • maybe its a layout without even sheet ?

    Yup. Giant layouts with no events, never called via events. It's just to set the object properties.

  • >

    > maybe its a layout without even sheet ?

    >

    Yup. Giant layouts with no events, never called via events. It's just to set the object properties.

    Actually .. I tend to add event sheets to my object layouts

    So annoying when you tweaked something ... run it .. and it loads the objects layout lol

    My object event sheets generally have something like:

    On start of layout, go to main menu

  • >

    > maybe its a layout without even sheet ?

    >

    Yup. Giant layouts with no events, never called via events. It's just to set the object properties.

    Wow, what a great idea. Can't believe I never thought of that before.

  • Wow, what a great idea. Can't believe I never thought of that before.

    Yup, great to test positioning of objects and relative size etc:

    [attachment=0:1vqy1zs9][/attachment:1vqy1zs9]

    Also a good testing layout is the screen size for HUDs & UI, so you can see it quickly develop and its fast to readjust, finding the X/Y for where sprites need to be.

    Anyway, hopefully the crashes for OP are resolved. Good luck with it!

  • Thanks again for the help. I already reduced the memory usage by splitting one layout into two (was using container layout already).

    Now I've got a question about music.

    For some reason, on an iPad, music only starts when touching the screen once the layout has started. This cause massive music problems in Healer Quest, and it happens when exported both with XDK and Phonegap Build. FYI there is no such music problems on android, and I think it's correct on iPhones, too (problem iPad only AFAIK, experienced on iPad Air 2 and iPad Mini 2).

    To counter this, the only solution I found was to add the music into the sound folder, and here is my question : Does making this increases the memory usage even if the music is not played?

    Another question : Is there any "clean" way to play music correctly on the iPad?

    Thanks!

  • I really would like to know if there is a clean way to play music on the iPad without having to put all the music in the sounds folder. Anyone has music working without nedding to click before it starts playing?

  • In other words, the image file size/format has no effect on memory use. It's effectively decompressed and loaded in to memory as a 32-bit ARGB bitmap.

    Does it means that if I have a 1024x1024 pixel spritesheet in my "image" folder, whether it is full of sprites, or just plain transparent with only a few sprites on the top half of it, it will use the same memory during the game?

  • Does it means that if I have a 1024x1024 pixel spritesheet in my "image" folder, whether it is full of sprites, or just plain transparent with only a few sprites on the top half of it, it will use the same memory during the game?

    Yes.

    1024 x 1024 images in vram is 4MB of memory, regardless of the original format or whats on it.

    2048 x 2048 = 16MB of memory.

  • Thanks again for the help. I already reduced the memory usage by splitting one layout into two (was using container layout already).

    Now I've got a question about music.

    For some reason, on an iPad, music only starts when touching the screen once the layout has started. This cause massive music problems in Healer Quest, and it happens when exported both with XDK and Phonegap Build. FYI there is no such music problems on android, and I think it's correct on iPhones, too (problem iPad only AFAIK, experienced on iPad Air 2 and iPad Mini 2).

    To counter this, the only solution I found was to add the music into the sound folder, and here is my question : Does making this increases the memory usage even if the music is not played?

    Another question : Is there any "clean" way to play music correctly on the iPad?

    Thanks!

    Never put Music into the sounds folder, it explodes the memory usage to insanity due to decompressing your music into raw wav files to store in memory to play instantly.

    Music is streamed, to minimize memory usage.

    The touch before playing is an issue with some browser engines on mobiles. You can bypass this by making a intro screen at the start of your game, requiring users to touch it to start the game. Think of consoles, "Press Start Button" menus.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • > In other words, the image file size/format has no effect on memory use. It's effectively decompressed and loaded in to memory as a 32-bit ARGB bitmap.

    >

    Does it means that if I have a 1024x1024 pixel spritesheet in my "image" folder, whether it is full of sprites, or just plain transparent with only a few sprites on the top half of it, it will use the same memory during the game?

    Yep. The content of the image does not matter, even if it is fully transparent: every pixel is still loaded in to memory with alpha, red, green and blue components.

  • Thanks Silverforce and Ashley, this is very useful. Now I know how to optimize my images.

    On the music problem, I started a topic this morning, but the problem I have is that every time a music should start playing, it is delayed until the user touches the screen. I'll try to rebuild with the latest version of XDK and hope the problem will be solved by itself.

  • I updated my games with the many advices in this thread. I've tested it for more than 2 hours without a single crash! Awesome!

    But as I told, I now have unbearable music problems, and it's not just about adding a touch to start the game. Every music in the game needs a touch before it starts (tested on iPad Mini 2 and iPad Air 2)! This is especially problematic after the player wins a level. Right now, the game display a big "VICTORY" word but plays no music... Then as soon as you click the button to continue, the victory fanfare starts playing. Ridiculous.

    Is there no way to play music correctly on iPads? (not sure how it goes on iPhones as I don't have one).

  • If you have a short "victory" music, you can put that into the sounds folder to ensure it plays instantly without touch input.

    Longer audio tracks leave it as music, touch to start is a limitation on browsers for mobiles, just work around it or incorporate it into your game.

  • If there is no way to make it perfect, I will just deal with it.

    Thanks for the info.

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