[RVGL] Car/Track Randomizer

Report issues and bugs here.
User avatar
Kiwi
Posts: 398
Joined: Thu Dec 07, 2017 9:04 pm

Re-Volt [RVGL] Car/Track Randomizer

Unread post by Kiwi » Fri Mar 23, 2018 9:47 am

Huki or Marv, can you have a look inside the RVGL code, how the car- and track randomizers are coded?

I'm sure I'm not the only one who have experienced, that the chance that a latly added track will be chosen is much higher, then older tracks. I would be interested in how this feature works exactly.

Example: When the new I/O bonus tracks was released, some people (different ones - I think Whitedoom and me, but also other ones) did random track races. At least every second track was a new bonus track.

In my opinion, every car/track should be chosen by the same chance. If 100 tracks are installed, the chance should be 1% for every track.
User avatar
607
Posts: 199
Joined: Thu Dec 07, 2017 5:49 pm

Re: [RVGL] Car/Track Randomizer

Unread post by 607 » Sat Mar 24, 2018 7:07 pm

Hm, interesting. I have not noticed this. But yeah, it should indeed be as random as possible. And I do mean random, not shuffled (which it surely isn't).
User avatar
Marv
Site Admin
Posts: 227
Joined: Mon Dec 04, 2017 6:45 pm
Location: /home/marv
Contact:

Re: [RVGL] Car/Track Randomizer

Unread post by Marv » Tue Mar 27, 2018 11:05 am

If 100 tracks are installed, the chance should be 1% for every track.
That's exactly how it works.
User avatar
607
Posts: 199
Joined: Thu Dec 07, 2017 5:49 pm

Re: [RVGL] Car/Track Randomizer

Unread post by 607 » Tue Mar 27, 2018 4:54 pm

Good. :) I was wondering how I hadn't noticed this. I guess it just isn't a thing. ;)
User avatar
Kiwi
Posts: 398
Joined: Thu Dec 07, 2017 9:04 pm

Re: [RVGL] Car/Track Randomizer

Unread post by Kiwi » Tue Mar 12, 2019 2:25 pm

Sorry for bringing this topic back from the grave, after nearly one year.
But I just recognised this entry at the changelog of RVGL release 19.0120a:

Image

Does this means, that there really were issues with the randomizer before this change, @Huki?
User avatar
Huki
Developer
Posts: 200
Joined: Wed Dec 06, 2017 5:54 am
Discord: Huki#1668

Re: [RVGL] Car/Track Randomizer

Unread post by Huki » Tue Mar 12, 2019 11:59 pm

Kiwi wrote:
Tue Mar 12, 2019 2:25 pm
Does this means, that there really were issues with the randomizer before this change, @Huki?
There was no issue, but the quality of the RNG could have suffered because it was re-seeded before every multiplayer race and the seed used was a weak one. It now uses a strong seed, so the generated random values are likely to be more closer to the theoretical probability.
► Show Spoiler
User avatar
Kiwi
Posts: 398
Joined: Thu Dec 07, 2017 9:04 pm

Re: [RVGL] Car/Track Randomizer

Unread post by Kiwi » Thu May 16, 2019 9:16 am

Again, I want to bring up this topic. We had a random car session yesterday, with 14 cars in the pool.
I had the following car folders in my installation:

amw
candy
fd103lv
jg2fulonx
pemto
phat

tc2 - Picked 2 times
tc3
tc4 - Picked 1 time
tc5 - Picked 2 times
tc8 - Picked 1 time
tc9 - Picked 1 time
tc10
tc11 - Picked 3 times

As said in my initial thread, I sometimes have the feeling, that folder names have an effect to the randomizer. It is 100% impossible, that the name of a folder (or even the date when a folder was copied in the cars/levels folder) has influence to the chance of being picked from the randomizer, right?

Maybe this is just a hint that I should play lottery IRL. :D
User avatar
Huki
Developer
Posts: 200
Joined: Wed Dec 06, 2017 5:54 am
Discord: Huki#1668

Re: [RVGL] Car/Track Randomizer

Unread post by Huki » Thu May 16, 2019 2:57 pm

Kiwi wrote:
Thu May 16, 2019 9:16 am
It is 100% impossible, that the name of a folder (or even the date when a folder was copied in the cars/levels folder) has influence to the chance of being picked from the randomizer, right?
It's definitely 100% impossible. The randomizer is based entirely on the ID of each car or track (a number). Suppose there are 20 selectable cars (excluding locked or removed ones), each selected car is a random number generated between 0 and 19. As the already picked cars are never excluded, the probability of a certain car being picked is always the same, no matter how many times it has been picked before. Also see the Gambler's fallacy.

Considering your cars folder setup, these are the IDs. I added 'rc' to the list since you need it (I originally planned on sending you the fixed build for this ladder, but oh well). Keep in mind that stock cars have a hard-coded order and custom cars are listed alphabetically after that.

Code: Select all

rc (0)
phat (1)
candy (2)
tc4 (3) [aqua]
tc2 (4) [panga tc]
tc5 (5) [ny54]
tc3 (6) [pest]
amw (7)
tc10 (8) [mtxl]
tc8 (9) [shocker]
tc11 (10) [splat]
tc9 (11) [groovster]
jg2fulonx (12)
fd103lv (13)
pemto (14)
Then this should be generated list of numbers (range 0-13):

Code: Select all

11, 3, 4, 10, 10, 9, 4, 5, 10, 5

The only way to prevent repeats is through exclusion-based randomization, where each selection is excluded from further selection. i.e., the first car is selected out of 14 cars, then this is removed and the next one is selected out of the 13 remaining cars. When there are zero remaining cars, we put back all 14, then rinse and repeat. But this is trickier and requires lot more bookkeeping. :?
Post Reply