[HN Gopher] Browsercraft: Java Minecraft in the browser
___________________________________________________________________
Browsercraft: Java Minecraft in the browser
Author : John7878781
Score : 139 points
Date : 2025-03-31 14:56 UTC (8 hours ago)
(HTM) web link (browsercraft.cheerpj.com)
(TXT) w3m dump (browsercraft.cheerpj.com)
| whalesalad wrote:
| We have come full circle #applets
|
| Twenty years ago running java in the browser would have just been
| called "using the internet"
| Ajedi32 wrote:
| Yep, the original Minecraft ran in the browser in a Java applet
| so this is particularly fun example. Though obviously there are
| significant security benefits to the JVM running within the
| browser's WASM sandbox instead of directly on the host.
| lxgr wrote:
| > there are significant security benefits to the JVM running
| within the browser's WASM sandbox instead of directly on the
| host.
|
| The JVM originally also had the goal of providing a security
| boundary, and even had a relatively complicated
| permissions/security model enforced via call stack
| inspection.
|
| That security model was ultimately too complicated for
| developers to work with, but I don't think the sandbox itself
| was particularly insecure.
| jcranmer wrote:
| My recollection is that the SecurityManager was notorious
| for being relatively easy to work around. Definitely one of
| the common questions people had when working on the richer
| HTML5 APIs was "how is your sandboxing going to be more
| effective than the Java applet model, given that that's
| known to be full of holes?"
| philipwhiuk wrote:
| Until they want features and punch holes in the sandbox.
|
| Audio/video codecs are a great example.
| esafak wrote:
| Java Applets gave Java a bad name. Java was that thing that
| made web sites grind to a halt.
| SJC_Hacker wrote:
| If it had come out of Google or Microsoft maybe even Apple,
| the JRE would have been integrated into the browser much more
| efficiently and it would have been no slower than Javascript
|
| But I don't remember Applets being particularly slow even
| back then, if you had a decent internet connection and they
| were written by a decent SDE
| TOGoS wrote:
| I wrote a lot of applets back in the day for little
| graphics experiments and such, somewhat inspired by Ken
| Perlin's homepage[1]. I found that it's quite possible to
| make applets that load fast and run fast if you care about
| those things while building it and do some profiling. If
| you pull in hundreds of megabytes of libraries and trigger
| a GC every second then of course it will be slow.
|
| [1] https://mrl.cs.nyu.edu/~perlin/
| freedomben wrote:
| Same. I built a lot of animations with applets back in
| the day and if you avoided dependencies (other than what
| ships with the JVM) and your code wasn't ridiculous, you
| could get some pretty damn good performance out of it
| (minus initial load time which did tend to be suboptimal,
| but manageable). Applets were a pain in many ways but I
| think the tech gets blamed unfairly for bad performance.
| CobrastanJorji wrote:
| Neither decent internet connections nor decent SDEs
| programming Applets ever happened in the 1990s.
| hombre_fatal wrote:
| It's not full circle. It's using built-in browser capabilities
| instead of a special sideloaded runtime granted by a browser
| extension.
|
| An example of full circle would be if wasm apps needed a
| browser extension so that they could access APIs not allowed by
| the browser.
| SunkBellySamuel wrote:
| This is the main way I used to play Minecraft in the Beta days,
| thanks!
| lxgr wrote:
| Wow, same here, but I somehow completely forgot about that!
| spicybright wrote:
| There's a very funny story behind MinecraftForFree.com which is
| what most people used back then.
|
| Notch (the creator of minecraft) was angry someone was posting
| his game online for free. He emailed the owner, Dylan, of the
| site threatening legal action.
|
| Instead of going down a legal route, Dylan challenged him play
| a game of quake3 to settle the dispute.
|
| If notch won, Dylan would take the site down. If Dylan won,
| notch would would leave him alone and let him keep hosting the
| site.
|
| Notch agreed, won the match, and Dylan followed the promise and
| took it down forever!
| mzajc wrote:
| There are even recordings of their match (in two parts),
| they're quite funny:
| https://www.youtube.com/watch?v=g_Fu0SZ7PN8
| awkwardpotato wrote:
| > If Dylan won, notch would would leave him alone and let him
| keep hosting the site.
|
| Small correction, Dylan always planned to take the site down.
| They were playing for Minecraft capes[0] for him and his two
| teammates. The original livestream of the match is still up
| on Twitch also.[1]
|
| [0] Cosmetics that used to be very rare and only given out by
| devs or at MineCon
|
| [1] https://twitch.tv/videos/38469359
| __jonas wrote:
| Huh, is Minecraft Java edition free now? I haven't played in a
| long time but I thought when you download the regular client you
| only get to play after signing in with an account that purchased
| the game, how is this thing just starting the game directly?
| looperhacks wrote:
| You could always play Minecraft without an account. But you
| can't join most servers that enable authentication checks
| h4x0rr wrote:
| Well yeah you could play without an account _with a cracked
| launcher_
| lelandbatey wrote:
| At first, there was no launcher there was just the
| Minecraft.jar file which you could launch to start playing.
| That's what the parent page is doing; it's just having us
| download and run the game, no need for a launcher.
| immibis wrote:
| Nope, this is piracy. Which you may or may not consider a bad
| thing, but there will be lawyers in this person's future.
| jillyboel wrote:
| > Clicking the button below will download the client from
| mojang.com. By clicking it, you agree to the Minecraft EULA.
|
| It's literally just downloading the client from
| https://piston-
| data.mojang.com/v1/objects/4a2fac7504182a97dc... where mojang
| makes it publicly available.
|
| It's an older version so it's not linked on their website
| anymore, but you can find the same download link on the wiki:
| https://minecraft.wiki/w/Java_Edition_1.2.5
|
| What makes you think they will have "lawyers in their
| future"?
| immibis wrote:
| Lawyers and judges care about the overall effect of a
| thing, not the technical steps you take to make it happen.
| The overall effect is: Someone goes to your website, and
| plays Minecraft for free. Therefore you gave them the
| service of playing Minecraft for free. Which is illegal.
|
| The fact that the file comes from Microsoft's server is one
| of those "technicalities" that you've heard about some
| people sometimes, but not usually, getting off on.
|
| Microsoft will probably argue that the login prompt is a
| technological protection measure, which makes it blanket
| illegal to work around, due to the over-broad DMCA. That
| technicality is about as likely to work against you, as the
| "it's from their server so I didn't distribute it"
| technicality is to work for you...
|
| Mandatory disclaimer: I am not a lawyer and this is not
| legal advice.
| jillyboel wrote:
| Start with suing the minecraft wiki then I guess
|
| Also you should probably advice mojang to put some
| authentication on their download URLs, which have been
| publicly documented for more than a decade by now.
|
| There is no login prompt. This project is over a year
| old. You are just misinterpreting the situation. This is
| like threatening to sue Mozilla because you can use
| Firefox to click on a download button, or Microsoft
| because double clicking on an exe on Windows runs the
| application.
| jillyboel wrote:
| It's running minecraft 1.2.5 which was released in 2012, which
| mojang still makes available
| accrual wrote:
| One can get early Alpha and Beta versions of Minecraft
| through the official launcher too. I think this is a nice
| benefit - you buy the game once and have perpetual access to
| the latest version, but also all the old versions which are
| worth playing for various reasons e.g. Beta 1.7.3 is very
| popular because it's one of the last versions before the
| terrain and cave generation was significantly changed.
| tialaramex wrote:
| Also Modded Minecraft is extremely popular, and the mods
| necessarily aren't version agnostic, so you need to be able
| to run a specific Minecraft version to play the pack of
| mods you're currently enjoying.
|
| Right now I am playing Enigmatica 2: Expert, which is a mod
| pack for Minecraft 1.12
|
| Today I need to teleport to my spaceship which is in orbit
| around a distant planet and then fly it back to our solar
| system and visit Mars, as I have neglected to obtain
| materials from Mars which I need to build this end game
| item I'm working on.
|
| It's still recognisably Minecraft even though I'm working
| with a 9x9 crafting grid. It has internal consistency,
| dragons hoard rare metals, Plutonium is a rare metal,
| therefore make sure to bring hazmat handling equipment if
| you're about to plunder a dragon's hoard.
| autoexec wrote:
| A long time ago I looked for a way to download Minecraft to
| install on systems without any internet connection and it just
| wouldn't work. I even tired alternate launchers, but eventually
| gave up. Maybe the situation has changed and it's possible now
| though.
| kevmo314 wrote:
| It crashed for me :( [failed to get system
| properties (java.lang.RuntimeException: No OpenGL context found
| in the current thread.)]
|
| Applets were a real vibe. The gradient-blue UI that came out of
| the box is true nostalgia.
| momojo wrote:
| I get that when my GPU is disabled, although it usually falls
| back to CPU...
| butz wrote:
| Playing Minecraft without Microsoft account? That doesn't look
| safe.
| HideousKojima wrote:
| Why?
| immibis wrote:
| It's safe for the player, unsafe for the one hosting it, who
| risks prison time.
| jillyboel wrote:
| Downloading a publicly available jar (https://piston-
| data.mojang.com/v1/objects/4a2fac7504182a97dc...), that
| gets linked on the minecraft wiki
| (https://minecraft.wiki/w/Java_Edition_1.2.5) and running
| it unmodified is "risking prison time"?
| nicce wrote:
| Depends on if the free trial is misused here somehow. I
| don't know if it is.
| jillyboel wrote:
| There is no circumvention of any access controls.
| immibis wrote:
| Due to the over-broad nature of the DMCA, almost anything
| is an access control that you aren't allowed to
| circumvent.
| earth2mars wrote:
| how to do fullscreen?
| gavinray wrote:
| 5 years ago, I watched a YouTube recording of a meetup talk given
| by one of the CheerpX engineers:
|
| https://www.youtube.com/watch?v=7JUs4c99-mo
|
| In it, they showed a functional demo of porting an OSS
| multiplayer C++ game entirely to the browser with WASM.
|
| Afterwards, I read some of their engineering content and was
| blown away.
|
| It's been fascinating to watch the CheerpX/CheerpJ progress from
| afar over the years.
| apignotti wrote:
| Thanks for your kind words, appreciated.
|
| Link to our blog, we try to regularly publish high quality
| content: https://labs.leaningtech.com/blog
| waveringana wrote:
| When I was in fourth grade, I'd take the half a mile walk to the
| library almost daily which always made my parents happy because
| they assumed I was going to read, but instead I was hopping onto
| their computers, going to http://minecraft.net, and playing
| minecraft on IE :)
|
| Thanks for the nostalgia
| afavour wrote:
| The longevity of Minecraft blows my mind. I was always aware of
| its existence but never looked into it. Now my kid is getting
| into it. So many generations of kids! It's incredible really.
|
| That said, it has been a little sad digging into the current
| state of Java vs Bedrock, Bedrock iPad vs Bedrock Switch. The
| platform ubiquity is wonderful and the tradeoffs are what they
| are. But if folks were able to create a touch-capable web-
| powered Java Minecraft that would be a great fit for the iPad.
| naikrovek wrote:
| The children yearn for the mines, apparently.
| immibis wrote:
| An interesting fact about Minecraft is that when it came out,
| storing the block IDs for the loaded area used up a big chunk
| of your computer's RAM and had to be optimized as much as
| possible. So it was 8 bits per block space, and when they
| expanded to 12 bits, they added on another array with 8 bits
| per 2 spaces.
|
| Now, it doesn't even use block IDs any more. It uses one
| whole object per block type, one pointer to one of those
| objects per block space, and has a lot more block types. The
| on-disk format stores the entire string name of the block,
| once per 16x16x16 region it occurs in.
| momojo wrote:
| Got any resources on this? As a kid I never thought about
| it but as a programmer, I always wondered how you scaled up
| these kind of problems.
| immibis wrote:
| My source is the code itself, but you could also use the
| wiki's documentation about the on-disk data format.
|
| It's fundamentally just a big array of one entry per
| block space. It was never _too_ big for an average
| computer to handle - otherwise Minecraft wouldn 't have
| been able to exist yet (maybe that's why it didn't exist
| until the time that it did) but they've gotten a lot less
| efficient since then, in the name of flexibility.
|
| Before Minecraft existed I played Cube 2 on "coop edit"
| mode. Its world structure is an optimization you might be
| interested in: it represents the whole game world (of
| fixed size) as an octree. So the map starts as a node
| with 8 child slots (one for each corner of a cube); each
| is either completely solid, completely empty, or another
| node, recursively down to some maximum depth. Therefore
| Large empty areas and large solid areas are stored in
| about the same amount of space as small empty areas and
| small solid areas.
| ClikeX wrote:
| It's basically LEGO, it tickles the mind. Which is ironic,
| because LEGO Worlds isn't nearly as inspiring as Minecraft.
| porphyra wrote:
| I used to do that except it was to play Runescape lol. The
| local library got some really nice Pentium 4 computers too.
| nullbyte wrote:
| Funny enough, the original version of minecraft used to run in
| the browser too! It used Java applets. That was a long time ago,
| I remember playing it as a kid
| neuroelectron wrote:
| Yes that's how notch was able to distribute it while
| circumventing publishers. Very smart move at the time.
| diggan wrote:
| Java Applets weren't some magical "workaround" for
| distributing without publishers, lots (well, subjective) of
| indie developers were distributing binaries via websites at
| the point of the first alphas of Minecraft. Of course, way
| more popular nowadays as there are dedicated platforms for
| it.
| 8note wrote:
| the initial scope of minecraft was also in line with the
| java applet games of ~2005, like the ski simulator.
| minecraft came well after the applet era, almost to the end
| of the flash.
|
| huh. Minecraft is the taylor swift of video games. the last
| big star before big tech took over discovery and access for
| an industry.
| laidoffamazon wrote:
| Very astute comparison. Yet somehow still both huge!
| schindlabua wrote:
| I got into Minecraft via 4chan, of all places. People used to
| make posts about it and how cool it was and others would
| naturally talk crap about the game.
| pfoof wrote:
| The craziest part is that it executes on my iPhone SE 2020 in
| Safari. Textures work, shading works, pretty insane. I even
| managed to break a block.
| apignotti wrote:
| Mobile is indeed supported, although the performance is not yet
| as nice as we would like.
|
| The trickiest issue is input, since the "look around with your
| mouse" interaction maps very poorly on a mobile platform where
| "mousemove" implies touching / clicking.
|
| We plan to eventually figure out a mobile-optimize UX, but we
| will most likely prioritize improving the performance first.
| neuroelectron wrote:
| There already is Minecraft in the browser implementations that
| are quite performant
|
| https://map.realismc.com/#world:-87986:65:-25312:0:-0.01:1.5...
|
| This is a world featuring llm powered players that make their own
| plans and constructions (using the terminal)
| CobrastanJorji wrote:
| Great. We brought back Applets.
| freedomben wrote:
| Now we just need to popularize Swing again and we'll be golden
| api wrote:
| It's too bad that this kind of thing is using x86 as the
| actually-pseudocode for this. I understand why -- ease of
| porting, etc. -- but using either WASM (w/WALI?) directly with a
| kernel compiled to WASM (there are efforts to do this) or
| something open like RISC-V would be better long term.
| apignotti wrote:
| This is actually running on top of a WebAssembly-based Java
| Virtual Machine (CheerpJ).
|
| You are probably thinking about our independent x86
| virtualization product CheerpX (https://cheerpx.io)
| api wrote:
| No, I'm thinking about porting the Linux kernel to WASM
| itself and not using a VM written in WASM but WASM directly:
|
| https://wasmlinux-demo.pages.dev
|
| In other words, using WASM as if it were the CPU architecture
| in the VM.
| Jotalea wrote:
| There's also Eaglercraft, which achieves the same result, but it
| has functioning multiplayer, and runs up to version 1.8.9, though
| you'll need a beefy computer.
| TeaVMFan wrote:
| +1 for Eaglercraft. It's based on the open source TeaVM project
| ( https://teavm.org/ ), which transpiles Java to JS or WASM to
| run efficiently in modern browsers. With numerous shipped
| production Java-in-the-browser projects, TeaVM is my preferred
| option for Java in the browser thanks to its performance, build
| speed, and Apache license.
| OsrsNeedsf2P wrote:
| The fact I'm playing this at 20 FPS on Firefox with a RX 7600
| shows how much web browsers have regressed in 10 years, not how
| much they've advanced.
| TeeMassive wrote:
| It's basically java -> wasm/webgl -> your computer
|
| A 10 times hit compared to a native C implementation on
| performance doesn't really matter anymore, but a compounded
| 10x10 times will.
| zimpenfish wrote:
| > The fact I'm playing this at 20 FPS on Firefox with a RX 7600
|
| Vanilla Minecraft is known for being awful for FPS even outside
| of a browser. There's a reason most people use a whole slate of
| performance mods just to get actual decent performance.
|
| (I've got a Ryzen 7 with a 3080 and it would frequently hover
| between 40-50fps even with graphics turned down. Install the
| performance mods and I can get >120fps with fancy graphics and
| shaders.)
| InMice wrote:
| A longstanding performance effecting bug was fixed in the
| recently released 1.21.5 and the difference is night and day
| at least for vanilla clients.
|
| This one: https://bugs.mojang.com/browse/MC/issues/MC-170134
|
| I now never see below 60 fps when for all my years of playing
| this bug would bring down my FPS to the teens or 0 all the
| time no matter what hardware.
| piperswe wrote:
| Minecraft back in the day was a Java applet, so the game was
| running in a native JVM. This demo is running the game in a
| WebAssembly JVM, so performance is absolutely going to suffer.
| If the game were actually written for the web platform, it
| would perform significantly better.
| singularity2001 wrote:
| well Wasm had the promise of giving near native speed, but
| since they still don't offer direct write/share of memory it
| results in abysmal FPS.
| kulahan wrote:
| This is a 20-ish year old game. It really shouldn't matter.
| Rohansi wrote:
| I get similar performance in Chrome on my phone (Pixel 7a).
| Perhaps this just runs poorly in Firefox?
| Ralo wrote:
| This implementation isn't using webworkers either. Moving the
| java VM to a webworker would likely improve performance 10
| fold.
| apignotti wrote:
| Hi everybody, happy to see our CheerpJ demo is appreciated.
|
| CheerpJ is a WebAssembly-based JVM that can run unmodified Java 8
| and Java 11 applications. Java 17 will be supported later in
| year.
|
| I am the lead developer of CheerpJ and CTO of Leaning
| Technologies. AMA.
| skrebbel wrote:
| Cool stuff!
|
| Hey I saw a typo on https://cheerpj.com/cheerpj-core-licenses/,
| it says "liencesees" halfway the page
| apignotti wrote:
| Thanks for spotting this, we'll get it fixed ASAP
| geokon wrote:
| Would it work for a JavaFX app? (not sure I'd be able to shrink
| the bundle size enough for it to make sense though)
| apignotti wrote:
| JavaFX is not yet supported, but we plan to get it to work
| soon.
|
| The issue here is that there is very little Java in JavaFX,
| it's mostly native C++ code. This makes it actually quite
| similar to the LWJGL library used by Minecraft.
|
| Our plan is to use for JavaFX the same technology we have
| developed for LWJGL.
| ConfusedDog wrote:
| I used to love Minecraft as a kid until my kid ruined it for me.
| This 5-year-old loves to be in Creative mode and put me in
| Survival mode and set up traps and rounds of enemies for me to
| fight my way out. Not relaxing at all anymore.
| doubled112 wrote:
| My 7 year old's favourite activity in Minecraft is to blow
| stuff up. I don't know whether to be concerned or not, but at
| least we've convinced him that it's really not cool to blow
| other people's stuff up.
|
| Like you say, not very relaxing.
| kulahan wrote:
| Send that child to the demolition career. There's good money
| in blowing up buildings!
| doubled112 wrote:
| Exactly! There is a demand for constructive deconstruction.
|
| Consent is everything?
| AlphaWeaver wrote:
| Another comment mentions MinecraftForFree.com...
|
| In middle school, in an attempt to get around the school
| firewall, I copied the HTML code from that website to my own to
| play Minecraft at school. Since my domain wasn't on the
| blocklist, it worked! But when my friends started using it to
| play, even after they hadn't bought the game, I resolved to add a
| login wall.
|
| I built a backend proxy in PHP that would POST their credentials
| to the Minecraft API to make sure they had purchased the game. I
| still think it's funny to think I had no ethical qualms about
| circumventing the school firewall, but piracy was where I drew
| the line.
| bobdigit wrote:
| We've gone full circle! Java was originally created to run apps
| in the browser.
| greatgib wrote:
| And in the meantime, this shitty Roblox still doesn't run on
| Linux...
___________________________________________________________________
(page generated 2025-03-31 23:01 UTC)