Ported js13k game underrun to D targeting webassembly

Steven Schveighoffer schveiguy at gmail.com
Sun Nov 18 19:51:06 UTC 2018


On 11/17/18 4:35 PM, Sebastiaan Koppe wrote:
> Underrun is small game build by Dominic Szablewski for the 2018 
> js13kGames competition.
> 
> I decided to port it to D and to target webassembly. You can play the 
> game here https://skoppe.github.io/spasm/examples/underrun/
> 
> It is part of my endeavour into the wonderful world of webassembly. I 
> specifically choose this project so I could get a feel for how to call 
> web api's other than the dom, i.e. WebGL and AudioContext.
> 
> Porting went pretty smooth, except for the fact that I wanted it to be 
> done in betterC, which turned out to cripple lots of things I am used to 
> rely on.
> 
> Things like:
> 
> - having to write closures by hand
> - not being able to use stdx.allocator
> - almost no use of phobos (even at CTFE)
> 
> D could definitely use some love in that area. I was specifically 
> stumped that stdx.allocator doesn't work in betterC; if somewhere is a 
> good place to use stdx.allocator you would expect it to be betterC, but 
> alas.
> 
> Had lots of fun though. Hope you like it.

Really cool. I didn't play the original, but I found this reasonably 
straightforward.

I love this this webassembly stuff, I think it's a fantastic 
demonstration, and test for the power of D.

A system to do closures by hand should be doable with templates I would 
think. Do you have a quick example?

-Steve


More information about the Digitalmars-d-announce mailing list