First game problems

Yes, but what pixel dimensions of the atlas files? Open your atlas and check properties to see the size.

You can also check the Generate Build Report checkbox when bundling.

Atlas is here:
So 2048 * 1024

But I cant find Generate Build Report Checkbox in game.project

Is that the only atlas you have? That’s nothing to worry about then. The build report checkbox is in the bundle dialog. Did you get the project to run with a larger heap size?

Nope… did not get it to run… I sent you a message with my project files perhaps that could help?

Ok, so I took a look at your project. You have one tilesource with a background image that is waaaaay to large:

The size of 4992x3648 will result in a texture that is 8192x4096 pixels, which equals 134Mb of memory (excluding mipmaps). You need to reduce this texture in size quite a bit. Your game.project specifies a screen size of 640x1136 so you should aim for a size closer to the screen dimensions.

If you take a look at the build report (which you get from checking the Generate build report checkbox:

You see that almost the entire bundle consists of this single texture. Nothing else comes close:

You should also consider using a texture profile to apply texture compression to your images to further reduce bundle and runtime memory requirements. Read more about this here: Texture Management in Defold


Holy C… ok, thanks for that I will look into it… But the reason I have the picture so big is because I am rotating it on runtime to make it look like a moving universe, but I guess that is not the right solution.
But OK, I will fix that and come back to this post with Facebook instant games questions tomorrow if I still have problems.

Thanks a lot @britzl

1 Like

You could perhaps use a shader for the background instead? Perhaps this. We even have a tutorial on how to add such a shader.

1 Like

So I reduced it just a simple background image… still can’t get the HTML 5 build to run…

:confounded: :confounded: :confounded: :confounded: :confounded::confounded:

Is this using the bundled version? How did you start the file server? And what’s the address you use in your browser? It should be for instance http://localhost:8000
I’d recommend having python to start a file server:

> cd my_bundle_dir
> python -m SimpleHTTPServer
Serving HTTP on port 8000 ...

(If you use “Build and Run”, the editor starts a file server for you)


So when I just click build the server is started by the Editor?


I have never made a game in HTML so I honestly didn’t know a server is needed to run it…
But I tried to upload it to and… still, it didn’t play…

A Defold HTML5 game consists of an html page, some javascript files and some binary files with game assets. If you open the html file from disk in your browser it will try to load the javascript and the assets but the browser will prevent this for security reasons. In order to run it you need to either upload it to something like or run a local web server like Mathias suggests. If you select Build HTML5 and run Defold will start a webserver for you. Did this work when you tried it?

1 Like

The reason a server is needed is because browsers block accessing certain features when a page using those features is ran locally as a security measure. I sometimes use as a quick server when needed.

Aha, thank you, everyone, for the explanation…
But the problem still remains that even when I uploaded the game to itch, it won’t run…

And is a website, with a server and I uploaded the complete zip file with the index.html as requested by them and with all the assets and js files that the defold build gave me.

Can you please confirm what happens when you select Build HTML5 and Run from the menu. What is shown in the chrome dev console?

So I clicked this:


The bottom of the editor says this:

Then my default browser (Edge) opens up to this:

And if I try to use the same link in Chrome I get this:

And the console says this:

And in the Defold Editor, there are no Errors or console logs whatsoever:

There :slight_smile: might seem a bit childish to post this way, but yeah, I hope this explains everything.

If I click this though:


A game window opens up:

and I get this log in the console of the editor:


Do you still have that heap size value set in game.project? Remove it or set it to a much higher value.


Thank you @britzl !!
I still had my heap size set, so I just removed it and set it to 0.
And now I got it to work in all the ways :slight_smile:
Even works on itch now! :smiley:
Yeah I know it’s a horrible game but I had to start learning somewhere xD

Next up, I need to optimize it a bit and try the tutorial from @Mathias_Westerdahl :slight_smile:

Thanks again! This community is awesome and really helpful! :smiley:


congrats on leaping over the first major obstacle =] Hope your further journey is smoother.

Also if you’re in a mood of watching 10-minute bits, here’s a Defold tutorial playlist for you:

Make a game, explore the project, get a better feeling of Defold.


Back at it :smiley:
So I got it all working nicely thanks to all the help. Even made a nice shader from the awesome tutorial.

Now I decided to jump into the next big thing: 3D

I remember seeing a tutorial about importing a 3D book int Defold or something… can’t find it now.
But I did find this:

and this

But somehow even after getting the object in and assigning a simple material (model.material and a blue sprite) the object was not visible at runtime. And the other thing I can’t seem to figure out is the camera… I got it imported and it works, but the rotation is awkward and behaves weird… And the modeler is stuck in orthographic view even though it’s technically 3D, how come? Can I change that?

What I am trying to achieve:

What I have:

Quite happy about 3 days progress from not knowing the engine to this :smiley: