HTML player slow graphics performance (SOLVED)

EDIT: The problem must’ve been something temporary with my machine. The game runs fine now without any code changes.

Hi
I have a small top down 2d game I’m working on, and when I make a HTML build it runs really slow.
The player character moves really slowly, both animation and x,y movement. I have some fade-out-fade-in transitions when I switch map, and they also seem to be really slow. It seems to run at half speed. If this had been an old c++ game I’d have thought my game loop was running too slowly.

My game is really bare bones:

  • One animated spritesheet sprite. Slow animation of maybe 10 fps.
  • One tilemap on screen, with four layers with 16x16 sprite tiles. Roughly one screen in total size.
  • Generated tilemaps (this does not seem to slow down much, but it’s a little slower than on desktop)
    No sound, no effects, no special renderers.

Without having to post all my code, I was wondering if anyone had any idea what the problem could be?

Have you tried the web profiler yet?

Is it slow only for you or others who have tested it?

Is it slow only on certain browsers?

Have you tried to make a copy of your project, and remove things until it goes fast?

1 Like

I Haven’t tried the web profiler. How do I start that?
The game is just something I do to test out Defold, so there are no other players. I tried it in IE and it was slow, so I was just wondering if the HTML 5-engine has known limitations. Like I said, it looks like the game loop is slow.
There is not much to remove. Only the sprite and the tilemap are loaded at the start.
I have tinkered back and forth with different aspects of the game, so it’s possible I have some problem somewhere. Maybe something fires too many events.

You can build a HTML5 version and upload to itch.io for free so we can test to see if it runs slow for us.

OK, thanks!
The profiler shows my engine frame taking up 167 ms or thereabouts. Nothing else seems to take much time. All frames are red, which I assume is bad. What should I look for in the profiler?

Upload a demo so we can test it for you.

Are you building a debug or release version? Debug builds verify opengl calls and that is very slow in Chrome at least.

2 Likes

Well, I have tried both “Build HTML5” and “Bundle HTML” and selected Release. They seems to perform the same. I’ll try to upload a demo.

1 Like

Haha, I uploaded it to Itch.io and now it works properly. Now slow down!
So then I tried a local build and it works fine as well. Just to double check I tried my slow build from yesterday, and THAT works fine too!
So it must’ve been something going on with my computer. Maybe anti virus or something? Pretty weird. I have not even restarted my computer since yesterday, only hibernated it.

Well, it works as it should now, sorry for wasting everyone’s time :stuck_out_tongue:

Here is the demo link if you want to check it out anyway. It’ not a game yet, just a test project to learn defold.

4 Likes