Defold stretches the game

#1

Hello. I’m trying defold as a new tool to make a game and faced many problems, here is one of them:

When I’m trying to tweak display width and height (via game.project file) Defold stretches the game and I don’t know how to prevent.

Here an example:
On width=1100 and height=700 I see this:

And on width=700 and height=1100 I see this:

In second case square stretched horizontally. How to fix?

0 Likes

#2

The default view projection in the scriptable render pipeline is a stretch projection where the area covered by the width and height specified in game.project gets stretched or compressed to fit the dimensions of the actual screen. This will result in stretching if the aspect ratio isn’t the same.

This can easily be fixed by switching from stretch to a fixed projection that retains the original aspect ratio:

Fixed fit:

msg.post("@render:", "use_fixed_fit_projection", { near = -1, far = 1 })

Fixed fit:

msg.post("@render:", "use_fixed_projection", { near = -1, far = 1, zoom = 2 })
1 Like

#3

Thanks for response, but I decided to quit Defold

0 Likes

#4

I’m sorry to hear that. May I ask why?

0 Likes

#5

I think it may be a good idea to default to fixed_fit_projection for all projects - and then show your end users how they can opt into a stretch projection. I would imagine there are so many use cases where folks would see that necessary compared to having a stretch projection. It does confuse so many starters (myself included) - and without much experience on the engine it may get very easy to dismiss it straight away.

9 Likes

#6

I’ve added a task to this sprint to investigate improvements to the render script:

8 Likes