To the article

Choosing a game engine

5 min read · 

Moving from canvas to game engines like Godot or Defold

Introduction

With the recent controversy about Unity, I see more and more posts about gamedev, which is a very interesting topic that I don’t usually work as much as I want; I only made small games with Phaser.js long ago and recently some experiments directly in canvas.

Cocoa Moss a team of two people that makes really cozy games, motivated me to give gamedev another try. I have been playing their games with my girlfriend for the past week almost every night, and they always make us happy.

Problems with canvas and not using a framework

My last game required hundreds of elements on the the screen moving and colliding with each other. canvas is very limited in this sense, and while it works, the performance is not the best. I also have to handle quirks like different density screens and other visual glitches.

I need to port the game to something faster, like WebGL. The problem is that WebGL by itself is a very low-level API, and I don’t want to write a game engine from scratch (neither I’m smart enough to do so)

Most people will opt to use a framework to handle the complexity of WebGL, the first option is usually three.js. In my case, the games are not 3D, so three.js feels overkill.

My second option was pixi.js while I’m getting somewhere, I don’t like so much how the API is structured. I find myself often searching for solutions online to do basic stuff, most of the time finding code for old versions that is not compatible with the current one. This is the same reason I stopped using Phaser, all examples have a mix of old and new APIs, which makes it very frustrating to attempt any changes.

So far, Pixi.js is my best option, but I’m still not happy with it.

Using game engines

The main reason for using a game engine is that it will handle all the complexity across many platforms, not limiting me to just the web, although that’s my main target. But hey, more performance is always good, and if I do free games, I want people to be able to download them and keep them forever, or for at least longer than the time I host them.

I never paid much attention to Unity, and after all the controversy with the fees, many developers are moving on to other alternatives, the main ones seem to be Godot or Unreal Engine. Unreal is probably overkill for what I want to do and not suitable for 2D, so my first choice was Godot.

Godot

This means that Godot is on the table. I avoided it at first because I’m the most comfortable writing JavaScript, and last time I checked, the developers were in the process of releasing version 4 with a huge rewrite of the engine, so I decided to wait.

There are two options for writing the code: GDScript and C#. After watching many videos about the advantages of one over the other, it seems that GDScript will emerge as the winner, so I will go with that.

Writing GDScript seems simple enough; it has basically the same syntax as Python, and it brings deep integration with the IDE.

While Godot seems to be great for making games, the situation of making web games is problematic at the moment because it does not support macOS web export. This is a problem when I’m planning on mainly making web games.

Defold

When searching for new engines, I stumbled into Defold.

I had never heard of it before, but; I’m very surprised. The engine is open source, free, and the export is very straightforward supporting almost every platform, including macOS, Windows, Linux, Android, iOS, HTML5, consoles, etc.

It uses Lua which I never wrote before, but I kinda love it now, it’s simpler than Python, it’s clear, and the compilation time is incredible fast, if you don’t believe me watch Lua in 100 Seconds

The IDE is very well organized, I was able to create most of the logic I need for my game after watching a couple of tutorials.

So far, I feel more tempted to start writing my game in Defold until Godot gets their web export fixed.

While they promote themselves as a 2D engine, underneath it’s a 3D engine, and it’s getting better and better.

There are fewer tutorials for Defold on the wild, the official tutorials are high quality, teaching step by step, with clear goals and good results.

Alternatives

I was tempted by other approaches like raylib specially using node-raylib, and Bevy, but I guess it’s better to bet on a bigger community and a more complete engine.

Conclusion

There are many ways to make games, and betting on open source should be the way to go, especially when game developers tend to be very talented people who are willing to collaborate on making a better engine.

Using a game engine brings many advantages. For me, having a community of people creating learning content is the greatest advantage, I can focus on making the game and not the engine, and I can export to many platforms.

Abstract illustration of an engine

Metadata
Published
Length 5 min read (917 words)
License CC BY-SA 4.0