Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

10 years ago by BrownHorse

The game works fine in Chrome and Firefox but not in IE11. I looked at the console and it says "failed to load resource" for all but a few sound files.

10 years ago by Joncom

Do you have both MP3 and OGG format audio files?

10 years ago by BrownHorse

Yes

10 years ago by Joncom

Does the error also provide a URL? What happens if you follow that URL?

10 years ago by BrownHorse

The error message is:
SCRIPT5022: Failed to load resource: media/sounds/piano/p_gs1.*

The link is:
loader.js, line 91 character 4

The URL bring me to this line in Loader
			throw( 'Failed to load resource: ' + path );

10 years ago by Joncom

Do you get the same error if you change p_gs1.* to p_gs1.mp3?

10 years ago by BrownHorse

Yes

10 years ago by Joncom

Does the same troubled IE have difficulty running other Impact games?
Such as Biolab Disaster?

10 years ago by BrownHorse

I was getting the same error with Biolab but then I reinstalled IE11 and it worked. My game is still not working though.

Here's an example of how I am currently loading my sounds:
ig.module(
    'game.note-sounds'
)
.defines(function(){

ig.NoteSounds = {
    
    guitar: [
        new ig.Sound("media/sounds/guitar/g_a1.*"),
        new ig.Sound("media/sounds/guitar/g_a2.*"),
    ],

Maybe IE doesn't like this syntax. Or maybe there are too many sound files (196).

10 years ago by Joncom

Still not working, as in, still getting the exact same error? You may want to try removing all sound files except for 1. You've just proven that some games (Biolab) can work with sounds in IE 11. So start simple, and then start adding things back.

Are you using Git? Because it can because it can be useful for taking a "snapshot" of where you are now, so you can feel safe to really pull things apart, knowing you can always go back. If not, a simple backup could work too...

10 years ago by BrownHorse

Yeah same error. I'll try what you suggested.

I haven't been using Git but I may start now.

10 years ago by FelipeBudinich

guitar: [
        new ig.Sound("media/sounds/guitar/g_a1.*"),
        new ig.Sound("media/sounds/guitar/g_a2.*"),
    ],

right there is the problem, IE chokes on trailing comas, it should be:

guitar: [
        new ig.Sound("media/sounds/guitar/g_a1.*"),
        new ig.Sound("media/sounds/guitar/g_a2.*")
    ],

10 years ago by Joncom

@BrownHorse: FYI... If you program with something like Sublime Text, you can have something called a linter, which tells you about syntax issues like the one FelipeBudinich just pointed out.

Does his answer solve your issue?

10 years ago by BrownHorse

Removing the trailing commas didn't fix my problem.

I tried preloading fewer sound files. I can preload about 10. Any more than that and IE has some sort of timeout and the rest of the sound files don't load.

10 years ago by Joncom

Are you saying you can predict with 100% accuracy when the game will fix and break, depending on if you add or remove that last sound to your game? Maybe see if you can create a fresh Impact game, with nothing except for a bunch of sound files. And see how many you can add. This will hopefully determine that "lots of audio" is the problem, and that it's not something funny in your other code.

10 years ago by BrownHorse

I did what you suggested. Here is my code:
ig.module( 
	'game.main' 
)
.requires(
	'impact.game'
)
.defines(function(){

MyGame = ig.Game.extend({

	guitar: [
        new ig.Sound('media/sounds/guitar/g_a1.*'),
        new ig.Sound('media/sounds/guitar/g_a2.*'),
        new ig.Sound('media/sounds/guitar/g_a3.*'),
        new ig.Sound('media/sounds/guitar/g_a4.*'),
        new ig.Sound('media/sounds/guitar/g_as1.*'),
        new ig.Sound('media/sounds/guitar/g_as2.*'),
        new ig.Sound('media/sounds/guitar/g_as3.*'),
        new ig.Sound('media/sounds/guitar/g_as4.*'),
        new ig.Sound('media/sounds/guitar/g_b1.*'),
        new ig.Sound('media/sounds/guitar/g_b2.*')//,
        //new ig.Sound('media/sounds/guitar/g_b3.*')
    ],
	
	init: function() {
		// Initialize your game here; bind keys etc.
	},
	
	update: function() {
		// Update all entities and backgroundMaps
		this.parent();
		
		// Add your own, additional update code here
	},
	
	draw: function() {
		// Draw all entities and backgroundMaps
		this.parent();
	}
});


// Start the Game with 60fps, a resolution of 320x240, scaled
// up by a factor of 2
ig.main( '#canvas', MyGame, 60, 320, 240, 2 );

});

If I uncomment the last sound my game stops on the load. I also tried it without an array and it could only load 9 sound files.

10 years ago by FelipeBudinich

Interesting (I guess the trailing comma issue got fixed after IE 8).

By the way, how many sound channels are you using?

The default is 4, maybe if you go down to 3, it will allow you to have more sounds.

Also, did you bake your game?
if not, maybe you are making too many server requests.

10 years ago by Joncom

Nice work. It's really looking like an IE issue at this point. Just to confirm things further, you could try removing the Impact component, and load a bunch of audio files manually, without ig.Sound.

var audio1 = new Audio('someSound1.ogg');
var audio2 = new Audio('someSound2.ogg');
var audio3 = new Audio('someSound3.ogg');
...

And see if you can break IE that way.

I would suspect you can, and for the same exact number of audio files.

If you can confirm this, this shows you that IE simply has issues adding that number of audio files or more. Or... I suppose it still may be possible that you have some malformed audio file that IE is getting hung up on...

10 years ago by BrownHorse

@FelipeBudinich: Thanks for the suggestions. Lowering the number of sound channels and baking didn't fix the problem.

@Joncom: Is this how you are recommending I load the files in order to test?
ig.module( 
	'game.main' 
)
.requires(
	'impact.game',
)
.defines(function(){

MyGame = ig.Game.extend({
	
	g1: new Audio('media/sounds/guitar/g_a1.ogg'),

10 years ago by Joncom

Yeah. That should work fine. It won't be preloaded that way, but that shouldn't matter too much. The test is to see if "too many audio files" breaks IE.

10 years ago by BrownHorse

I'm not sure this is proper syntax. I don't get console errors in IE or Chrome, but if I look at the network info it says the first sound file doesn't load.

10 years ago by Joncom

Doesn't load, but no error? That seems like a contradiction...

10 years ago by BrownHorse

I think my (stupid) mistake from the last post was that I forgot to put the audio files in the media folder.

I recently tried again in IE and did not get any errors in the console tab. I did have some results in the network tab though. In the Result column, only 10 of my audio files had a code of 200, the others had 304. And those 10 were the only sound files which were identified as audio/mpeg files in the Type column, the others were blank.

10 years ago by Joncom

If you share your test case, I could see what results I get on my end.

10 years ago by ManaSky

Hey, I had the same problem. Internet Explorer has a limit, so if you preload more than 40/44 (don't remember the exact number), it will not preload any sounds further from that. So I just load all my files on the go with Internet Explorer.

In init of ig.Sound

// Not explorer.
if(getInternetExplorerVersion()===-1)
this.load();

In play():

// Not explorer.
if(getInternetExplorerVersion()===-1) {
this.currentClip = ig.soundManager.get( this.path );
this.currentClip.loop = this._loop;
this.currentClip.volume = ig.soundManager.volume * this.volume;
this.currentClip.play();
} else {
this.currentClip = new Audio(this.path);
this.currentClip.loop = this._loop;
this.currentClip.volume = ig.soundManager.volume * this.volume;
this.currentClip.play();
}

Hope this helps!

10 years ago by ManaSky

Here is the code I use for checking if the browser is Internet Explorer:

function getInternetExplorerVersion()
{
var rv = -1;
if (navigator.appName == 'Microsoft Internet Explorer')
{
var ua = navigator.userAgent;
var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
if (re.exec(ua) != null)
rv = parseFloat( RegExp.$1 );
}
else if (navigator.appName == 'Netscape')
{
var ua = navigator.userAgent;
var re = new RegExp("Trident/.*rv:([0-9]{1,}[\.0-9]{0,})");
if (re.exec(ua) != null)
rv = parseFloat( RegExp.$1 );
}
return rv;
}
Page 1 of 1
« first « previous next › last »