Lego Microgame - Super Lag w/ low FPS

Hey everyone

I just published a Unity game on WebGL but it’s lagging tremendously lol
It was pretty bad in the editor too but not nearly as bad as after publishing…

I put a lot more work into designing it and I’m wondering what could be causing such a terrible experience… I have a ton of assets and I’m not sure how to really optimize them. There’s a lot of moving obstacles but I wouldn’t think it would cause such poor performance. I’ve linked the game.

Any feedback would be great! Just trying to learn what to fix for the next game I create. Cheers!

WebGL is slow. Slower than the editor. But you know that now. :wink:

I get around 10-20 fps when looking into the distance. Facing the character so I don’t see much of the world gives me heavily fluctuating 30-60 fps. This is on Chrome with a 1070 GTX.

There’s a number of things that need to be optimized. For one, this kind of fluctuating could mean the CPU is doing too much and/or too much garbage collection happening. You can look into that with the profiler in the editor, any improvement you make there will be reflected in WebGL.

More importantly, you’re using assets that are unfit for WebGL.

Issue #1 would be render distance - from the start point I can see the entire level. Everything needs to be drawn, even the particle effects in the far distance! You can limit the draw distance by lowering the far clipping plane. This should give you a great speed boost.

Issue #2 would be transparency. I bet if you disabled transparency of shaders and removed the particle effects you should see a noticable increase in fps.

Issue #3 is not easily solved. These starter kit assets are simply too high-poly for WebGL. The Lego character has a lot of round surfaces which means a relatively high poly count for the looks. But even this item up-close you’ll notice the corners have bevels (on the left side the corners are slightly brighter due to the bevels). Means: they aren’t 90° angles which means more unnecessary polygons.

Issue #4 is textures, particularly the skybox. From the looks of it I would say it is at least a 2048x2048 texture, if not higher. That’s a lot of memory wasted for the sky that is unavailable for other assets. WebGL is extremely memory limited, more so than any mobile game. I would also expect the textures of other assets contributing more than what WebGL can handle.


3 Likes

Wow! Thank you so much for the detailed response (:

I’ll get to work and make those changes! Cheers!

1 Like

You can point the camera to an angle so it does not show all the objects all the time, occlude them, that will help with FPS