Thread overview | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
August 10, 2020 tetris in D in webassembly | ||||
---|---|---|---|---|
| ||||
http://webassembly.arsdnet.net/ tetris.d source here: http://dpldocs.info/this-week-in-d/Blog.Posted_2020_08_03.html#tetris-in-d web assembly source and explanation here: http://dpldocs.info/this-week-in-d/Blog.Posted_2020_08_10.html Short version: BARE MINIMUM druntime port to webassembly together with a bare minimum source port of simpledisplay.d to it as well made that little game playable. In theory we could make a lot more work by building up one function at a time. In practice I gotta get back to real work so don't hold your breath :) |
August 10, 2020 Re: tetris in D in webassembly | ||||
---|---|---|---|---|
| ||||
Posted in reply to Adam D. Ruppe | On 8/10/20 11:08 AM, Adam D. Ruppe wrote:
> http://webassembly.arsdnet.net/
>
> tetris.d source here: http://dpldocs.info/this-week-in-d/Blog.Posted_2020_08_03.html#tetris-in-d
>
> web assembly source and explanation here:
>
> http://dpldocs.info/this-week-in-d/Blog.Posted_2020_08_10.html
>
>
> Short version: BARE MINIMUM druntime port to webassembly together with a bare minimum source port of simpledisplay.d to it as well made that little game playable.
>
> In theory we could make a lot more work by building up one function at a time. In practice I gotta get back to real work so don't hold your breath :)
Very cool!
Bug report: the score doesn't increase for me when I complete a line ;)
-Steve
|
August 10, 2020 Re: tetris in D in webassembly | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | On Monday, 10 August 2020 at 16:24:02 UTC, Steven Schveighoffer wrote:
> Bug report: the score doesn't increase for me when I complete a line ;)
The reason for that is actually explained in the article; has to do with webassembly not blocking on eventLoop and the program was written with the assumption that it would.
|
August 10, 2020 Re: tetris in D in webassembly | ||||
---|---|---|---|---|
| ||||
Posted in reply to Adam D. Ruppe | On Monday, 10 August 2020 at 15:08:59 UTC, Adam D. Ruppe wrote:
> http://webassembly.arsdnet.net/
>
> tetris.d source here: http://dpldocs.info/this-week-in-d/Blog.Posted_2020_08_03.html#tetris-in-d
>
> web assembly source and explanation here:
>
> http://dpldocs.info/this-week-in-d/Blog.Posted_2020_08_10.html
>
>
> Short version: BARE MINIMUM druntime port to webassembly together with a bare minimum source port of simpledisplay.d to it as well made that little game playable.
>
> In theory we could make a lot more work by building up one function at a time. In practice I gotta get back to real work so don't hold your breath :)
Awesome!
By the way you should post on reddit (/r/programming) if you haven't already.
Matheus.
|
August 10, 2020 Re: tetris in D in webassembly | ||||
---|---|---|---|---|
| ||||
Posted in reply to matheus | On Monday, 10 August 2020 at 21:30:53 UTC, matheus wrote:
> By the way you should post on reddit (/r/programming) if you haven't already.
I don't really do reddit. I sometimes troll in the comments but it isn't a site I care for.
That said if you or someone else wanted to and post the link, I'll answer questions that come up there.
|
August 11, 2020 Re: tetris in D in webassembly | ||||
---|---|---|---|---|
| ||||
Posted in reply to Adam D. Ruppe | On Monday, 10 August 2020 at 15:08:59 UTC, Adam D. Ruppe wrote:
> http://webassembly.arsdnet.net/
>
> tetris.d source here: http://dpldocs.info/this-week-in-d/Blog.Posted_2020_08_03.html#tetris-in-d
>
> web assembly source and explanation here:
>
> http://dpldocs.info/this-week-in-d/Blog.Posted_2020_08_10.html
>
>
> Short version: BARE MINIMUM druntime port to webassembly together with a bare minimum source port of simpledisplay.d to it as well made that little game playable.
>
> In theory we could make a lot more work by building up one function at a time. In practice I gotta get back to real work so don't hold your breath :)
This is really cool. This idea, especially, titillates me:
"I'm pretty tempted to make serve.d automatically compile modules on demand to make a generic little server that can run a variety of programs without even thinking about it. Just drop a D file in the directory and surf to it in your browser! I might do that later."
|
August 11, 2020 Re: tetris in D in webassembly | ||||
---|---|---|---|---|
| ||||
Posted in reply to Adam D. Ruppe | On Monday, 10 August 2020 at 15:08:59 UTC, Adam D. Ruppe wrote:
> http://webassembly.arsdnet.net/
>
> tetris.d source here: http://dpldocs.info/this-week-in-d/Blog.Posted_2020_08_03.html#tetris-in-d
>
> web assembly source and explanation here:
>
> http://dpldocs.info/this-week-in-d/Blog.Posted_2020_08_10.html
>
>
> Short version: BARE MINIMUM druntime port to webassembly together with a bare minimum source port of simpledisplay.d to it as well made that little game playable.
>
> In theory we could make a lot more work by building up one function at a time. In practice I gotta get back to real work so don't hold your breath :)
Just needs a rotation feature (unless I am just unaware of how to do that.)
But pretty cool project
|
August 11, 2020 Re: tetris in D in webassembly | ||||
---|---|---|---|---|
| ||||
Posted in reply to Atwork | On Tuesday, 11 August 2020 at 12:46:51 UTC, Atwork wrote:
> [snip]
>
> Just needs a rotation feature (unless I am just unaware of how to do that.)
>
> But pretty cool project
The blog post says it is space bar. Tripped me up too.
|
August 11, 2020 Re: tetris in D in webassembly | ||||
---|---|---|---|---|
| ||||
Posted in reply to jmh530 | On Tuesday, 11 August 2020 at 13:22:02 UTC, jmh530 wrote:
> The blog post says it is space bar. Tripped me up too.
Yeah, I learned yesterday that there's a whole other PC tetris world I had no clue about.
I only ever played the Nintendo/ELORG version on the NES. On that, dpad is left, down, speed, and then the A button is rotate. So for my clone I based it on that, arrows move, space bar, on the opposite side of the controller, does the rotation.
The specifics of piece movement etc. are kinda based on that NES game too and the newer PC games have all kinds of other rules that I just never knew.
But oh well, the game was at first something to just kill time on a boring flight, so I wrote it from memory on my laptop. Then it posted as a simpledisplay.d demo basically. And now I used it for webassembly because I thought it was super cool to have the very same source code we used on desktop last week in the browser this week (even though like I said there, I cut a LOT of corners to finish it in my limited time).
Now I kinda want to expand the library a bit more. It occurs to me if I did draw text too and a little bit more input events, then my terminal emulator could run in the browser. Then my terminal client code can go there since it can embed the emulator. And a little more work, minigui.d's custom widgets can too...
It wouldn't be a good experience tbh but it might be cool online demos of future programs and can also load up some of these little games etc on mobile too though the browser.
|
August 11, 2020 Re: tetris in D in webassembly | ||||
---|---|---|---|---|
| ||||
Posted in reply to starcanopy | On Tuesday, 11 August 2020 at 04:10:10 UTC, starcanopy wrote: > This is really cool. This idea, especially, titillates me: That's actually easy enough to do I just went ahead and made it. so behold: http://webassembly.arsdnet.net/ and the source is pushed up to github, with just a little bit of effort you can prolly run it at home. I don't have write access publicly to my server here to play with... but I might even add a little form for that so you can goof around with this dead-simple by copy/pasting some source code into the browser form. But still with this I can add more demos easily and you can see the source in the browser so it is something to play with. |
Copyright © 1999-2021 by the D Language Foundation