Game crashing in Chrome.

Monkey Forums/Monkey Programming/Game crashing in Chrome.

Jesse(Posted 2011) [#1]
can people try this game and see if it crashes in your browser:
http://www.hexobot.com/html5/MonkeyGame.html
Actually, it crashes the browser.
I have been trying to figure out why it crashes on my computer when I run it in Chrome.
I can run it in Safari and it works fine.

the Flash version seems to be fine also:
http://www.hexobot.com/flash/MonkeyGame.html

I am using sounds as ogg and wav and are only supposed to play on supported browsers.


muddy_shoes(Posted 2011) [#2]
Runs without crashing for me on Windows Chrome 13.0.782.218.

Edit:
Also runs okay on FF6.
Runs without crashing on IE9, but the cushion collisions appear to add energy rather than dissipate it. One shot and all the balls bounce around faster and faster until they're potted or fly off the screen.


therevills(Posted 2011) [#3]
Works fine here runnng Chrome and IE9.

Looking good btw Jesse :)


Samah(Posted 2011) [#4]

:)


Bremer(Posted 2011) [#5]
It crashed with the following error when I tried it in Firefox 6.0. I know you wanted people to try it in Chrome, but you might want to know that it can crash in other browsers as well.

[Exception... "An invalid or illegal string was specified" code: "12" nsresult: "0x8053000c (NS_ERROR_DOM_SYNTAX_ERR)" location: "http://www.hexobot.com/html5/main.js Line: 856"]


Volker(Posted 2011) [#6]
Works in chrome and firefox 6.01 here.


Jesse(Posted 2011) [#7]
Thanks all of you!
it doesn't crash consistently or in the same place/time, I have gotten to play it for a couple of minutes and then it crashes.

Thanks zawran. I don't know what that means but I'll take a look into that.

I am surprised it hasn't crashed on Chrome. Hmm!
What to do? What to do?

[edited]

Thank's therevills, glad you like it.


Jesse(Posted 2011) [#8]
I checked the line 856 in main.js. it's the marked line in this function:

gxtkGraphics.prototype.DrawImageTinted=function( image,dx,dy,sx,sy,sw,sh ){

    if( !this.tmpCanvas ){
        this.tmpCanvas=document.createElement( "canvas" );
    }

    if( sw>this.tmpCanvas.width || sh>this.tmpCanvas.height ){
        this.tmpCanvas.width=Math.max( sw,this.tmpCanvas.width );
        this.tmpCanvas.height=Math.max( sh,this.tmpCanvas.height );
    }
    
    var tgc=this.tmpCanvas.getContext( "2d" );
    
    tgc.globalCompositeOperation="copy";

    tgc.drawImage( image,sx,sy,sw,sh,0,0,sw,sh );
    
    var imgData=tgc.getImageData( 0,0,sw,sh );
    
    var p=imgData.data,sz=sw*sh*4,i;
    
    for( i=0;i<sz;i+=4 ){
        p[i]=p[i]*this.r/255;
        p[i+1]=p[i+1]*this.g/255;
        p[i+2]=p[i+2]*this.b/255;
    }
    
    tgc.putImageData( imgData,0,0 );
    
    this.gc.drawImage( this.tmpCanvas,0,0,sw,sh,dx,dy,sw,sh ); <-*******************************
}


it's the drawimage line but I don't have that problem here everything displays fine. I don't see anything missing either. I have a suspicion that it might be the way firefox handles 'zero' scaled images. I don't have firefox so I am going to have to install it to do some tests. darn It!

I did noticed that the mserver is reporting that its trying to play wav files in Chrome so that might be the cause of the crash but since no one else seems to be reporting the crash, I am at a loss here. I don't know what to do.


Bremer(Posted 2011) [#9]
In my own game I have seen crashes which has refered to a line with "drawImage" as well, but I could not figure out why it crashes, but you might be right that it could have something to do with zero scale images.

The flash version seems to be working just fine. I have tried the html version several times just now and it seems like it might have something to do with when a ball is taken away from the table. One error mentioned line 805 instead of 856?

Monkey is not the easiest thing to debug thats for sure.


matty(Posted 2011) [#10]
I have noticed in the past that on firefox 3.5 (old I know) scaling images to 0 in either width or height didn't crash but simply caused no graphics at all to be displayed...which was difficult to debug at first....


Jesse(Posted 2011) [#11]
after several hours of head banging, I think I solved it. there were three things that seem to have been wrong with the game:

first I made custom list class by adding some extra functionality to the original which was pretty limited for my use. I made some errors in adding the logic. I added a firstnode/lastNode and were not returning the correct node when the list was empty. that's fixed now(I think). this was the error that was being displayed in the Firefox Browser. surprisingly it seems to be the only browser doing the right thing.

the other was the 0 scale image. I limit the size to 1 pixel in size and that solved the problem.

the third thing was that the wav files seem to be crashing the Google Chrome browser. but what is odd is that neither of the other browsers were crashing. maybe it's an operating system thing.
Mine is Apple but I don't know anyone else's system. So far it's just a guess.

I posted a new link for html5 in the post above. Any one that tries it please report any bugs please.


I notice while running the html version on my Macbook the performance from best to worst:
Safari, Chrome,Firefox, Opera. Opera almost being unplayable at times.