Overview
The ViaVersion system allows clients running newer YSFlight versions to connect to servers running older versions. This enables server operators to maintain compatibility with a wider range of clients without updating their core YSFlight server.How It Works
When a client connects to the proxy, Sakuya AC intercepts the version handshake and translates the client’s version to match the server’s expected version. This allows seamless communication between mismatched versions.Configuration
Enabling ViaVersion
In yourconfig.py, set the following variables:
config.py
The version of your native YSFlight server. This is the version that all client connections will be translated to.
Enables or disables the ViaVersion system.
True- Allow clients from different versions to connectFalse- Only allow clients matchingYSF_VERSION
Supported Versions
Sakuya AC has been tested with: Server Version:- YSFlight
20150425✓ Fully tested
- Post-
20150425versions are supported whenVIA_VERSION = True - Specific tested client versions are not documented
While other server versions may work, only
20150425 is officially supported and tested.Version Translation Process
The ViaVersion system uses thegenViaVersion() function to generate version translation packets:
Packet Structure
The version translation packet contains:| Field | Type | Description |
|---|---|---|
| Packet size | unsigned int | Total packet size (24 bytes) |
| Command ID | unsigned int | Command identifier (1) |
| Username | char[16] | Client username (padded to 16 bytes) |
| Version | unsigned int | Target server version |
Translation Flow
Proxy Intercepts Version
Sakuya AC intercepts the client’s version packet and reads the client version.
Generate Translation Packet
If
VIA_VERSION = True, the proxy generates a new version packet using genViaVersion() with:- The client’s username
- The server’s
YSF_VERSIONas the target version
Forward to Server
The translated packet is sent to the native YSFlight server, which sees the client as matching its version.
Limitations
Known Issues
Protocol differences may cause desync
Protocol differences may cause desync
If the client and server versions have significant protocol differences, you may experience:
- Packet misalignment
- Missing or corrupted game data
- Unexpected disconnections
New features not available
New features not available
Clients using newer YSFlight versions won’t have access to features added after the server version:
- New aircraft
- Updated physics
- Additional commands
Username length restrictions
Username length restrictions
Usernames are limited to 16 bytes due to the packet structure:Solution: Ensure usernames don’t exceed 16 characters.
Unsupported Scenarios
- Downgrading client versions: ViaVersion translates clients to older server versions, not vice versa
- Server versions before 20150425: Only
20150425is tested and officially supported - Custom protocol modifications: If your YSFlight server uses modified protocols, ViaVersion may not work
When to Disable ViaVersion
Strict Version Control
If you want to ensure all players use the exact same YSFlight version for competitive fairness.
Protocol Issues
If you experience frequent disconnections or desyncs with newer clients.
Custom Server Mods
If your server uses custom protocol modifications that conflict with version translation.
Debugging
When troubleshooting connection issues, disable ViaVersion to rule it out as the cause.
config.py
Testing Version Compatibility
When enabling ViaVersion, follow this testing procedure:Test Basic Connection
- Connect with a client matching your server version
- Verify normal gameplay works
- Check logs for errors
Test Newer Client Versions
- Connect with a newer YSFlight client
- Test core functionality:
- Chat messages
- Aircraft spawning
- Flight controls
- Weapon systems
- Monitor for desyncs or errors
Troubleshooting
Clients can’t connect
Verify YSF_VERSION is correct
Verify YSF_VERSION is correct
Ensure
YSF_VERSION in config.py exactly matches your YSFlight server:Check VIA_VERSION setting
Check VIA_VERSION setting
If
VIA_VERSION = False, only clients with matching versions can connect:Review connection logs
Review connection logs
Enable debug logging to see version translation details:Look for version-related errors in the output.
Desync or corrupted data
Version gap too large
Version gap too large
If the client version is significantly newer than the server, protocol differences may cause issues.Solution: Either:
- Update your YSFlight server to a newer version
- Advise clients to use an older YSFlight version
- Disable ViaVersion and enforce strict version matching
Packet size mismatches
Packet size mismatches
Different versions may have different packet structures.Solution: Monitor logs for packet errors and consider disabling ViaVersion if issues persist.
Performance issues
Version translation overhead
Version translation overhead
While minimal, version translation adds processing overhead.Solution: This overhead is negligible in most cases. If performance is critical, profile your server to identify bottlenecks.
Best Practices
- Test thoroughly - Always test with multiple client versions before deploying to production
- Monitor logs - Keep an eye on logs after enabling ViaVersion to catch early issues
- Document supported versions - Let your players know which client versions are tested and supported
- Have a fallback plan - Keep ViaVersion disabled configuration ready in case of issues
- Update gradually - If updating your server version, test ViaVersion at each step
Implementation Reference
The ViaVersion system is implemented inlib/YSviaversion.py. The core function is compact but critical:
lib/YSviaversion.py
- Username is encoded to ASCII and padded to 16 bytes
- Packet format:
II16cI(2 ints, 16 chars, 1 int) - Total packet size is fixed at 24 bytes
- Command ID is always
1 finalVersionis the target server version fromYSF_VERSION
Further Reading
- Configuration Reference - Complete config.py documentation
- Architecture Overview - System architecture and packet flow
- Packet System - Understanding the YSFlight packet protocol