Programmer cuts GTA V's load times by almost 70% - Rockstar needs to fix its game's poor programming
'The problems shouldn't take more than a day for a single dev to solve'
Published: 1st March 2021 | Source: T0ST |
Programmer cuts GTA V's load times by almost 70% - Rockstar needs to fix its game
Last weekend, a programmed called T0ST discovered a way to shorten GTA Online's initial loading times by almost 70%, reducing the game's loading times from exactly 6 minutes to 1 minute and 50 seconds. This was using a system with an AMD FX-8350 and SSD storage.
With GTA Online receiving continual updates and new next-generation version on PlayStation 5 and Xbox Series X, Rockstar should be looking for ways to make GTA V load faster and make the best possible use of the latest gaming hardware. This should be true for both PC and consoles.
The short-hand summary of the problem is that GTA V has a single-threaded CPU bottleneck, struggles to work through a 10MB JSON file and then wastes time with a slow data checking system that T0ST claims is "useless".
With AMD's FX-8350 being a weak processor by today's standards, offering poor single-threaded performance when compared to the Intel processors of that era, T0ST issues are less prevalent on more modern systems. That said, the boosted single-threaded performance of modern CPUs will still need to waste a lot of time on these same processes, making T0ST fixes hugely valuable for Rockstar and its oncoming GTA Online development efforts.
The first of GTA Online's problems is that it struggles to work through a 10MB JSON file that contains 63,000 items. Strangely, GTA V reads this file 63,000 times while loading GTA Online, which adds up to a lot of wasted CPU time. While each read is incredibly fast, skimming though the file 63,000 times quickly adds up to a lot of wasted CPU cycles and creates longer than necessary loading times.
GTA Online's second issue is that the game also checks its calculations for repeated values, even though GTA Online's JSON list contains no repeated items. With the JSON list being 63,000 values long, T0ST believes that GTA Online needs to conduct 1,984,531,500 cross-checks, all of which are appear to be useless. All entries in this file are unique, removing the need for this cross-check entirely.
To reduce GTA Online's loading times by almost 70%, T0ST created two fixes that mitigate these major issues, both of which should be considered by Rockstar games. With Grand Theft Auto 5 having over 100,000 concurrent players on Steam every day, the total time-saving benefits would be monstrous.
If 100,000 GTA Online players could load the game 1 minute faster, the total human time savings would be 69.4 days. T0ST saved over four minutes of time when loading GTA Online with his fixes, making the time saving potential even larger for those with weaker systems.
T0ST's fix is comprised of two parts, both of which are described on his blog. The first is a bypass for the game's duplication check, removing the unnecessary check from GTA Online's loading times. This dropped GTA Online's loading times from six minutes to four minutes and 30 seconds.
The second fix is a patch to the game's JSON parser, which caches the start and the length of GTA Online's JSON file. This change allows GTA Online to read through the file once and see the answer repeatedly without re-reading the file. Instead of reading the file 63,000 times, this fix allows the file to be read only once. This fix reduced GTA Online's loading times from 6 minutes to Two minutes and 50 seconds.
When both of these fixes are combined, GTA Online's loading times can be reduced from six minutes to one minute and 50 seconds. The code for these fixes is available on Github, though GTA Online players shouldn't use the code as it could be seen as cheating by GTA Online's anti-cheating system. That's why Rockstar needs to implement these fixes themselves.
Rockstar, Please Fix this
GTA Online remains incredibly popular on PC, and T0ST claims that his fixes could be implemented by a single Rockstar developer in a single day. With this in mind, Rockstar should see implementing this fix as a no-brainer. Shortened loading times will bring some PC gamers back into the world of GTA Online, and existing players will benefit from having less waiting time and more gaming time.
If these fixes can also be brought over to the console and next-generation console versions of GTA Online, the combined human time savings of these fixes would be even more considerable. Faster loading times for the next-generation versions of GTA Online would be a big improvement for fans of the title.
We will end this article with T0ST's plea to Rockstar Games to address these loading issues.
If this somehow reaches Rockstar: the problems shouldn’t take more than a day for a single dev to solve. Please do something about it :<
You could either switch to a hashmap for the de-duplication or completely skip it on startup as a faster fix. For the JSON parser - just swap out the library for a more performant one. I don’t think there’s any easier way out.
You can join the discussion on the programmer who reduced GTA Online's loading times by 70% on the OC3D Forums.