Page 1 of 11 123 ... LastLast
Results 1 to 10 of 103

Thread: OpenWeather [Testing]: A proposal to fix weather issues

  1. #1
    WMD Member Asturbo's Avatar
    Join Date
    Jun 2012
    Location
    Asturias / Spain
    Posts
    1,603
    Platform
    PC

    OpenWeather [Testing]: A proposal to fix weather issues

    NOTE: Initial Beta testing versión here

    PRELUDE

    As we all know, we have some problems with the weather configuration that affects specially to online communities:

    • If we select Ramdom Weather we have rain and its variations in most of the times. Nice to show the game possibilities the first weeks, but not valid to communities. Link
    • If we select Real Weather, we always get clear weather, because it has stopped working from 1 month ago. Link

    So we only can use predefined slots for our races. That is a problem, because there is no surprise and everybody knows what will happen during the race, and the exact moment when the weather will change. With Project Cars 1, I was using a table with the lottery of the day of the race to choose the weather conditions, using different weights to the different scenarios. A little bizarre but it worked because all we know the weather few minutes before the race.

    The prefered solution would be another type of weather called “random realistic” with more logical options of each scenario (clear 30%, cloud 30%, …light rain 10%, Rain 8%, Extreme 1%). But I don’t think at this stage of development, we could get this. So I was thinking in other possible solutions after studying how RW works in the game and why is probably failing. (See this link)

    HOW IT WORKS RW

    The host of the race (P2P or DS), connects to realweather API to obtain the next hours slots for the current time & location. The program (PC2), logs in the weather server, makes a query for the next hours forecast and receives the weather data, that are assigned by the game to the slots of the session. The problem ATM, is that we aren't receiving any data, so we always get clear weather. In previous link I commented the possible reason (the key id), but after undestanding how the system works, I'm now thinking in a more ambitious solution.

    PROPOSED SOLUTION

    We can redirect the query to another IP where we can build our own weather server . Obviously we don’t will have real weather (because we don't have the data), but we can obtain weather slots with a random & logical pattern with different weights to diferent scenarios. SMS (or a third party) could make a tiny web based APP installed in the local computer, that accepts the query and responds with random-logical weather data. We can use the method used by Zenzic with his wonderful utility [link] and we can personalize the weather weights, or exclude bizarre scenarios.

    HOW REDIRECT THE QUERY

    It’s very easy. We know the URL used to get real weather: api.openweathermap.org , and we can add it manually to the host file of our Windows to tell the system where is our weather server hosted (without using public DNS resolution). So we can redirect this URL to any other IP (public or private) or our own localhost IP, where the weather server app is hosted.

    The windows host file (if exist, if not we can create it) is stored in the C:\Windows\System32\drivers\etc folder. If we add the line:

    127.0.0.1 api.openweathermap.com

    all the connections to this URL are redirected to the IP 127.0.0.1 (Localhost), where the API could be located providing random weather data.

    Click image for larger version. 

Name:	hostfile.png 
Views:	531 
Size:	20.9 KB 
ID:	261023

    THE HARD WORK

    Someone (SMS or any Third Party) has to make a tiny web bassed APP that accepts the query, generates a random weather pattern and responds in the same format as opensimweather (Example). Obviously the weather data would be random (not real) because we don't have the data, but it would be a big step forward because we can get random-custom weather, that it's all we want (for me even better than RW). Thats allows us to simulate a full season in Christmas without driving at 5º.

    ADVANTAGES

    • We don’t need any API key, licences… only our own app.
    • No connectivity or traffic overload issues.
    • We solve in a row the "Too rainy random weather" and the "Real Weather not working" issues.
    • This method is better that in-build ones (random and real) and we could have "ramdom custom".
    • We can program the Weather Server API with different weights based in our preferences or logical patterns (using Zecnic or similar method)
    • No need to touch the code of the game. Everything could be outside, so no redesign or hard code changes needed. That's the best part for SMS.
    • It’s very easy to program (much more than doin in-game). The APP only needs to accept the query, generate the random weather pattern (Zecnic method) and responding in the same output format as openweather.org (example)
    • It's transparent to the game. It gets the data from a diferent IP and applies to the weather slots ingame.
    • The API port could be forwarded in our router, to have a public weather server hosted in our public IP.
    • It will work online and offline and the querys probably goes much faster than with the real servers.
    • It's reversible. The API could have a check that enables disables the redirection. So we can choose Real Weather (if it gets fixed) or random personalized weather using out local appp.


    Hope SMS could have a think about this solution, because it’s easy, effective and solves most of the weather issues we have without touching any line of code of the game. We have to use the in-game RW option, but the result will be custom-random weather. It could be distributed as an Steam utility like the DS as "Custom Weather Generator" or as third part app.

    I’ll contact by PM with Zecnic, to study the viability of this possible solution, because he has solved brilliantly the most of the hard work needed for this App.

    [Sorry, I'm system engenieer, but not programmer and can't do the task]
    Last edited by Asturbo; 11-10-2018 at 08:24.
    CPU: Intel i9-9900KF | GPU: nVidia RTX2080Ti | RAM: Gskill 2x16GB DDR4 3600 | MB: Asus ROG Strix Z370 | SSD: Samsung EVO 970 500Gb | Monitor: Acer Predator Z35P UW WQHD | Wheel: Fanatec DD1 + Porsche Endurance + Formula 1 V2 | SO: Windows 10 Pro 64bits
    WMD1 & WMD2 Gold Member /// Steam Profile /// Unofficial Issue List /// Button Box Label Template /// DS Flags Calculator /// Open Weather App /// DS Config Samples /// Google Standings /// PCARS4 wish list

  2. #2
    WMD Member Asturbo's Avatar
    Join Date
    Jun 2012
    Location
    Asturias / Spain
    Posts
    1,603
    Platform
    PC
    This is the format of the query:

    http://api.openweathermap.org/data/2.5/forecast?lat=%3.2f&lon=%3.2f&mode=xml&c

    I our app we can ignore the Latitude and Longitude parameter, because it doesn't condition the random pattern.

    And this is the format data obtained from openweahtermap for 3 hours slots. Probably only few of this lines are used in Project Cars 2

    <time from="2018-10-07T12:00:00" to="2018-10-07T15:00:00">
    <symbol number="500" name="light rain" var="10d"/>
    <precipitation unit="3h" value="0.615" type="rain"/>
    <windDirection deg="80.5023" code="E" name="East"/>
    <windSpeed mps="4.21" name="Gentle Breeze"/>
    <temperature unit="kelvin" value="310.67" min="307.615" max="310.67"/>
    <pressure unit="hPa" value="966.38"/>
    <humidity value="42" unit="%"/>
    <clouds value="few clouds" all="12" unit="%"/>
    </time>


    These are some links that expains the data output formats:

    https://openweathermap.org/current
    https://openweathermap.org/weather-conditions
    https://openweathermap.org/weather-data
    Last edited by Asturbo; 08-10-2018 at 18:07.
    CPU: Intel i9-9900KF | GPU: nVidia RTX2080Ti | RAM: Gskill 2x16GB DDR4 3600 | MB: Asus ROG Strix Z370 | SSD: Samsung EVO 970 500Gb | Monitor: Acer Predator Z35P UW WQHD | Wheel: Fanatec DD1 + Porsche Endurance + Formula 1 V2 | SO: Windows 10 Pro 64bits
    WMD1 & WMD2 Gold Member /// Steam Profile /// Unofficial Issue List /// Button Box Label Template /// DS Flags Calculator /// Open Weather App /// DS Config Samples /// Google Standings /// PCARS4 wish list

  3. #3
    GT5 Pilot mr_belowski's Avatar
    Join Date
    May 2015
    Posts
    1,492
    Platform
    PC
    Now that's a *very* good idea. A little webservice running locally and a hosts file redirect to the loopback address and the pcars2 weather stuff could be unpredictable, convincing and awesome in single player.

    If only there was a locally installed app with a wide user base to host such a webservice...

    A standalone service for dedicated servers would also be very cool.

    I'll have a play with Crew chief to see if I can embed something. I already have a branch that includes some ReST services that I was playing with a few months ago

    And for single player, doing this even opens up the possibility of weather forecasts
    Crew Chief details here http://forum.projectcarsgame.com/sho...r-for-PC-users
    Website, download link and forum: http://thecrewchief.org
    Or make a donation, if you think the chief needs to drink more beer:
    https://www.paypal.com/cgi-bin/websc...=LW33XFXP4DPZE
    The following 6 users likes this Post: Asturbo, ermo, M. -VIPER- Morgan, Maskmagog, Ryzza5, VelvetTorpedo


  4. #4
    WMD Member Asturbo's Avatar
    Join Date
    Jun 2012
    Location
    Asturias / Spain
    Posts
    1,603
    Platform
    PC
    Yes, it could be integrated in the DS too. But I initially was thinking in a totaly independet app to don't touch anything else, and/or allow third party developers to do the job.

    Thanks for supporting the proposal.
    Last edited by Asturbo; 07-10-2018 at 09:11.
    CPU: Intel i9-9900KF | GPU: nVidia RTX2080Ti | RAM: Gskill 2x16GB DDR4 3600 | MB: Asus ROG Strix Z370 | SSD: Samsung EVO 970 500Gb | Monitor: Acer Predator Z35P UW WQHD | Wheel: Fanatec DD1 + Porsche Endurance + Formula 1 V2 | SO: Windows 10 Pro 64bits
    WMD1 & WMD2 Gold Member /// Steam Profile /// Unofficial Issue List /// Button Box Label Template /// DS Flags Calculator /// Open Weather App /// DS Config Samples /// Google Standings /// PCARS4 wish list

  5. #5
    Superkart Pilot Maskmagog's Avatar
    Join Date
    Sep 2017
    Location
    Sweden
    Posts
    761
    Platform
    XBOX1 X
    Brilliant idea!
    I'm guessing since consoles don't have the Real weather-option, they never make any calls to outside api's? So not possible for consoles?
    Thrustmaster TX, Ferrari 599XX Alcantara rim, T3PA-Pro, Firmware 54, Xbox One X, public OS, 28" 4K monitor
    Don't miss Yorkie065's excellent videos: Ep26-LiveTrack pt1. Ep 27-LiveTrack pt2.
    Project CALC - cross-platform PC2 leaderboards per car - Xbox/PS4/PC - Forum thread
    The following user likes this Post: Asturbo


  6. #6
    WMD Member Asturbo's Avatar
    Join Date
    Jun 2012
    Location
    Asturias / Spain
    Posts
    1,603
    Platform
    PC
    No, I'm afraid it's not possible.

    With this method the idea is using the in-game "real weather" option and redirect the query to our own web based APP where we can manage the different weather options with custom weights.
    In consoles there is no real weather option, AFAIK
    Last edited by Asturbo; 07-10-2018 at 09:45.
    CPU: Intel i9-9900KF | GPU: nVidia RTX2080Ti | RAM: Gskill 2x16GB DDR4 3600 | MB: Asus ROG Strix Z370 | SSD: Samsung EVO 970 500Gb | Monitor: Acer Predator Z35P UW WQHD | Wheel: Fanatec DD1 + Porsche Endurance + Formula 1 V2 | SO: Windows 10 Pro 64bits
    WMD1 & WMD2 Gold Member /// Steam Profile /// Unofficial Issue List /// Button Box Label Template /// DS Flags Calculator /// Open Weather App /// DS Config Samples /// Google Standings /// PCARS4 wish list
    The following user likes this Post: Maskmagog


  7. #7
    GT5 Pilot mr_belowski's Avatar
    Join Date
    May 2015
    Posts
    1,492
    Platform
    PC
    Perhaps a standalone application is a better approach. Maybe in the future it could also expose a 'forecast' endpoint which provides some suitably unreliable info about the weather slots it's just generated
    Crew Chief details here http://forum.projectcarsgame.com/sho...r-for-PC-users
    Website, download link and forum: http://thecrewchief.org
    Or make a donation, if you think the chief needs to drink more beer:
    https://www.paypal.com/cgi-bin/websc...=LW33XFXP4DPZE
    The following 2 users likes this Post: Asturbo, M. -VIPER- Morgan


  8. #8
    WMD Member Asturbo's Avatar
    Join Date
    Jun 2012
    Location
    Asturias / Spain
    Posts
    1,603
    Platform
    PC
    Quote Originally Posted by mr_belowski View Post
    Perhaps a standalone application is a better approach. Maybe in the future it could also expose a 'forecast' endpoint which provides some suitably unreliable info about the weather slots it's just generated
    In multiplayer, I think that only the host of the session makes the query to openweather and inserts the weather data in the weather slots of game for the session (to avoid different status for players).
    Then, only the host needs the APP running in localhost and the rest gets the same random-custom generated weather when logs to the session.
    So I think it should work online & offline and solves the weather problems of online comunities.
    Last edited by Asturbo; 07-10-2018 at 09:55.
    CPU: Intel i9-9900KF | GPU: nVidia RTX2080Ti | RAM: Gskill 2x16GB DDR4 3600 | MB: Asus ROG Strix Z370 | SSD: Samsung EVO 970 500Gb | Monitor: Acer Predator Z35P UW WQHD | Wheel: Fanatec DD1 + Porsche Endurance + Formula 1 V2 | SO: Windows 10 Pro 64bits
    WMD1 & WMD2 Gold Member /// Steam Profile /// Unofficial Issue List /// Button Box Label Template /// DS Flags Calculator /// Open Weather App /// DS Config Samples /// Google Standings /// PCARS4 wish list

  9. #9
    Superkart Pilot Zenzic's Avatar
    Join Date
    May 2015
    Location
    BE
    Posts
    626
    Platform
    PC
    Good idea, Asturbo!

    At the moment I don't have a lot of spare time to help out in any significant way, but I'll gladly provide the randomisation code I wrote if that's worth anything. Just don't judge me by my messy code.

    Quote Originally Posted by mr_belowski View Post
    And for single player, doing this even opens up the possibility of weather forecasts
    That would be awesome.
    AMD Ryzen 5 1600 - ASRock A320M Pro4 - EVGA GeForce GTX 1060 SC GAMING 6GB - G.Skill 16GB DDR4 - Samsung 850 EVO 250GB - Seasonic Focus Plus Gold 550W - Thrustmaster T300 RS - Triple monitors
    The following user likes this Post: Asturbo


  10. #10
    GT5 Pilot mr_belowski's Avatar
    Join Date
    May 2015
    Posts
    1,492
    Platform
    PC
    when i get a few hours i'll knock up a quick SpringBoot application as a prototype and see how it feels
    Crew Chief details here http://forum.projectcarsgame.com/sho...r-for-PC-users
    Website, download link and forum: http://thecrewchief.org
    Or make a donation, if you think the chief needs to drink more beer:
    https://www.paypal.com/cgi-bin/websc...=LW33XFXP4DPZE
    The following 3 users likes this Post: Asturbo, emi11, ermo


Similar Threads

  1. Change request on weather system when you use random slots
    By Scott1904 in forum General Discussion
    Replies: 1
    Last Post: 28-12-2017, 17:21
  2. Request: Random seasonal weather
    By ZulfoDK in forum General Discussion
    Replies: 4
    Last Post: 27-09-2017, 12:35
  3. Request: Weather API
    By palm3r in forum Third-Party Apps & API Discussion
    Replies: 1
    Last Post: 23-09-2017, 23:30
  4. Replies: 32
    Last Post: 19-07-2017, 14:38
  5. Weather Settings change request
    By Scott1904 in forum Multiplayer
    Replies: 0
    Last Post: 16-12-2015, 11:52

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •