Prerequisites:

  • Python 3.11 or 3.12 (3.12 tested)
  • Git (optional, for cloning)

Step 1: Get the source code

Option A: Download ZIP (any OS)

Download from Download page and extract the archive.

Option B: Windows Installer

Download and run the installer from the Download page (skip to "How to run" if using installer).

Option C: Git clone (any OS)

git clone https://github.com/legoman0701/drift_race_test.git cd drift_race_test

Step 2: Create and activate a virtual environment

Windows (PowerShell):

# From the project root python -m venv .venv .\.venv\Scripts\Activate.ps1

Linux / macOS:

# From the project root python3 -m venv .venv source .venv/bin/activate

Step 3: Install dependencies

Option A: Install from requirements.txt

pip install -r requirements.txt

Option B: Install in editable mode

pip install -e .

Troubleshooting: If Pygame-CE fails to build wheels, update pip and retry:

python -m pip install --upgrade pip # Then try installing again pip install -r requirements.txt

Note: On some systems, you may need to use python3 and pip3 instead of python and pip.

Important: Make sure your virtual environment is activated before running the game! See "How to install" for activation commands, or check "Can't activate venv?" below for alternatives.

Quick run (GUI):

python -m drift

Alternate (explicit app module):

python -m drift.app

Multiplayer from the command line:

Host a room:

python -m drift.app --mode host --code ABCD --name YourName

Join a room:

python -m drift.app --mode join --code ABCD --name YourName

Notes: Hosting acts as the server. Others join via the code shown in the UI. A relay is used to help with NAT traversal. On some systems, use python3 instead of python.

Driving:

Up / Z Accelerate
Down / S Reverse
Left / Q Steer left
Right / D Steer right
Space Handbrake
R Reset your car
L Headlights on/off
C Cycle car type
Esc Open Settings

Gameplay tips:

  • Drifting is about balancing throttle and steering — too much angle, scrub speed; too little, straighten out.
  • Handbrake can help initiate a drift, but throttle modulation keeps it going.
  • Tire marks start smoky and fade toward rubber to show your line.
  • Mouse wheel to zoom, middle-mouse drag to pan the camera.

AI and Multiplayer:

  • N — spawn an AI (host only)
  • In multiplayer, share the room code for others to join.

Debug & Performance:

  • F3 — toggle debug overlays. When OFF, the game skips debug calculations for better FPS.
  • FPS and Debug status are shown in the top-right.

If you installed via the installer:

Run unins000.exe located in the game installation folder to uninstall the game.

If you cloned/downloaded from source:

# Deactivate and remove the virtual environment Deactivate Remove-Item -Recurse -Force .venv

Then simply delete the project folder.

1. Make sure pygame-ce is installed (not regular pygame)

Drift Race requires pygame-ce (Community Edition) for optimal performance. Regular pygame may cause significantly lower FPS.

# Uninstall regular pygame first pip uninstall pygame # Install pygame-ce pip install pygame-ce

2. Always run the game with your virtual environment activated

Make sure your virtual environment is active before running the game. This ensures you're using the correct dependencies.

Windows:

# Activate the virtual environment .\.venv\Scripts\Activate.ps1 # Then run the game python -m drift

Linux / macOS:

# Activate the virtual environment source .venv/bin/activate # Then run the game python3 -m drift

3. Verify your installation

Windows:

# Check which pygame version is installed pip list | Select-String pygame # Should show: pygame-ce (not pygame)

Linux / macOS:

# Check which pygame version is installed pip list | grep pygame # Should show: pygame-ce (not pygame)

Additional performance tips:

  • Disable debug mode by pressing F3 (debug calculations can impact FPS)
  • Turn off headlights with L if not needed
  • Limit the number of AI cars spawned
  • Close other applications to free up system resources
  • Update your graphics drivers to the latest version

Note: If you're still experiencing issues after these steps, make sure you have Python 3.11 or 3.12 installed, and that all requirements from requirements.txt are properly installed in your virtual environment.

If you can't activate your virtual environment or prefer not to, you can run commands directly using the full path to the Python and pip executables inside the venv.

Windows (PowerShell / CMD):

# Install packages .\.venv\Scripts\pip.exe install -r requirements.txt # Run the game .\.venv\Scripts\python.exe -m drift

Linux / macOS:

# Install packages .venv/bin/pip install -r requirements.txt # Run the game .venv/bin/python -m drift

Note: On some systems, the executables might be named python3 and pip3 instead of python and pip. If one doesn't work, try the other.

Why use a virtual environment?

  • Keeps project dependencies isolated from system Python
  • Prevents version conflicts with other Python projects
  • Makes it easier to manage and reproduce the exact environment
  • Allows different projects to use different package versions
  • Pygame-CE install issues: Update pip, ensure Python 3.11/3.12, then reinstall requirements.
  • No audio or errors at startup: The game auto-falls back to simpler audio settings; if all fail, audio is disabled.
  • Performance on low-end PCs: Disable debug (F3), keep lights off (L), and avoid spawning many AI cars.