sashakoshka / m4kc

Minecraft 4k: decompiled, translated to C using SDL for graphics and input, and improved upon
78 stars 8 forks source link
game minecraft minecraft-4k procedural-generation terrain voxel

M4KC

Grass block icon

Minecraft 4K - C Rewrite

For those who don't know, Minecraft 4K was a stripped down version of Minecraft submitted by Notch to the Java 4K Game Programming Contest, where each submission had to be under 4 kilobytes in size. Its wiki page can be found here.

Being so small, the game proved somewhat easy to de-compile and edit. Multiple people have given this a go, including me.

This project is an attempt to translate the game into C in order to increase its performance, and to provide a platform upon which to add new features.

Some goals for this project

βœ…οΈ - got that!

πŸ—οΈ - not yet...

Dependencies

Bare minimum to make this code run

To get it down to a small size, you need

On windows, you will need

Build instructions

Visit the wiki for more detailed build instructions.

Linux, unix, etc

Windows

The exact same as above, but you need to do it within an MSYS2/MINGW64 shell. Instructions on how to do this can be found here.

Places

There is a forum thread for this project here

I will be uploading binaries here

Holanet was recently migrated to the hlhv architecture. The software page has not been migrated yet. For now, binaries will be uploaded to the releases section on GitHub.

FAQ

I've either been asked these, or I expect to be at some point.

What's with the cryptic variable names like f22 and i6?

A lot of this code is decompiled from the original java version, and those are names the decompiler assigned to the variables. Much of the code is extremely obfuscated due to what are probably compiler optimizations, and some variables have not been deciphered and renamed yet. This is why they mostly appear in the gameLoop function.

Why is it so slow?

The game uses a 3D voxel raycaster to render things, which is a lot slower than more traditional methods of rendering. Luckily, C provides more powerful ways to optimize something like this than Java - and optimizations will keep coming.

Will you add in _____ from Minecraft?

I plan to port over a lot of user interface features, controls, and gameplay mechanics from the official game. However, this game will be taken in its own direction content-wise. For example, crafting will be a part of the game eventually, but creepers will not. New features will be added if they fit with the aesthetic and feel of the game, and make sense from a technichal and gameplay perspective.

Screenshots

What this actually looks like.

Main menu Cool house World selection Rolling hills A beach