Understanding Heaps Deployment - Documentation

I’ve been reading and watching videos on Heaps and something I wish was documented better is how Heaps gets onto target platforms.

Here is my understanding so far:

  • Somewhere in Nicholas’s video on Heaps he mentioned that most of Heaps is written in Haxe. Since Haxe is designed to be compiled to any platform, this code is not a problem. What is a problem is the 20% or whatever that is NOT in Haxe (I think he said it was the renderer?)

  • With heaps you have various Target Platforms, currently listed as Flash, HashLink and HTML.

Now presumably if you want to target Desktop or Mobile you would use HashLink then, since the same page says By targeting HashLink you are also able to generate Native C code for your project (On another video Nicholas says you can just use Flash and Adobe Air to get onto mobile, but then elsewhere I’ve read him say that the performance for this isn’t great).

So for most common situations you would have Heaps Code (-> compiles down to) HashLink (-> which then can run on) Target Platform.

A few questions:

  • In the docs it says HashLink is a virtual machine. Does this use bytecode? So when you create a game.hl file - is this bytecode?
  • If this is bytecode, then are we not just running byte-code on the target platform? This doesn’t then seem like “able to generate Native C code for your project”… What am I missing?
  • If it is bytecode, do you then wrap your game.hl and assets with the platform version of the HashLink VM?

Maybe all of this stuff is obvious but I’ve somehow missed it from my investigations…

Yes, game.hl is bytecode. So you have to provide it, and its interpreter for the platform you target.

When you target hl, you can chose bytecode or C sources.

See: https://hashlink.haxe.org/

Now, compiling C sources for heaps is another story.
You can refer to this discussion: How to compile c files generated by HashLink

Thank you.

But Haxe is designed to target any language, correct? So surely you can target, say, Java. Then all you would need is the 20% of Heaps that is platform specific (now I think it was the DRIVER).

Am I getting close? I guess I’m asking about the build architecture. You have a game in Heaps, and it somehow can be used to run on HTML or on Mobile… where can I go to understand how this pipeline works?

For example, I know that Kha works by generating project files for each deployment. So if you target, say, Windows then it will generate a visual studio project for you. How does Heaps do it?