Non-championship races vs. championship difference

Here you can post questions about GP2, your favourite GP2 things and errorreports/problems!
Laahustaja
GP2 Newbie
Posts: 17
Joined: 30.09.2019, 11:33

Re: Non-championship races vs. championship difference

Post by Laahustaja »

rremedio wrote:
02.10.2019, 14:24
It works similarly to the Random Grip Range but it affects the car power and you can't change the actual range. When turned on, a small random value will be subtracted from the power of each car. The grip variation works the same but it is always turned on, it doesn't affect the player's cars and you can set the maximum possible value that can be decreased from each driver grip.
Ok thanks, I will test it in my championship and see whether I like it or not.
User avatar
GP2Lap
GP2 Newbie
Posts: 8
Joined: 03.10.2019, 17:43

Re: Non-championship races vs. championship difference

Post by GP2Lap »

Hi,

The fact that your random numbers are different only when the quickrace is aborted is because the sequence for the next race will continue where the previous race left off. This is because there is no real random seed in the game. There's only a random number generator (RNG) state of 5 bytes. One of those bytes is used as random number after all 5 have been changed using XORs and shifts. The state is also what is recorded by GPxPatch for reproducing weather conditions. Since the RNG is used quite a lot, for example to randomize the engine sound pitch, the RNG will have advanced a certain amount determined by the moment you abort the race. This exact moment is almost always different. But if you let the race end it will have advanced the same amount every time.

The executable has the initial state, which you could name 'seed' if you want. This state is 'seeded' ONCE after the game is launched by advancing the RNG by an amount determined by an external timer value. The result is the same as starting a quickrace and randomly aborting it :)

Perhaps DosBox always has the same timer value? Or you are starting the game inside DosBox automatically after launching, causing the timer to advance the same amount each time? I'm using DosBox myself to start F1GP and I didn't notice this behaviour (I did run similar tests since I'm working on a TSR that introduces the fixed random seed per session), but I start F1GP manually after launching DosBox.
Last edited by GP2Lap on 04.10.2019, 11:00, edited 1 time in total.
René Smit, Independent Software Developer.
Download GP2Lap here.
User avatar
rremedio
GP2 Legend
Posts: 1559
Joined: 14.01.2007, 15:05

Re: Non-championship races vs. championship difference

Post by rremedio »

And there he is! Welcome to our circus, René!

Now that you explained it, it makes much more sense.

I get the same results for the first quickrace by either starting gp2/gp2lap automatically or manually.
"The Fox provides for himself. but God provides for the Lion"
Image
Early 90s F1 forever!
User avatar
GP2Lap
GP2 Newbie
Posts: 8
Joined: 03.10.2019, 17:43

Re: Non-championship races vs. championship difference

Post by GP2Lap »

That's interesting. I'll have to look up if GP2 uses some different input for the seed. Do you already know if this also happens in real DOS?

PS: I'm a new member so my posts are being moderated before being published. It would be nice if the moderator can increase my clearance level already :)
René Smit, Independent Software Developer.
Download GP2Lap here.
User avatar
rremedio
GP2 Legend
Posts: 1559
Joined: 14.01.2007, 15:05

Re: Non-championship races vs. championship difference

Post by rremedio »

GP2Lap wrote:
04.10.2019, 11:03
That's interesting. I'll have to look up if GP2 uses some different input for the seed. Do you already know if this also happens in real DOS?

PS: I'm a new member so my posts are being moderated before being published. It would be nice if the moderator can increase my clearance level already :)
We don't know it yet. I'm gonna try to find out if I have time to install a virtual machine later today (or if someone has real dos please let us know).

I can approve posts but I don't have access to giving directly clearance. In case the other mods don't see this and do it, you just need one mode message and will be good.
"The Fox provides for himself. but God provides for the Lion"
Image
Early 90s F1 forever!
User avatar
GP2tifoso28
GP2 Starter
Posts: 86
Joined: 29.09.2015, 14:21

Re: Non-championship races vs. championship difference

Post by GP2tifoso28 »

Wowww the legend himself has appeared!!!! What a nice surprise

What you explained about aborting the quickrace makes perfect sense now, I was wondering how it could possibly have made any difference.

I can also confirm that when I was quitting the game, I was just typing "GP2" into the command prompt to start it back up again without closing dosbox, but rremedio said that he was closing dosbox completely so then I started doing it that way as well. I was getting the same results either way.

It's worth mentioning that I put the commands into my conf file and link my conf file to a shortcut on the desktop which launches the game automatically. When I tested with gp2 lap I also did the same thing so maybe that was having an effect?

When I get a chance I'll try to do it again by typing in the commands manually just to make sure.

When you say external timer value are you referring to a physical timer or just some kind of dos process that gp2 uses to generate the initial number?

One thing we can try is to see if we get the same quickrace results, but I don't know if it would actually prove anything other than if we are all starting off the same seed or not.

Are the 5 bytes like the strings in a seed or is it completely different? If we are starting from the same point every time then theoretically we would only ever be seeing the "events" from 1 of the 5 bytes no? Or would a normal gameplay session cause enough XOR's and shifts to change all 5? I have no idea if I've grasped this concept correctly btw

That's cool that you're still working on F1GP, what's a TSR? I noticed that the random seed feature in gpxpatch is only for the practice and quickrace, is that due to technical limitations?

Sorry for the wall of text but this has become quite a fascinating topic for me, hopefully we can get some dos data if we're lucky
User avatar
rremedio
GP2 Legend
Posts: 1559
Joined: 14.01.2007, 15:05

Re: Non-championship races vs. championship difference

Post by rremedio »

It doesn't prove anything (DosBox and VirtualBox could have the same issue), but running GP2 in a Win98 VirtualBox vm also has the same issue with the first quickrace always having the same results (both running from Win98 or rebooting on MS-Dos mode).
"The Fox provides for himself. but God provides for the Lion"
Image
Early 90s F1 forever!
User avatar
GP2tifoso28
GP2 Starter
Posts: 86
Joined: 29.09.2015, 14:21

Re: Non-championship races vs. championship difference

Post by GP2tifoso28 »

rremedio wrote:
05.10.2019, 03:25
It doesn't prove anything (DosBox and VirtualBox could have the same issue), but running GP2 in a Win98 VirtualBox vm also has the same issue with the first quickrace always having the same results (both running from Win98 or rebooting on MS-Dos mode).
One thing I thought was trying to install win95 on dosbox, and then installing Gp2 into win95 and running it from the dos in win95, would it be like using proper dos or would it be like using dosbox?
User avatar
GP2Lap
GP2 Newbie
Posts: 8
Joined: 03.10.2019, 17:43

Re: Non-championship races vs. championship difference

Post by GP2Lap »

When I say external timer I refer to a system/hardware timer outside of the game. For F1GP it's Intel 8253. For GP2 this would be the same. For GP3 and GP4 it's a Windows API called QueryPerformanceCounter.

All 5 bytes are processed using XORs and shifts on each call, resulting in a very long sequence of pseudorandom numbers (only 1 of the bytes is used as 'output' of this function). Skipping the first 0 to N numbers of this sequence results in N different game playthroughs. N can be very large, but e.g. for GP3/GP4 it's limited to 4086. User input during a session results in further disturbance resulting in a unique playthrough each time.

I've taken a look at GP2 and I couldn't find it seeding this random number state. So it appears to be a bug in GP2, resulting in the same session setup (performances, etc.) until user input disturbs and 'fixes' it.

The random seed feature in GPxPatch works only for practice and quickrace because a race weekend consists of multiple sessions (qualify, race, etc.), and most of the driver/team performances etc. are already setup at the start of the weekend. But iirc the weather is setup before the start of the race session. Ideally I'd record/restore the seed at the start of the weekend, but user input in the sessions before the race will disturb it, resulting in different weather during the race.
René Smit, Independent Software Developer.
Download GP2Lap here.
User avatar
GP2Lap
GP2 Newbie
Posts: 8
Joined: 03.10.2019, 17:43

Re: Non-championship races vs. championship difference

Post by GP2Lap »

A TSR is a Terminate and stay resident program. This is the way you'd hook into an executable in the background in DOS.

I'm working on a new utility similar to GP2Lap/GPxPatch, but it's called GPTest for now. I'm also working on newer versions of GPLapTim, GPPerf, and CCPit (some of it has been released already on the F1GP File Archive). Those utilities were originally made by Trevor Kellaway and open sourced not too long ago. You can find my fork on GitHub.
René Smit, Independent Software Developer.
Download GP2Lap here.
User avatar
rremedio
GP2 Legend
Posts: 1559
Joined: 14.01.2007, 15:05

Re: Non-championship races vs. championship difference

Post by rremedio »

GP2Lap wrote:
06.10.2019, 12:40
A TSR is a Terminate and stay resident program. This is the way you'd hook into an executable in the background in DOS.

I'm working on a new utility similar to GP2Lap/GPxPatch, but it's called GPTest for now. I'm also working on newer versions of GPLapTim, GPPerf, and CCPit (some of it has been released already on the F1GP File Archive). Those utilities were originally made by Trevor Kellaway and open sourced not too long ago. You can find my fork on GitHub.
That's very cool, René! I wish I could help with those things but every time I try to understand GP2Lap code I always fail to understand how I should approach the whole process of adding custom code to GP2 (and anyway the custom code I would be able to add is very limited because of me having a hard time following what is happening in the "ASM side", so to speak).

I've been able to add features very similar to CCPit to my overlay/monitor program in the past but it is still very unreliable and clumsy (and it requires DosBox) and I haven't found a good way to deal with replays yet. The only reason I haven't given up on this yet is the fact the by using it to hack the DosBox window instead of using the GP2Lap approach I can do some cool graphical tricks, which adds a little bit of motivation lol.
GP2Lap wrote:
06.10.2019, 12:33
When I say external timer I refer to a system/hardware timer outside of the game. For F1GP it's Intel 8253. For GP2 this would be the same. For GP3 and GP4 it's a Windows API called QueryPerformanceCounter.

All 5 bytes are processed using XORs and shifts on each call, resulting in a very long sequence of pseudorandom numbers (only 1 of the bytes is used as 'output' of this function). Skipping the first 0 to N numbers of this sequence results in N different game playthroughs. N can be very large, but e.g. for GP3/GP4 it's limited to 4086. User input during a session results in further disturbance resulting in a unique playthrough each time.

I've taken a look at GP2 and I couldn't find it seeding this random number state. So it appears to be a bug in GP2, resulting in the same session setup (performances, etc.) until user input disturbs and 'fixes' it.

The random seed feature in GPxPatch works only for practice and quickrace because a race weekend consists of multiple sessions (qualify, race, etc.), and most of the driver/team performances etc. are already setup at the start of the weekend. But iirc the weather is setup before the start of the race session. Ideally I'd record/restore the seed at the start of the weekend, but user input in the sessions before the race will disturb it, resulting in different weather during the race.
So it has to run all those XOR and Shifts operations and just assigning a random value to "N" wouldn't work, right?

I made a few tests and indeed if I join a non-championship race as a player and mess with a session, it will change how the next sessions play out even if I don't mess with those (which is fine unless you don't want it to go that way, which is something most people won't care most of the time).

PS.: I think the forum will not require approval for you messages from now on.
GP2tifoso28 wrote:
05.10.2019, 17:53
rremedio wrote:
05.10.2019, 03:25
It doesn't prove anything (DosBox and VirtualBox could have the same issue), but running GP2 in a Win98 VirtualBox vm also has the same issue with the first quickrace always having the same results (both running from Win98 or rebooting on MS-Dos mode).
One thing I thought was trying to install win95 on dosbox, and then installing Gp2 into win95 and running it from the dos in win95, would it be like using proper dos or would it be like using dosbox?


I have no idea about how it would work. But apparently, as René said, there is a bug in GP2 and running it on "real DOS" would yield the same results.
"The Fox provides for himself. but God provides for the Lion"
Image
Early 90s F1 forever!
User avatar
GP2Lap
GP2 Newbie
Posts: 8
Joined: 03.10.2019, 17:43

Re: Non-championship races vs. championship difference

Post by GP2Lap »

So it has to run all those XOR and Shifts operations and just assigning a random value to "N" wouldn't work, right?
N is an iteration count based on the timer value, which is kind of really random, though with DosBox and automatic startup script you could start to see common occurrences, unless DosBox somehow initializes the 8253 timer from the host system timer.

N can be assigned anything and can be considered as the actual random seed. The thing you can't just assign is the RNG state (the 5 bytes). In practice this might work, but in theory it's a bad idea. Geoff's way of doing it is quiet neat, and it works as long as N is not too large (you would start to see a delay after starting the game).
René Smit, Independent Software Developer.
Download GP2Lap here.
User avatar
GP2tifoso28
GP2 Starter
Posts: 86
Joined: 29.09.2015, 14:21

Re: Non-championship races vs. championship difference

Post by GP2tifoso28 »

Thanks for the insight René, it's quite fascinating stuff.
GP2Lap wrote:
06.10.2019, 12:33
All 5 bytes are processed using XORs and shifts on each call, resulting in a very long sequence of pseudorandom numbers (only 1 of the bytes is used as 'output' of this function). Skipping the first 0 to N numbers of this sequence results in N different game playthroughs. N can be very large, but e.g. for GP3/GP4 it's limited to 4086. User input during a session results in further disturbance resulting in a unique playthrough each time.
That's interesting, so if I understand correctly each call would be the initial booting of the game when it first gets (or would / should get) the initial seed state from the external timer value? And then each individual disturbance changes the sequence of events in real time?

So GP3/GP4 would boot at a random point in the 4086 playthroughs, and is then further affected by user input, whereas gp2 is relying solely on user input?

Would you say that gp2 is lacking due to this bug or does the quickrace trick sufficiently simulate the initial randomisation in the same way that the external timer value should be doing?
User avatar
GP2Lap
GP2 Newbie
Posts: 8
Joined: 03.10.2019, 17:43

Re: Non-championship races vs. championship difference

Post by GP2Lap »

The sequence is never changed, it's just the current position in the sequence that is changed (advanced by 1 with each call). The position it is at when a session starts determines its playthrough, until user input is involved. Except for replays, when recorded user input is being replayed and results in the same replay each time. The RNG position is also recorded, so when a replay is started, the position is reset to what it was at that moment, and will advance and end up at the original position when the replay is done. Replays consists of snapshots. Snapshots contain all the data that changes during a session, including the RNG position, car state, etc. It also contains user input between that snapshot and the next one. Replays can be rewound to one of the snapshots and resumed from there by feeding it the user input. It will transparently pass through the next snapshots (these are only used to quickly rewind or fast forward, jump to the start or jump to the end). F1GP only had 1 snapshot at the start, meaning you could watch a replay but was forced to continue to the end, without a way to skip/jump/rewind. Probably for this reason the replay length was also rather short. But that was probably caused by memory contraints. I can't exactly recall the replay length in GP2, but Gp2Video allows for many more snapshots than the original GP2. GP3/GP4 also have much longer replays, as long as it fits in memory.

I just want to point out that the RNG is also very important for replays and saved games.

In theory GP2 is lacking due to the seed bug, but in practice you probably won't notice it when you use the aborted quickrace trick, unless you're very consistent in when you abort it. But unlike computers, humans always have external inputs that influence this moment.
René Smit, Independent Software Developer.
Download GP2Lap here.
User avatar
GP2tifoso28
GP2 Starter
Posts: 86
Joined: 29.09.2015, 14:21

Re: Non-championship races vs. championship difference

Post by GP2tifoso28 »

Thanks for explaining it René. 1 thing I'm a bit confused about is when you refer to the "call", what exactly is the call?

Honestly I don't know if other racing titles work differently, but gpx is the only series which gives me the illusion of racing with real drivers. The AI and general feel of the races is incredible. The variance is amazing but not stupid and unrealistic.

For example here is a race I just did in my championship, Mika Hakkinen didn't set a time in the first session and must of had some kind of technical problem in the second session. He was 27th and failed to qualify for the GP. A very rare situation, but it can happen in real life and it happened to Mika in gp2. Even after 23 years this game still surprises us. This type of realism seems absent from other titles.

It's this kind of drama and emotion that pulls you in, and the races in GPx play out extremely realistically. This is incredible for such an old game but most importantly it's realistic and not stupid like other titles where Mercedes will be running in 15th on pure pace. Geoff did an absolutely amazing job
Attachments
_20191018_160427.JPG
Post Reply