Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Could one use WASM to build a game engine that runs from the web in a browser and actually performs good?

How does it work? What sort of VM is it running on? How is it compiled?



User rossisred ported his "Funky Karts" game from C++ (targeting Android) to WASM.

Direct link to the game: https://www.funkykarts.rocks/demo.html

Blog post on porting the engine: http://www.rossis.red/wasm.html

Original thread: https://news.ycombinator.com/item?id=14411328

His post helped me demystify what WASM is capable of and how it fits with the DOM. He shares some eye-opening code snippets, but the game itself is closed source so it leaves something to be desired.


these barrels remind me of that fun old DOS game, Skunny. Quite fun, very nice port !


You can, but with a lot of caveats:

- single-thread CPU performance is pretty much 'good enough' now

- WebGL and WebGL2 too, but you have very different performance behaviour than a native GL driver (much higher call overhead for instance)

- pretty much all other HTML5 APIs: oh boy what a mess :/

Don't expect a 100 GB AAA Steam game to run on the web anytime soon, but mobile games will port over fine. It's better to define the web as your main platform, and design a new game from scratch around it's limitations.

So if you have a project which needs to do 3D rendering, audio, touch input etc... CPU performance is the least of your problems.


> mobile games will port over fine.

If they take advantage of OpenGL ES 3.0, 3.1 and 3.2 features not present in WebGL, it is going to be a bit hard.


Yes, you could. In 2014. (Using the old asm.js.)

Here's a 2014 Unreal Engine asm.js demo now running on WASM:

https://s3.amazonaws.com/mozilla-games/ZenGarden/EpicZenGard...

It's running on your browser's JavaScript VM (maybe in a special mode). The code compiled to WASM just like any other machine language. Quite a few compilers support WASM as a target now.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: