Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mrproper

macrumors newbie
Original poster
Mar 6, 2022
1
5
Hi everyone,

I recently saw a post on reddit about the original Minecraft 0.30 ported from Java to C (https://github.com/johnpayne-dev/MinecraftC) and after trying it on Windows I realized that it was indeed really lightweight in comparison to the Java version even without any optimizations enabled.

I thought that it could give powermacs a chance to see minecraft at above 60FPS and also provide a little bit of nostalgia from this very early and very broken version of Minecraft :).

So I gave this a go. The short story is that this was a painful adventure, but thanks to the discovery of GTA III on PPC (which led me to this forum) and the existence of SDL 2.0.3 I solved my biggest issues, and in a few weeks worth of compiler compilations I managed to get it running, and really well.

I have not tested it much, but it is very light on CPU and the main limiting factor is GPU. RAM usage stays around 120MB, but it seems there are some leaks as it slowly grows over time. I welcome any performance measurements on weaker machines. I'm now looking for a G3 machine as all I have are G4s laptops and a G5.

Requirements:
* Mac OS X 10.5.8 Leopard (it is built against its libraries)
* GPU with accelerated OpenGL (tested only on ATI 9600 128MB + 256MB)

You can download it here:
* https://mega.nz/file/xr4kXJqa#pZBSKjQzxJJDWWss6pY2-bytzVO-HGk1HQw2BDHa_9A

Video recording:
*

Known bugs:
* No sound
* Saving/Loading is broken
* Resizing window during loading doesn't resize the game
* Player sometimes gets ejected into outer space
* Picking shot arrows adds more arrows than on ground
* Game doesn't start from Applications folder for some reason

Control notes:
* With TAB you can shoot arrows
* F5 turns rain on


The long story is that I first wanted to compile it as is, without any changes using the latest clang. For that I first went through the compilation of multiple versions of GCC, then Clang, all of which required manual patching. I've found out that clang-7 is the last supported version for Darwin PPC. Then I tried to get SDL working, which ended in me giving up on the project for a few weeks (I have no experience with Cocoa and OS X APIs). Then just out of the blue, I found the re3 PowerPC port where an older version of SDL 2.0.3 was used. That was a big victory and a step forward. That got me 90% of the way. What remained were a few mouse input/capture handling functions, which I relatively easily ported from SDL 2.0.4. And that worked on the first try, but it was crashing often. Also, when I enabled optimizations everything broke. I found out that similar problems are even on my Windows desktop with clang-7 and with just a few changes I was able to get clang-8 running (it may be possible to go further, but it'll likely be broken). That solved some problems, but it was still crashing and graphical glitches were all over the place. The crashing was caused by using float arithmetics for indexing/growing lists.. which I replaced with integers. Then I've investigated graphical glitches and it turns out that clang has issues with vector extensions (Altivec) on PowerPC. Since replacing all those vector functions manually would be a horrible pain, I instead changed the project to use C++ and wrote a very simple vector struct myself. I used C++ so that I could use overloading of operators and minimize the manual work required. That itself took multiple hours as it turns out I forgot how different C actually is (I'm a C++ programmer). But after fixing some new bugs I created in the process (there was still a lot of manual work) I got it to work as well as on Windows (the same above bugs are present).

Oh, I would almost forget, I've used an older version of MinecraftC and upgraded it without the survival removal.

My next plan is to get saving/loading working. Afterward, I don't know yet. I thought about rewriting the entire game to pure C++ and using EnTT ECS framework same as the Bedrock version so that there is no proprietary code from the original Minecraft and it can handle even more. Currently, the code is a kinda pile of garbage and I don't want to release the code as yet, mainly because there is the survival code. I'll give myself some time to work on other projects, but if there will be interest, I'll gladly continue on this.
 

Attachments

  • Picture 2.png
    Picture 2.png
    1.2 MB · Views: 110
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.