digitalmars.D.announce - Running a D game in the browser
- Sebastien Alaiwan (18/18) Aug 03 2016 Hi,
- Kai Nacke (8/26) Aug 03 2016 That's awesome!
- Sebastien Alaiwan (6/10) Aug 04 2016 That would be great, and might simplify the toolchain a lot.
- Sebastien Alaiwan (5/7) Aug 04 2016 I created a dedicated github branch "fastcomp-ldc".
- Johan Engelen (10/17) Aug 05 2016 That patch doesn't look too bad.
- Sebastien Alaiwan (9/16) Aug 07 2016 I could definitely formalize things a bit, but any patch of this
- Dechcaudron (5/7) Aug 03 2016 I know virtually nothing about compilers and even less about
- Joel (7/12) Aug 03 2016 Good work.
- Joel (2/15) Aug 03 2016 Oh, I read it wrong, the score is reset. Dummy, me!
- Sebastien Alaiwan (9/12) Aug 03 2016 It's just that you're becoming better at this silly game :-)
- Joel (4/5) Aug 03 2016 On Wednesday, 3 August 2016 at 20:26:23 UTC, Sebastien Alaiwan
- Mark "J" Twain (16/34) Aug 03 2016 Interesting but a bit lame.
- Chris (7/25) Aug 04 2016 Cool. I think the D Foundation should actively support stuff like
- Mike Parker (4/8) Aug 04 2016 Reddit:
- Sebastien Alaiwan (3/12) Aug 04 2016 HN:
- Suliman (7/7) Aug 04 2016 Very cool!
- Martin Tschierschke (5/11) Aug 04 2016 [...]
Hi, I finally managed to compile some D code to asm.js, using Emscripten. It had been done by one dude several years ago, but some changes in the inner workings of Emscripten (the introduction of fastcomp, also probably combined with changes in the way LDC generates LLVM bitcode) made it impossible to use the same technique. You can play a minimalistic demo: http://code.alaiwan.org/dscripten/full.html The source code + toolchain deployment scripts are available on github: https://github.com/Ace17/dscripten And a blogpost explaining the technique is available here: http://code.alaiwan.org/wp/?p=103 (Spoiler: at some point, it involves lowering the source code back to C) Please let me know what you think!
Aug 03 2016
On Wednesday, 3 August 2016 at 20:26:23 UTC, Sebastien Alaiwan wrote:Hi, I finally managed to compile some D code to asm.js, using Emscripten. It had been done by one dude several years ago, but some changes in the inner workings of Emscripten (the introduction of fastcomp, also probably combined with changes in the way LDC generates LLVM bitcode) made it impossible to use the same technique. You can play a minimalistic demo: http://code.alaiwan.org/dscripten/full.html The source code + toolchain deployment scripts are available on github: https://github.com/Ace17/dscripten And a blogpost explaining the technique is available here: http://code.alaiwan.org/wp/?p=103 (Spoiler: at some point, it involves lowering the source code back to C) Please let me know what you think!That's awesome! Do you still know the modifications you made to compile LDC with emscripten-fastcomp? I would be interested to have a look into the "PNaCl legalization passes" problem. Regards, Kai
Aug 03 2016
On Wednesday, 3 August 2016 at 20:40:47 UTC, Kai Nacke wrote:That's awesome! Do you still know the modifications you made to compile LDC with emscripten-fastcomp? I would be interested to have a look into the "PNaCl legalization passes" problem.That would be great, and might simplify the toolchain a lot. First we must get the build to pass again ; I'm working on it at the moment, I have a patch to making the build work (only for the binary "ldc2", not other tools of the package). I can send it to you if you want.
Aug 04 2016
On Thursday, 4 August 2016 at 19:17:34 UTC, Sebastien Alaiwan wrote:at the moment, I have a patch to making the build work (only for the binary "ldc2", not other tools of the package).I created a dedicated github branch "fastcomp-ldc". The patch: https://github.com/Ace17/dscripten/blob/fastcomp-ldc/ldc2.patch
Aug 04 2016
On Friday, 5 August 2016 at 05:39:57 UTC, Sebastien Alaiwan wrote:On Thursday, 4 August 2016 at 19:17:34 UTC, Sebastien Alaiwan wrote:That patch doesn't look too bad. Could you introduce a CMake option for building with Emscripten-fastcomp? And a #define "LDC_LLVM_EMSCRIPTEN" or something like that, so that you can change `#if LDC_LLVM_VER >= 309 && 0` to `#if LDC_LLVM_VER >= 309 && !LDC_LLVM_EMSCRIPTEN`. Should be mergable into LDC master then! cheers, Johanat the moment, I have a patch to making the build work (only for the binary "ldc2", not other tools of the package).I created a dedicated github branch "fastcomp-ldc". The patch: https://github.com/Ace17/dscripten/blob/fastcomp-ldc/ldc2.patch
Aug 05 2016
On Friday, 5 August 2016 at 13:18:38 UTC, Johan Engelen wrote:That patch doesn't look too bad. Could you introduce a CMake option for building with Emscripten-fastcomp? And a #define "LDC_LLVM_EMSCRIPTEN" or something like that, so that you can change `#if LDC_LLVM_VER >= 309 && 0` to `#if LDC_LLVM_VER >= 309 && !LDC_LLVM_EMSCRIPTEN`. Should be mergable into LDC master then!I could definitely formalize things a bit, but any patch of this kind would quickly be obsolete, as Emscripten catches up with LLVM versions. Moreover, I don't feel comfortable polluting LDC with the specificities of some obscure use case (as cool as this use case can be!). It might be preferable - though harder - to patch Emscripten so it aligns on LLVM official API versions.
Aug 07 2016
On Wednesday, 3 August 2016 at 20:26:23 UTC, Sebastien Alaiwan wrote:I finally managed to compile some D code to asm.js, using Emscripten.I know virtually nothing about compilers and even less about Emscripten, but the fact that you managed to get a D game running inside a browser is plain awesome. Congratulations!
Aug 03 2016
On Wednesday, 3 August 2016 at 20:26:23 UTC, Sebastien Alaiwan wrote:Hi, I finally managed to compile some D code to asm.js, using Emscripten.Good work. [snip]You can play a minimalistic demo: http://code.alaiwan.org/dscripten/full.html[snip] Though, it looks like the score isn't reset when you start a new game. Or, is it intended that way?
Aug 03 2016
On Wednesday, 3 August 2016 at 23:23:24 UTC, Joel wrote:On Wednesday, 3 August 2016 at 20:26:23 UTC, Sebastien Alaiwan wrote:Oh, I read it wrong, the score is reset. Dummy, me!Hi, I finally managed to compile some D code to asm.js, using Emscripten.Good work. [snip]You can play a minimalistic demo: http://code.alaiwan.org/dscripten/full.html[snip] Though, it looks like the score isn't reset when you start a new game. Or, is it intended that way?
Aug 03 2016
On Thursday, 4 August 2016 at 05:03:17 UTC, Joel wrote: [snip]It's just that you're becoming better at this silly game :-) Thanks for your replies! As Mark guessed, I didn't spend a lot of time on the game-design side (but I'm still interested in game-design related comments). It's more of a proof of concept, using D. Using C++, there already are impressive demos: https://kripken.github.io/BananaBread/wasm-demo/index.htmlThough, it looks like the score isn't reset when you start a new game. Or, is it intended that way?Oh, I read it wrong, the score is reset. Dummy, me!
Aug 03 2016
On Wednesday, 3 August 2016 at 20:26:23 UTC, Sebastien Alaiwan wrote: [snip]Please let me know what you think!Another thing, the sound effects are late.
Aug 03 2016
On Wednesday, 3 August 2016 at 20:26:23 UTC, Sebastien Alaiwan wrote:Hi, I finally managed to compile some D code to asm.js, using Emscripten. It had been done by one dude several years ago, but some changes in the inner workings of Emscripten (the introduction of fastcomp, also probably combined with changes in the way LDC generates LLVM bitcode) made it impossible to use the same technique. You can play a minimalistic demo: http://code.alaiwan.org/dscripten/full.html The source code + toolchain deployment scripts are available on github: https://github.com/Ace17/dscripten And a blogpost explaining the technique is available here: http://code.alaiwan.org/wp/?p=103 (Spoiler: at some point, it involves lowering the source code back to C) Please let me know what you think!Interesting but a bit lame. 1. The movement should continue in the same general direction, if not exactly the same. It is impossible to avoid something that can do anything. 2. The movement shouldn't accelerate so fast, it's harder to control where you want to go when if you hold the key down a you end up on the other side of the screen. Of course, I doubt this was a game intended to be fun ;) The good news is that you have a lot of upside. Consider making a video player... replace stinking flash! Could create better websites by having more programmatic functionality, etc.. (more app like websites) The upside, from the initial looks, seems to be quite good if you go in that direction.
Aug 03 2016
On Wednesday, 3 August 2016 at 20:26:23 UTC, Sebastien Alaiwan wrote:Hi, I finally managed to compile some D code to asm.js, using Emscripten. It had been done by one dude several years ago, but some changes in the inner workings of Emscripten (the introduction of fastcomp, also probably combined with changes in the way LDC generates LLVM bitcode) made it impossible to use the same technique. You can play a minimalistic demo: http://code.alaiwan.org/dscripten/full.html The source code + toolchain deployment scripts are available on github: https://github.com/Ace17/dscripten And a blogpost explaining the technique is available here: http://code.alaiwan.org/wp/?p=103 (Spoiler: at some point, it involves lowering the source code back to C) Please let me know what you think!Cool. I think the D Foundation should actively support stuff like this (once funding and resources are secured). Mobile (iOS/Android) and asm.js. That's where huge shares of the market are, it's a "must have". PS I don't like WASD in the game, I'm not left handed ;)
Aug 04 2016
On Wednesday, 3 August 2016 at 20:26:23 UTC, Sebastien Alaiwan wrote:And a blogpost explaining the technique is available here: http://code.alaiwan.org/wp/?p=103 (Spoiler: at some point, it involves lowering the source code back to C)Reddit: https://www.reddit.com/r/programming/comments/4w3svq/running_a_d_game_in_the_browser/
Aug 04 2016
On Thursday, 4 August 2016 at 09:57:57 UTC, Mike Parker wrote:On Wednesday, 3 August 2016 at 20:26:23 UTC, Sebastien Alaiwan wrote:HN: https://news.ycombinator.com/item?id=12225036And a blogpost explaining the technique is available here: http://code.alaiwan.org/wp/?p=103 (Spoiler: at some point, it involves lowering the source code back to C)Reddit: https://www.reddit.com/r/programming/comments/4w3svq/running_a_d_game_in_the_browser/
Aug 04 2016
Very cool! Is it's possible now to write not graphical Apps for web in D? I do not need graphics, but I need normal language instead of js that can help me to do some computation. For example is it's possible to write in D app that would validate some fileds in HTML and simply show (even on console) information about data in them.
Aug 04 2016
On Wednesday, 3 August 2016 at 20:26:23 UTC, Sebastien Alaiwan wrote:Hi, I finally managed to compile some D code to asm.js, using Emscripten.[...]You can play a minimalistic demo: http://code.alaiwan.org/dscripten/full.html[...]Please let me know what you think!Fascinating!
Aug 04 2016