[HN Gopher] Minetest for the Web
       ___________________________________________________________________
        
       Minetest for the Web
        
       Author : tech234a
       Score  : 86 points
       Date   : 2022-10-14 18:52 UTC (4 hours ago)
        
 (HTM) web link (minetest.dustlabs.io)
 (TXT) w3m dump (minetest.dustlabs.io)
        
       | satoshinm wrote:
       | 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.
        
         | Sardtok wrote:
         | 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.
        
           | slim wrote:
           | it was outdated even back then
        
       | dekhn wrote:
       | 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.
        
         | Iv wrote:
         | Gotta love open source
        
         | Macha wrote:
         | 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.
        
           | dekhn wrote:
           | 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.
        
           | poser-boy wrote:
           | I suppose it depends on perspective. MC Alpha these days
           | lacks performance optimisation, and cannot beat the
           | extensibility of Minetest IMO.
        
       | dvh wrote:
       | https://minetest.dustlabs.io/mt/minetest.js(1): Uncaught
       | RangeError: WebAssembly.Memory(): could not allocate memory
        
         | isaacaggrey wrote:
         | I also see an error but instead:
         | 
         | Uncaught TypeError: GLctx is undefined
         | 
         | --
         | 
         | Firefox 105 on Linux 64-bit (ElementaryOS)
        
       | tomrod wrote:
       | A lot of lag, but has a lot of promise. Neat!
        
       | jhatemyjob wrote:
       | Wait... this is amazing. Is there Lua addon support?
        
         | jasonjayr wrote:
         | 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.
        
         | ROllerozxa wrote:
         | 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.
        
           | cowtools wrote:
           | Seems like one might be able to use emscripten_wget or
           | something. Emscripten can expose a unix-like filesystem
        
       | paradust wrote:
       | 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!
        
         | hutzlibu wrote:
         | "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)
        
           | paradust wrote:
           | 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.
        
           | tech234a wrote:
           | 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
        
             | hutzlibu wrote:
             | "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.
        
             | paradust wrote:
             | 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.
        
         | freedomben wrote:
         | 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.
        
           | paradust wrote:
           | 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.
        
       | mysterydip wrote:
       | 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.
        
         | satoshinm wrote:
         | 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.
        
       | freedomben wrote:
       | 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!
        
       | makarhum wrote:
       | Here is the original Minetest project if someone has missed it:
       | https://www.minetest.net/.
        
       | robotnikman wrote:
       | 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
        
       ___________________________________________________________________
       (page generated 2022-10-14 23:00 UTC)