Sometime last year I started tinkering with StaticCompiler.jl for fun. I was able to PoC getting it to work with SDL to create web builds. I was able to write the actual game logic in Julia and convert it to WASM. The game is very simple, but I thought it’d be a good way to show off what I was working on. This is something I’d like to tinker with more and see what I can do with it. I don’t know if anyone has done something similar, but I thought it was cool to get Julia running in the browser. If anyone is interested, here’s the source code for this specific game: StaticCompilerGame.jl/sand.jl at main · Kyjor/StaticCompilerGame.jl · GitHub . The repo is really messy at the moment, but I plan to clean it up as I work on other projects within it. Also, I still am working on the commercial game. Things are taking longer than expected, but we are still making progress.
Thank you! Yes, this is a very simple version to show that it’s not too hard to create WASM code using Static Compiler. I adapted the code from someone else’s example
This sounds great! Once you seem to be keen to work with wasm, I would like to make you aware of this thread. May be you get some ideas for synergy with other attempts on Julia and wasm.
This is really nice and quite fun to play with!
Your approach to manipulate the game state is quite interesting:
Is it that julia in 64-bit uses wrong alignment for WASM 32-bit therefore you have to implement the accessor function manually?
I guess, I side stepped the problem in these experiments by using julia 32-bit for the cross-compilation. Hopefully this will get better in the future.
I am wondering if you considered to use MallocArray ? This allows you to use the regular julia array syntax A[i,j] = value (as long you use @inbounds)
It’s been months since I initially implemented that, but IIRC that was the issue! I guess I didn’t think about using julia 32-bit, but that’s a great callout!
I believe at one point I tried to use MallocArray and was having a bit of trouble understanding how to use it. I’ll take a look at your code and use it as a reference. Thanks!!