playcanvas / playcanvas/engine
Explore AssemblyScript integration
@mvaligursky is already working on this.
Since Sep 2, 2020.
- Dominant language
- JavaScript
- Stars
- 16.8k
- Forks
- 2k
- Avg merge
- 4h 32m
- Merged PRs (30d)
- 222
Description
We have a PR https://github.com/playcanvas/engine/pull/2213 which explores one way of using AssemblyScript (WASM) modules by Playcanvas. I would like to explore a way to build custom functions using AssemblyScript, which can be called by the main engine in JS to optimize hot functions / but perhaps do more in the future.
Main objectives:
-
build system should build the engine as currently, but build wasm module along it from separate ts files.
perhaps https://www.npmjs.com/package/rollup-plugin-assemblyscript could be useful here
but also this is interesting as it allows to embed the wasm module into main script
https://blog.scottlogic.com/2017/10/30/migrating-d3-force-layout-to-webassembly.html
https://github.com/rollup/plugins/tree/master/packages/wasm -
AssemblyScript allows code to be compiled to WASM, but also generate TS code. It would be good to have this as an option during development / debugging, allowing easy debugging of AssemblyScript code in form of TS.
Later:
- AssemblyScript has support for SIMD and atomics (experimental features), it'd be great to see if these can be used. I'm not sure what the impact is of the code using these still being able to compile to TS.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.