Forums » Bugs & Suggestions

This is why you're lagging

    • 21 posts
    January 15, 2017 2:08 PM PST

    NOTE: If there's anything I say here that's incorrect, please feel free to reply to the thread and politely correct me. I'm not an expert, I'm just reporting the trends and correlations that we've seen so far, and drawing conclusions based on those things, what we've googled, and previous knowledge. I want this to be an intelligent, non-emotional discussion, so we can help each other figure this out together.

    *Important things in this post are in bold.
    *Direct questions for Max are in red.

    The Problems in the WebGL Version:

    So 24 hours after the return of Warmerise, there’s been a lot of complaints about lag. These are some common symptoms:

         - Generally low framerates/fps
         - Fluctuating framerates (between decent-ish and bad)
         - High pings and network lag
         - Occasional crashes

    The lag wasn’t this bad before. So what changed from before the shutdown to now?

    The biggest change that we can see is that Max ported the game over from Unity Web Player to WebGL. The difference in the background is that Unity Web Player is a plugin (middleman between the browser and the game), while WebGL is a framework built into the browser (no middleman).

    Question 1: Max, did you change anything else in the game other than the platform in the Build Settings in the Unity Editor?

    About the framerates:

    Lots of people are reporting low fps. I have a pretty good laptop computer (HP Envy 17”, with Intel i7 6500 @2.5Ghz, 16GB RAM, and NVIDIA 940M), and before, I averaged 80-150 fps, depending on the map. Now, I’m between 20-50 fps. While the counter says 50 fps, it feels like I’m bouncing between 20 and 50 fps really quickly, or it looks like I’m dropping frames like when someone is streaming. So what’s going on?

    While not playing Warmerise, my CPU usage is around 10% with only a couple small programs open, and my GPU usage stays pretty steady at about 40% (with 2 external monitors as well). While playing Warmerise, my CPU usage skyrockets to above 80% and 90%, while my GPU usage doesn’t change. Several other people with both good and bad computers reported similar results.

    [EDIT]: So I did some more research and testing after I read some comments Zero made about how it's not actually using the CPU to render things. I'm currently collecting some data and will edit this post again.

    The Reason:

    WebGL is not your computer’s graphics hardware. Your CPU is not designed for doing graphics, like a graphics card with a GPU is.

    [UPDATE]: 2 possibilities.

    At first I thought that it wasn't using my graphics hardware like it should have. Then while I was messing with browser settings, all of a sudden turning on hardware acceleration bak on helped a lot, even though I'd had it on before and still had bad fps. That may still be part of it; though from the hardware usage results I'm seeing from other WebGL games, I'm less convinced that's the big problem.

    The second possibility goes off of what Max said about the .NET networking classes being non-functional in WebGL. I did a few "tests" with different maps with different amounts of people in them. There seems to be a correlation between more people in a room and lower fps. At first that'd seem obvious, but I'm talking about a big drop in fps with only a couple people. By myself, I can almost get normal framerates, but with other people, it goes down the toilet, much more so than Unity Web Player did.

    I'm wondering if the networking class issues are having more of an effect than we think; i.e. that the low fps isn't being caused so much by graphical performance problems, but rather more by network struggles. While my first thought is "that's stupid, network lag makes people teleport, it doesn't affect your fps," but sometimes people with high pings would bring everyone's fps down in the Unity Web Player version, and there were other instances where network lag seemed to cause fps problems.

    In addition to graphics handling, WebAssembly seems to have some stuff for networking, as well. Definitely something to look into.

    The Solution:

    We don’t know.

    So I’ve googled a lot, and talked to Chronospectrum a good bit about it. We haven’t found any settings to change that have made any difference. We don’t think there’s anything that players can do that will make a significant difference. We also don’t know if there’s much that Max can do about it. The reason is because we monitored the same things with WebGL and Unity Web Player versions of other games, and the results of that were consistent.

    The WebGL games significantly increased CPU usage and didn’t change GPU usage, while the Unity Web Player games didn’t increase CPU usage very much and increased GPU usage a little bit.

    We think the fault probably mostly lies with the people who make the browsers and/or the people who make WebGL.

    I’ve seen some other threads where people have given some tips to

    Max has mentioned an update to WebGL called WebAssembly that is supposed to help improve WebGL’s “hardware acceleration,” or how WebGL uses your computer’s hardware. I messed around with some WebAssembly demos and the performance was pretty good. So there’s hope. Hopefully Max will begin experimenting with that ASAP.

    About the network lag:

    So there’s two parts to the network lag I’m going to talk about. The first one is the game’s networking (people moving around, shooting each other, dying, etc.), and the second is the website’s networking (making accounts, verification emails, posts, etc.).

    1. The game’s networking

    So people’s pings have been somewhat higher than normal. Most are sort of reasonable and still relative to the difference between what country they’re in and the room’s server region, but pings of 500+ are pretty common. Once I saw 13,500. Not kidding.

    We don’t have much information about this. We know that before the shutdown, Max used a server-hosting service called Photon for the game’s networking. We assume he used Photon PUN, which uses Photon’s server hardware and network connections and things.

    Question 2A: Max, did you use Photon PUN or Server before?
    2B: Have you changed the networking service you’re using?

    Other times, people have been taking a long time to die after they’ve been shot, or are teleporting a bit, or other things, while their pings are normal. This might not actually be network lag; it might just be the CPU struggling to keep up. Not sure.

    2. The website’s networking

    The problem is that there’s been inconsistency in how long it takes for verification emails to be received. Some people have gotten them instantly, others had to wait up to 2 hours. When Max re-opened the website (14 minutes early), he closed it again within a couple minutes, re-opened it, closed it again, then posted he had to get more RAM for the server in order to handle the traffic.

    This implies that Max is using his own hardware to host the website. It also implies that he was doing something different to host the website before the shutdown.

    Question 3A: Max, what are you using your own hardware to host the website?
    3B: If so, what were you using before?
    3C: If not, what are you using now?

    The problem seems to have gone away now, as far as we can tell.

    A third interesting thing is that the title of the login page on the website is “Warmerise – Gamestream Home.” There’s a few references to “Gamestream Home” in the source code for the website pages, as well, most of which are just a CSS theme (CSS is the programming language used to specify fonts, colors, and positions of webpage elements, among other things).

    Question 4: Max, what is this Gamestream thing?

    About the crashes:

    People are reporting all kinds of browser-related issues, including incompatibility, crashes, and more. I'm hearing different things from different people using the same browsers, so I don't really have any answers there, other than that so far, it seems to generally function for most people in Firefox and Microsoft Edge. I and other people have been able to get the game to run in Chrome Beta and Canary briefly, with prompt crashes. It runs very very slowly in IE 11. I've heard it doesn't work in Safari, and I don't know about Opera.


    These are the important things to remember:

         - You’re lagging because WebGL is using your CPU to render the game’s graphics instead of the graphics hardware.
         - You might be lagging because WebGL isn't using your graphics hardware correctly, or
         - You might be lagging because of networking issues with WebGL,
         - You might be lagging because of some other WebGL reason we haven't narrowed down yet.
         - As a player/user, you can’t fix it (we don’t think).
         - We don’t think there’s much Max can do to fix it, either.
         - We probably have to just wait until either WebGL and/or the browsers update.

    This post was edited by Profezzional at January 16, 2017 10:53 PM PST
    • 254 posts
    January 15, 2017 2:29 PM PST

    I just did a Google search for gamestream. Looks like it's an NVidia deal...



    NVIDIA’s GameStream technology lets you stream games from a GeForce-powered Windows PC to another device. It only officially supports NVIDIA’s own Android-based SHIELD devices, but with a third-party open-source GameStream client known as Moonlight, you can stream games to Windows PCs, Macs, Linux PCs, iPhones, iPads, and non-SHIELD Android devices.


    Not sure how that's affecting things {better minds than mine will have to work that one out}.


    • 21 posts
    January 15, 2017 2:51 PM PST
    I highly doubt it's the NVIDIA Gamestream. There would be some NVIDIA branding somewhere and there isn't. Also, that technology doesn't really have anything to do with this format of game. I don't think it's the, either.
    • Moderator
    • 998 posts
    January 15, 2017 3:40 PM PST

    Profezzional said:

    Question 1: Max, did you change anything else in the game other than the platform in the Build Settings in the Unity Editor?

    Question 2A: Max, did you use Photon PUN or Server before?
    2B: Have you changed the networking service you’re using?

    Question 3A: Max, what are you using your own hardware to host the website?
    3B: If so, what were you using before?
    3C: If not, what are you using now?

    Question 4: Max, what is this Gamestream thing?


    A 1: The game code is practically the same from when the game was on Unity Web Player. I usually have around 150+ fps in Unity editor, so the problem is not with the game.

    WebGL is still a relatively new technology and it's not at the level of Unity Web Player yet.


    A 2A/2B: I'm using Photon Cloud same as before. That's a WebGL issue aswell.

    From Unity documentation:

    "Due to security implications, JavaScript code does not have direct access to IP Sockets to implement network connectivity. As a result, the .NET networking classes (ie, everything in the System.Net namespace, particularly System.Net.Sockets) are non-functional in WebGL. The same applies to Unity’s old UnityEngine.Network*classes, which are not available when building for WebGL."

    Hopefully it will get fixed in the future. But the main issue is performance at the moment, the game is still somewhat playable with higher ping.


    A 3A/3B/3C: Website is hosted on VPS (virtual private server), upgrading is done remotely.

    The server just wasn't properly configured to handle large traffic.

    But that's not really what cause the issue with verification emails. Looking at the logs I can see that emails are sent correctly (usually 15 seconds after registrations).

    What might be happening is that email providers have website's ip blocked or their spam filter is too agressive.

    I will be looking into resolving this issue as soon as possible


    A 4: Gamestream is just a name of website theme. Changed homepage title to "Warmerise – Home Page"


    About your "Conclusion/Summary" it's mostly correct, there is not much I can do at the moment.

    I will be keeping an eye on WebGL/WebAssembly updates and will be testing them as soon as they are released

    This post was edited by Admin at January 15, 2017 3:41 PM PST
    • 82 posts
    January 16, 2017 1:38 PM PST


    • 4 posts
    January 16, 2017 4:39 PM PST

    Nice write up Pro


    • 21 posts
    January 16, 2017 10:57 PM PST


    I did some "tests" with various WebGL games under various conditions and monitored the hardware usages and framerates. I've crossed out and replaced the things that the results of those seem to suggest are incorrect.

    Max, are other classes (the Unity WWW class, WebRTC, etc.) not viable options to replace the .NET and UnityEngine.Network classes?


    This post was edited by Profezzional at January 16, 2017 10:57 PM PST
    • 12 posts
    January 17, 2017 11:24 AM PST

    DAWG said:

    Nice write up Pro


    accept my friend request