Making engines

Making engines

in

I wanted to make this post about my planned milestones for 2026 but realized I have to talk about engines in general first because it will keep popping up otherwise.

Why not to make a game engine

The one thing everyone knows about game development is that you should not start by making your own game engine. At least not if you want to ship a game at some point.

Making a full-fledged game engine is a much bigger project than making a game. There are plenty of game jams; there are no game engine jams. Of course one part of it is that using someone’s game engine is a lot more work than playing someone’s game.

But that’s also the point. It is very unlikely that anyone is going to use your game engine, even if you finish and publish it. There are after all, ones with more features, better documentation and more frequent updates.

There are a couple of reasons to roll your own tech, however:

  1. You are doing it for fun
  2. No existing engine does what you want
  3. You are making an engine for a specific type of game

Now number one is pretty self-explanatory. Learning is fun and everyone needs a hobby.

Number two is more interesting and there is a lot of room to be weaselly here. Is your game idea really that special? There is probably a plugin or extension you can use (or create yourself) instead of creating a whole game engine.

Number three is kind of what I am doing. Instead of creating a generic engine like Unreal or Godot, you should focus on what you actually need and want for your projects.

Not really making a game engine

I am not really making an engine. I’ve thought about what words to use to describe it but none of them really fit. What I really am building is a virtual machine, like the Z-machine.

However, if I talk about a virtual machine, most people will not know what I am talking about, and most of the rest of them will think I am talking about operating system emulation or cloud computing. So I will mostly refer to it as an engine.

But yes, what I am making is a Domain Specific Language (DSL) for defining games and an interpreter for that language. This is actually a common practice in interactive fiction. In addition to the ZIL language for the Z-machine, there is also a lot of other languages, the biggest ones being Ink, Inform, ChoiceScript, and so on.

Why make another one?

So why not use one of those instead?

Well first of all, most of those are very specific. With that comes assumptions about the type of game you’re making.

For Ink and ChoiceScript those are that you are expected to mostly be writing the text of your story while sprinkling dynamic bits into it. There is very little support for more complicated world models (state management) or role allocation (deciding which entities fill which parts).

For Inform and other adventure game languages, there is better support for creating an interactive world. But these then take a very simulation-first approach, where the player is expected to be manipulating objects turn by turn. This strongly guides you towards making a very specific type of game.

Also, I am becoming more convinced that you should build your simulation on top of your game, instead of trying to build a game on top of your simulation. But maybe more about that in a later post.

So what I really want is a system that puts the game functionality first but which is generic enough to create several types of menu based story games without lots of boilerplate.

Using a game engine anyway

Now even if you are making your own language and interpreter, you still need to handle all the other stuff a game engine would handle, like rendering graphics or handling user input. For these I am actually using an engine (for browsers it’s Phaser 4, for desktop it will probably be LibGDX). But I am using it more like a software framework.

The whole thing is basically:

  1. The game configuration files (written in the DSL)
  2. That are interpreted by my code (written in Clojure)
  3. Which communicates with the game engine (Phaser)

This has the benefit of all pieces being modular. So the files can be changed for each game without touching the code, the code can handle standard stuff like saving and menus that are the same from game to game and the engine can be switched if necessary.

That last part is especially relevant now after Unity’s questionable choices in recent times. And also because I want support for both browser and desktop. Even porting to console should be easier with this setup.

Conclusion

There’s plenty more to talk about this, but I am trying to keep these posts relatively contained and on topic. I didn’t even mention Ren’Py, Versu or SCUMM. I’ll go into the details in later posts.

Until then, look before you leap and think before writing your own game engine.
See you next time.