PC2 Fix for real weather and random weather

Ayup,

I still race pCars2 from time to time and am often disappointed that the real-weather doesn't work (it's always 'clear' because pCars2's openweather API key has expired), or annoyed that "random" weather always fills the slots with snow and storms when I just want a bit of unpredictable convincing weather that I can actually race in.

So, as part of my ongoing attempt to take over the world I knocked up a workaround. It's an app that acts as a weather server, pretending to be api.openweather.org.

I only started this on Tuesday so it is far from finished, but does appear to work. If anyone on here is up for a bit of testing i'd appreciate any feedback.

The app is here (along with instructions)

https://github.com/mrbelowski/PCars2OpenweatherServer

It should work equally well (or badly) as a local thing for single player, or for dedicated servers


Jim
 
This is very cool, thank you for going to the effort of making this.

Is there any configuration in PC2 where we could change the url for openweather api calls so that, for example, I could host an openweather api on my personal server and it could proxy from there?
 
Hi there. Thank you for the fix.
But I can't get it to work.

I've added the line in my windows host file, I launch the app, launch Pcars2 but the real weather still stay "clear" (yes I've checked by selecting several tracks with different weather conditions around the world).

I assume I have to use it in Proxy mode, but your instructions are too vague for someone who does not know anything about java. Can anyone explain step by step what to do in order to get the real weather conditions?
 

Some notes:

- You need to execute notepad as admin to save the host file in his location.
- You need Java installed in your computer.
- You need to keep the java app running while playing to answer the game querys when weather data is needed.
- The text file with the launch command must be saved with .BAT extension to be executable, and must be in same folder than the app.
- The App could be executed in a different computer (you have to adjust the host file of the computer running PC to point to the IP of the computer running the APP)
- In MP only the host of the online session needs to accees to the Proxy App.
- You have to remove the line in the host file if some day this option works again in-game.
- If your firewall asks for the app trying to connect to internet, allow it, because it needs connection to openweathermap.org to retrieve the data.

You can test also from your browser connecting to http://127.0.0.1 and you'll receive a message of invalid parameters, but that confirms that the server is listening and waiting for a correct query.
 
I've tried with my API key and with yours and something doesn't work.
In the command window, after having launched the bat file, the process can't go as far as I see in your video : it stops at the line "main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup". And obviously I can't get the real weather in the game. Any idea?
 
I will try this. I've noticed that all of the weather now is clear and sunny.....hmmm. I hope that SMS can fix this in an upcoming update. There's no use for all of the weather effects if the game cannot mix weather automatically.
 
Thank you for your solution to this problem, @mr_belowski and thank you @asturbo

I have it working! The api.openweathermap.org IP address seems to change, so if real weather stops working, ping api.openweathermap.org again to get a current IP address.

I have a question about Real Weather: I have only used this very briefly. Does the weather stay the same over an hour-long timeslot, or does PC2 introduce some variability? In other words, if openweathermap reports that there is heavy cloud at Hockenheimring, will I get that static weather condition throughout the first hour of racing? Is there any chance that it could rain, or clear slightly?

Thanks again :thumbsup:
 
Thanks for your hard work. It's a pity they dropped the real weather option even though it was one of the promised features but hey ho, that's SMS and Bell for ya.
 
It don't work for me. When I launched the game the cmd file said this:
Capture d’écran 2022-05-28 144017.png
 
It don't work for me. When I launched the game the cmd file said this:View attachment 570146
Same here. I'm not a programmer but searching for info gave me an explanation : the HttpMediaTypeNotAcceptableException exception is thrown by Spring MVC when there's a mismatch between what the client asks for and what the server can actually produce.

So I think the data format sent by openweather has received some update and changed and pcars2 can't read them. Hope someone with some expertise confirm or unvalidate the diagnostic, and can find a solution.
 

What are you racing on?

  • Racing rig

    Votes: 528 35.2%
  • Motion rig

    Votes: 43 2.9%
  • Pull-out-rig

    Votes: 54 3.6%
  • Wheel stand

    Votes: 191 12.7%
  • My desktop

    Votes: 618 41.2%
  • Something else

    Votes: 66 4.4%
Back
Top