First, you should install some prerequisites. On Ubuntu 20.04, this can be done with the following command: sudo apt install libsdl2-dev libopengl-dev libglew-dev libpython3-dev build-essential
If this does not work, either because we missed a package or a package has changed names since then, please feel free to let us know!
Once you have the dependencies, you can clone the code from the sm64pc-python repo. From there, the following set of commands should work:
This will likely produce a lot of warning/error messages, but it should get there in the end.
The python portion of the engine is in sm64.py. By default, this module contains a number of functions that have been ported out from C to Python and modified during the process. These can be freely modified to change the game's functionality (though the game must be restarted afterwards!)
The sm64.py file must be in the program's current working directory (the directory it was launched from)!
Some of these modifications made to the engine are silly (e.g. the "Air Time" triple jump depicted in the opening image), and there are some bugs (probably floating-point-related) still lurking around that may appear when you e.g. approach a door too fast.
Most of the work involved with adding Python support was in figuring out how the codebase worked, and then adding glue code which exported those functions and constants out to Python via the stack.
This glue code is mostly in the files src/pc/*_python.*. By all means, please feel free to poke around and see what's available! Some extra work was put into making things like text boxes and letters more usable, too.
For demonstration purposes, the default sm64.py uses standard Python APIs to serve a web page on port 8064 while the game is running. This page has a number of options for affecting gameplay:
There's a lot going on here, and we may come back to revisit this project at some point. There have been quite a few new commits in the original repository that need to be integrated. Please let us know if you do something fun with it!