Current WebGL challenges

Working with Unity and WebGL.

The new WebGL build feature from Unity is pretty cool and – at the same time – somewhat overdue. Huge thanks to Unity for putting so much effort into it and pushing forward!

However, when playing around with first WebGL builds, we’ve come across some drawbacks:

  • Long build time: you can’t just try out a new feature or test a changed setting quickly. We have not measured the build time for Volley Brawl yet, but have the feeling that it really takes quite long. Also, the system seems to be halting for a moment (even the mouse pointer stops moving). Maybe this is just now at the beginning, because we have to try out a lot with this new technique. We are looking forward to the cloud build feature for WebGL as announced for Unity 5.3 which does the builds automatically in the background to save you build time and resources.
  • Threading: in our previous project Maze Rat we relied on threading for AI calculations a lot, as it took ages when running all the calculations from the main thread. In addition, Parse requires async tasks, too. Thus, we feel the need to find a workaround for this. The AI for Volley Brawl isn’t yet completed, but we don’t expect it to grow more calculation intense as it is now, which feels ok. For Parse we have to write a workaround in JavaScript, to be accessed and interacted with from Unity C# scripts.
  • Keyboard input: keyboard input is possible with WebGL – no issues so far. But we have interferences with browser hotkeys. We haven’t found the ultimate solution to avoid collision of browser hotkeys and game keyboard controls, so actually we are using an odd keyboard layout. For the release, we have to find ways to optimize this, most likely by writing a browser hotkey suppression in JS.
  • JavaScript: we have learned C# together with Unity and still enjoy every minute of using C#. It is probably pretty polarizing as lots of people are in love with JS, but personally we disgust JavaScript. If measures of aesthetic apply to programming, JavaScript is really sloppy. You can define everything everywhere, which feels kind of like “Uh, I didn’t tell you before? This is a declaration of an object method.” But enough whining. With WebGL we will – more sooner than later – get to that point where it is impossible to avoid JavaScript. We just have to accept that.

Currently we are mainly focussing on optimizing two crucial JS libraries into our WebGL build:

  1. PeerJS – to implement peer to peer browser communication for PvP
  2. ParseJS – for storing user information, player progress and matchmaking

We’ve achieved nice first results for both, but there are still some must have features that we need to implement for the release.

Updates are to follow,

Your Fantasy Arts Team

Share on FacebookShare on Google+Tweet about this on TwitterShare on TumblrShare on LinkedInEmail this to someone

Be the first to comment

Leave a comment

Your email address will not be published.