
A hacker by the identifier T0st says that he discovered a central problem that caused load times longer than necessary in Grand Theft Auto Online for years. The hacker released a proof-of-concept DLL fix that reduces long boot times by about 70 percent.
Grand Theft Auto OnlinePC load times have been a persistent problem for seven years, remaining slow despite general improvements in hardware and the game’s status as a source of continued profitable revenue for Take Two. An anonymous Reddit survey last year found that about half of the players were waiting three to six minutes for the game to load, and about 35% of the players waiting even longer to start each session.
This is not scientific research or anything, but even taking into account the problems of self-selection and reporting, these loading times are very long, especially for such an old game. The problem is even more difficult to understand when the single player Grand Theft Auto V tends to load many times faster.
Saving time with disassembly
To get to the bottom of the problem, T0st writes that they started profiling their own CPU to try to figure out why the game was maximizing a single CPU thread for more than four minutes during loading. After using a tool to dump the process battery and disassemble the GTA while the code was running in memory, T0st noticed a set of functions (somewhat obfuscated) that seemed to analyze a 10 MB JSON file with more than 63,000 entries in total.
The JSON file in question appeared to be the “online store catalog” that describes each item GTA Online players can buy with the in-game currency. Analyzing a 10 MB file should not be also a big problem for a modern computer, but some obscure problems in the specific implementation seem to lead to massive slowness.
On the one hand, the specific function used to parse the JSON string (apparently sscanf in this case) was apparently running a strlen checking function that took time and time after reading to every piece of data. Simply caching the string length value to speed up these checks has resulted in a more than 50 percent reduction in load times on its own, writes T0st.
After analyzing all of this JSON data, GTA Online it seems to load it into an array in an extremely inefficient way, scanning the entire array for duplicates as it grows. Replacing this process with a hash table that can quickly check for duplicates has led to a reduction of approximately 25 percent in loading time on its own, writes T0st.
With these two corrections combined, T0st says GTA Onlinethe machine’s charging time dropped from six minutes to just under two minutes on the test machine. Those interested in replicating the results can build a similar DLL from the T0st source code. Players should only do this at their own risk, as this type of modification can easily (and erroneously) trigger the game’s anti-cheat checks.
In the meantime, T0st writes that implementing this fix for all players on the Rockstar side “shouldn’t take more than a day for a single developer to resolve.” We hope that the renewed attention this problem is getting will make Rockstar do it sooner or later.