phaserjs / phaser

Phaser is a fun, free and fast 2D game framework for making HTML5 games for desktop and mobile web browsers, supporting Canvas and WebGL rendering.
https://phaser.io
MIT License
36.91k stars 7.08k forks source link

All 2.0 examples doesn't display on T-Mobile G2 Android 2.3.4 #590

Closed elitechance closed 10 years ago

elitechance commented 10 years ago

This phone works on the previous versions of phase 1.1.x

photonstorm commented 10 years ago

Very old phone, but regardless do you actually get a console error or something to go on?

elitechance commented 10 years ago

I was able to enable the usb debug for this phone but it requires a chrome browser installed in it and the latest chrome is not compatible anymore. I've tried the adb port forwarding but I can't make it to work. What I did is to check if this phone is still working on the latest 1.x series which 1.1.6 and it's working fine. You're right this is a very old phone and I'm just using for speed test. Too bad because I'm not sure on how to provide you with more info. Anyway, thanks for considering it.

photonstorm commented 10 years ago

I think in the old Stock browser you can actually turn on a javascript console! It's only in Chrome you have to remote debug it. It's probably hidden under a browser flag / setting somewhere, but I'm sure I did it on my nexus 1. I'll close this for now but please re-comment if you manage it.

elitechance commented 10 years ago

Thanks for giving me that idea, i was able to log some details using adb logcat. See logs below when loading the example game Tanks.

D/dalvikvm( 1589): GC_EXTERNAL_ALLOC freed 31K, 49% free 2922K/5703K, external 5816K/6413K, paused 91ms D/dalvikvm( 1589): GC_EXTERNAL_ALLOC freed 16K, 49% free 2922K/5703K, external 7029K/7074K, paused 34ms D/SearchDialog( 6181): launching Intent { act=android.intent.action.SEARCH flg=0x10000000 cmp=com.android.browser/.BrowserActivity (has extras) } I/SearchDialog( 6181): Starting (as ourselves) #Intent;action=android.intent.action.SEARCH;launchFlags=0x10000000;component=com.android.browser/.BrowserActivity;S.query=http%3A%2F%2F192.168.1.2%2Fphaser%2Fexamples%2F_site%2Fview_full.html%3Fd%3Dgames%26f%3Dtanks.js%26t%3Dtanks;S.user_query=http%3A%2F%2F192.168.1.2%2Fphaser%2Fexamples%2F_site%2Fview_full.html%3Fd%3Dgames%26f%3Dtanks.js%26t%3Dtanks;end I/ActivityManager( 1436): Starting: Intent { act=android.intent.action.SEARCH flg=0x10000000 cmp=com.android.browser/.BrowserActivity (has extras) } from pid 6181 E/browser ( 6181): Console: Uncaught ReferenceError: Float32Array is not defined http://192.168.1.2/phaser/examples/_site/js/phaser.js:57063 D/dalvikvm( 6181): GC_CONCURRENT freed 1992K, 56% free 5499K/12487K, external 4804K/5825K, paused 3ms+12ms E/browser ( 6181): Console: Uncaught ReferenceError: Int16Array is not defined http://192.168.1.2/phaser/examples/_site/js/phaser.js:15565

elitechance commented 10 years ago

After some research, Typed Arrays will only work on Android 4.0 and above: http://caniuse.com/typedarrays

elitechance commented 10 years ago

Again, after digging on ways for fallback, I found this solution and it works. Yey! http://stackoverflow.com/a/11278663

By adding typedarray.js in examples/_site/view_full.html, Tanks is running again :).

photonstorm commented 10 years ago

Ohh that's really interesting, thanks! I'm going to remove the use of the TypedArray internally. It's used for Sprite cache data. Should be a simple change, rather than having that massive polyfill. Of course P2 uses TypedArrays all over the place, but you simply can't use those on Android 2.x.

photonstorm commented 10 years ago

Could you grab the dev build for me and see if that fixes it please? :)

elitechance commented 10 years ago

It's working, kindly confirm if I did it correctly. I checkout dev branch then copy the file form build/phaser.js to phaser-examples/examples/_site/js/.

photonstorm commented 10 years ago

Yes you did it right. Awesome :)