What causes bad WebGL performance

Hello,

I have recently published a game to Kongregate and was wondering what can cause bad webGL performance.
The game is multiplayer integrated with PUN. I published the game in the past to another game portal website. When the game got a significant amount of players it seemed to lag. What can cause that? Any ideas, please post them below.

Thank you

According to Unity’s WebGL performance considerations, their Profiler does work on WebGL.

I believe it’s faster and easier if you just attach the profiler to get reliable results on performance, rather than asking for ideas.

2 Likes

Thank you! Did you have time to play the game yet? Would you think that it would run smooth with a good amount of players? Let me know

Ultimately webGL is just a rubbish platform. You have a thousand hoops to jump through to get adequate performance.

Start with the profiler and work your way through it all.

1 Like

Not just adequate performance, but in some cases any performance. I know a lot of WebGL builds just give me the old grey screen that sits there and does nothing, no matter what settings my browser has. I don’t know if this is exclusive to Unity or if it’s just the platform in general but it’s this sort of thing that gives me a “not ready for prime time” vibe for anything more complex than test applications.

The only problem I have with my WebGL Testing the fact that Linear lighting isn’t in it yet, which I hear in next update it will be with the WebGL 2.0 update.

But honestly, I still don’t see why we had to go to WebGL, what exactly was wrong with the old Web Player, and why is WebGL Supposedly - superior enough to use it instead.

The change was nothing to do with WebGL being superior or even ready. The change away from the old web player was because it was being killed by browser companies.

That is exactly right! Chrome moved away from NPAPI functionality therefore the web player became deprecated. Other browsers soon followed. Unity3d then proceed to webGL.

I am about to get the game on Kongregate’s hot new games section.
Only problem is that I’m afraid with lets say 8-12 player matches, there will be some lag/choppy gameplay.
I opened the game on a few different browsers with new tabs. Gameplay seemed good enough, however I don’t know if this will follow through with other users.
“Start with the Profiler then work your way through it all” The game only lagged with multiple players though.

Ah okay, makes sense. But why would they drop support for it? Was there like some sort of hacking people could do through it?

@aidangig56 : I don’t see how it can be choppy, unless of course you have 12 tabs on the same machine running the same exact thing. Of course it will be slow then, because the browser is then having 12 different instances of a game running. Each taking up so much memory, etc. the only way to test this theory out is to have 12 different machines running it.

Then run a profile with multiple players…

The basic performance trouble shooting steps are as follows

  • Duplicate the problem
  • Profile while the problem is occurring
  • Solve the problems indicated by the profiler
  • Repeat from step 1 until resolved

Without this information we are just making random guesses. It could be you have some weird code that means your game performance doesn’t scale linearly with more players. It could be that your network code is waiting for a server response and and limits the frame rate to the slowest round trip speed of all players. It could be that you have hit memory limitations that only show up in multiplayer games.

I can throw up other useless random guesses. But without profiling, they will only be random guesses.

2 Likes

I think that technology was just becoming dated since it has been around since Netscape. Chrome just decided to push more towards HTML-5
If there are multiple players then all having 1 tab open to play the game. Should they all be fine?

Alright so just open the editor and open the game on a few browsers and check up on the editor’s profiler to optimize?
Have you been able to test the game out on the link? The game looks good so maybe it can be high quality textures mixed with all player interacting could cause lag…

Dang been around sense then haha. I remember using Netscape and Dialup LOL.

Well I don’t know how your game is designed, nor do I know anything about it, so I can’t say anything.
if it’s MP game, if you coded the game correctly then the only thing’s running on you (the player’s) PC is your scripts, not theirs. However as you mentioned - materials could also be in.

What texture sizes are you using? What kind of shaders are you using? If you’re using PBR, then try doing a legacy diffuse, etc.

Welcome to the glory of optimization, 9 out of 10 times in something you haven’t even thought of causing the problem. So don’t think of obvious reason’s unless it’s staring you directly in the face, always account for them and try them, just don’t expect them. It’s usually something that will make you face palm and have to re-do a lot of stuff lol.

EDIT: Sorry I don’t have time to test the game out right now.

Why would I?

Playing the game will give me very little insight into under the hood performance. That’s what the profiler is for.

Yes. That’s precisely it. It was a major security risk.

1 Like

Besides potential security risks, the recent trend has been to move away from vendor specific browser extensions toward standardized technologies like HTML5.

NPAPI(Netscape Plugin Application Programming Interface), as it’s name suggests was a non-standard technology, like its counterpart on the Microsoft side, ActiveX.

It’s not unlike graphic card vendor specific technologies like NVIDIA HairWorks. It can provide some additional features that the standard API doesn’t cover, but it would require extra works for developers to provide a fallback where such a technology is not available, or in the worst case, it can cause vendor lock-in, making certain web sites only viewable in a specific browser.

I’m glad that the days when we had to put a disclaimer like “You need XXX browser to see this page” on a website is finally over (though we have many government websites that still rely on ActiveX in my country).

Probably in a few years, HTML5 related technologies will catch up with those older, proprietary technologies like NPAPI or ActiveX, in terms of features and performance, so we won’t have to miss them anymore.

2 Likes

Originally it may have been proprietary but when everyone has implemented it to the point that you can release a plugin and it is guaranteed to run on the major browsers then you can no longer claim it’s a non-standard technology.

I know that NPAPI was once supported by both IE and Chrome. But the former stopped doing it since IE 5.5 which was quite a long time ago, and the latter followed suit couple of years ago.

So, while NPAPI not being available on IE for a long time, ActiveX has never really been supported outside Window platform, which means you had to make at least two different versions of a plugin if you want to support all the major platforms and browsers.

I’ve been a long time Linux user, and thanks to that kind of situation, it’s only recently that I began to be able to use local online banking and shopping sites on my desktop. And I still cannot use the government’s tax service website because they require tons of crappy ActiveX controls, and such kind of problems also affect Mac users as well.

To be fair this is Microsoft we’re talking about. They’ve ignored the actual standards (HTML, CSS, etc) in the past so it stands to reason that they’ll just ignore the unofficial standards too.