Live data from Hacker News

WebAssembly 101: A developer’s first steps

blog.openbloc.fr

21–30 of 153 posts

Re: WebAssembly 101: A developer’s first steps

#21
post #2

Nice! With a BBC Micro (6502, 1MHz) I was able to achieve about the same FPS (I was genlocked for UK PAL TV transmission so either 25FPS or 50FPS) but only for a 40x25 grid, using 6502 assembler embedded in BASIC!

I am actually impressed someone managed to write game of life that drops below 60 fps at ~200 points on screen.

Re: WebAssembly 101: A developer’s first steps

#23
post #15

Not very reassuring that two of the first steps are "copy and paste this stuff from stack overflow to make it work", without any explanation as to why it's needed.

Agreed. Setting up the environment with 0's seems like it should just be the sane default: 'env': { 'memoryBase': 0, 'tableBase': 0, 'memory': new WebAssembly.Memory({initial: 256}), 'table': new WebAssembly.Table({initial: 0, element: 'anyfunc'}) } But it is really early on and if the Portable updating SDK is any indication it seems like they want to make it easy to get started.

[deleted]

Re: WebAssembly 101: A developer’s first steps

#24
post #18

Earlier quoted context omitted.

I'd be inclined to agree. Unless the point was not to show off, but that a 30 year-old computer is as fast as the bleeding edge in browser rendering technology.

Given that this [1] runs easily at solid 60fps on Chrome, a pure software rasterizer written in pure JavaScript with some basic optimizations, I'm pretty sure that webasm is can do at least as well. The Beeb is not capable of anything remotely like that. https://jsfiddle.net/Sharlin/9w26necy/52/

Well sure, but can you play Granny's Garden in Chrome?

Re: WebAssembly 101: A developer’s first steps

#25

I recommend anyone wanting to experiment with WASM to check out https://github.com/dcodeIO/webassembly which takes a lot of pain out of setting up the toolchain and lets you produce much leaner binaries as well. Also keep an eye on https://github.com/dcodeIO/AssemblyScript :)

Thanks for the link, I would probably have tried this had I stumbled on it before! I did an ask HN prior to writing this article but did not get that much answers: https://news.ycombinator.com/item?id=14483383

Re: WebAssembly 101: A developer’s first steps

#26
post #12
post #2

Nice! With a BBC Micro (6502, 1MHz) I was able to achieve about the same FPS (I was genlocked for UK PAL TV transmission so either 25FPS or 50FPS) but only for a 40x25 grid, using 6502 assembler embedded in BASIC!

Looks like the code is pretty slow. Lots of branches in the inner loop, like range check. https://github.com/blaze33/way-of-life/blob/master/src/js/wa...

I'll concede that I did not spend any time optimizing the C code, the focus was mainly on getting a working wasm module that integrated correctly with th js code. I'll probably have a look on this after work.

Re: WebAssembly 101: A developer’s first steps

#27
post #26
post #12

Earlier quoted context omitted.

Looks like the code is pretty slow. Lots of branches in the inner loop, like range check. https://github.com/blaze33/way-of-life/blob/master/src/js/wa...

I'll concede that I did not spend any time optimizing the C code, the focus was mainly on getting a working wasm module that integrated correctly with th js code. I'll probably have a look on this after work.

Yeah, my point was this example shouldn't be used to judge webasm performance.

No point to benchmark "Hello, World!"s.

Re: WebAssembly 101: A developer’s first steps

#28
You can play my favorite arcade game ever in a wasm gameboy emulator (credit goes to Ben Smith of Google: https://github.com/binji/binjgb) in a web-based OS I've been working on for 5 years. This is known to work in current Chrome and Firefox. Keyboard game controls: 'w'=up 'a'=left 's'=down 'd'=right '.'=A ','=B space=start enter=select. Also, standard (17 button, 4 axis) USB gamepads should "just work" via plug'n'play.

Go to this link to test it out:

https://linuxontheweb.org/desk?desk_init=bHMgL3B1YjtvcGVuIEF...

The argument in the URL is the base64 encoding of an initialization script that is being passed to the desktop environment. Going to the link in current Edge should just open the "Arcade" app, with nothing else happening.

You should be able to drag-n-drop ".gb" or ".nes" ROM game files from your native desktop right onto the Arcade app window, and it should just start playing. You can also just drop them onto the web desktop to save them there, then just double-click them when you want to play. That way, the file is kept in the site's local storage.

Learn more about how to use the web-based OS here: https://www.youtube.com/channel/UCZkhPP7327fXcSsjD_lt67w

If anybody has wasm-capable Edge or Safari, let me know if you can play the game.

Re: WebAssembly 101: A developer’s first steps

#29
Remember when you could hit "View Source" to see how the web was built? I don't like where this is going. Minification was bad enough, now we're going to be getting more non-free blobs shoved into our browsers and this is being touted as a great new feature for us.

It will end up being a tool of control and surveillance like always.

This guy says it a bit more eloquently than I can:

https://lobste.rs/s/wjtu7c/webassembly_mozilla_won#c_yqsej7

Post reply on HN