armory3d / armorcore

3D Engine Core for C with JS scripting

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

V8 bytecode compilation and support

N8n5h opened this issue · comments

commented

This is a feature request / question: is it possible for armorcore to support V8 bytecode to protect armory code, similar to NW.js and Electron with https://github.com/OsamaAbbas/bytenode?

If so, what needs to be done for it to work?

Hi, it's already implemented in armorcore via the --snapshot flag. I will eventually make Armory use this system as well but it requires some special treatment, because the snapshot is also used to pre-parse and embed assets directly into krom.bin.

./Krom . --snapshot

Generates a krom.bin file from krom.js file. krom.js file should already be minimized using the closure compiler. When --snapshot flag is passed, Main.main() function is used as a startup point for serialization.

./Krom . # Regular startup

Looks for a krom.bin file. If it exists it gets de-serialized and Main.kickstart() function is used as a startup.

https://github.com/armory3d/armorpaint/blob/master/Sources/Main.hx#L42
https://v8.dev/blog/custom-startup-snapshots