/pystk

Python SuperTuxKart interface

Primary LanguageCOtherNOASSERTION

Python SuperTuxKart

Build for M1 Mac

Tested on M1 Mac in zsh, with Python 3.9.

  1. Prerequisites

Assumes Homebrew is already installed. Info about XCode command line tools.

xcode-select --install # XCode command line tools
brew install cmake python@3.9
  1. Clone SuperTuxKart

This fork has changes for M1 Mac that are not in the upstream.

git clone https://github.com/benhunter/pystk.git
cd pystk
  1. Build from source

Build with Python 3.9. Python 3.11 did not work for me. Python 3.10 is unconfirmed.

python39 -m venv venv --system-site-packages
source venv/bin/activate
pip install requests

mkdir build
cd build
cmake ..
make
cd ..

# Make sure the file we need is here:
ls -lah pystk.cpython-39-darwin.so
  1. Download game assets
cd pystk_data
python setup.py fetch_data
deactivate
PSTK_DIR=$(pwd) # will use later
  1. Copy the binary and game assets to your site-packages

You must copy pystk.cpython-39-darwin.so into your site-packages directory so it becomes accesible by your virtual environment. Examples with anaconda and miniconda3:

/Users/USERNAME_HERE/opt/anaconda3/envs/DL/lib/python3.9/site-packages /Users/USERNAME_HERE/miniconda3/lib/python3.10/site-packages

Find where to put the binary:

python3.9 -c "import site; print(''.join(site.getsitepackages()))"

Similarly, copy the entire pystk_data directory into the site-packages directory.

cd project_that_needs_pystk
source ./venv/bin/activate # if needed
SITE_PACKAGES_DIR=$(python3.9 -c "import site; print(''.join(site.getsitepackages()))")
echo SITE_PACKAGES_DIR
cp $PSTK_DIR/pystk.cpython-39-darwin.so $SITE_PACKAGES_DIR
cp -r $PSTK_DIR/pystk_data $SITE_PACKAGES_DIR
  1. Install a couple auxiliary libraries required to visualize the videos generated by the game:
pip install imageio imageio_ffmpeg

Credit to Ander Murillo for doing the hard work of finding the changes to make for M1 and making the original instructions! Thank you!

Original README

This is a heavily modified version of the free SuperTuxKart racing game for sensorimotor control experiments.

Many parts that make SuperTuxKart fun and entertaining to play were removed, and replaced with a highly efficient and customizable python interface to the game. The python interface supports the full rendering engine and all assets of the original game, but no longer contains any sound playback, networking, or user interface.

See https://pystk.readthedocs.io for a full documentation.

If you find a bug in this version of supertuxkart please do not report it to the original project, this project significantly diverged from the original intention of the video game.

Hardware Requirements

To run SuperTuxKart, make sure that your computer's specifications are equal or higher than the following specifications:

  • A graphics card capable of 3D rendering - NVIDIA GeForce 8 series and newer (GeForce 8100 or newer), AMD/ATI Radeon HD 4000 series and newer, Intel HD Graphics 3000 and newer. OpenGL >= 3.3
  • You should have a CPU that's running at 1 GHz or faster.
  • You'll need at least 512 MB of free VRAM (video memory).
  • Minimum disk space: 800 MB

License

The software is released under the GNU General Public License (GPL) which can be found in the file COPYING in the same directory as this file. Information about the licenses for the artwork is contained in data/licenses.