Realtime weather mod for Train Sim World, using open data.
Synchronizes real-world weather conditions with Train Sim World 6 based on your exact location in the game. As you drive your train through different regions, the application automatically fetches and displays current weather data from OpenWeather API.
The application displays two main panels:
- Distance Panel: Shows your current location coordinates and travel progress with a visual progress bar
- Weather Panel: Displays comprehensive weather information with color-coded values and emoji indicators
Download the latest release from the Releases page.
- Train Sim World 6 installed
- OpenWeather API key (free tier available at https://openweathermap.org/api)
- Download the latest release
- Extract to a folder of your choice
- Configure the application (see Configuration section below)
- Launch Train Sim World 6 with the
-HTTPAPIflag - Run
tsw6-realtime-weather.exe
The application uses a config.json file for configuration. On first run, a default configuration file will be created automatically.
-
weather.update_threshold_km(default: 5.0)- Distance in kilometers the player must travel before new weather data is fetched
- Lower values = more accurate weather but more API calls
- Recommended range: 5-50 km
- Example:
"update_threshold_km": 25.0to update every 25 km
-
weather.transition_duration_seconds(default: 30)- Duration in seconds for smooth weather transitions
- Weather values gradually interpolate over this time
- Lower values = faster changes, higher values = more gradual
- Recommended range: 15-60 seconds
- Example:
"transition_duration_seconds": 45for slower transitions
update.location_check_interval_seconds(default: 5)- How often (in seconds) the application checks the player's location
- Lower values = more responsive but higher CPU usage
- Recommended range: 5-60 seconds
- Example:
"location_check_interval_seconds": 10to check every 10 seconds
-
retry.max_retries(default: 5)- Maximum number of retry attempts for failed HTTP requests
- Uses exponential backoff between retries
- Set to 0 to disable retries
- Example:
max_retries: 3for fewer retries
-
retry.initial_delay_ms(default: 100)- Initial delay in milliseconds before the first retry
- Subsequent retries use exponential backoff (100ms → 200ms → 400ms → 800ms → 1600ms)
- Example:
initial_delay_ms: 200for longer initial wait
api_keys.openweather(optional)- Your OpenWeather API key
- If left empty, the application will fall back to reading from
WeatherApiKey.txt - Recommended: Store your API key in the config file for easier management
- Example:
"openweather": "your_api_key_here"
logging.level(default: Information)- Minimum logging level: Debug, Information, Warning, Error
- Debug: Verbose logging including all location updates and distance calculations
- Information: Standard operational logging (recommended for normal use)
- Warning: Only warnings and errors (includes retry attempts)
- Error: Only error messages
- Example:
"level": "Debug"for troubleshooting
{
"weather": {
"update_threshold_km": 5.0,
"transition_duration_seconds": 30
},
"update": {
"location_check_interval_seconds": 5
},
"retry": {
"max_retries": 5,
"initial_delay_ms": 100
},
"logging": {
"level": "Information"
},
"api_keys": {
"openweather": "your_openweather_api_key_here"
}
}For backward compatibility, you can still use a WeatherApiKey.txt file instead of adding the key to config.json. Simply create a text file named WeatherApiKey.txt in the same folder as the executable and paste your OpenWeather API key into it.
Priority: The application checks config.json first, then falls back to WeatherApiKey.txt.
- 🌦️ Real-time weather synchronization - Fetches weather from OpenWeather API and updates TSW6 game weather
- 🎬 Smooth weather transitions - Gradual interpolation between weather states over configurable duration (default: 30s)
- 📍 Automatic location tracking via TSW6 HTTP API
- 🚂 Distance-based updates - Weather refreshes after traveling configured distance (default: 5km)
- 📊 Clean terminal UI - Compact display with distance tracking and detailed weather information
- 🎨 Color-coded display - Temperature colors from blue (cold) to red (hot), dynamic wind and cloud colors
⚠️ Smart warnings - Status messages only appear when issues need attention- ⚙️ Fully configurable - Update intervals, distance thresholds, transition duration, logging levels, retry behavior
- 🔄 HTTP retry resilience - Automatic recovery from network issues with exponential backoff
- 📝 Comprehensive logging - File and console logging with configurable verbosity
- 🎯 Native AOT compilation - 14.5MB executable, no .NET runtime required
- 📍 Location (city name and country)
- 🌤️ Current conditions with weather emoji (sunny ☀️, rainy 🌧️, cloudy ☁️, etc.)
- 🌡️ Temperature - Color-coded from blue (freezing) through green (comfortable) to red (hot)
- ☁️ Cloud cover - Percentage with dynamic colors
- 🌧️ Precipitation - Rain and snow intensity when present
- 💨 Wind - Speed, direction (N/NE/E/etc.), and gusts with color coding
- 💧 Humidity | 🔽 Pressure | 👁️ Visibility - All on one compact line
- ⏰ Last update timestamp
- The application connects to the TSW6 HTTP API (localhost:31270) to monitor your position in-game
- As you drive your train, it tracks your movement distance using the Haversine formula
- When you've traveled the configured threshold distance (default: 5km):
- Fetches current weather data from OpenWeather API based on your exact coordinates
- Converts the weather data to TSW6 format (temperature, cloudiness, precipitation, wetness, ground snow, fog density)
- Smoothly transitions to the new weather over the configured duration (default: 30 seconds)
- Updates TSW6 every second during the transition with interpolated values for realistic changes
- The real-world weather gradually transitions in your in-game environment!
Make sure you launched Train Sim World 6 with the -HTTPAPI flag. You can add this to your Steam launch options:
- Right-click TSW6 in Steam → Properties
- Under Launch Options, add:
-HTTPAPI - Launch the game, then run the application
- Add your OpenWeather API key to
config.jsonunder"api_keys": { "openweather": "..." }, OR - Create a
WeatherApiKey.txtfile in the same folder as the executable with your API key
This means the TSW6 HTTP API subscription hasn't been established yet. Simply start driving your train and the subscription will activate automatically.
- Verify you can see weather changes in the application's Weather panel
- Check the logs for any PATCH request errors
- Try restarting TSW6 with the
-HTTPAPIflag - Make sure no firewall is blocking localhost connections
- .NET 9.0 SDK or later
- Windows, Linux, or macOS
dotnet build# Windows x64
dotnet publish -c Release -r win-x64 --self-contained -p:PublishAot=true -o ./publish
# The executable will be in ./publish/tsw6-realtime-weather.exeThe project includes a GitHub Actions workflow that automatically builds on every push to main:
-
Automatic: Push to main triggers a build
git push origin main
-
Manual: Go to Actions → Build → Run workflow
The workflow produces a ZIP artifact containing:
- Native AOT compiled executable (no .NET runtime required)
- Configuration template (
config.json) - Documentation (
README.mdandQUICKSTART.txt)
Artifacts are available in the Actions tab and can be used to create releases manually.
MIT License - feel free to modify and distribute.
