I need your advice about game sounds.
I have about 100 short sounds and about 5 long music tracks. I combine them in .fla file and compile .swf file.
In my AIR game I dynamically load .swf and use it such way:
var appDomain:ApplicationDomain = null;
for each(appDomain in _applicationDomainArray)
{
if(appDomain.hasDefinition(name))
{
var temp:Class = appDomain.getDefinition(name) as Class;
return new temp() as Sound;
}
}
What can your recommend in OpenFL/Starling version of game?
Is it a good idea to embed about 100 .ogg files in project.xml?
For music tracks, it depends on how long the tracks are and when you choose to load them. Iāve found that OpenFL takes a while to load .ogg music files and that can cause hiccups in the CPU. We were loading music tracks in our OpenFL game (targeting a Windows .exe) as things were animating and there was always about a half second stutter.
If you can stomach using more disk space, .wav files will load very quickly. Otherwise, you might have to try loading the .ogg files on a separate thread.
Since they both have the same id, the Haxe code shouldnāt need any conditional compilation:
var sound:Sound = Assets.getSound("sounds/my_sound");
If you have a lot of sounds, it might be somewhat tedious to list every individual sound file in your project.xml, so you could include all sounds with a particular file extension like this:
On which target ? Pretty sure I used .wav on windows with no issue. If itās a Starling issue Iāll look into it
My experience with web is limited/old but I think all browsers do this and thereās no way around it ? Kinda like fullscreen, I think you have to make the user click or tap something in your app first (I could be wrong)
Yes.
I have <assets path="assets/sounds" embed="false" />
in project.xml
I converted .wav to .mp3 and now it works.
About my second question. I added temporal global listener to first TouchEvent from user to start music. I donāt know is it a good solution, but it works.
P.S. If it is interested - my current game working progress - Mushroomers Demo
My bad, I thought you were having an error when trying to get the path
Iāll do some further checking on this.
The game looks good already, I was lucky to find the button to change the language I love how russian looks but I canāt read anything ^^
I got some mushrooms but didnāt really understand what I was supposed to do
By the way, you might be interested in knowing that there is a port of as3 feathers for openFL-starling in progress. I donāt know how much time it will take though.