Settings

Theme

Show HN: A multiplayer game to discover NFT artists, built with WebAssembly

play.moonlightmuseum.io

9 points by diegomacario 4 years ago · 2 comments · 2 min read

Reader

Hi everyone!

I'm one of the developers behind this project. I wrote it with my two brothers, Daniel and Ricardo.

For years the three of us have been curious about how multiplayer games work, which is why we decided to work on this project.

Our goal was to gain a deep understanding of how different players can share the same 3D space, which is why we wrote our own tiny game engine instead of using something like Unity.

We wrote the engine using C++ and OpenGL, and we then compiled it to WebAssembly using Emscripten so that it would run effortlessly on web browsers. We are really excited about the possibilities that are opening up thanks to WebAssembly.

Throughout this project we faced some massive technical challenges, like for example:

- We had to implement a collision detection and response algorithm so that players could collide with objects in the world.

- We had to implement an animation system that's capable of loading animated characters from glTF files, and that can play animations and fade between them.

- We had to implement a system that downloads images in worker threads, and that uploads them to the GPU in small chunks so that the game runs smoothly while paintings are being loaded.

- We had to implement techniques like client side prediction, server reconciliation and entity interpolation so that players look smooth when they are moving in the 3D space.

It was a great learning experience. If you have any technical questions, the three of us would be happy to answer them.

On the product side, our hope is that this project can make the experience of discovering NFT artists more fun and social. We think that scrolling through endless pages of NFTs is mindless and boring. We hope that in the museum people will look at digital art for more than a glance, and that they will discuss it with others.

We are constantly improving the museum to make it more fun, and we are also building some awesome tools for artists and collectors to showcase their work in new ways. If you would like to keep up with our progress, you can leave your email here: https://www.getrevue.co/profile/moonlightmuseum

Thanks for your time!

ayanb 4 years ago

Very interesting gameplay - I played a bit :)

> We had to implement techniques like client side prediction, server reconciliation and entity interpolation so that players look smooth when they are moving in the 3D space.

Curious: what kind of tools/frameworks could have helped in shipping to wasm faster and better?

  • climber_mac 4 years ago

    Thanks for playing the game :)

    I'm Daniel, Diego's brother who also worked on this project. Your question is a bit broad, but I can tell you what it was like to work with emscripten.

    We used emscripten to compile our C++ application to WASM and to generate the JS code that loads the application. This part was very easy. We had the game running on the web in no time.

    What was much much more difficult was working with emscripten's APIs to do things like handle mouse / touch / keyboard inputs. There's tons of gotchas and weird limitations to work through.

    Another huge challenge was in sending data between the JavaScript layer and the C++ application. You have to serialize data and then parse it on the C++ side, which sounds easy until you try to do it.

    We faced some tough challenges asynchronously loading the paintings. Our initial solution of using a simple thread pool library which manages web workers didn't run on Safari due to some strange incompatibilities with WebGL 2.0, so we had to go for a purely web worker based approach.

    Overall, we are amazed at what you can do with emscripten, but you have to be prepared to face some bad documentation, browser incompatibilities, and to tinker A LOT.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection