There are two main methods of building browser games in 2018, and they both revolve around using game engines. We’ll explain these a bit:
Java’s main drawback, especially for a beginner, is going to be resource and asset management – when you’re building on top of huge asset loads and garbage collection systems, and you start to fill up the asset memory, JS will start to show its cracks in the form of automatic garbage collection and asset compression – which means you’ll need to build a slow asset caching system, or your game performance is going to be quite terrible.
Unity WebGL demo Angry Bots
So, think of it this way – if you want to build mainly 3D browser games and perhaps dabble in creating 2D games that are installed on the user’s device, go with Unity engine. If you want to focus exclusively on 2D browser games, something like the Phaser 3 framework would be much better for this purpose. All that you need is to decide about the details of your game. For example, take a look at these parking games – each one might use a different framework despite the fact that all of them look pretty similar.
One other thing to consider is if you want to target mobile users as well – Unity WebGL doesn’t exactly play nice with Android browsers, so much in fact that Google Chrome for Android has Unity WebGL disabled by default. It’s much better to build a game as a separate Android build, but this isn’t too much of a concern, considering not too many people are playing browser games on their Android device – and some browser-based IO games, like Slither.IO, do in fact have highly successful mobile ports.
Final Thoughts – Choosing the Right Path for You