It’s been a while since our last post. We’ve been busy preparing the Episode 2 of Sage Fusion. But now, we have (hopefully) a good news for you, especially those of you who have just bought your BlackBerry Z10 (just like our friend Yusdi who bragged about it here). We have finally submitted Sage Fusion to BlackBerry World for review.
While the other two developers were busy on preparing the Sage Fusion 2, I got a chance to play with Yusdi’s Z10. And turns out that BlackBerry Z10 is quite a remarkable device, especially in terms of HTML5 support. I had minimum to no problem porting Sage Fusion to BlackBerry. In theory, it shouldn’t be called porting at all. We are using BlackBerry HTML5 WebWorks for Sage Fusion, which is an HTML5 based app platform built in BlackBerry OS, therefore Sage Fusion should be able to run directly on BlackBerry 10. And it did, with a few bugs. So these are the challenges that I encountered during the porting process (Warning!! This part will contain some technical discussion. So for those of you who are not interested with such thing, just continue to the last paragraph):
- Big images were not displayed properly. One of the biggest shock that I got after installing Sage Fusion to BlackBerry 10 is…. All the big images were cropped out!!!! – We were so shocked that one of our friends were so angry he wanted to throw his Z10 to me (which I regretted he didn’t do so, otherwise I would own a Z10 by now). – To counter this issue, we use a small transparent png image as the ‘src’ for each <img> element, and add the actual image as its “background-image” CSS property. (We later learned that this bug is fixed in the 10.0.10.x version of the OS, but we decided to keep the “background-image” workaround so those poor users who are stuck with 10.0.9.x because their carriers are too lazy to push updates can also play our game).
- Screen scrolling. Another challenge that we faced is that sometimes when playing Sage Fusion on Z10, we could accidentally scroll the entire viewport. The funny thing is, we had already included — as far as we know — every code needed to prevent scrolling known to man (event.prefentdefault(), etc), but the scrolling still happened. So what we did is force the screen to go back to (0,0) position every time the game scene changes. Not a real fix, but we deem it sufficient enough as a workaround.
- When the game was minimized, audio was still playing. We have to detect the event (you can find the documentation here and here) when the WebWorks app is minimized and then pause all audio. After Sage Fusion is opened, we will resume the audio.
- Audio latency. There is a delay of around 0.5 to 1 second from the time a sound is loaded until it is played. Therefore, we had to implement a mechanism to preload the audio (which is HTML5 <audio>). This is especially important for battles.
- Game freezes when loading audio. At times when we were testing the game, there were occasions when the game would momentarily freeze for no particular reason, seemingly at random. Sometimes it froze for only a few seconds, sometimes longer. Upon further investigation, we found out that these freezes always occurred when an audio stream is being loaded. Upon further investigation, we found out that when we had three audio streams loaded at the same time, the third one would often go completely silent — after the freezes in particular. In the end we decided to limit the number of audio streams to just two. This comes with a small sacrifice, however, because we had to remove the “clicking” sound effect for battle menu. Because of the need to preload audio, we would have needed three audio streams for battle if we wanted to include the clicking sound effect: the music that keeps playing on the background, the clicking of the menu selection, and the action sound effect which is already preloaded during the menu. In spite of the challenges on using the HTML5 <audio>, Blackberry 10 support for HTML5 <audio> is among the best, considering that I didn’t need to create native code for the audio.
- OS Update. Well, it’s not a bug or something, but the way BlackBerry updates its OS is quite troublesome for us. BlackBerry OS updates must be pushed by carriers, so users are at the mercy of carriers to get their new features, bug fixes, and — most importantly — security updates. We had to use a dead SIM card from a different country to update. This is 2013, BlackBerry; wake up! (We’re aware that 10.0.10.x includes changes in software radio that require approval of carriers, but you can separate the update into two separate updates or whatever. It’s not rocket science. Linux distros have been doing that since, well, ever).
- BB World problems. After all the technical problems we encountered, finally we were ready to submit it to the BlackBerry World. We were so excited. BUT… it was not the end of our suffering. When we tried to upload the binary to the BlackBerry World, we failed so many times. There were a few reasons to it:
- our internet service provider is very unstable (read: total crap), and of course, not very speedy. For this issue, our solution is go to the nearest Coffee Shop, order a cup of coffee, and ask for the WiFi password.
window.xhr = new XMLHttpRequest() window.xhr.open("GET", "https://appworld.blackberry.com/fill-with-whatever-the-error-throws-at-you",false) window.xhr.send()
I have contacted the BlackBerry support and they are very kind to offer to upload the binary for us. We ended up not taking their offer, though. (But kudos for excellent developer support!)
- When we tried to download our game from the BlackBerry World (as a draft), It kept puking up an error which, curiously, can be suppressed by changing the user’s screen name. Since I used Yusdi’s Z10, he complained to me for changing it too many times. “BlackBerry is so gonna ban me for changing the screen name three times a day,” said he.
Geez it’s a long writing. So.. Yes, we experienced a number of problems in making Sage Fusion run on BlackBerry Z10, but just like Yusdi said, “It’s impossible to be able to install a software to a new hardware and have it run properly the first time without the need to tweak it”. And overall, BlackBerry Z10 is a remarkable device. And it got me thinking, maybe I should buy a Z10. Or, maybe I could just take Yusdi’s.. He’s too busy doing the Sage Fusion 2 anyway, no time for him to play with his BB Z10.
Update: Sage Fusion for BB10 is now Built for BlackBerry certified.