DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
  1. DZone
  2. Coding
  3. JavaScript
  4. Use of JavaScript In Online Games

Use of JavaScript In Online Games

While HTML5 and C++ might be the first languages that you think of when you think of games, JavaScript has a big role in game development, too.

Julia Beyers user avatar by
Julia Beyers
·
Jul. 27, 22 · Presentation
Like (7)
Save
Tweet
Share
14.11K Views

Join the DZone community and get the full member experience.

Join For Free

Do you know which programming language was used to develop your favorite online game? Many people will immediately think about HTML5 and C++, and they are actually right. These are the most common options. But what about JavaScript?

JS is considered to be the most popular and well-known programming language in the modern world. Its popularity is caused by a number of reasons, including user-friendly code and versatility. Indeed, JavaScript can also be an excellent helper when developing online games. Its scripts make it possible to easily combine JS codes with HTML5 and CSS, thereby creating excellent cross-platform applications.

This article is not another review of online ARPG game or top-list of their best features. Here, we are going to answer the question of whether it is possible to create a cool online game using JavaScript. And also, we’ll list the best engines for this task and some examples of games that can inspire you.

Is It Possible to Create a Proper Online Game Using JavaScript?

Of course, this is possible. There are many 2D and even 3D games created using pure JavaScript or its frameworks. You can find a really huge number of libraries and frameworks, written in JS, but aimed at HTML5 games development, for example — Feather. Games made with JS will not always be native, but this does not make them worse.

Creating a game on JavaScript is not only possible but also simple. In fact, you don’t even have to use Node.js or bother with the server-side of the project. All you need is a basic knowledge of JavaScript and CSS. Still, the required amount of knowledge depends on how complex your game will be. Obviously, you will need more skills to create a large-scale RPG. At the same time, you need literally basic knowledge to develop a simple platformer.

On the web, there are many various step-by-step tutorials aimed at helping you with your first online game. Decide which game you want to develop and proceed to the next step — choosing a library and engine. We have listed the best of them below.

Best JavaScript Engines to Build Web Games

PhaserJS

Phaser is one of the most popular choices among developers when creating an online game. Its database is open-source, and a large community of developers will be there to help you grasp all the processes and find answers to many questions. Phaser uses a built-in JavaScript library — PixieJS. This allows for seamless interaction between WebGL and Canvas elements.

This framework is great for beginners because it handles most of the game automation processes. Thus, you do not need to write long code for each element of your game. Physics of objects can also be achieved using special external libraries. Ultimately, your game produces a very professional feel thanks to the objects' realistic movements and behavior.

In fact, using Phaser and ready-made code from GitHub, you will roll out your first game after a couple of hours of work.

BabylonJS

Oh yes, this is one of the best frameworks for creating 3D browser games. It allows you to render objects of varying complexity, and you do not even need to write a lot of code. Creating a 3D object using a regular WebGL would take a lot of time and code. BabylonJS handles all the complexity on its own, so minimum efforts are required from you.

A few more features of BabylonJS are hardware scaling, a system of particles, smoothing, automatic scene optimization, and the ability to use 9 types of cameras with custom materials and shaders. Sounds good, doesn't it?

MelonJS

This is a lightweight open-source framework that has a number of special features. First of all, this is a "plugin-free" tool for creating games on the "wrote once, launched anywhere" principle. The framework does not have such a large community as the two previous ones, but the developers who prefer Melon are its real fans.

Let's list a few features of the framework:

  • lightweight 2D engine;
  • a simple HTML5 library;
  • compatibility with all popular browsers: Chrome, Mozilla, Opera, Safari, Internet Explorer;
  • compatibility with mobile devices;
  • lightweight physics with low requirements for your computer's CPU;
  • built-in support for CocoonJS and Ejecta;
  • and so on.

In short, MelonJS is an ideal choice if your task is to create a simple lightweight 2D browser game with a minimal computational load.

Of course, there are many more of them. However, let's look at some popular games created using JavaScript.

Examples of JavaScript-based online games

On/Off

Oh, this platformer will wrack your brain and freak you out. We have warned you! A beautiful and simple 2D-game with cool physics that pays respects to the Super Mario era. Play with headphones since fun music makes up 30% of the atmosphere.

Konnekt

That’s a great game for training abstract thinking. A virus has infected your system and you must move the nodes to save yourself from the total infection. Try it, but you need to read the rules first.

Everyone's Sky

Oh, this is a full-scale space RPG that runs instantly and works in your browser. Explore space, enter into alliances or destroy your enemies.

1024 Moves

This game is a platformer where you need to move the cube through the map in an attempt to achieve the goal. The levels are full of small puzzles, switches, movable boxes, and so on. What may seem simple to you in the first round, will cause problems in the 6th. Oh yes, you only have 1,024 moves to complete the game!

All these games are a great opportunity to spend free time without buying, downloading, and installing anything. By the way, each of the above games is under 13kb of code. How do you like that? And there are lots of such games.

Summing Up

It is safe to say that JavaScript is used in online games. Yes, it isn't so popular now, but its community and convenience promise a bright future for JS-based online games. It is mostly platformers and puzzles now, with a focus on the intellectual components of the game rather than on graphics or else.

On the other hand, every novice coder, who wants to create a game, can use JS for this. It won't cause any problems, while the experience gained will be unique. The developer can show this game to their friends and discuss how to improve it. It is this unique experience that JavaScript brings to the game development sphere. With the help of JS, everyone has the opportunity to create their own game. Try it for yourself!

JavaScript library

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Testing Repository Adapters With Hexagonal Architecture
  • Getting a Private SSL Certificate Free of Cost
  • Keep Your Application Secrets Secret
  • Authenticate With OpenID Connect and Apache APISIX

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: