Weather files?

I've been really enjoying playing GTR2 with the weather feature. However, it takes away from the immersion when I already know what the weather is going to be like since I'm essentially the weatherman.

I have an idea, but I'm not sure how to execute it. My plan is to create several hundred weather files, number them, and store them in a specific folder. If I knew how to code, I could create a simple program that would delete the weather file from the log folder, randomly select another file, and rename it before pasting it in place.

I asked Chat GPT to help me write a short code and explain how to turn it into an exe.
I'm not sure about it, so I'm asking for some tips. Could someone please take a look?

import os
import random
import shutil

# Define the path to the game's weather file and the directory containing the weather files
game_weather_file = "/path/to/game/Weather.txt"
weather_files_directory = "/path/to/weather/files"

def replace_weather_file():
# Get a list of all weather files in the directory
weather_files = os.listdir(weather_files_directory)

# Select a random weather file from the directory
random_weather_file = random.choice(weather_files)
random_weather_file_path = os.path.join(weather_files_directory, random_weather_file)

# Replace the game's Weather.txt file
shutil.copy(random_weather_file_path, game_weather_file)

# Example usage
replace_weather_file()
 
Don't know if any of these would be of interest:

"Autosim Weather Generator v1.0
(c) 2008 Alex Zhdankin

-- In english -------------------------------------

Another weather generator for GTR2.

1. Run the program.
2. Specify what sessions you want.
3. Draw air temperature and humidity graphs.
4. Export the results to weather.txt file in GTR2 folder.

"Modify and export" button makes it possible to add some randomness to your forecast before exporting."

or

"New Advanced Weather x GTR2

So What’s The Weather Like?
***************************
The idea of creating fluctuating weather arose because of a ‘bug’ in GTR2 that does not allow for weather
to evolve during the various race sessions. GTR2 generates weather conditions at the onset of a session, but
this weather then remains static for the entire session, including a race.

With the assistance of the communities around SimLeague and Lisgo, and with the aid of a meteorologist who
helped me refine the algorithms, I have created NAW, a programme that will accurately alter the weather patterns of each session in GTR2, in a realistic way.

NAW acts on the ‘weather.txt’ file, a file that is generated by GTR2 in which all the sessions prior to
the race are stored. The meteorological conditions, and temperatures generated by NAW, are directly influenced
in a ‘simul-real’ way by the climate (or track) chosen, the month of the year chosen, and the time of day. "

or

"Weatherfile Generator for GTR2 v2.3

With this program you can make weatherfiles for GTR2. That way you can
race with changable conditions.

NEW: A confirmation message is shown when a weatherfile has been created.

- - - Features: - - -

- Generates a weatherfile and a forecast.
- Changing weather conditions like changing temperatures, rain
intensities and showers.
- You can, but don't have to, adjust all kinds of settings."

There is this for online use, the last sentence is of interest-

"GTR 2 dedicated server version 1.1.0.0
Weather patch by jtsn

In GTR 2 the changeable weather is defective. Weather works in the
practice and qualify sessions, but does not change during the race.

This patch modifies gtr2dedicated.exe.

After applying the patch changeable weather also works in the race
session on the dedicated server.

Creating a similiar patch for single player and in-game host would
be possible
, but is prevented by the copy protection. :-("
 
Not sure if you are aware, but setting weather to Changeable partially brings immersion back. In order to increase chance of rain, you can adjust "Average rain =" in track .gdb file. Unfortunately, built in generator very rarely generates variable weather, so it is either rain or not.

Another problem is that at certain rain intensity, AI gets confused and keeps pitting and coming out with dry tires, and repeating the same again next lap. That bug I'll try to address in my plugin at some point.
 
Last edited:
I have been testing the weather files a bit and find that things happen more naturally when the weather shifts gently, drifting back and forth between rain or not rain. If I use the in-game randomness, it's like a switch, firstly, it seldom rains, and when it does, it's carnage.

Because I had no idea what I was doing, I was trying to work out the simplest method of having some kind of random weather while still controlling it. If I had any sense, I would write a script that retrieved weather forecast data from one of the many free services and turn it into a weather file much like they have done in AC.

And a Ham-fisted method like this will work in Race07 too.
 
I had the same idea of generating my own weather files once. I don't remember the site anymore, but I know for a fact there's at least one where you can get historical weather for any location. I figured I'd get a number of years of data in and around the race weekend date and use that to calculate average temperature and rain probability and so on. I was going to write a script for a statistical program like R to create the text files from the weather data (since I'm already familiar with using such software).
 

Latest News

Are you buying car setups?

  • Yes

  • No


Results are only viewable after voting.
Back
Top