Hacker News new | past | comments | ask | show | jobs | submit login
Custom Minecraft Classic client written from scratch in C (github.com/unknownshadow200)
141 points by TheFreim on Sept 15, 2023 | hide | past | favorite | 75 comments



This looks super neat! I'm a little sad in general though about the amount of effort invested in the Minecraft ecosystem when it's so unfriendly to open source.

If you care about freedom-respecting software and you like Minecraft, definitely check out Minetest. I've been really impressed with it, both functionally but also code quality. Really cool project and I hope they succeed. The biggest complaint I've heard about Minetest is that the controls just aren't as fluid and polished as real Minecraft.


I wouldn't describe Minecraft as being unusually unfriendly to open source. Compared to most games, the company treats the mod devs pretty well (nobody's getting sued, they released decompilation symbols to make life easier, the whole thing's in Java), and there's a healthy collaboration scene among the mod developers, most of whom release their mods as open source projects these days (with a couple of notable exceptions, coughAzanorcough).

So, sure, Minecrat's not open source. But they don't mistreat their mod devs, released an abundantly hackable game, and have the largest player community on Earth.


There are two things called “minecraft”, and one of them is not written in java, is much more prickly about mods, and iirc has a significantly larger playerbase.


nobody actually gives a shit about bedrock, at least on PC

despite microsoft's best attempts, they haven't been able to kill the java edition and it's only grown


Bedrock has more players?


Bedrock almost certainly has more players, especially in the younger bracket.

Most adults and definitely most content on YouTube is on Java.


I'm pretty sure it does. Bedrock (aka glorified Pocket Edition) is available on PCs (Windows 10/11), Android, iOS and consoles

I mean, I've seen people talking about Minecraft Java on Android and you can certainly run it on the Stream Deck, but both of these tasks are not something the average user would do


Hot take: I'm tempted to say that minecraft is "practically" even if not legally open source. It's very well-understood internally and has been _heavily_ colonized by mod developers.

It's at the point where it's impossible to run a safe and secure minecraft server without installing a mod like paper that completely overhauls the game. There are several modpacks that contain probably 50x more code in mods than code from mojang.

Not to mention, who really controls the game?

If microsoft ever did anything truly egregious I have no doubt that the entire community would pick up sticks and move. It would be large, it would be coordinated, and it would be swift. There are LOTS of successful mincraft clone projects out there, ranging from being loosely minecraft-inspired with lots of new content, to striving to replicate each new feature and addition perfectly, to being written in rust, you name it. The loss of java mods would suck, but give it a year or two and most of the active ones would probably be rewritten. Hell, most of them are written against the very handy Forge modding API, not microsoft's code.

Never mind the fact that the moment microsoft tries to crack down on modding, the various open-source 3rd party launchers will patch out the licence-mandated piracy checks (or will be forked to do so, in fact these pirate forks probably already exist).


I feel like this is one of those projects missing missing an important "Why" section. It's an interesting project, but from the outside, I don't immediately understand why someone has done all this effort. Huge Minecraft classic fans? Programming exercises? Is it about porting to as many platforms as possible? This is the version they are forced to make to not get their pants sued off?


Microsoft’s made account management annoying and shitty and unreliable—like, they make it weirdly hard just to buy the damn game—for MC Classic.

I’d love a way to sidestep them. It’d make my life easier. We already own four or five copies of the game, so I’m not even talking about piracy.

Plus their fucking launcher phones home to any of a whole bunch of IP addresses, refusing to launch the game if those requests fail, which makes allowlist-based management of kids’ connected devices difficult if you want them to be able to play Minecraft and don’t want to have to manually intervene every time they start the game. God damn is that annoying.

(We tried the minecraft-clone plug-in bundle for that one open source engine, and the kids and I both found it off putting and definitely worse in ways that were hard to put my finger on, but were real. Instant rejection by the kids, and I couldn’t blame them)

[edit] though without survival mode or the ability to do multiplayer, this project is also no help to us.


Minecraft Java can be run fully offline without their launcher, and servers can be run with authentication disabled. There's no need to rewrite the whole game ...


For real? Ok yeah I need to do that. Shit’s obnoxious and just another way for things to go wrong if all you’re trying to do is local games and local-network multiplayer. I assumed they’d made it impossible to run without the launcher—if you can, it seems to kinda defeat the whole purpose of all the phoning-home (though I think a lot of that’s after it starts, too, so am not sure if this approach will end up helping)


There are lots of 3rd party (mostly open source) launchers.


Can't run it without their launcher last I tried. How? (I own the game since beta but I can't be bothered to deal with MS anymore)


via third party launchers. some of them can also handle modpacks, shaders, optifine, LAN multiplayer, etc:

https://github.com/huanghongxun/HMCL

https://github.com/PojavLauncherTeam/PojavLauncher

https://github.com/PrismLauncher/PrismLauncher


Thanks. I only heard about MultiMC before and it apparently required MS login...


The version JSON file and JAR are both public. The JSON file describes the dependencies needed (public urls) and how to build the launch command.


As far as I could tell, it can't be installed offline or without a MS account. There's no offline installer. If a rewrite corrects this, that's a huge win


...Ah. Totally can-ish. I helped the RasPi4 community a few years ago with that. I'll go see if I can dig up those scripts. Though I have a sneaking suspicion you might be right in that to generate the initial flurry of download urls you need someone to have had an account to get the urls for version of the client you're downloading, plus the asset packs. Once you have those urls, you should be able to wget to stage/mirror to your hearts content locally, and then you just have to use a shellscript and a bonkers lontg java invocation that the launcher normally generates. You don't need the installer/an account to start the game once you have the clients downloaded, though not having to deal with wrangling lwjgl libs, java classpathery, and the occasional java runtime increment is definitely an increase in ergonomics, I'll give you that.

Didn't maintain it or anything, but another member of the community took the lessons learned from my teardown of it and I think polished it up. Needed a pick me up project at the time. Was around 1.14-ish I think? Also helped them get sound working in Forge.

Found one of the threads, though this either wasn't one of the ones with the gorey details, or they probably snipped the posts as they may not have been super comfortable with me laying out how to vivisect Microsoft's shiny new acquisition for people. I was in a rough headspace back then.

https://forums.raspberrypi.com/viewtopic.php?t=260357


You just need to manually install it. The JAR and all the dependencies are public.

There are many installers out there that don’t auth, I wrote one that does auth for Apple Silicon support and it wasn’t difficult.


are you talking about minetest? my kids play with that just fine. sure, it's different, but it also has features minecraft doesn't have. if you are used to minecraft then of course it may take some time getting used to.


I have done something similar for another game.

It started as a fun curious idea to understand more about programming and mechanics in games, but became very quickly extremely addictive.

Paired with big personal problems at that time it provided me with an excellent opportunity to escape and basically not leave my home until I was done.

And I regret none of it. I learned much much much more about engineering than I would have ever done otherwise and with this knowledge I landed very good jobs with good and stable income which eventually brought me out of my personal problems.


Is that something you have shared online (or would share here)?


No, I didn’t and won’t. Hope you can understand it, this is too intimate for me to share on the internet :-)


Because they can, programming for many is not only a job but also a hobby and passion. Doing something like this you can learn a tons as well and it is a worthy challenge in itself to push your craft.

People re-create classic games all the time, like tetris, for fun.


I enjoy writing toy versions of real-world applications. I'd say 90% of the code that makes up a program is there only to provide smooth edges, error checking, safety, etc. If you ignore all of this and focus on the remaining 10% - the core, bit-banging logic - you can learn a lot and have fun.


Yeah, I'm left wondering the same thing. The project page says that there isn't a survival mode, nor will there ever be.

Uhm... why not? If I contributed a Survival mode, and submitted it as a PR, then it would be rejected? If the goal of this project isn't to recreate what we loved about old-school Minecraft, then I don't know if this project is for me or not, and then I don't know who it's for.


Note that the goal is to recreate "old-school Minecraft", but actually even older school than you're thinking of. For the first year or two of the game there was no survival mode, only creative mode. And people played that version for much longer as it was available as a free to play in-browser version for like the first 5 years of Minecraft's life, even as survival mode got developed in the branch that led to one of the current versions. Also the main branch didn't have creative mode at the time (or even multiplayer for some of it), so some people played classic for creative mode or multiplayer too.

It's not like the way modern creative mode is just a game mode in the same engine as modern survival. Classic is quite a different game so what would a classic survival mode be? Either you're inventing rules for a classic survival mode that didn't work, or you're implementing an Indev/Infdev/Alpha clone in the same codebase as the Classic clone, and I think those two things are different enough that you'd still end up just maintaining a fork inside the same codebase with the amount of conditional "if(alpha) else if (classic)" behaviours you'd need. It's like trying to have the same codebase be classic mac os and os x at the same time. I can't blame a maintainer who doesn't want to sign up for that.


Fwiw re: lack of survival- mojang has tried (and backed off) to take down cc under the assumption it had crafting/survival. The lack of survival aspects is the only reason it’s still around.

That, and classic v .30 doesn’t have any survival features


why should there be a reason to? if there are people that are interested in developing it (even if you solely is the only one interested), who cares?


Yeah.

Its seemingly too big for a programming exercise. Minecraft Classic isnt really broken or super limited like the targets of many open source remakes. Its not commercial.

The big selling point seems to be support on really old desktop devices and iOS/Android? Assuming the mobile controls are good.


> Its not commercial.

Er, isn't it? I'm pretty sure all versions of Minecraft are proprietary software that cost money.


Classic used to be free for everyone as a browser applet on minecraft.net . It was always commercial, but it was free for most of its history. It was shut down for a few years because of the death of browser plugins and java applets, but then Mojang ported an older-than-the-last-classic-version version to wasm and made it available again at classic.minecraft.net (for free again)


The version on classic.Minecraft.net was deemed written from scratch to vaguely replicate classic last I heard. There were physics quirks, block textures, and entire blocks that weren’t ever in any version of classic, but were in that release.


There's certainly a standalone minecraft variant, with full modding capability as a first class citizen, modeled after `forge`, with an asset store modeled after `curseforge` or the `feed the beast launcher` of yesteryear.

Vanilla minecraft no longer appeals to me whereas the hardcore modpacks are ridiculously addictive. Think factorio meets minecraft.


Do you have recommendations for modern "factorio meets Minecraft" modpacks? The more hardcore and complex the better.

I am very out of the loop with Minecraft, not having played in quite a few years. Meanwhile, I have been getting into factorio... but the thought of going back to my Minecraft roots is appealing


GregTech: New Horizons.

Pretty sure between the very active developer community they've built up and the incredibly deep and broad tech progression, new end-game content is being added faster than players could possibly reach it. Got pretty in-depth quest tree to keep pointed in the right direction.


GTNH modded Minecraft 1.7.10 to run on Java 17 and 20.

That’s the level of dedication there.


If it has truly been a few years, you've missed quite a few good ones.

- Enigmatica 2: Expert (or 6)

- AllTheMods 8

and my personal favorite

- Not too Complicated 2

Basically, anything Lashmak[1] plays.

1: https://www.youtube.com/@Lashmak/playlists


Nomifactory and Multiblock Madness have well-written questbooks that guide you into building up infrastructure and setting up automation.


Factorio was inspired by minecraft tech modpacks, so that tracks.


Great project, why though the insistence on no survival mode?

> It does not have a survival mode (nor will such a mode be added)

https://github.com/UnknownShadow200/ClassiCube#what-classicu...


Because it is a recreation of classic 0.30 that used to be on the minecraft website, which did not have survival


I mean, the only mode was survival… at least that’s what I recall playing the prerelease versions.


This is based on a version that predates those versions you're thinking of.

It went Classic -> Indev -> Infdev -> Alpha -> Beta -> full release.

Indev was the introduction of survival mode.


The very first version was just a creative-mode browser game without any health or fight mechanics, I think. (Never played it as I started in alpha)


1 because the target version didn’t have any survival features, 2 because mojang absolutely would not appreciate it.


I love this project! My kid plays ClassiCube on an old 400 MHz G3 iMac and it's perfectly adequate performance-wise.


Very cool! And I thought running it on my 600 MHz K6-3+ was impressive. :)


Here's their WebAssembly playable single-player version: https://www.classicube.net/server/play/?warned=true


I don’t think the provided webclient uses webasm, it’s just transpiled to js. It can be transpiled to webasm but there’s no benefit right now (and worse performance iirc)


I love minecraft so much, that I wonder if this is the right avenue to take for the future. (Maybe its a fun project for them, I'm not criticizing the authors) If you code a replica, can you get sued from M$? I feel like I've seen similar happen to Nintendo replicas.

I'm so afraid of M$ and what they will do to Minecraft. I have seen the open source variants that give me some uncanny valley feelings, but I imagine this is the long term solution.

In a different life or when we achieve post scarcity, I'd love to contribute to one of these.


The author of the client just likes writing it. The owner of the website just likes running it too. Both have decent day jobs that cover the costs easily, so that’s nice.

I know the website owner has actually talked mojang’s legal team down from trying to take classicube down- the lack of modern Minecraft features essentially differentiates it from their product, assumedly it makes it much harder to sue for.


M$... That aside, no a replica is not a problem unless it uses any actual IP like Steve or the actual Minecraft art.


> I feel like I've seen similar happen to Nintendo replicas

Nintendo is probably the most aggressive about this.


I’m a bit short on time and can’t dig into the code, but maybe somebody can answer this for this or the original version:

In what data structure are the blocks in Minecraft actually stored? And by which mechanism are they quickly retrieved to check which block the player was hitting?

I would think the model partitions the space with an octree and their position jumps from parent node to parent node. Then at each bit we just have to go through 8 elements to find a block and all the entities for this partition.


https://minecraft.fandom.com/wiki/Anvil_file_format

https://minecraft.fandom.com/wiki/Chunk_format

The main unit of minecraft storage is the chunk, which is a 16x16xWorld height area of the map. Chunks are bundled into groups of 32x32 chunks for storage on disk. Minecraft keeps a map of chunks for an area of (configured render distance + 3) chunks in memory, and pages these in and out as you move around (including generating new chunks if you reach a chunk that's never been generated before).

Chunks themselves are subdivided into 16x16x16 sections of blocks by vertical height.

So the process is:

1. Find chunk containing co-ordinate (maths + dict lookup) 2. Find array containing data based on y co-ordinate (basically an array lookup) 3. Find block in array (another array lookup)

There's also various data of more variable size (e.g. lists of entities, structures, etc.) tacked onto the chunk format. These tend to be much smaller in number for any given chunk, so my understanding is these are basically just linearly searched or iterated on a per chunk basis when required.


A bit of searching implies that they are not stored as Octrees due to "performance reasons":

> [...] To understand why octrees are slower for Minecraft games, it isn’t really necessary to invoke such exotic explanations. The underlying reason for the worse performance is purely algorithmic: each time an arbitrary voxel is touched, either when iterating or performing a random access, it is necessary to traverse to the entire height of the octree. Since octrees are not necessarily balanced, this can be as much as log(maximum size of game world)! Assuming the coordinate system is say 32 bit, this brings an added overhead of 32 additional non-coherent memory accesses per each operation that touches the map (as opposed to the flat array, where everything is simply constant time).

https://0fps.net/2012/01/14/an-analysis-of-minecraft-like-en...


Thanks a lot! Posts like yours are exactly what make this community great.


Why would you need a tree?

You always know the location of the player in x,y,z. The world is extremely regular, first you figure out the co-ordinates of what you are hitting, then you do a direct lookup of that from the world, with like a single top-level hashtable that links to large fixed-size segments. This will be dramatically faster than any tree.


this is the kind of question a co-pilot programming assistant AI should be able to answer with direct quotations of the relevant code


It's cool that they are intending to port it to old gaming systems: PSP, 3DS, Wii, GameCube, Xbox, Dreamcast.

The readme notes all say "The <console> port needs assistance from someone experienced with <console> homebrew development - if you're interested, please get in contact with me." , it's got entries in the Makefile for all of them at least.


It actually already almost fully works on all of those but the Xbox! Several players play on the Wii, GameCube, and 3ds. Most servers don’t work (due to ram and processing limitations) but they’re totally functional and mostly-stable.


BTW Classic Minecraft means "beta Minecraft from 10+ years ago when it was free"


From the readme:

> It does not support logging in with Mojang/Minecraft accounts

They almost make it sound like a bad thing


This is great.

It would be cool to do this in Rust and run on WASM.


Minecraft was officially playable in the browser from the website back in the day!


Using Java applet...


what did you expect? the game is written in java


Just saying that it's not really running in the web browser, merely displayed within it. And won't run today.


To "run in the web browser" you mean rewriting the game in javascript.

No, webassembly wasn't a thing yet at the time (arguably still isn't). I'm not sure emscripten existed, and even when it works it turns 20KB C++ binaries into 3MB of broken javascript. Non-starter for a performance-sensitive game engine.



NO it is NOT.

I said RUST to WASM.

That link is just for compiling C with JavaScript interropts.

I was simply commenting that:

'hey that is cool you did this with C'

'wow, this seems like it would also be a cool exercise to do with Rust'.


Whoever is downvoting this so hard, I'd like some explanation.

This was the most innocent comment ever.

Is there an anti-Rust sentiment?

Is it so bad to say something was a good idea, it makes me think of trying other things too.


Or in Malbolge and run on MMIX.




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: