Germination X: More on platform independence

More detail on yesterday’s HTML5 canvas version of Germination X. The game engine it uses (known in the source code as “truffle”) is carved up into several layers in order to allow it to make use of HaXe’s cross platform abilities. This is exactly the same concept as used with console games – you set up some standard interfaces to be used from the game code, and implement them for each target at the lower level. The main thing it to make sure you continually build and test both versions.

Here’s a diagram with rounded corners:

There are a few things in the game code I needed to go directly to flash for, one was the glow effect on the plants owned by the player – using a filter. The other was doing an image pixel colour lookup to get the emotional colours for the spirits – both of these are switched off in the canvas version, to be fixed later.

One of the things I’m most impressed by is the ability to send a HaXE closure to Javascript code, store and run it from there (for example on those pesky mouse events on sprites). Of course this works as it’s all Javascript in the end, it’s just one of those cool things that takes you by surprise.

Creative Commons License
This work, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>