I never intended to write a game engine. In Javascript. But I did am.

It started out as one of those “I wonder if I can…” questions. In this case, it was “I wonder if I can make a game based on what I’ve learned about game development over the years, but have never actually put into practice.”

I mean, I’ve read a ton of stuff, watched tutorials, looked at and successfully modified existing open source game code to varying degrees but for whatever reason never really had the motivation to do it for my own project.

Then, one day whilst playing Elite: Dangerous, flying the long-haul out to Hutton Orbital, I figured it’d be a bit more fun if I could play some version of Elite, inside Elite. And that was the trigger: I had an idea, and a specific use case instead of some vague notion of making just another Space Invaders clone in an already over-crowded market for an audience that doesn’t really want or need one.

So I began making a 2D top-down infinite scrolling version of Elite that I’ve called Elite Arcade. It took a long time, gradually layering techniques one on top of another, looking up specific ways to achieve some things while making up others for myself.

But ultimately I had a game of sorts. Lots of things are working: Ship modelling, collision detection, point scoring, power-up drops, shields, hull damage, some graphical effects, rudimentary AI, basic behaviours and roles, autonomous relationships that form between the player and NPCs and among NPCs themselves, sensors and a HUD, joypad support, a functional touch interface and keyboard support. All in Javascript, and all without any pre-existing frameworks or engines.

There are still a couple of game mechanics that need to be polished up and some bugs to fix but it was at this point that I stepped back for a moment and realised that the biggest effort still lay ahead: missions and gameplay, both of which I have a ton of ideas for.

But then another thought struck me immediately: all the stuff I’ve written already makes a pretty good basis for a stand-alone game engine.

And so began Eccentric Engine.

It turned out, though, that separating the core engine parts of Elite Arcade from the elements that are very much Elite-specific gameplay was a bit tricky because I hadn’t actually intended to create a game engine when I started coding. Remember, this was just a “I wonder if…” exercise that kind of grew into yet another “I wonder if…” thing.

Anyway, the long and short of it is that I have yet another project in progress that was built to test the game engine’s suitability for hosting a slightly different style of game, and because it turns out that I did really want to make yet another Space Invaders clone after all, but for a very specific implementation: Astro Wars.

You might be wondering why I chose Javascript, and why I didn’t do the sensible thing make use of an existing game engine framework. There are enough out there, after all.

To address the second question first, I didn’t use an existing engine because I wanted to really get to know all the things a typical engine has to deal with, to discover where the bottlenecks are, what the absolute minimums in each area are that would be just good enough to get something up and running, and I had no time pressures to get it done. It was purely a learning and exploration undertaking with nobody to answer to other than myself.

In terms of choosing Plain Old Javascript, that happened ultimately it’s because it’s easy and immediate with a very low bar to entry – you just need a browser and a text editor to get started. Sure, it’s also easy to write more than enough code rope to hang yourself with, and I did several times. The trick is recognising when it’s happening and trying to make it right, or deciding to live with it for the time being.

I did also add Webpack and NPM into the “toolchain” for Astro Wars because these bring improved browser compatibility and easier setup in exchange for some additional complexity in the project definition files. And there’s a ton of resources out there to help with those, too.

If you happen to go off and explore the code I’ve written (it’s all on Github), don’t expect anything beautiful, and don’t even expect to find instances of best practice all over it. This thing is still taking shape, and is honestly likely to morph and warp in all kinds of ways I haven’t considered yet.

The really interesting (to me at least) thing about this whole endeavour has been the way the initial project “Can I make a game…?” has answered that particular question for me, and spawned several other ideas as well, all of which are lined up on my drawing board, and all are pleasingly different from each other.

I did, and still do, intend to share Elite Arcade with the Elite-playing community, and maybe even try to get Frontier to implement it in their shipboard computers so that the next journey to Hutton Orbital might be just a little more bearable. I’m not particularly hopeful that it has any chance of happening, but I’m channeling my inner Field of Dreams here: If I build it, they will… use it?