Help with cross-platform Audio & Input

Get help using Construct 2

Post » Sun May 20, 2012 3:29 pm

Hello everybody!
Two questions related to the best way to port the same webgame to pc and ios web.

1) how do you overcome the nightmare of having different audio formats for different browsers? (especially with ios's safari).
Since appears to be no one-solution format, how do you conform to all?

1)b)Somebody found an easy workaroud to the lack of audio on ios safari? Some I found in the community works but are a pain really.

2)When you make a webgame for pc and also for ios web browsers, how do you manage the dual controls scheme when there's no 1:1 correlation between pc controls and ios heavy use of touchscreen?
I think the answer is to have a "Case" or many "if" here and there but maybe there's a more manageable solution. Some kind of master controller that switch "versions" depending of the platform initiating the game.

Very lost in portability techniques. Any help would be appreciated a lot.

John.
B
31
S
4
G
4
Posts: 110
Reputation: 4,588

Post » Sun May 20, 2012 3:50 pm

1. For desktops, you will have to live with having two audio formats. Sorry. It's the browser's fault.
In terms of mobile, you will be hard pressed to get even the simplest game to run at any decent framerate on iOS safari... No need to try to conform to this platfrom then, much better to use a wrapper (directcanvas or cocoonjs).

2. You will have to detect whether the user is using a mobile device, then change control schemes according to that. It would probably be better to export two different versions.

Basically, look into wrappers instead of using the device's browser. Unfortunately you will be very disappointed about performance in this regard if you choose not to use a wrapper.sqiddster2012-05-20 15:51:08
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Sun May 20, 2012 4:15 pm

1) If you're on Windows 7 or up, you can just import WAV files to Construct 2 and it will dual-encode them to both AAC and Ogg Vorbis automatically for you. That covers all browsers. If you're on XP or Vista for licensing reasons we don't encode to AAC automatically, but you can find free tools to do it yourself. Hopefully on Windows 7 and up it's not a nightmare, it should be quite straightforward.

1b) There's nothing you can really do about it in the Safari browser, but there are various native-app wrappers that can make iOS apps with extra features like audio working. See PhoneGap, directCanvas and CocoonJS.

2) Have a look at Touch controls and a trick to detect input method
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Mon May 21, 2012 1:43 pm

First, thanks for the quick responses.

1)That dual-encode is pretty good stuff to have. It solves this problem. I'm using windows 7 so this issue is gone for me. Good work Scirra on this one. But a question anyway:
This dual-encode works too using those below-mentioned wrappers for ios browsers?

1)b) I know about the wrappers, that is the only way to go so far.
Isn't Construct 2 already capable of exporting using those wrappers?
I belived that appmobi was more or less done in the last release of C2 and CocoonJS was in testing phase for android apps.
How's the development going for this kind of "html5 to native" solution?
Using of course those mentioned wrappers.

2)Sqiddster is one of those users I take as a reference about the way to go. So you say it's better to make a dual project instead of losing hair detecting devices in-code? So far this is my approach since probably other areas will suffer severe changes in format too.
I'll check those methods you mentioned Ashley, just to have all grounds covered.

To extend the question in 1b, If I export using a wrapper like, say, directCanvas, I gain audio and speed, but there's a stopper somewhere? Some feature unsupported or any side-effect in the process?

Last about the wrappers,
Can be used with constuct 2 to make native apps and ios webgames or works just in one front only?

Thanks in advance, i found no other reasons or walls on my way if those questions are answered in a positive way. Fingers crossed!
B
31
S
4
G
4
Posts: 110
Reputation: 4,588

Post » Mon May 21, 2012 1:52 pm

Dual-encoding works with all wrappers as well.

The situation is like this:
PhoneGap support is mature and can build native apps for iOS, Android, Blackberry, Windows Phone 7 and a couple others. However it's sometimes slow, because it uses the device browser.

CocoonJS and directCanvas are newer and still experimental, but sound should work on both. These also are much faster than PhoneGap (5-10x faster), but some features do not work because they do not directly use the device browser. They're still definitely worth checking out, though.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Mon May 21, 2012 2:59 pm

To close as solved I recap:

1) how do you overcome the nightmare of having different audio formats for different browsers? (especially with ios's safari).

2) When you make a webgame for pc and also for ios web browsers, how do you manage the dual controls scheme when there's no 1:1 correlation between pc controls and ios heavy use of touchscreen?

A)
1)All audio problems are easily solved in any situation/device/platform just using Construct 2 dual-enconding feature (W7 Only) and wrappers for ios browsers. Dual-encodig works in any situation.

2)If controls are easy to replicate then use C2 methods described in tutorials and blog. But if the controls are too dispar then a dual project could be more manageable in the long run.

Workflow for webgames so far:
1) Develop for pc, keep controls in mind if you intend to export to ios.

2) If you develop under windows 7, any audio issue across browsers and devices will be automaticly fixed with C2 dual-encoding feature.
For other OS, you need to do this by yourself.

3)When you want to export your webgame from pc to ios make it as a separate project or see tutorials for ways to detect devices and use only one project/code for any end device/platform.

4)Export your final project to ios using a wrapper, PhoneGap for easy casual browser games (given it's slow) or directCanvas/CocoonJS for speed and more "native" games (as those doesn't use ios browser).
THE END

Thanks Ashley and Sqiddster for your atention to my questions!
B
31
S
4
G
4
Posts: 110
Reputation: 4,588


Return to How do I....?

Who is online

Users browsing this forum: SpartCrafter and 24 guests