How to determine size?

I am learning and want to create a game for android phone.
For my first game as learning, I am taking reference from one of existing game.
For now I am creating screen to look like this:

My queries are how to determine these:

  1. What height and width should I select in game.properties? (ticking on High-Dpi)
  2. What should be the size of these dot looking sprites in px for png?

Thanks

I would set the width and height to a common enough size for mobile phones such that the game area fits inside this width and height and then leaves empty space above and below when playing on a taller screen or on the sides when playing on a wider screen (less common on mobile).

You could go for a classic iOS resolution such as 640x1136 and a fixed fit projection. More resolutions: https://www.ios-resolution.com/

You could design them with the size of what is needed for a 640x1136 screen. When the game is played on a larger screen they’ll be scaled up which probably looks ok at least.

Another option is to design for the highest possible resolution so that graphics look crisp there and then if played on a different size screen the fixed fit projection will scale down the screen. Your icons will probably then still look good.

3 Likes

Using fixed fit projection is causing black background on above and below, what can I do so that the background which I am showing for the game appears on this black area too.
This background may have some animated components too.
Thanks

One option is to increase the size of the background such that it covers a wider range of aspect ratios. Will that work in your case?

thanks for quick reply
nice idea but what if I am creating this background dynamically like painting with colors gradient

can’t we know the size of current screen, so that I can generate accordingly
like the sys config height gives the size we set n game.properties

is making bigger enough like may be 2000x2000 the only solution for 640x1136 ?

You can check the current window size using:

local w,h = window.get_size()

You can also get the size in the render script if you wish to create the gradient using a shader:

local w = render.get_window_width()
local h = render.get_window_height()

-- create a constant buffer and pass these to your shader program
local constants = render.constant_buffer()
constants.width = w
constants.height = h
render.draw(my_gradient_shader, constants)
1 Like