One aspect of creating a football simulation that is easy to take for granted but quickly becomes challenging is how to create realistic weather patterns for your games. Especially if you have a league where cities are close together, if you have a major snow storm during a home game in Denver but have a beautiful sunny day in Colorado Springs, that just feels unlikely. (Actually, growing up in Denver, I do realize it's probably more likely than I am giving it credit) Actually, it's entirely possible to build an entire league within a single city, and if that is the case, you should expect every game to have similar weather as theoretically they would be being played within a few miles of each other.
So with those restrictions in mind, I didn't want to just randomly generate weather for each game based on typical weather patterns for that location. No, I needed something more robust than that. I decided to map each league season to a real, historical year, and pull weather data for the actual day in that year. For example, year 2046 for League 1 might be mapped to 1995, so a game on September 23 in Denver should look up September 23, 1995, resulting in a cloudy day at 56 degrees with 8mph winds. Precipitation is taken from the precipitation probability for that day, and then a dice roll is performed to determine whether there is precipitation. Then, if there is precipitation, the type of precipitation (rain or snow) is determined by the temperature.
MyFootballNow uses the Visual Crossing API to look up the historical weather data for the selected date, which is fantastic because they provide historical weather data from around the world, instead of just the United States (which many services are limited to). This enables us to produce realistic weather for any city in the world.
No comments:
Post a Comment