I almost put “resolution” in quotes in the title since I know there are a number of factors (don’t ask me to list them, ha). The last time I had to figure this out, 800x600 seemed the right answer since not everyone had a “hi res monitor”.
How big should my screen be, width and height? I’ve been getting my Phaser feet wet with sprites that look “fine” based on a target 800x600, even when scaled to twice that so it’s almost a mute point…
… but I know we’re all 16x9 now and am asking for advice. What are y’all doing?
Phaser size can set by window.innerWidth\window.innerHeight(you shouldn’t set viewport width=devicewidth etc)
resolution is another story
sprite size set can use scaleManage
I just added a repo with an example of the optimal game resolution for any device (including tables and pc). This will make your game look as sharp as possible on any device
Wow! This will help a lot once digested … and it confirms my suspicion, the raw images should be large (way larger than I guessed)! The game I’m porting, lol the largest sprites are 90x9 and 100x40.
I really appreciate this @yannick and will be back again with questions… thanks!
I got into this today and started to panic when I saw the contents of src/atlas but was pleased to find TP’s Black Friday sale “discount expires in -8 days”
I need more sleep, hopefully it’s not another silly question… why width/3 here?
I can’t get head around this… these 800x600 character sprites, how do they relate to the “house” or the “world” backdrop… those surely don’t need to be rendered 8000x6000 if my question makes sense? I might believe the house 8Kx6K but my mind explodes thinking the “world” at 80x60k pixels.
I agree. Not to sound rude but we shouldn’t have to redo ALL of our artwork in order to resize everything correctly. We should be able to resize the window and have all the assets resize with it while still providing optimal resolution.
Hmm I’m not sure what you’re agreeing to? I just finished porting enough over to evaluate my game in Phaser. If you look at http://www.bitblaster.com/pdw0 these are the same tiny sprites as I used 10 years ago on CRT’s at 800x600… looks good!
But, on today’s jumbotron 1920x1080 every pixel is stretched, folded and spindled significantly and I think it’s worth the effort to redo my assets to squeeze some crisp juice out of this game. Of course I might feel differently if they weren’t either abstract ideas or crudely drawn scribbles a programmer might have created in an hour or two
Simply to add the object at 1/3 of the screen width
No, the highest resolution I target is 640x360 times 4 (which is 2560x1440). On every device with a higher resolution than this, you can scale and stretch the canvas to fit into these 2560x1440 or scale the background image down.
You do not need to, unless you want your game to look sharp on every device. You could simple set a fix resolution of 1280x720 and use a simple built in scaling strategy from the Phaser ScaleManager to scale the game to fit any device screen.
It is up to you how much effort you put into your games. The strategy I published in the git repo above seems to work best for me, since I want to publish my next game to any platform including Smart TVs.
But if you are only targeting mobile, maybe it is easier to choose a fixed resolution.
One great thing about this strategy is that it is easy to let the user choose if he wants to scale down if the game does not render at 60fps on his device. Simply ask the user if he want to restart game with a lower resolution and manually scale the resolution down.
// is the user not happy with 'best',
// simply set the graphics to 'medium'
// (maybe store the settings in LocalStorage)
const graphicsSettings = { best: 1, medium: 0.75, low: 0.5 }
const DPR = window.devicePixelRatio * graphicsSettings.best
Man I’m so close! I’m going to have to try to simplify so to have something useful to share unless something breaks open soon.
TP says, “The maximum texture size for mobile devices should not exceed 2048. Bigger textures might not be displayed on some devices or might cause jittering sprites.”
I think you’re saying we don’t need to worry? thanks
… and am sending up a flare, so stuck, what can I do?
PS: So all that and now as I’m about to click the button and post, the example no longer behaves like my game source! There’s still a wide spot on the right though so I do need help Thanks!
I take your point, yes this project is (supposed to be about just) porting an old fixed-width game to the web. I’m looking forward to going deeper in V2.0 which needs to be responsive.
Changing those constants fixed the issue! Almost entirely, I will need to circle back around on this topic but can proceed with confidence my tests will run ok, will be far more than “darn, it looks right on my computer”. THANKS!!!
I have a question. What if my game has a lot of images, let’s say 1000 images? I want my game to be responsive for PC and mobile and to be as sharp as possible, so making 4 images with different resolutions would come out 4000 images, and it doesn’t seem like the best solution. What would you recommend in my case?
I find myself struggling to make a decision on handling a super high res game on mobile. On my 4k monitor they are crisp and awesome looking, but the assets/tiles/sprites are overkill on mobile and causing a problem