Hacker News new | past | comments | ask | show | jobs | submit login
Minetest for the Web (dustlabs.io)
157 points by tech234a on Oct 14, 2022 | hide | past | favorite | 41 comments



Hi all, I made this. Surprised by the sudden interest. It has been live but unchanged for 6 months.

There's an updated launcher. It's not finished yet, but it is nicer for exploring single-player community-made games: https://minetest.dustlabs.io/ez/

I'm not actively working on this, as I have concluded it is not (yet) possible to create a good web experience. There are problems with storage, network, keyboard side effects (e.g. Ctrl, W), concurrency, and performance that need to be addressed by browser vendors. I highly recommend installing the native Minetest!


"keyboard side effects(e.g. Ctrl, W), "

You can intercept and cancel the standard browser events and therefore prevent closing the tab for example with Strg W.

Storage option on the web for more data is indexedDB. It is quite fast and stable by now.

What kind of network issues do you have?

But general performance I would not suspect to go drastically up anytime soon, since you already use wasm. (Unless you find some emscripten flags, that speed up things, but this is not my area)


A handful of key combinations cannot be cancelled. With the Full Screen API, the page also loses use of the ESC key, which is extremely important to Minetest's menu interface. (That's why F11 is the recommended way to go full screen)

For storage, a bare minimum Minetest world needs 1GB, grow-able to multiple gigabytes. I don't think IndexedDB is meant for that.

The network issues are specific to Firefox. Multiple threads in Minetest do network I/O. In Chrome this works fine, but on Firefox only the main thread can do I/O, and so network requests are proxied to the main thread (this is done transparently by Firefox, using a mutex internal to firefox). Unfortunately this arrangement leads to a deadlock given the particular way it is used.


"For storage, a bare minimum Minetest world needs 1GB, grow-able to multiple gigabytes. I don't think IndexedDB is meant for that."

It actually is. My app also uses way over 1 GB after a while with no issues. The global limit is just tied to the users avaiable free space.

"The maximum browser storage space is dynamic — it is based on your hard drive size. The global limit is calculated as 50% of free disk space."

https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_A...

"The network issues are specific to Firefox"

And honestly, I would not care too much and just make it clear, that it does not yet run stable in firefox and recommend chromium. (With a link to the technical limitations of what you just wrote, so you do not get yelled at so much by the firefox only crowd, who otherwise assume you did it out of evil neglect)

I regretted the huge amount of work I did to cater to firefox limitations. Its market share is just too low and chromium works also on linux.

(I use FF for browsing myself though)


You actually can't override a few of the events such as Control-W [1], however that could easily be fixed by using an alternate keybind for the game instead.

This port uses a proxy for networking, as the main game uses UDP-based networking [2]. Perhaps it would be possible to upstream basic WebSocket/WebRTC packet-wrapping support to the servers in the main Minetest project?

I am also curious about the storage issues.

[1]: https://source.chromium.org/chromium/chromium/src/+/main:chr...

[2]: https://dev.minetest.net/Engine/Network_Protocol


"You actually can't override a few of the events such as Control-W"

I definitely did overwrite it in my app, but I just checked and remembered, that you also have to be in full screen mode.


Although the support isn't amazing [1], I believe you can capture C-w and friends [2].

[1]: https://caniuse.com/mdn-api_keyboard

[2]: https://developer.mozilla.org/en-US/docs/Web/API/Keyboard_AP...


WebRTC data channels would be ideal, so that clients can connect directly to servers (or at least regional proxies) in a UDP-like way. Vanilla minetest would need to include an WebRTC endpoint for this to become universally available. There are lots of details that would need to be worked out.


Neat project! And thanks for the explanation :-)

Do you think the browser issues are being addressed already or will be addressed soon? or do you think it's a low priority for them? I would think enabling complex WASM apps would be a priority (especially for Google/Chrome) but you never know.


There is definitely a tremendous amount of work going into emscripten/wasm. Minetest is multi-threaded, and so relies on SharedArrayBuffer which only became available in 2020.

The UX issues do seem to be stubbornly persistent though. I ran into the same issues long ago porting games with NaCl and asm.js. I'm not sure what is preventing progress there.


I sympathize with the persistent UX issues with web-based voxel engines. I think what is really needed is a UI/UX expert (unfortunately not me) willing to push forward and drive fixes across the entire stack: the game engine, Emscripten, and even investigating and submitting fixes/enhancements to web browsers - owning the complete experience.

For what it's worth, when porting NetCraft I did make an effort to isolate, fix and upstream various UX fixes to Emscripten:

https://github.com/satoshinm/emglfwbugs

with _some_ success; the developers of Emscripten are happy to accept pull requests. But I agree there's a lot of papercuts, and tracking down each of the usability nits could essentially be a full-time job...

For the keybinding problem, I've found using backquote/tilde key for escape can sufficiently workaround the un-interceptable escape key. It also works well on mobile browsers without escape keys.

But the problems with multi-gigabyte world storage, multi-threaded networking, SharedArrayBuffer, may require more invasive architectural changes. At this point, maybe a rewrite focused on web support from the beginning would easier than a port? But _a lot_ of work was put into Minetest over the years, it is great having the library of mods already developed for Minetest, available on the web. Although the same could be said for Minecraft itself.

In any case, thank you for your work porting Minetest to the web. I appreciate it moving the needle in the "web-based Minecraft clone" niche. Even if it may not the be all to end all, hopefully the UX blockers can be resolved, fit and finish, if not in Minetest itself maybe it will inspire others to create something anew with lessons learned from your port. One step closer to the metaverse.


Two of the browsers are owned by the same companies that control two of the walled-garden app stores. The better the UX is for web apps, the less need people have to jump through app store hoops.


This looks amazing, great work!

A web-based "Minecraft" has great potential, in my opinion, and has long been a dream of mine. My humble attempt at such a project: https://satoshinm.github.io/NetCraft/ (2017) - a port of Michael Fogleman's Craft, a simple Minecraft clone written in C, ported to the web using WebAssembly and Emscripten. It works, reasonably well (after a few small enhancements/fixes to Emscripten) but did not get very far. But it could be so much more, a "metaverse", if you will.

Minetest is a much more sophisticated application: paradust7's minetest-wasm port, even in its early stages, is already quite impressive. If it can be optimized, with streamlined add-on installation, seamless multiplayer/networking support, browser compatibility improved - I would not be surprised if this project catches on and gives Minecraft a run for its money.

Having the ability to easily casually play within a web browser, no install needed, is a massive advantage over the Java or C++ implementations of Minecraft - which have not (officially) embraced modding to the extent Minetest has. If successful, this project could capture the large and diverse community of Minecraft modders - able to more seamlessly deliver their creative content through the web. Excited to see how it develops further.


I guess you never played the early alpha versions of Minecraft. It used to run as a Java applet back when that was still kind of a thing. It ran just fine in the browser 13 years ago. Of course, you'd have to put in a bit of effort to be able to run an applet today, as that tech has been shut down due to security issues quite a while back.


it was outdated even back then


Minetest is an absolutely incredible project. My kids love to play it and it's one I can get behind because I can easily self-host so I own all the data, and I know my kids aren't talking to internet strangers through the game.

It's packaged on most distros also so you can probably `apt get install minetest` or `dnf install minetest` and have it running. You can host games on the LAN from your machine, or you can easily start a server. On fedora you can trivially `dnf install minetest-server` and then run `minetestserver` and you've got a server!


Hosting a private Minecraft server is also quite easy, you just need a JVM and a freely redistributable .jar file. I think Minetest will perform much better on low-end hardware though; you can use PaperMC, Sodium, etc to improve Minecraft performance, but Minetest runs much smoother out of the box.

Anyone here got experience running both Minecraft and Minetest servers? How do they compare?


You could also scale to zero a minecraft server with fly.dev https://fly.io/blog/scale-to-zero-minecraft/

The other voxel OS game is : https://veloren.net/


Here is the original Minetest project if someone has missed it: https://www.minetest.net/.


Minetest is great. After the last Microsoft debacle I looked into Minetest and after a bit managed to amass a nice collection of mods to make a truly enjoyable game. UIt's everything Minecraft has come to not be.


What mods do you use?

I've tried base mineclone2 and mineclone 5 and they just feel like a clunkier version of minecraft. I played Minecraft Alpha and that was more polished.


3d_armor, awards, basic_materials, beds, binoculars, biome_lib, boats, bones, bucket, butterflies, carts, chest_of_everything, compost, creative, default, dfcaverns, digilines, digistuff, display_biome, doors, dungeon_loot, dye, dynamic_liquid, env_sounds, farming, fire, fireflies, flowers, game_commands, give_initial_stuff, item_drop, keys, map, mesecons, mobs_animal, mobs_monster, mobs_npc, mobs_redo, moreblocks, mtg_craftguide, pipeworks, player_api, ropes, screwdriver, sethome, sfinv, signs_bot, spawn, stairs, tnt, travelnet, tubelib2, unifieddyes, unified_inventory, vessels, vines, walls, wielded_light, wool, xpanes

So basically, it's the minetest game with a number of additions to make survival mode more interesting or convenient (dfcaverns, mobs, travelnet, unified_inventory, ropes), some automation I haven't used yet (mesecons, digilines, signs_bot), some things that sounded cool but haven't tried yet (tubelibe, signs ) and other things that round out the world (wool, dyes, vines).

I make a small number of concessions in survival mode: occasional use of flying, XYZ location, extremely rare use of the chest of everything or /giveme. And a stratum of iron at -8 :)

My current focus is on dfcaverns- massive caves with different ecosystems that involve digging deep. For exmaple, in minetest, ores often don't show up frequently until you get to -1024, which means digging straight down and building elevators for a while.

I played Mineclone 5 for a while and it was mostly feature complete for what I wanted to do, but it doesn't play with other mods all that well, while all the mods I selected have good interoperability.


MeseCraft is a great game for Minetest: https://www.mesecraft.com/


I suppose it depends on perspective. MC Alpha these days lacks performance optimisation, and cannot beat the extensibility of Minetest IMO.


Gotta love open source


It would be great to be able to pair this with the server, letting people play on it together just by going to a website. I have a server set up for my daughter and her cousins, so reducing the friction to "go to this site, that's it" would be very useful.


This is the precise reason I'm also very interested in this project (or more generally, any implementation of a web-based voxel game). Douglas Crockford correctly identified "load and go delivery" as a key feature of the web platform. I've lost friends as players because of problems they had installing the Java version of Minecraft on their new PC. If they could simply visit a website in their browser, especially on a mobile device, we could play again.

Amusingly, very early versions of Minecraft circa 2009 _did_ run on the web browser: as a Java applet. This was short lived, and of course since 2017, Java applets are completely deprecated.

Mojang also published a JavaScript implementation of Minecraft at https://classic.minecraft.net/. You can share a link to play multiplayer. However, it is only a version of Minecraft "classic" (reports as 0.0.23a_01), and even then, a reimplementation, not 100% faithful to the original. It seems to be more of a "hey look what you can run your browser" cool tech demo of WebGL and WebRTC, than a serious multiplayer survival game.

Hopefully Minetest for the Web can succeed in this niche. I, for one, am rooting for them.


This is the idea behind the "Play with Friends" feature, still under development. Check back in a few weeks!


The web used to be full of applications like this. First Flash, then Java. Now we have open standards that are used so rarely that they are notable post-worthy events.

Why is WASM not used as extensively as Flash and Java were?


People built apps in Flash because they could put great experiences onto whatever outdated crappy IE version they had to target. There was also a really great editor. Lastly, the APIs for a lot of stuff just didn't exist. There aren't really great wasm editors any more. JS frontend development has replaced most of that. Wasm is used but mainly to port existing applications to the web, like in this instance, or to implement client side computation heavy applications. It's also rarer because it's still quite recent compared to JS which has tons of inertia. Generally, incumbents are only replaced if the new solution is really better than the incumbent (or there is a powerful enough trend).


Speaking of Minetest and the Web, it would be great if there was a web based control panel for Minetest servers, similar to how there are many out there for minecraft servers like Multicraft


Runs better than I expected on my browser, it gives me ideas on porting other software to webassembly :)


https://minetest.dustlabs.io/mt/minetest.js(1): Uncaught RangeError: WebAssembly.Memory(): could not allocate memory


It needs to allocate 2 GB on startup. Could you be low on memory?


I also see an error but instead:

Uncaught TypeError: GLctx is undefined

--

Firefox 105 on Linux 64-bit (ElementaryOS)


Can you check if the browser supports WebGL2?

https://get.webgl.org/webgl2/


Wait... this is amazing. Is there Lua addon support?


All Minetest games consist purely of Lua, so of course there is. I don't know if there's a way to "sideload" games and mods into the browser storage but installing them from ContentDB works.


Seems like one might be able to use emscripten_wget or something. Emscripten can expose a unix-like filesystem


The official mod API is pure lua:

(as an example:)

https://github.com/tenplus1/minetest_game/blob/master/mods/f...

That code would run server side, but there is some recent work for client-side scripts as well.


A lot of lag, but has a lot of promise. Neat!




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

Search: