PoC is restoring Rockstar’s inefficient seven-year-old loading routine
Gaming mods are a dozen or so, particularly for Grand Theft Auto Online. But then someone comes along with someone who’s so amazing and still so plain that you’re curious why the creator didn’t do the same thing in a patch. One hacker has demonstrated a load-time patch that’s so easy that you’ll ask why Rockstar didn’t take care of it years ago.
Without a doubt, the load times of Grand Theft Auto Online are atrocious. A non-scientific poll conducted on Reddit last summer showed that most were waiting for the game to start three to six minutes, and more than 35% of players had load times longer than six minutes. In the worse case cases, there were more than 15 minutes of waiting periods.
A hacker who goes through T0st looked at what could be behind his six-minute load times. After deleting the loop stack, he found two bottlenecks that had maxed out a single CPU line. A badly written routine was inefficiently decoding a 10MB JSON file comprising more than 63,000 objects.
As it turned out, the JSON file contained items that could be bought from in-game stores (not to be confused with microtransactions). The routine reads every entry in the register, and then stores it in the list. For each move, the whole duplicate sequence is tested before the new object is added. If you can guess, this process is getting longer and longer as the array expands.
To address the issue, T0st built a DLL to delete the two bottlenecks. The first remedy is “caches” long string lengths.
“When it is called again within the context of the string, [it] returns [the] cached value,” writes T0st.
Since this patch removes repeat entries, a duplicate search is no longer needed. Then the second section of the DLL essentially inserts the values in the sequence.
The outcomes of these two patches are very remarkable. With just the replication tests installed, the load time was modestly shortened from six minutes to 4.5 minutes. The JSON parser was much more effective, lowering the wait to two minutes, 50 seconds, and adding all patches to the DLL increased the load time by around 70 percent (or 1m 50s).
The results which differ based on the design of the rig, but the optimizations should dramatically increase loading speeds for any setup.
T0st posted proof of concept to GitHub if you’re involved, even though he warns you could be suspended by injecting it whilst online. His writing about how he discovered and solved the dilemma is also a good one to read. He hopes the Rockstar can get the wind out of his PoC and release an official patch, which is not an unfair order for a seven-year-old cash cow at the studio.
“If this somehow reaches Rockstar: the problems shouldn’t take more than a day for a single dev to solve,” he writes. “Please do something about it.”
Yes. Please do.