Mobile content size issue

My game appears like this in HTML5 and desktop:

But looks like this on mobile:

The game’s content looks far too small on mobile and I don’t know why this is happening. I have the “High DPI” setting enabled in the game.project file and it seems to do nothing.

I’m also using the Orthographic Camera asset. Its projection is set to FIXED_ZOOM and set to a zoom level of 2 in all cases.

I’d like all the assets to look twice as big as they currently are. What can I do?

Hey, Sorry upfront that I do not have an answer for you. But I do have a question for you. I see your game uses slopes. Is that a custom platform engine or are you using something like platypus?

Wish I knew enough to help. My apologies.

The ground collision uses a raycast to check below the player. If the raycast collides with ground, the player’s position is set to the raycast hit position (at an offset). The raycast fires down a little further than where the player’s feet are so that it works on slopes.

I used to use Platypus, but it had issues so I replaced it with this system.

This works fine for my game since there’s no jump button. But if I added jumping I’d have to modify it a bit, maybe by disabling the raycast while moving upwards.

2 Likes

Ahhh, that makes since. I have been trying to add slope support, but no one engine has proven to work well with my enemy AI. Thanks and good luck.

If you take a look at the screenshot you have from the mobile version it looks like there is a 2x zoom set:

Each pixel is 2x2 pixels wide, which is what I expect from a fixed zoom with level 2. The same is true of the desktop/HTML5 build. They both apply the correct zoom as expected. The difference is the pixel density and physical screen size. Your mobile phone probably has a much higher pixel density and it most definitely has a smaller physics screen size. This will obviously make everything look smaller.

2 Likes

It looks like the solution is to set the zoom level to 2 or 4 depending on device.

Is it possible to detect if the screen has a high pixel density so I can do this?

I decided to use a naive solution for now, checking if the window height is greater than 1000. If this is true when the game starts, set zoom to 4, else set zoom to 2.

This seems to work fine on an iPhone XR and iPad Pro (2018), but it would take an extraordinary amount of time to test on all devices and I can’t guarantee that this is a universal solution. I’m open to more ideas.