Flax HTML5 Game Engine Development Diary Part 2
As Tim Schafer might say, development is slower than molasses going uphill in January. On crutches. While Ciarán got a million and one things documented in the last few days (see?), I’ve mostly been fighting with the design for Weave. And it seems to have stolen my trousers.
What is Weave?
Weave will be a map (and audio and settings) editor for the engine. It’s got an awesome name, and it may or may not be powered by unicorn tears. It’s a browser-based GWT app, and it’s entirely my responsibility.
What does Weave look like?
I’m so glad you asked. It looks like this:
What does Weave do?
Weave’s split into three parts (really, two parts). It edits the maps, the audio and the settings. The latter two will be stored in XML files, and the maps will be stored as serialised objects in JSON format.
We’re using JSON for our maps because the map editor actually uses much of the actual game engine. Naturally, it has to render the map, all the objects, has to use a graphics abstraction layer, et cetera, and because we’ve already designed all of those things for the Flax Engine, it seemed foolish not to re-use those parts. I mean, we’re using GWT so we can leverage Java and OOP, and this is what Object Oriented Programming is made for.
We’re using XML for the Settings and Audio, as neither of those are actual objects (unlike the Map). I’ve not yet gotten around to properly designing those sections yet, so I’ll shut up about them and focus on the maps today.
Flax’s Maps
For Flax, we’re going with some good old 2D maps, Gameboy style. Essentially, they’re a group of tiles. These tiles are objects, programming-wise, so they each know where they’re supposed to go. They have a few default properties, and more can be added. The map object itself holds this group of tiles.
Easy, right? Right.
You said something about trousers?
Right, well. Up until now, it’s all been fairly easy. Designing Weave wasn’t too difficult. At least, that’s what I thought. Then the excrement hit the ventilator: we figured out that we couldn’t do things we wanted to do, namely using JSON to serialise and deserialise objects. Ciarán mentioned this in his post, with a handy-dandy diagram. Because of this, Weave’s gone through quite a few design revisions. We had maps as XML first, then JSON, then fully serialised, non-human-readable objects, then XML again, then XML and serialised objects, and now, finally, JSON again. Thanks to the magic of the GWT-Ent library, which we discovered a few days ago, we can serialise and deserialise objects just how we want them.
So, finally, we beat the problem into the ground and I took my trousers (and pride) back. Then I rode away on a unicorn.
Man, programming stories are fun.
3 Comments
Trackbacks for this post
[…] Flax HTML5 Game Engine Development Diary Part 2 […]
[…] Flax HTML5 Game Engine Development Diary Part 2 […]
[…] Flax HTML5 Game Engine Development Diary Part 2 […]