Mobile game template screen size stretched


I tried out the mobile game template, but when I did something and loaded the screen, everything seems stretched horizontally , is this a bug?

If no how can I fix zis and is it a thing to run mobile games on mobile?



You are using default render script? If so it’s not a bug, just the way it works by default. There are 3 options in the default render script you can switch between and one of them will give you a non-stretched view.

There are other good options for render scripts such as Orthographic and RenderCam libraries for Defold.

1 Like


is it a thing to run ur project on a mobile device???

also why cant defold use the non stretch render script as default if there is one

1 Like


Yes, you can change projection with a message. More information in this manual:

1 Like


You change it through a single line of code as @AGulev describes. The reason why is it non-stretch is that we chose that projection type when Defold was created. It works for some types of projects and not so well for others. In hindsight it was maybe not the best choice but we try to always be 100% backwards compatible and never introduce breaking changes. Changing the default projection would break functionality of games that haven’t made a choice.



It might still make sense to change it to non-stretched in the main script of the mobile template though. Can the templates be put on github so we can suggest changes to them?



They are on GitHub:

The editor copies directly from those templates.

1 Like


Ah, I didn’t know before! Or forgot. :slight_smile:

I’ve made some pull requests now for a few of them.

For mobile and desktop added fixed fit projection to the main script by default.

For desktop and blank added HiddenInputField as the default since imo it should be the default now at least in the template projects, the current default doesn’t work right on newer phones.

Can you put a readme into ? I can help setup a nice basic 3d template project. Can’t fork empty projects.

1 Like


We will fix the 3D template and add it to the editor this or the next week actually. What do you think the 3D template should contain besides a perspective camera setup and maybe a model component?



For 3D one you want more than what the other templates have.

The readme should mention RenderCam if not fully embrace using it in the template.

It should include some starter materials and .dae objects with animations setup on some. And should have a render script based light system for batching.

It should demonstrate 3d collisions and custom movement solving.

Could also have first person shooter, 3rd person shooter, and 3rd person vehicle templates.

I wouldn’t use this in a template because it’s not very clean, someone who knows what they are doing could surely do it better but basic first person shooter templates will be useful for people. Also you can use any assets from my projects on github as you know basically everything I publish there is put in public domain.



We will probably create both a template and a sample. The template will be quite basic but provide what you need. @jhonny.goransson is currently working on it.



It is more likely that we will do several smaller templates over time Instead of adding lots of features in one. A first step is to just to add something small that renders a .dae model with a custom material and a camera. Nontheless your suggestions are great!



The main thing that is important is helping people who want to make 3D games see the features in action so it’s easy to adapt to Defold way, know what’s possible, and have common things they would want to do as accessible as possible. I’ll help make some more of these options in the future too, like opinionated render setups. May be good idea to ask King teams, especially the technical artists, what kinds of things they would want to see.



wow this post became a small forum itself