Can Javascript be Used to Make Games?

JavaScript, a language that was once thought to be one dimensional and used solely for the web has now become one of the most versatile in modern programming. Its adaptability has notably increased during the last 10 years of development.

JavaScript has been in the limelight for its ability to create web applications, mobile apps, desktop applications, backend servers, databases and everything else in between.

Naturally, with a programming language this versatile, questions arise about its ability to create games. After all, we’ve seen many different programming languages adjust to different industries.

So, can JavaScript be used to makes games?

JavaScript can be used to make games using a variety of platforms and tools. Both 2d and 3d libraries can be used in combination with JavaScript to create fully-fledged games in the browser or external game engine platforms.

These tools/frameworks include:

With each of these tools, there are of course learning curves, however, each one has its benefits for providing a legitimate way of creating great gaming experiences. 

By using any of the aforementioned game engine libraries, production costs can be kept reasonably low and therefore allocated resources can be reduced. But these frameworks only provide a small insight into what’s available for JavaScript game creation. Let’s explore JS game development in more detail.

Is JavaScript good for creating games?

An important point to consider, is that just because JavaScript can makes games, is it actually any good for making games?

The answer to this heavily relies on your own criteria of what constitutes a good game creation language. It should be noted that the majority of JavaScript game development focuses on creating games used for the browser. This in itself creates some limitations.

Common gaming aspects such as collision detection or other rendering tasks typically require heavy calculations using GPU computation. However, since we’re confined to the browser the computation power is not as powerful as other game rendering engines and technologies.

As a result, JavaScript is currently not a sufficient tool for making AAA games. The lack of rendering pipelines, true OOP and advanced memory management hinders it for these types of titles.

Additionally, since the majority of JavaScript game frameworks are also targetting the browser. These games will essentially not be native. However, just because the majority of the games are targetting the browser, doesn’t delegitimize the scope and capabilities that some JavaScript games are striving to achieve.

After all, the power of browsers is increasing significantly year by year. It’s only a matter of time where they can provide experiences comparable to other game platforms. For me, although I can see that JavaScript is not on the same level as other languages for creating games, it is evident that it’s in for a bright future based on the evolution of the modern browser.

What games were made with JavaScript?

Nothing demonstrates the gaming capabilities of a programming language better than the games it creates. It is important to be able to point to accomplished products that are already on the market.

So, what games have been made with JavaScript? Well, there is a wide variety of games available to play in the modern web browser.

I think it’s important to preface the list with the fact that these games are not as fully-fledged as titles that’s available on other platforms. It’s a given that JavaScript games development is in its early stages and a lot of what’s available are inductions into what JavaScript games will eventually be capable of.

So with that in mind, here is a short curated list of some notable titles:

HEXGL

HexGL is a fast-paced racing game built primarily with HTML5, JavaScript and WebGL. 

It strikes similarities to the classic Wipeout series which was renown for its futuristic style and remarkable electronic soundtrack. There are some very impressive graphics demonstrated here and is a great showcase of what JavaScript games are capable of.

Underun

Underrun is another sleek production, that exhibits the artistic vision that can be used in JavaScript games.

Familiar stylized blocky pixels dominate the art style. It’s simple but gives a great preview of what JavaScript games could be capable of in the future.

CrossCode

Quite possibly the most comprehensive JavaScript game available. CrossCode was created using HTML and ImpactJS.

It is a futuristic retro-inspired 2d game with a very well realized settings. With a deep story and interactive world full of NPC’s with their own storylines.

CrossCode provides a quality RPG experience and bolsters impressive RPG gameplay that puts it above most JavaScript current releases. 

Gods Will Be Watching

Gods will be watching, provides an interesting puzzle game that features a crew that has to survive for 40 days in isolation.

It has a robust cast of different characters with a very interesting art style

The player has to interact with the crew to keep them warm, nourished and sane. With its intriguing premise and adventure game style action, Gods will be watching provides one of the more unique JavaScript game experiences available.

PolyCraft

Polycraft offers a resource collection, 3d tower defense game. Its probably one of the most polished JavaScript games available and it run incredibly smoothly in most web browsers.

Can you make mobile games with JavaScript?

So if we can agree that JavaScript games are usually not lengthy with relatively simple controls and complexity, you might think that they would be best suited on an AppStore. There is certainly an argument to made for this, a mobile could provide the optimum platform for what typical JavaScript games are trying to achieve.

With this in mind, can you make mobile games with JavaScript? Generally, if you would like to deploy a JavaScript game to mobile devices there are quite a few tools to available accomplish this.

WebView mobile development frameworks have been popular in the JavaScript ecosystem for quite a while. Essentially, these create applications that use the web browser to simulate a native application on a mobile phone.

These frameworks allow users to build Hybrid Mobile Apps. They are built with HTML, CSS, JavaScript and are contained in a native wrapper so it can be installed and published on a mobile device, whether that be iOS or Android.

This is very advantageous for the developer as it allows him/her to create and publish mobile applications without having to be proficient in their native programming languages (e.g Java for Android).

Some of the most popular frameworks include:

These frameworks use HTML, CSS, and JavaScript to build mobile-like experiences.

There are of course some hardware considerations here. Performance could be a concern, this is primarily because of the WebView wrapper trying to simulate a native app-like experience. In this process, a mobile device has to open up a web browser (web view) internally and load potentially heavy web assets, all while trying to imitate opening up a native application.  

Thankfully, a lot of these issues have been ironed out by these frameworks over the years. And they provide a performant way to create JavaScript games from the ground up.

One of the biggest advantages, is the build once, publish anywhere mantra of a framework like Ionic. This enables a developer to build a JavaScript game once and publish it to many app stores. This is very beneficial as the available target market for a JavaScript game can be expanded exponentially with the increase in app stores to publish to. 

Conclusion

Overall, it’s evident that JavaScript games are still early in their lifecycle. The depth of these games are destined to evolve over time. What is particularly impressive are the tools available to construct creative browser experiences.

And although the depth of the games are in their infancy, to underestimate JavaScript game development could be quite unwise. The sheer talent of the developers working at Google, Microsoft, Mozilla, and Apple will ensure that browser-based development becomes much more viable, especially given how lucrative the mobile gaming market has been. 

As the power of the browser advances, JavaScript games will also take a step forward. It is an interesting space to be in as the potential reach of a JavaScript game is only limited by a device that can not use a modern browser.

Looking forward is will be fascinating to see how new JavaScript games adapt to browser improvements. It will also be interesting to see if it will reach the popularity of mobile games which were also originally developed under similar technical restraints.

Proudly published with Gatsby