PDA

View Full Version : "Custom Random Weather Automator"



Zenzic
01-11-2017, 21:03
Current version: 1.6.0

This tool automatically and randomly sets the weather slots for custom races. Weather types can be excluded if desired and probability of adverse and extreme weather can be configured.
Both PC and PS4 are supported.


https://www.youtube.com/watch?v=IqASTjkHrUU


Requirements

- Windows 10 (I haven't tested other versions)
- (PS4) PS4 Remote Play for Windows (https://remoteplay.dl.playstation.net/remoteplay/lang/en/index.html) - Allows remote control of the PS4 via PC.
- The Custom Random Weather Automator in x64 (https://mega.nz/#!duBiCDqQ!C5W7sKOT-FP39SzmJP3b6GmLtX13abGVChbekQ1TO5M) or x86 (https://mega.nz/#!ViwmWIIa!_P9Rm3lbvoT7vreKaLUIg_CvZq-8FkL6ZBJAmebqy94) version.


Setup

(PS4) Install PS4 Remote Play.


Interface

https://i.imgur.com/2elRvZj.png

"Clear", "light cloud", "medium cloud", "heavy cloud", "overcast" and "hazy" are considered optimal conditions. When setting "Probability of adverse weather during this race" to 0 one of those optimal conditions will be chosen randomly for each weather slot.

By default the automator offers a 20% probability of an adverse weather type occurring during the race. There is a 10% probability that that adverse weather type will be of the "extreme" variant and a 90% probability it will be from the "suboptimal" variant. "Snow", "Heavy snow" and "Blizzard" are disabled by default.

Some examples:

1. You want a 50% probability of "light rain" or "rain" during your race and are not interested in any other adverse weather types:
- Disable all weather types except for the two you want.
- Set "Probability of adverse weather during this race" to 50.
- Adjust "Number of weather slots selected in game" and "Down presses needed to save" to mirror the settings in game.

2. You like all weather types equally, except for snow, which you want disabled. You want a 1 in 4 probability of adverse weather:
- Assign all weather types to "Suboptimal".
- Disable "Snow", "Heavy snow" and "Blizzard".
- Set "Probability of adverse weather during this race" to 25.
- Adjust "Number of weather slots selected in game" and "Down presses needed to save" to mirror the settings in game.

3. You're racing at Imola in June and want realistic weather:
- Find weather statistics for the location of the circuit; I'm mostly using yr.no (https://www.yr.no/place/Italy/Emilia-Romagna/Imola_Circuit/statistics.html).

https://www.yr.no/stasjon/wmo/16140/graf/nedboer.eng.png

- Calculate the percentage of days it has rained in that month. In the case of Imola in June: 6/30*100 = 20%.
- Set "Probability of adverse weather during this race" to 20.
- Adjust "Number of weather slots selected in game" and "Down presses needed to save" to mirror the settings in game.


Usage

1. Run CustomRandomWeatherAutomator-vx.x.x-x64.exe or CustomRandomWeatherAutomator-vx.x.x-x86.exe on your PC.
2. (PC) Start PCars 2. (PS4) Boot your PS4, start PS4 Remote Play on your PC, connect to your PS4 through Remote Play and start PCars 2.
3. Go to the "Race Settings" screen in PCars 2 and change all settings to your liking, including the number of weather slots.
4. Finally, highlight the first weather slot, like this (https://i.imgur.com/s5NQsjX.png). This is important, since all the keyboard inputs sent by the automator have this item as starting point.
5. Press alt-tab to show the Custom Random Weather Automator window. Make sure the window running PCars 2 is still visible on your desktop; it should not be minimized.
6. Set the Platform toggle to match your platform, either PC or PS4.
7. Set up weather types and probabilities to your liking in the Custom Random Weather Automator.
8. Make sure "Number of weather slots selected in game" matches the number of slots you chose in step 2.
9. Make sure "Down presses needed to save" matches the number of arrow key down presses needed to reach "Save" at the bottom of the PCars 2 "Race Settings" screen. For instance, in this screenshot (https://i.imgur.com/s5NQsjX.png) it's 4, since "mandatory pit stop" is greyed out.
10. Press "Go" and wait for the countdown to expire. If all goes well the automator will automatically bring the PCars 2 window to the foreground, fill each weather slot with random weather and save the race settings. At this point you should actually look away from the screen.
11. When the automator is done you'll hear a notification sound meaning you can watch the screen again. You should be back to the main custom event screen without knowing what weather to expect. Don't reopen the race settings screen, obviously, or you'll spoil the random weather surprise. :)


Remarks

- There's other, better, cooler ways to do this (Rubbery Ducky usb, presenting Linux as bluetooth client device to PS4, build a Lego NXT controller wielding robot). However, this was free and took little effort.
- There's barely any checking in the code, so use common sense. For instance: assigning all weather types to "suboptimal" combined with "Probability of adverse weather during this race" set to 100 and "Probability of adverse weather being extreme" set to 100 makes no sense; the automator will only be allowed to assign extreme weather types, yet it will not have any extreme weather types to choose from.

Enjoy!

Zenzic
01-11-2017, 21:21
This being a third-party tool for PS4 I'm not sure if this belongs here. Feel free to move to the PS4 subforum. :)

Zenzic
06-11-2017, 12:19
I've revised the code a bit. The tool works a lot faster now. I've also replaced the "standing start" box with a selector for the number of D-pad down presses needed to reach the "save" button. This means the tool can now also be used for practice and qualifying sessions.

alegunner68
17-11-2017, 14:18
That looks great, if it worked as an android app i'd be all over it.

Zenzic
17-11-2017, 14:49
I'm willing to put some work in to make it compatible with the PC and Xbox versions of PCars 2, but I have zero experience programming for Android, I'm afraid. :) Also, automatic weather slot selection is quite a key part of this tool and I'm not sure how that would work on a mobile platform since remote control is needed for consoles.

Maskmagog
17-11-2017, 15:56
Great tool, nice!

I'm on xbox and would love this. Perhaps Xbox Smart Glass can be used? Found something that may or may not be of help: http://destinytracker.com/guides/18/how-to-control-your-xbox-with-your-pc

Zenzic
17-11-2017, 18:54
I'll gladly try and support Xbox too. As long as you're able to press the arrow keys on your pc and those key presses get sent through to PCars 2 on your Xbox it should work. Could you give that a try?

I also need the title of the window of the Smart Glass app. You can follow the steps I posted here (http://forum.projectcarsgame.com/showthread.php?57497-Help-How-can-I-get-a-dynamic-random-and-realistic-climatology&p=1424503&viewfull=1#post1424503).

Zenzic
17-11-2017, 19:24
I've updated the code to match the title of the PCars 2 window on PC. In theory it should now also activate the PC version of PCars 2 to automatically set weather slots.

I'm not able to test the PC version myself. Could someone on PC give it a try and let me know if it works?

Please follow these steps closely:

1. Start the random weather tool
2. Start PCars 2
3. In-game: "Quick Play" > "Custom Race" > "Race Settings"
4. In-game: set the desired number of weather slots
5. In-game: highlight the first weather slot, like this (https://i.imgur.com/s5NQsjX.png).
6. Press alt-tab to switch to the random weather tool. Make sure the PCars 2 window is still visible, it should not be minimized!
7. Tool: make sure "Number of weather slots selected in game" matches the number of slots you chose in step 4.
8. Tool: make sure "Down presses needed to save" matches the number of arrow key down presses needed to reach "Save". For instance, in this screenshot (https://i.imgur.com/s5NQsjX.png) it's 4, since "mandatory pit stop" is greyed out.
9. Press "Go" and wait for the countdown to expire. If all goes well the tool will automatically bring the PCars 2 window to the foreground, fill each weather slot with random weather and save the race settings.

Remark: the tool searches for any window with a title starting with "Project CARS 2". So if you have any other window open with a matching title it will open the wrong window.

Thank you!

mr_belowski
17-11-2017, 22:32
awesome, nice tool - the random weather in game is completely silly but this is a very ingenious way to work around it :)

not tried it yet, but next time I'm playing pCARS2 I certainly will

Maskmagog
17-11-2017, 22:47
Ok, so I tried to follow your instructions. Not sure Smart Glass is controllable with arrow keys though. Anyway, here is the screenshot with info on Xbox Smart Glass:
245405

This is from windows 10, x64.

Maskmagog
17-11-2017, 23:19
I've not found a way to control the game from the pc's keyboard. The xbox app on windows has a 'remote mode', with A/B/X/Y-buttons, and d-pad arrows, but pressing those doesn't do anything on the actual xbox. Project cars 2 running on xbox, of course.
Maybe someone else has more knowledge on this. I'll see if I can figure something out.

Zenzic
17-11-2017, 23:48
@mr_belowski: Thanks! I'm looking forward to your feedback! (And whether or not the window focusing actually works on PC now too. :))

@Maskmagog: Thanks for the screenshot! Should you figure out how to pass keyboard inputs through to the Xbox, let me know!

Edit: Reading about SmartGlass it doesn't seem promising for what I'm trying to do here. It looks like it serves more as a second screen app with some limited functionality as opposed to actually remote controlling the console.

RacingAtHome
18-11-2017, 02:57
Wow. That's pretty awesome. Thanks man.

Sid Snott
19-11-2017, 15:51
Tried this with PS4 & laptop, works a treat once I did the down presses to start right. Thanks alot for this.

Zenzic
19-11-2017, 19:35
Good to hear you're enjoying the tool, guys! :)

OddTimer
21-11-2017, 13:13
man, this looks awesome! I've noticed folk mentioning the Xbox box on this thread...is it compatible with it? I'd love to try it. Thanks!

Zenzic
21-11-2017, 13:19
I'm afraid it isn't compatible with Xbox. The tool runs on Windows and sends key presses to PCars 2, either directly to the windows version of PCars 2, or to PS4 through the PS4 Remote Play app on Windows. I haven't yet found an easy way to remotely control an Xbox from Windows. Feel free to let me know if you find something. I'll happily adapt the tool.

Edit: maybe someone with an Xbox could give game streaming (https://support.xbox.com/en-US/games/game-setup/how-to-use-game-streaming) a try? If this allows you to control menus in PCars 2 through Windows 10 with the keyboard arrow keys then I could make this tool work with Xbox too.

Zenzic
22-11-2017, 22:44
Updated to version 1.6.0.

Changes:
- The tool made it rain too often when more than one weather slot was selected. My intuitive programming of the probability calculations was wrong. Wanting an x% probability of rain during a race obviously does not equate to having that same x% probability of rain when randomly populating more than one weather slot - e.g., when wanting a 50% probability of rain some time during the race, 50% probability of rain for each of the four slots incorrectly results in a 93.75% probability of rain during the race, while 15.9% probability per slot does result in 50% for the race. This is now fixed with the right formula: 1-(1-probabilityofadverse)^(1/numberofweatherslots)
- Got rid of the PC/PS4 selector. The tool now simply tries activate both types of windows and sends its key presses to the window that responds.
- Some rewording for clarity.

SergeMaltesse
22-11-2017, 23:33
@Zenzic I've already tested your application and it works perfectly.

Finally the random weather makes sense.

I recommend this application to anyone who wants to configure races with a random, variable and realistic weather.

Thanks Zenzic.

Endurancer
23-11-2017, 03:06
This a great way to workaround PCARS 2 nonsense, sending snow at Australia in summer season and things like that.

But obviously we hope SMS will get it sorted in-game at some point, because this workaround has its limitations. In a 12-24 hours race, cycling trough the same 4 slots time and time again is not really nice.

There should be some more intelligence on the RANDOM in-game slot; it should consider the location or, at least, the season selected. Actually SMS should take a look in this app interface in put it in-game, but combined with the random slot, not fixing 4 slots.

nobby362000
16-09-2018, 19:06
Just tried this on pc and it works like a dream, just had one of my best races ever against ai. Big thank you to Zenzic for this little program its amazing. I can't believe sms can't do something similar! Who wants to race cars in snow? This has brought Pcars 2 back to life for me:)

mr_belowski
17-09-2018, 21:00
just had a couple of races using this tool. It's fantastic. Proper random weather that you know isn't going to be silly just adds so much to the game. Blasting along looking at the sky trying to guess if it's going to rain adds loads to the experience. Thanks Zenzic, this is definitely a must-have tool

Asturbo
17-09-2018, 21:12
I don't know why something like this is not in the game, specially in the dedicated servers that could generate the random weather from a file text with all the avaliable options.

Javaniceday
09-10-2018, 19:39
Love this app. Works wonderful.

Seven Smiles
04-12-2018, 17:46
I found this thread as I was thinking of something similar for the Dedicated Server - plugging in a bit of code to randomise the weather a little when rotating from event to event. Unless someone's already done that?

Javaniceday
04-12-2018, 17:50
I found this thread as I was thinking of something similar for the Dedicated Server - plugging in a bit of code to randomise the weather a little when rotating from event to event. Unless someone's already done that?

I'm pretty sure no one has something like this working at the moment. If you were able to implement it it would be amazing!

Seven Smiles
05-12-2018, 09:07
I think Mr Belowski already has the answer with http://forum.projectcarsgame.com/showthread.php?65160-OpenWeather-Testing-A-proposal-to-fix-weather-issues

cjr3559
26-01-2019, 18:02
Got this installed on PS4. Only issue is the controller defaults to the DS4 instead of my wheel when ready to play the game. I assume it’s my error and I’m missing something. Any advice?