Weird Sound bug
I found a strange bug that popped up on me on Friday. I’m working on 2 different versions of the same game, a platformer and an endless runner, I’m not sure which I’m gonna go with in the end. But any I was working on the endless runner and my character would no longer jump as if it was colliding with an object that wasn’t there, it tried to jump but only moved a fraction. I tried different things buttons you name it nothing worked. So I moved to my platformer and the characters all behaved properly only none of the sound effects worked at all just the background music. I tried loading new sound files...nope, tried deleting and replacing...nope, reloaded the app, restarted my iPad(iPad Air 2) nothing worked. Deleted the entire thing and loaded from previous backups, this fixed my character jump issue but not the sound issue. So did some more fiddling couldn’t even preview the sounds. Went into the sound editor played a couple sounds and for some reason THAT FIXED IT! Quite the journey for 2 days was really bothering me. I should mention that I am running the developer beta for iOS 12 beta 4. Might have something to do with it. Although I didn’t have any issues on the previous beta.
Ok so now it won’t play sound in the endless runner version. Is anyone else having this problem? It won’t even preview the sound files, they are .wav files. Works on the platformer still though.
There have been a few reports of odd sound issues. Honestly not entire sure of what's going on yet, we haven't changed anything with sound yet.
We're working on changing the sound engine, may have to prioritize moving to the new engine sooner than planned.
@murtaza this is from the iOS 12 betas. It’s also happening in the older version of hyperPad. I’m also using latest betas of iOS. All have had this problem.
There’s also timing issues, within iOS 12, probably related. It uses display refresh signals differently from iOS 11.
@deeeds Could this explain the sudden loss in FPS that I’m getting in my scrolling background? About every 8-10 seconds on the endless runner the FPS drops from 60 to 20-30 for maybe a fraction of a second causing a small stutter. Seems that no matter how I set it up it’s doing this.
@lulabay Sort of. That's a different issue, stemming from the same root cause. One that's famous and integral to an un-fixed cocos2D-iPhone, which hyperPad is based upon. I've supplied them with sufficient info on the fix, they've said they can't (or won't) do it, despite it being something universal, and without side effects.
At the core of cocos2D-iPhone is a reliance on the unreliable, and uncertain flipping flags of a thing called CADisplayLink.
The solution I've shared, for this problem, will likely fix the audio and timing issues prevalent in iOS 12, as iOS 12 far more aggressively asserts control over (and more variance upon) CADisplayLink. Ultimately CADisplayLink will be completely untethered from any connection to device reality as it's used for all manner of frame rate efficiency variance efforts within iOS.
ProMotion displays are coming to iPhones sooner rather than later.
The solution, base the game loop on absolute time, and do own calculations of when a frame should be ready to present. Every other engine does this, as does every fixed version of cocos2D-iPhone. Or, you can do a hybrid approach, get ready to draw then wait for a CADisplayLink call, which many others do. Relying on CADisplayLink, though, causes the problem, as it's not regular, nor reliable.
This causes a race condition, wherein memory/objects aren't released until the OS senses memory pressure, at which point you see that stutter.
The two creators of hyperPad maybe forced to make a fix for iOS 12 that relies on Mach (absolute) time. It's not hard, and somewhere on these forums I've even posted the code to do it.