I wanted to share a project to the community that turned out very nice after spending a week on it as a side-project for the holidays. Not that the world needs another Match-3 style game, but I have long term plans to do something fun and thematic with this project. Also, I occasionally like to zone out playing these games while my mind goes to auto-pilot mode.
More work needs to go into cleaning the code up but it’s already running smooth. I’ll be spending some time to make it more robust and hunting down any left over memory leaks by introducing the GenPurposeAlloc leak detection hook. Also, I will be adding a resource (images, fonts, music, sfx) caching library to simplify asset loading.
My Zig version has only been tested and built on MacOS. Contributions are welcome for getting this to compile on Linux/Windows/other. Contributions are also welcome for any bug-fixes or improvements to the code that maintain the spirit of the original C++ version.
The original code was GPL2.0 so this Zig version must also remain GPL2.0 to my understanding.
I don’t think you have to keep the original license if you port something. It’s if you copy paste it that you need to keep the license. Of course it’s always polite to give credit.
Cool project! If you want to take it one step further, you could try swapping out the system dependencies for ports of those dependencies to the Zig build system, so that the game can be built with the Zig compiler itself as the only prerequisite. The allyourcodebase GitHub organisation has working ports of SDL, SDL_image and SDL_ttf (but unfortunately not SDL_mixer (yet?)).
I don’t think this is correct. If you port or translate some code to a different language (or rewrite it from scratch in the same language), the translated result is almost certainly considered a derivative work of the original code and must therefore be covered by the terms of the original license. For GPL specifically they even have an entry in their FAQ about translation:
What does the GPL say about translating some code to a different programming language? (#TranslateCode)
Under copyright law, translation of a work is considered a kind of modification. Therefore, what the GPL says about modified versions applies also to translated versions. The translation is covered by the copyright on the original program.
If the original program carries a free license, that license gives permission to translate it. How you can use and license the translated program is determined by that license. If the original program is licensed under certain versions of the GNU GPL, the translated program must be covered by the same versions of the GNU GPL.
So @deckarep’s understanding that the Zig port must also be licensed under GPL2.0 appears correct.
My understanding is that for some code to be considered fair use and not covered by the license terms of some original project, it would need to be clean-room reverse engineering effort or based solely on the publicly documented/observable API without using code from the actual implementation.
AIUI, this is correct. The FSF believes that anything short of clean-room reverse engineering will result in a “derived work”. Whether that’s legally enforceable is a different question though.
I’m grateful that Zig is MIT licensed throughout. I can use any part of it in any way, I just don’t get a warranty “of any kind” or to blame Zig/ZSF for my problems.
Thanks, I am aware of the Zig specific libs that are already packaged exclusively for the build system and will look into moving to that at some point.
Thanks for pointing it out as this would be a good project to support all dependencies being done with Zig alone.