Thursday, August 31, 2017

Defold Game Engine

I haven't fooled around with game engines in a long while, and I recently learned about Defold. It's an engine bought over by King (of Candy Crush fame), and it's primarily for 2D development, though it's a 3D engine at heart.

I've been playing with it for over a week, mainly learning Lua and going through the various tutorials. For what it's designed for, it's superb.

However, when I started to deviate from its roots, I found it quite challenging to work with.

For a start, the camera. In Unity for example, it's quite straightforward to setup/position the camera, ortho or 3D, and do stuff like space transforms from screen space to world. It's all worked out in the api.

In Defold, things get a little more tricky.

The camera is pre-defined to work in a certain way, with the camera centered at the bottom left of the screen, which is perfect for what the engine is designed for. Given the genre of games that King develops, as well as a fair amount of games I've seen in the forums, this is perfect. It works out of the box, not much tweaking required.

For me, I wanted to try something different, a camera centered at 0,0 and that's when things got tricky.

To do so, you'll need to figure out a projection matrix for it. It's challenging, as I'm not a strong maths person. Embarrassing, considering what my job is. Hours were spent on Scratchapixel trying to understand exactly how it all works. I've definitely walked away with an improved understanding of the rendering pipeline, as well as a refresher course on matrices :)



On the flip side, the html 5 export is an interesting thing, it would be cool to dev mini games for my chromebook and stuff like that. I'm also quite fond of the way they handle input, some of my basic tests for mouse/keyboard input went flawlessly. Haven't yet tried touch, but given as I'm not as fascinated with mobile game dev as before, I don't think I'll bother.

I think the key draw for me is the engine's dev team. Defold was original developed years ago before it was bought over, and the development team, including the original developers, are active in the forums. That's houdini-like levels of awesome!

I've read many arguments why not to use an engine by King, (Banner Saga trademark thingy). That's really icky, but you know what, the engine itself was created way before King, and the folks developing Defold are responsive on the forums. For that reason - plus I'm not a game developer - I've decided to stick with Defold as my fun engine for choice for the time being.

No comments: