jdah / minecraft-weekend

Minecraft, but I made it in 48 hours.
MIT License
4.04k stars 444 forks source link

Native Windows Support (as a patch) #104

Open larioteo opened 3 weeks ago

larioteo commented 3 weeks ago

Hello @jdah,

Cool project! I enjoyed your video and I wanted to try it myself.

To start, I looked into your implementation, but I noticed that the project wasn't prepared out-of-the-box for Windows. However, given that your code and libraries seemed already platform independent, I added native Windows Support in 25 minutes... with premake5.

Let's be real, Windows is still the most used OS worldwide, especially in gaming, and it's also a pleasure to develop on. I hope you don't mind that I created this patch. Only 2 changes were necessary in your code, a missing explicit cast in worldgen and a little bug fix in the sort header -- likely related to the switch to Clang instead of GCC.

Minecraft-Weekend-Windows-Patch.zip

  1. git clone
  2. git submodule update --init --recursive
  3. download and unpack contents of patch (the source folder should be merged carefully, isntead of copy paste...)
  4. execute generate-build.bat
  5. open visual studio and press play

Yes, I could also offer you a PR, but as it seems you don't care about/like Windows or Microsoft for some reason, maybe you don't want to support it, I don't know. I thought that there are a lot of people out there, that could benefit from your project, so I decided to pack everything to a small zip file and upload it here.

Regards, random-developer

Pedroma34 commented 2 weeks ago

Thank you.! Few things, though. Make sure to install Clang toolchain for Visual Studio 17 (run the installer, click modify VS17->individual components->C++ Clang compiler and MSBuild support for LLVM (clang-cl) toolset. It's about 8gb but then it should build just fine.

larioteo commented 2 weeks ago

Yeah, forgot about the setup, thank you to.

Also for beginners, you can reach full FPS in release mode, which is normal, cause in debug mode, the math stuff is slow, due to optimizations turned off.

Beyond that premake5 can create also build files for cmake for all operating systems, in my opinion it's a good choice for cross platform support. Also other configurations are possible, but for that the lua files may be set up correctly.