One level freezing on iPhone device

Home 4 Forums iOS / tvOS Starter Kits The Role Playing Games iOS and tvOS Starter Kit One level freezing on iPhone device

This topic contains 23 replies, has 2 voices, and was last updated by  Universe 5 hours, 53 minutes ago.

  • June 12, 2018 at 1:08 am #184737

    Even though checked all scenes (non iPhoneX) for consistency at 3rd level scene my game freezes. Any ideas? Cant figure out what else to check.

  • June 12, 2018 at 10:25 am #184753

    Project tested fine. Played through it once and made it to level 3 fine. I think you should make use of the Clear array though….

    https://cartoonsmart.com/the-clear-array-in-the-role-playing-games-ios-starter-kit/

    You mentioned in the email you had issues with the portal working and sometimes not working, so that could be a sign that you aren’t clearing out some of the inventory values between levels. Inventory is treated like any other UserDefault so if you’ve gotten a key in Level 2, then quit out the app, reopen and go back to Level 2, you’ve still got that key. A portal door should still open if you’ve got two of the same thing, but still. I wouldn’t rule that out as the problem.

    If things work fine from a clean slate though, thats a good sign.

  • June 12, 2018 at 10:58 am #184754

    Thanks for checking out.
    I added Clean array in plist under next level node (E.g., CastleKey under Dungeon level). Is that correct?
    I played again but still app does not work properly (previously described left dead body of player and cannot exit scene). Even if you reach level 3, the problem may appear later – like after loosing 2 or even 3 times in the same level. And even if you pass to finish of game, game may stuck in level 3 and not switch to winners scene. Is there something to check in between of same level sessions (when player is killed by enemy)? I am not finding any parameter in plist but not sure to touch the code.
    Thanks!

  • June 12, 2018 at 12:27 pm #184755

    Clear not Clean. But otherwise, yes.

    Try adding EndPhoneX.sks just to rule out that isn’t the problem.

    For the player dying issue, find this function…

    func killPlayer(){

    … and load it up with print statements to see at what point it’s getting to.

    You could do the same in the resetLevel() function right below killPlayer()

  • June 12, 2018 at 7:56 pm #184785

    Yes, sorry, i did use Clear with same result.

  • June 12, 2018 at 11:06 pm #184805

    Hi Justin – i found that the same issue exists in standard RPG Kit without any changes.
    I will send you details how to find the bug. Hope it can be resolved or workaround found. Thanks!

  • June 12, 2018 at 11:17 pm #184806

    You’re gonna make me test getting killed 7 times in a row? Alright. I better see this bug =)

    • June 12, 2018 at 11:20 pm #184807

      Yes, please move the player to clone2, allow it to be killed. Repeat the process 6-7 times.

  • June 13, 2018 at 12:02 am #184808

    Well, I made it to around 14 deaths and respawns, but it did finally crash with this error in the Output window….

    2018-06-13 00:49:19.351519-0400 RolePlayingGames[19760:5693252] SKAction: Error loading sound resource: “Whoosh.caf”

    That ran a few times for a few sounds (all of which were playing earlier in testing) so this seems like a Sprite Kit bug I read about a while back….

    https://forums.developer.apple.com/thread/63532
    https://forums.developer.apple.com/thread/20014
    https://stackoverflow.com/questions/26683171/skaction-playsoundfilenamed-crashes-when-repeat-sprite-kit

    Nice to not be alone, but waiting on Apple to patch this up could take a while. Two things to try. Convert your sounds to mp3. Apple has long suggested caf for short sounds in SpriteKit, but maybe mp3 won’t cause as many issues.

    Go into the code in GameScene.swift and with the rest of the many variable declarations add in…

    var sound1 = SKAction.playSoundFileNamed(“[replace in sound name here].mp3”, waitForCompletion: false)
    var sound2 = SKAction.playSoundFileNamed(“[replace in sound name here].mp3”, waitForCompletion: false)
    var sound3 = SKAction.playSoundFileNamed(“[replace in sound name here].mp3”, waitForCompletion: false)

    For your sounds and see if pre-loading them like that makes any difference.

    • June 15, 2018 at 1:55 am #184944

      Justin – why is that for you it takes 14times, but for me in any device exactly 7times? Pulling my hairs out in this.

  • June 13, 2018 at 2:26 am #184811

    Justin – tried out changing file names to mp3 (files and plist), but then sound from these files within games disappears at all.
    Further added variables for all those files (with .caf extension). But the problem remains the same. 4th day as stuck with this. Wondering if it can work at all.

  • June 13, 2018 at 10:25 am #184814

    That could be an encoding issue with the mp3. I use an app named Sound Converter Here’s the function that plays sound…

    func playSound(_ theSound:String , noOverlapping:Bool  ){
            
            if (theSound != ""){
                
                
                if ( noOverlapping == true) {
                
                
                    if (self.action(forKey: theSound) == nil) {
                
                        let sound:SKAction = SKAction.playSoundFileNamed(theSound, waitForCompletion: true)
               
                        self.run(sound, withKey: theSound)
                    
                        print ("will play \(theSound)")
                    
                    } else {
                    
                        print ("the sound \(theSound) is already playing")
                    }
                
                } else {
                    
                    let sound:SKAction = SKAction.playSoundFileNamed(theSound, waitForCompletion: true)
                    
                    self.run(sound, withKey: theSound)
                    
                    print ("will play \(theSound)")
                    
                    
                }
                
                
            }
            
        }
        

    There’s nothing in there that prevents mp3 from playing (it isn’t specifically looking for .caf in other words). Are you reading the print statements in the Output window?

    One thing you definitely need to do is file a bug report with Apple. I just filed one. The more bug reports the better, especially while the latest Xcode is in the works. Its going to be tough to give them an example (they won’t test your game long enough to see this bug in action), so I would just basically remind them this issue still exists. Clearly they didn’t fix it a couple years back when most of those other devs were writing about it, or it’s crept back in.

    And like I wrote earlier, it took me 14 times of dying and reviving to get it to drop the sound. Your Apple reviewer won’t even die once. It’s not what they test for. So if the game is ready, get it out there as is.

    • June 15, 2018 at 4:35 am #184945

      Justin – an afterthought about playSound function in scene helper.
      Would it be possible to make separate function for each level?
      I am thinking that then possibility of this sound overload maybe would not accumulate and not start distruption in level one or two in your kit.
      Thanks!

  • June 13, 2018 at 6:26 pm #184839

    I think it is not about encoding, because the mp3 files play, just not in the app. So, i am wondering where else if have to replace caf extension with mp3 – besides file name, plist. In menu and home case, there is a place in the code where i change and it plays mp3, but for caf in scenes around player, items and enemies it looks different and changing to mp3 stop playing these sounds.

    I think, due to this error, it is not a good idea to release the app, because user will experience this crash at least once, if he/she is to complete the game until the finish (at least i cannot pass complete the game without experiencing this at least once).
    Is it memory related as mentioned in the discussion in Apple link (but we discussed earlier that it is not)? If so maybe have try to reduce the amount of sounds in the game or something? Thanks!

  • June 13, 2018 at 10:17 pm #184843

    Also, i dont think Apple review is the issue, i just dont want to scare away users with bad experience.

    Then you mentioned output. Did you mean debugger? I dont see any outputs from the kit as it would be for a nonSpriteKit apps.

    Thanks!

  • June 14, 2018 at 1:03 am #184888

    Justin – i figured out about output, please ignore that one: The results seen in output are that when the game stops functioning this kind of msg appears:

    2018-06-14 14:56:33.140158+0900 RolePlayingGames[7147:3201761] SKAction: Error loading sound resource: “Thud.caf”
    //Maybe other sounds too

    Kill player and reset function print tests are working properly.
    Please kindly advise what else can be done for users to finish game without disruption.
    1) I am still wondering why functioning mp3 files do not play in the kit game scenes with player and enemies (GUI menus are ok).
    2) Could reduction in number of sounds improve the situation? // I am exploring this now but sounds are quite necessary.
    2.1) Could using the same sound file in various situation help?
    3) Maybe reducing the sound file size could be helpful?
    4) Any other ideas?
    Please help!
    Thank you!
    I

  • June 14, 2018 at 9:50 pm #184937

    I converted to mp3 which worker via Adobe audition and also reduced files sizes. Now mp3 worked but no luck withe the app freeze issue i am struggling for 5th day. Very lonely suffering with the RPG kit. 🙁

    • June 16, 2018 at 9:21 am #184990

      I don’t think your Output window is showing in the project.

      Output Window in Xcode

  • June 16, 2018 at 9:19 am #184988

    Many of us developers have found bugs in Sprite Kit (and the rest of Apple’s frameworks). Around iOS10.3 Apple crashed every one of my sticker packs that had more than 20 animated stickers.But they fixed it in iOS11. Thats why we have bugreport.apple.com .

    This particular issue is going to be tough to get them to fix because it requires a lot of resetting the same level over and over again. And without a noticeable increase in memory (and there’s not), they won’t have much to go on.

    Here’s what I would do next. Try to isolate if removing anything in the game fixes this. Copy the project of course.

    Start by taking out the particle systems. Play through 7 or 10 times and see what happens. Still crashes, then you know its not the particles.
    Then remove all the TileMaps. Still crashes, then you know its not the tilemaps.
    Then remove all the sounds. Still crashes, then you know its not the sounds.

    And so on.

  • June 16, 2018 at 9:27 am #184992

    Yes, as concluded – it is sound files related. If sound disabled from the player, the game goes on.

  • June 16, 2018 at 11:18 pm #184998

    When did you post that earlier?

    Okay, new rule. Keep conversations about this to one thread. Posting about the same thing in multiple places is not helping.

    So describe exactly what you’ve done to solve this…

  • June 17, 2018 at 2:09 am #185015

    Not really – two posts about different malfunctions but turned out to be the same bug.

  • June 18, 2018 at 3:18 pm #185051

    It gets confusing with emails too. Just saying let’s keep it to one thread so I can track this easier. So describe what you did to solve this. Which properties did you leave out?

  • June 20, 2018 at 7:53 am #185108

    You have to sacrifice Class functionality in this kit by assigning different sound files to each to make the program stable till the winning end.

You must be logged in to reply to this topic.

Download the new CartoonSmart TV App - Tons of FREE and Premium Lessons

It's Free Right? Sure, I'll Get It!