Back to Main Page


I decided to try and replicate the online time trials for practicing purposes and to satisfy my curiosity about how much data I could find for them.

 

Time Trials - Online things offline.


I was going to write a page about the development of this mod... but why bother I asked myself. I will just leave this page and video here as a record of its completion.

 

I did think about adding some fancy selection UI but the problem is that each image for each time-trial is in its own texture dictionary and I wasn't sure of the implcations of keep requesting and releasing texture dictionaries in rapid succession. Online you only get one per week, so it only ever has to load one texture dictionary. If I can find out if the other races and events work the same way, then it might be okay as you can scroll through the list of all races without any issues.

Update: As anyone who has watched the video will have noticed, the checkpoint colours in the RC Bandito trials were the wrong way round. I originally had it correct, was convinced it was wrong, changed it and after just going online, I noitced that it was correct how it first was. *sigh*

As you can see from this image, it is now correct.

Additional Note: Anyone watching the video will also see another example of my failing brain at the end... "Time RC Trial Available" pops up in the notification at the end... Things like this don't make writing mods any easier and it's because there seems to be an increasing disconnect between the order I think words and the order I write them. It also happens on a letter-level as well though, which makes variable names a complete minefield to work with.

I also discovered that online is even worse than I thought with the RC Bandito trials, if you're already in your RC, it removes the time-trial markers from the map, so you can't even access them at all. Kinda stupid to need a special vehicle to use for them and then to not let you do them when you're in that special vehicle.

Update 19th November 2020: After a couple of days of trying to create a UI for this, I have decided against it for now. What it does now, is 15 seconds after the game loads, it generates a random time-trial and RC time-trial. 30 minutes later, it will replace them with two more. If one of them is active when it tries to replace them, it will delay the process for 5 minutes, giving it time to finish.

I think I will just create a more "themed" notification system for this, which just slides in a small notification in the top-left corner, so it is less intrusive.

For now I have just added this list as an option you can switch on, which shows the number and name, to make selection a bit more of an informed process. I could turn it into an interactive menu I guess, using code from my FileBrowser class but you can enter text with this window on-screen, so it's easy enough to use.

Update: Notification system now in and working. It's small, unintrusive and simply lets you know something has changed. I tried drawing the Icon textures as sprites in it but they just turned to pixelated crap at that size, I don't know why they are not being filtered properly.

Update 20th November: I am going to consider this now finished apart from some minor prop manipulation on one of the RC Construction Site time trials.

So what does it do in total.

1) Let's you complete any of the 32 Time Trials or 10 RC Time Trials offline, replicating them almost completely, to make them feel as close to online as possible. Checkpoint detection distances are from the scripts, so everything detects as it should. Weapon restrictions and out-of-vehicle timer serve no purpose here, so they were left out of the mod. Respawn control remains under consideration but isn't essential.

2) Stores all Personal Best times to disk, meaning you always have your all-time best to compete against, as well as the par time.

3) Let's you choose a random Time Trial or RC Time Trial by inputting "tt on" or "rctt on" and lets you turn them off with the corresponding "off" command.

4) Let's you choose a specific TT from the displayed list by entering the same "tt" or "rctt" command followed by a number.

5) A few seconds after the mod loads, it chooses a random TT and RCTT from the pool. These will remain active for between 15 and 25 minutes (chosen randomly for each one), upon which point it will choose different ones. Being active in the TT, or being within 15m of the start point of the TT will postpone the reselection of the active TT type for 5 minutes. Randomising from a pool ensures no duplicate choices can occur until the pool is emptied and refilled.

6) 3 - 5 will cause the associated notification to slide in from the top-left corner, stay there for 5 seconds and then slide out again.

So it requires no user interaction of any kind if you just want to do the trials as you find them during normal play, or by driving/teleporting to the start/trigger point. but at any point you can take control if you choose to do so. It does exactly what I wanted it to do, in an even better way than I first envisioned it... task complete!

Update: You can always count on Rockstar to f*ck things up when you least expect it. Game Version 1868, mod works flawlessly. Game Version 2060, checkpoint texture on the ground doesn't appear, checkpoint icons are wrong because it seems Rockstar have decided to add more checkpoint icons, throwing the numbers out of sync.

Turns out the start checkpoint number was off by 2, correcting that also fixed the missing ground texture. The other checkpoint values were off by 1. Annoying that despite using no version specific code in the mod, like offsets or patterns, it still broke because of a game update. A harsh reminder I guess that updates can break anything, not just those things that use memory related code.

Update 22nd November: After messing up a couple of the RC Time Trials halfway up a construction site, it became clear that the restart option was needed... so it has now been added. One major difference is that in this mod, you get put back inside the trigger area and remain in the RC Bandito, whereas in Rockstar's fumbling hands, you get dumped across the street on foot. They can't stand you enjoying any part of this game, so they always go to any lengths to make it as frustrating as possible. Why restart you in the right place, when they can make you cross 4 lanes of traffic and climb a fence?

Adding this feature also brought a major screw-up on my part to light and I don't know how I didn't spot it sooner. When I created the video on this page, I was using a single shared scaleform for the infoboard at the start checkpoint. I then mistakenly believed that I could create two of them and store them in each time-trial class. Because the normal time-trials originally seemed to be fine, I have spent all my time in the RC and that also seemed fine. Today, I went to do a normal time-trial and the infoboard was showing the details for the RC Time Trial. When I output the handle for both scaleforms, it was the same. So I have gone back to the shared scaleform and that has solved the problem.

Sadly, it's not just Rockstar you can count on to f*ck things up... I can do a magnificent job of it as well.

Update 23rd November: Quitting option now implemented for both time trial types. In the normal time trial, hitting and releasing the Vehicle Exit control within 250ms causes you to leave the car. Holding the Vehicle Exit control for 2500ms causes you to quit and reappear at the start point. I had to Ped.Task the vehicle exit because that control is disabled during the trial, so it won't exit by default.

In the RC trials, only the hold function is used because you can't enter the RC Bandito normally, you have to warp into it. I didn't want to mess about writing spawn-into-car code, so you just have to restart then exit... not a problem.

The quitting display only appears during the quitting process, just as it does in online.

There is a destroyed vehicle fail and a timeout after 60 minutes in the online trials but I am not going to bother with those. I'll make the vehicle invincible and I am never going to sit in a time-trial for longer than a few minutes anyway. I also have never-wanted turned on in my trainer, so I am not going to bother with wanted level processing either. I am always in god mode, so the player can't die as well.

Update: Huh, well that was enlightening. I just did a couple of comparison videos between my mod and online, just to check a few details and the one thing that really stood out, was how much more traffic there was in online than I remembered. It always felt like the traffic was reduced online but it doesn't seem to be... at least not during these time trials anyway.

And after a read through some more of the freemode.c script, I think I now know why. It takes the max number of network vehicles and peds and subtracts the number of reserved network mission vehicles and peds and then adjusts the ped and vehicle density based on that. Time trials don't have any of those reserved entities, so maybe that defaults the density to a default state of 1f. All I know is that the adjustments I was making were making the time trials easier, so I have removed those adjustments.

I also noticed that when the Time went past the Personal Best time, the Personal Best display turned red, so that's now in as well.

Update 24th november: Here's an image showing how much map content is different/missing online in just one small section of the map.

Litter bins seem to have been removed completely from this whole area and generally around the map. In the cemetery there are lots of them offline around the time trial route that are not there in online. These do actually affect the route you have to take, so I might have to implement some form of prop culling to deal with them.

Update: Well it seems the low priority prop restore asi mod held the answer and I was truly shocked at what it was. If you have this mod and want to see what online feels like, disable PRI_OPTIONAL_HIGH and PRI_OPTIONAL_MEDIUM. So as PRI_OPTIONAL_LOW is off by default, online removes every instance of any OPTIONAL props... no wonder it feels so empty. I presume it is to avoid having to sync all those prop states across clients as they can be moved or destroyed.

The problem is, as that is controlled from that asi mod, I have to set it permanently, so I might just create a game version that mirrors the online game completely for any mods that try to replicate online features. If that mod works that forces the online maps to load at the start, then I could implement that as well. From what I have read, it seems it's just a simple native call to turn the online maps on and off.