10 Years of development: A custom game engine


So it's late on a Friday night after a work day and I fancied writing something up about my custom game engine behind Dead Desert and some of the tools I made for the engine, after all I think it's quite interesting!

If you want to know about Dead Desert check it out here: https://ajamdonut.itch.io/deaddesert  

As you'll see from the post I've tried to keep it short and without any typical British Sarcasm (This is a joke, you should read the whole thing with a hint of British Sarcasm, if you can even do a northern British accent in your head as you read it that would be great.)

(Disclaimer: Dead Desert and the Game Engine has not been in development for 10 years, BUT the tooling I use certainly was started from scratch in 2008 (I was 18).... wow I'm old :( and these tools are now over 10 years old. 

This tooling is now integral to the development of the game and serves as the "toolset" - if you like - for the game engine and the development pipeline)

(Disclaimer 2: In case you're ever wondering why the frick I'm using JavaScript, and not C++, Java etc - it's simple, my day job is lead dev for a full stack team who use JS / PHP, when I started my projects I never expected to get this far. Oh and I also love JS; let the haters hate)

[Bonus: Here's a lil video, just a lil clip I threw up as a mock before making the Dead Desert game]

My toolset looks like this right now:

  • A custom JS Game Engine using PixiJS
  • A custom JS Map Editor
  • A custom Object Management Database in PHP/MySQL
  • And.. A custom entity creator, multi platform build generator, auto-translator, GUI Editor and more (they're boring and rubbish so if I don't mention them in the post you can find them on my twitter!)
  • Spine for Animations
  • Affinity Designer for Art
  • Google Docs to manage everything else (tasks/plans/ideas/etc)


A bit about how it started - Silly dev makes something in 2017

The engine for the game and the tooling around creating it are almost completely custom, created by myself spanning over 10 years. 

Because the tooling and engine were not built specifically for the game and evolved over time, I can't say it's a good idea to develop your own game engine, I simply did naturally out of a curiosity of what I was creating, past projects and never wasting any code (this doesn't mean not rewriting 1000's of lines of it though... at least 3 times).

The 2D aspect of the game engine started around 4 years ago, with a very simplistic shape drawn on the screen which would move around, adding a few more shapes and tools allowed me to create a sort of "Flatland" like world, as can be seen in the video below:

Video 1 - [03 March 2017]

This early prototype wasn't created with a purpose of making a game; I was simply having fun with HTML5 canvas, path finding and other such tech... for fun!

So after a while I get thinking about game ideas for this little prototype I had created, and that's when I think up Arcade Builder, which gets released on Newgrounds and various sites a couple times. 

The clip below shows a little of what that game looked like after its latest release, a vast difference from the last video - but the similarities and core mechanics are still there:

Video 2 [08 Nov 2019]

And with the release of Arcade Builder, and finding it didn't all fall to pieces on launch, I figured why not set my sights on a bigger game, one with a huge map, complex AI, combat and stories and dialog... Because... well I'm dumb and hopeful. But that's a good thing.

So here's the last video for this post, the rest will be screenshots, but this is just a pan around of the large map Dead Desert has, this shows just 1/100th of the map.

Video 3 [19 June 2021]

So... and a big 'so...' here, how the frick did I go from video 1, to video 2 and then video 3; in short the real answer is time... I just grinded and grinded, but let me go a bit deeper down the well and reveal some of the stuff I did.

The custom JS Engine - A stolen JS library

So as we can see from Video 1, the prototype looks like rubbish and is barely functional, even I was surprised it ran to be honest... It was using simple javascript, simple canvas with no object orientated approach at all.

After a few more iterations I noticed slowdowns of the canvas which at first I blamed the canvas API, and therefore started investigating WebGL libraries.. Bringing me to PixiJS. A little gem that would serve perfect as the base for my game engine; not well known due to its niche application in the web world, but an amazing little 2D rendering library with an appropriate license to let me use it, with all sorts of functionality built in and a bunch of open source libraries readily available.

I love the PixiJS guys and what they've made. They helped me get so far and personally respond to my forum posts and issues as I progress building a game engine on top of their amazing library.

This really boosted development, even with my rubbish code the game ran sweet and I could use PixiJS to build out all the rest of the components I would need; UI, buttons, animations, all sorts.

After 6 months of working with PixiJS I had released the first version of Arcade Builder, with 2 more versions coming out over the following 1 and a half years.

The custom Map Editor - A repurposed old game.

So when I designed Dead Desert I needed a map editor... Some way to manage this enormous map I wanted to create... It didn't take long before silly thoughts started creeping in... "Isn't it funny how I've just made a game which literally lets you build your own arcade... placing items... placing floors... kinda sounds like a Map editor to me!"

And so it was. I now use my re-purposed old game, to make the maps for my latest game. Talk about creative upcycling huh. It works a charm. The items I add to my object manager (see further down) instantly load into the level editor, and those same objects can be used to add logic/gameplay and functionality to the game. Quick, simple, dusted, done.

The level editor has now been used for over a year to develop, test and run the game,, and I'm extremely happy with the results.

Screen 1 - The level editor, simply a list of objects/tiles and the ability to edit NPC's and Items in the world.


The Object Manager - An ancient piece of technology

So my games... They have lot's of items, lots of little things I want people to see, interact with, place and y'know the usual Cow extends Animal story. Well anyway when I was 17 (2007) I made a game with a buddy called Luke, the game was an Online Browser RPG still online today.

It had the same requirement for the game, where it needs loads of items which all do different things; and so we came up with this control panel that manages aaaaall the items in the game. Want a cow? Describe cows to our tool, and you now have a cow, infact you can have any cow you want.. Milk cow? beef cow? milkshake cow? Mmmm.. milkshake cow.

And so after releasing the first version of Arcade Builder and wanting to push harder with the game and add much more items faster and easier - I wanted a tool that would fit the job, and remembered this one I had developed for the online game, it was still really decent and work well on my machine.

Without going to deep into how proud I was this relic worked... this tool just worked so well and I could extract the items from it quite simply since I made the thing after all. It's powered by PHP (since it was an ancient browser based game) and has a MySQL database. I just grab this data, turn it into Javascript or JSON depending on what funky stuff I'm doing; and boom... items in my game. 

Here's some screenies

Screen 1 - This is just a list of all the different item types.. You can add new ones, export them, change what variables they have... All sorts

On the left hand side you'll see that pretty much every object you need in a game is there, dialog, sprites, tilesets, collision handlers, particles, items... Everything I need in my game, I just add it here.


Screen 2 - Here we can see a list of sprites for weapons, the list at the top is the categories of sprites currently in the game.

Screen 3 - Here is a part of the tool where I'm managing one of my GUI's

As you can see at [A] I have a preview of the GUI component, and at [B] I have the actual code to render that component

Pros and Cons - Or TL'DR

Ooo I made a nice little table with pros and cons to making my own engine:

Pros Cons
If there is a bug, it's typically caused by your code, so it's easier to fix If there is a bug, it's typically caused by your code, so it's harder to fix
You can avoid stack overflow for solving problems You can't just use google or stack overflow for problems
You control every little "tick" and detail (I love this aspect) You control every little 'tick'... You better be good at performance
Some people admire the fact you're making a game from scratch Some people have other opinions on how best to make a game
The engine is focused on just your games needs No documentation unless you write it
The software is lighter and your dependencies can be lower You will forget you coded something and code it again
It makes your game a little bit quirky Some things you want are just too hard for you to code (see recommendation 1)
No community that relates to you (see recommendation 2)
It's super hard to stay driven (see recommendation 3)
It's super hard to actually deliver the game (see recommendation 4)

Conclusion

And so I don't want to add too much, I think this post has already gone on for too long. But I think I might add another post in future about the other tools I have made for the game. I'll close out with some personal sentiment and recommendations.

If you are making your own game engine, I really commend your effort and you have my admiration for sure; I do think you will struggle to release a game, but that doesn't mean you won't - there are countless examples of games out there with custom game engines.

If you're thinking of making your own game engine; let me ask you this... what's more important, you figuring out how to write a game engine, or you actually delivering a game?

If you're making a game and just think this is cool, well thanks for reading - I'll be surprised if you read it all. Nice grind. Good luck with your game I hope it makes millions.

If you're just reading it coz you're a boss... Well done. You completed the game.

Some recommendations for other game devs and engine devs

  1. If you can't code something coz it's just to hard (sometimes it is just accept it), take it out of scope for now and try to add it later... I didn't add chunks into my engine until my 3rd game in the engine.
  2. One huge bonus of using a tool like Unity or UE is the community. Community is one of the most understated things you need for a game to succeed, and when you use a tool that's so widely adopted, you also get adopted into that community. You'll find places to hang out in discord, places to post issues online and this in turn gets you into the good books of other developers who will absolutely share your game and help you!


  3. Staying focused on a project isn't just one of the biggest challenges in solo/indie dev - it's "the" challenge. If you can stay focused for long
    enough, you will deliver a game. But what does focus really mean? To me it means my energy is focused; not my mind, not my task list. No... My energy. If I'm spent, tired and I don't want to work.. I won't. I play the games that inspire me, speak to the friends that enthuse me. It's break time, even if that lasts 1 month, 2 months... I'm in it for the long haul, I've been doing this for 13 years, 2 months break is nothing. So I take my break, remembering I owe time to the project. When I'm recharged, I jump back in - Focused as ever and ready to roll.


  4. It's super hard to deliver a game... it's super hard to do anything. If you have picked to develop a game, and your own game engine - you just made it 10x harder. But - if you focus on the right areas to develop for your game and you keep the scope tight, you can deliver it. When I made arcade builder I had one secret trick up my sleeve... Arcade machines and games all do the same thing... You walk up, pay money, walk away. That's tight, that's focused. I develop that one bit of AI and now apply loads of variation around it, simple. Again I thought Arcade Builder eventually would just not be realised as a game but nope... There it is... being played in all it's buggy glory.


Catch me outside

If you like my stuff please follow me on twitter I post random rubbish all the time if I remember: https://twitter.com/AJamDonut

Get Dead Desert

Comments

Log in with itch.io to leave a comment.

(+1)

Really cool to read about your custom engine. Loved Arcade Builder. I’ll live stream Dead Desert when that’s out for sure ✌️

Eyy thanks buddy, i'll make sure to drop a message as soon as I have something ready!