Jump to content

How can I achieve certain behaviour


mazoku
 Share

Recommended Posts

I think you'd probably need some sort of switch in your code that detects the difference between mobile and desktop. UA sniffing isn't infallible but is probably the most obvious solution here, or you could check screen dimensions, but that's probably even trickier to get a decent reading on mobile vs desktop.

Bigger question is why do you want to achieve this? Depending on your answer there could be an alternative solution.

Link to comment
Share on other sites

With the awful big res that is required from me on desktop only canvas performs ok. I have great performance on mobile with the auto setting (webgl most of the times) and canvas is slow on mobile. 

Again my resolution for this is way too big. 

Link to comment
Share on other sites

So maybe sniffing on pixel density and canvas size would be better than UA sniffing, both density and size are easy checks and then just manually choose which 'flavour' of Phaser you want (pretty sure this is exactly what the auto function does under the hood, although likely checks for the existence of a GPU).

Seems odd that the CPU performs better than the GPU, I have an oldish retina mac so a high resolution, great CPU and garbage GPU (I have 2, both fairly toilet) but I've never had an issue that swapping to CPU rendering solved.

Link to comment
Share on other sites

Phaser's AUTO logic goes - if WebGL available use that, else use Canvas.

Browser performace depends on many variables, the device itself being the biggest factor.  I've seen mobile browsers unable to push half as many pixels in landscape as they can in portrait.  I've seen browsers perform the best in webgl at low resolution, then perform better in canvas at higher resolutions.  Deciding on canvas/webgl mode based on it being a desktop browser might just seem right given the number of devices you've tested on, but in the real world it's different and forever changing.

If you can afford a bit of a delay on startup, then benchmark the device in both modes at the resolution and orientation you want to run at, and use that to decide.

ps. Phaser has a built in 'Phaser.Device.desktop' that you can use to determine which mode to set Phaser into (and a load of other useful ones ios/android/iphone/opad etc). There are other libs that specialise in determining the browser spec.

 

Link to comment
Share on other sites

Check your network tab in the console for any traffic during runtime, if there is none then the two setups 'should' be equal.

If' you're using a live reload system then that'll still be hammering the network even though the game assetts are loaded, and will cause stuttering.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...