Skip to main content
This guide covers detailed installation, configuration, and advanced setup options for Sakuya AC.

System requirements

  • Python: 3.9 or higher
  • Operating system: Linux, macOS, or Windows
  • Network: Access to YSFlight server
  • Memory: ~50MB per proxy instance
Linux systems can use uvloop for improved I/O performance. The proxy automatically detects and uses it if available.

Installation

1

Install Python

Ensure you have Python 3.9+ installed:
python --version
# or
python3 --version
If not installed, download from python.org.
2

Clone repository

Clone Sakuya AC from GitHub:
git clone https://github.com/the-indian-dev/sakuya-ac.git
cd sakuya-ac
3

Install dependencies (optional)

Dependencies are only required for Discord integration:
pip install -r requirements.txt
On modern Linux distributions, you may need to create a virtual environment:
python -m venv venv
source venv/bin/activate  # Linux/macOS
# or
venv\Scripts\activate  # Windows
pip install -r requirements.txt
Dependencies (requirements.txt):
aiohttp==3.11.12        # Async HTTP for Discord
uvloop==0.21.0          # Fast I/O loop (Linux/macOS)
# ... and supporting libraries
4

Configure proxy

Copy and edit config.py to match your setup:
config.py
from logging import DEBUG, WARN, INFO, CRITICAL

# Logging Level
LOGGING_LEVEL = INFO  # Use DEBUG for troubleshooting

# Server Configuration
SERVER_HOST = "127.0.0.1"  # YSFlight server IP
SERVER_PORT = 7915          # YSFlight server port
PROXY_PORT = 9000           # Proxy listening port

# YSFlight Server Version
YSF_VERSION = 20150425      # CRITICAL: Must match server

# Enable ViaVersion
VIA_VERSION = True          # Allow newer clients

# G-Limiter
G_LIM = 4                   # Kill at |g| >= 4

# Welcome message
WELCOME_MESSAGE = "Welcome {username} to the server!"

# Command prefix
PREFIX = "/"

# Health hack detection message
HEALTH_HACK_MESSAGE = "Detected for health hack"

# Smoke on damage
SMOKE_PLANE = True
SMOKE_LIFE = 5              # Smoke when life < 5

# Discord integration (optional)
DISCORD_ENABLED = False
DISCORD_TOKEN = "DISCORD_BOT_TOKEN"
CHANNEL_ID = 0
Critical: Set YSF_VERSION to your exact YSFlight server version. Incorrect values cause connection failures.
5

Start the proxy

Run the proxy server:
python proxy.py
Expected output:
INFO: Welcome to Sakuya AC
INFO: Perfect and Elegant Proxy for your YSFlight Server
INFO: Licensed under GPLv3
INFO: Press CTRL+C to stop the proxy
INFO: uvloop found! Using uvloop for fast I/O  # Linux only
INFO [proxy.py:371]: Proxy server listening on port 9000
6

Configure clients

Point YSFlight clients to the proxy:
  • Host: Your proxy server IP
  • Port: PROXY_PORT (default: 9000)
Clients connect to the proxy, which forwards to your YSFlight server.

Configuration options

Logging

from logging import DEBUG, INFO, WARN, CRITICAL

LOGGING_LEVEL = INFO
  • DEBUG: Verbose packet-level logging (use for bug reports)
  • INFO: Standard operational logging
  • WARN: Warnings and errors only
  • CRITICAL: Critical errors only
When reporting issues, set LOGGING_LEVEL = DEBUG and include full logs.

Server connection

SERVER_HOST = "127.0.0.1"  # YSFlight server IP or hostname
SERVER_PORT = 7915          # YSFlight server port
PROXY_PORT = 9000           # Port for proxy to listen on
  • SERVER_HOST: IP address of your YSFlight server
  • SERVER_PORT: Port your YSFlight server listens on
  • PROXY_PORT: Port clients connect to (change if 9000 conflicts)

Version compatibility

YSF_VERSION = 20150425  # Server version
VIA_VERSION = True      # Allow different client versions
  • YSF_VERSION: Must match your YSFlight server version
  • VIA_VERSION: When True, allows post-20150425 clients to connect
ViaVersion is experimental. Some features may not work correctly with version mismatches.
When a client with a different version connects:
# In proxy.py:172-175
if player.version != YSF_VERSION and VIA_VERSION:
    info(f"ViaVersion enabled : Porting {player.username} from {player.version} to {YSF_VERSION}")
    message_to_client.append(YSchat.message(f"Porting you to YSFlight {YSF_VERSION}, This is currently Experimental"))

G-limiter

G_LIM = 4  # Kill player when |g| >= 4
Enforces realistic G-force limits. When a player’s aircraft experiences G-forces >= G_LIM, they are killed.
  • Set to 100 to effectively disable
  • Typical values: 4-8 for realism
  • Checked in proxy.py:186 via FSNETCMD_AIRPLANESTATE packets

Damage mechanics

SMOKE_PLANE = True   # Enable smoke on damage
SMOKE_LIFE = 5       # Smoke when life < 5
When SMOKE_PLANE = True and aircraft life < SMOKE_LIFE:
  • Black smoke emitted from aircraft
  • Engine breakdown (no afterburner)
  • Missiles disabled
Implemented via weapon config packets (proxy.py:255):
addSmoke = FSNETCMD_WEAPONCONFIG.addSmoke(player.aircraft.id)
message_to_server.append(addSmoke)

Welcome message

WELCOME_MESSAGE = "Welcome {username} to the server!"
  • Use {username} placeholder for player name
  • Sent when player joins (proxy.py:265)

Commands

PREFIX = "/"
Command prefix for in-game chat commands. Players type PREFIX + command (e.g., /help). Commands are processed in proxy.py:218-222:
if msg.message.startswith(PREFIX):
    command = msg.message.split(" ")[0][1:]
    asyncio.create_task(triggerCommand.triggerCommand(command, msg.message, player, message_to_client, message_to_server, plugin_manager))

Anti-cheat

HEALTH_HACK_MESSAGE = "Detected for health hack"
Message broadcast when health hacking detected (proxy.py:193-196):
if player.aircraft.prev_life < player.aircraft.life and player.aircraft.prev_life != -1:
    cheatingMsg = YSchat.message(f"{HEALTH_HACK_MESSAGE} by {player.username}")
    warning(f"Health hack detected for {player.username}, Connected from {player.ip}")

Discord integration

DISCORD_ENABLED = False
DISCORD_TOKEN = "DISCORD_BOT_TOKEN"
CHANNEL_ID = 0  # Discord channel ID as integer
Requires dependencies: pip install -r requirements.txt
When enabled:
  • In-game chat syncs to Discord channel
  • Join/leave notifications sent to Discord
  • Discord messages forwarded to game
Setup:
  1. Create Discord bot at discord.com/developers
  2. Enable “Message Content Intent” in bot settings
  3. Copy bot token to DISCORD_TOKEN
  4. Get channel ID (right-click channel → Copy ID) and set CHANNEL_ID
  5. Invite bot to server with “Read Messages” and “Send Messages” permissions

Running in production

As a service (Linux)

Create /etc/systemd/system/sakuya-ac.service:
[Unit]
Description=Sakuya AC Proxy Server
After=network.target

[Service]
Type=simple
User=your-user
WorkingDirectory=/path/to/sakuya-ac
ExecStart=/usr/bin/python3 proxy.py
Restart=always

[Install]
WantedBy=multi-user.target
Enable and start:
sudo systemctl enable sakuya-ac
sudo systemctl start sakuya-ac
sudo systemctl status sakuya-ac

With Docker

Create Dockerfile:
FROM python:3.9-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
CMD ["python", "proxy.py"]
Build and run:
docker build -t sakuya-ac .
docker run -d -p 9000:9000 --name sakuya-ac sakuya-ac

Troubleshooting

Connection refused

Symptom: Clients cannot connect to proxy Solutions:
  • Check firewall allows PROXY_PORT
  • Verify proxy is listening on 0.0.0.0 (all interfaces)
  • Ensure no other service uses the port: netstat -tulpn | grep 9000

Version mismatch

Symptom: “Version mismatch” or connection errors Solutions:
  • Set YSF_VERSION exactly to your server version
  • Enable VIA_VERSION = True for mixed versions
  • Check logs for version info: LOGGING_LEVEL = DEBUG

Health hack false positives

Symptom: Health hack messages when players repair Solutions:
  • This is tracked with player.aircraft.just_repaired flag (proxy.py:198)
  • Check plugin compatibility
  • Report with DEBUG logs and .yfs replay file

High CPU usage

Solutions:
  • Install uvloop on Linux: pip install uvloop
  • Reduce LOGGING_LEVEL to WARN or INFO
  • Check for packet loop issues in plugins

Next steps

Discord integration

Set up chat sync with Discord

Plugin system

Install community plugins

Build plugins

Create custom features with the plugin API

Features guide

Learn about G-limiters, damage mechanics, and anti-cheat

Build docs developers (and LLMs) love