> The engine was created using Kotlin *Multiplatform* and can run on a JVM and JS.
Kotlin allows you to have a single codebase that compiles and runs on:- JVM
- WASM
- JS
- Native Windows/Linux/Mac (LLVM)
- Android, iOS/tvOS/watchOS
This is disregarding any notions about the language benefits of Kotlin vs Java.
The JS version has very high latency. How does it work under the hood?
Can the same pipeline port Java Applets to WASM/JS?
> How does it work under the hood?
The Kotlin is transpiled to JavaScript by the Kotlin compiler:For non-applets there is even more possibilities: there is google’s closure compiler and teawm, both can produce really great code!
The docs at https://minigdx.github.io/tiny/ have a demo "BREAKOUT" game embedded in the page under the first paragraph with a link to the source code lol
Screenshot for reference: https://i.imgur.com/TVzQwiu.png
But I guess I'll dig through at some point...
nm, that breakout (that you could run on a 6502) maxxes a 15W modern CPU core. That's 10.000x less efficient.
> I think it would be more interesting to expose how the bytecode becomes JS.
There's no bytecode emitted -- Kotlin is unique among JVM languages in that it acts more like a frontend, similar to LLVM or GCC.The Kotlin code is translated from an IR/AST into JS directly. The JS is one of many target languages for the Kotlin compiler.
Kotlin Source Code
|
Kotlin Compiler
|
IR
/ / \ \
JVM WASM Native JS"Unique among JVM languages" lol. Like most of the good parts of Kotlin, this was actually copied from Scala.
oh i forgot, 2000 fps is good for bragging rights