~sebsite/generic-tetromino-game

Clone of NES Tetris

87836ab website: comment out video

9 days ago
a month ago

#generic tetromino game

This is a clone of NES Tetris. The base game remains as faithful to the original as possible, but the game also adds new features and includes a modding API.

For more information, see the website.

#Compiling

The only dependencies are a POSIX-compliant C11 environment, a POSIX-compliant implementation of make, a pkg-config implementation (such as pkgconf), and development files for SDL2, SDL2_mixer, and Lua 5.4.

For non-Windows:

make

FreeBSD users (and possibly other platforms as well) will need to override the LUA macro:

make LUA=lua-5.4

If your C compiler doesn't support UBSAN, override the SANITIZE macro with an empty string:

make SANITIZE=

Then run make install to install, optionally setting PREFIX and DESTDIR. You may also want to run make install-mods to copy the mods from contrib to your data directory. All mods are opt-in from the options screen, with the exception of statistics which is enabled by default.

Compiling for Windows can be done with MinGW. I do it by cross-compiling to MinGW from a non-Windows environment. Using Alpine Linux with mingw-w64-gcc, I do this:

make -f Makefile.mingw generic-tetromino-game.zip

This creates a zip file containing all assets the game needs to run. The .exe can be run natively on Windows. You may need to set the PREFIX and MINGW_PREFIX macros to different values in the above command to suite your environment.

Also note that the Windows build doesn't support online play, since it's implemented using the POSIX sockets API. I honestly have very little interest in writing much platform-specific Windows stuff, since Microsoft are the ones not following standards here. If anyone wants this, you are free to implement this yourself and send a patch (though note that I'm in the process of rewriting all of the online stuff, so you may want to hold off; ping me on IRC or fedi or wherever if you have questions).

#Some miscellaneous notes for hacking in this repo

The source code for the game is almost all in main.c, with a few helper functions in shared.c. The server is incomplete and will be rewritten At Some Point, but its source code is in server.c (also using the helper functions in shared.c).

If you make any changes to the Lua API, you should update the documentation in docs.md. You can then run make website/docs/api/index.html to re-generate the HTML docs. You should also search through mods/ and update things so they don't break, if necessary.

If you're developing a mod, you can access API docs online, within the in-game console with the function console.help, on the command-line using contrib/docs.sh, or you can just view docs.md itself.

If your editor isn't configured to respect .editorconfig, take care that your code uses the same indentation style as similar code. In general, you should make sure your code follows the same style guidelines as everything else. I don't actually care that much about style, it just really pisses me off when a codebase is inconsistent.