A Rockstar Games is very good at squeezing his golden goose to make money, GTA Online, but it seems that even users can provide better solutions than they are able to do to improve the gaming experience, and is therefore that a modder known as 't0st ' developed a mod that reduces game loading times by around 70 percent on PC. Such was his performance and popularity, that Rockstar appreciated his work and will integrate it natively in an upcoming update of the game.
"After a thorough investigation, we can confirm that player t0st did indeed reveal an aspect of the game code related to loading times for the PC version of GTA Online that could be improved. As a result of these investigations, we have made some changes that will be implemented in a future title update."
The issue of loading times in GTA Online is largely caused by a single thread of code causing a CPU bottleneck. Hopefully, they tip the kid well, out of the game, of course.
"First, the game would read a text file with all the items that could be purchased in the game, and after each of the 63,000 items, it would again count each character in the 10MB text file. Do this Counting once is not a big deal, but doing it 63,000 times is a lot of wasted CPU time, "revealed Digital Foundry.
"Second, to prepare all the data of the articles that have been read, the game records both the data associated with that article (for example, its name, price, category, statistics) and a hash of that article (essentially a calculated "fingerprint" that uniquely identifies it.) Every time the game stores an item from the list - which, remember, happens 63,000 times - it checks the hash value of the item that is stored with the hash value of all other items that have already been stored.
At first, this does not take long, but as the number of items successfully loaded into the game increases, this check takes longer and longer. In total, t0st estimates that 1,984,531,500 checks are performed (almost two billion!), Again consuming a ton of CPU time. The game does this to make sure that there are no duplicate items in the final list, but since the list is completely empty, to begin with, and the file being loaded has no duplicates, the check is essentially useless.
To solve the problems, t0st wrote its own code that overwrites some of the game's functions. To solve the "read items" problem, you created a basic cache that calculates the length of the item list once and then returns that same value without re-calculating each time Rockstar code prompts you for it. length. This reduces the number of times the check has to be done from 63,000 to one, saving a huge amount of unnecessary work.
The second solution is even easier. Since t0st thinks there is no need to check for duplicate items, your code just inserts the new item directly, without performing the hash check. This means that none of the nearly two billion checks need to be performed, and the CPU can speed up the process.
With both fixes, GTA Online loads much faster. On the t0st PC, avoiding duplicate object checking reduces load time from 6 minutes to 4.5 minutes, and adding object load correction also reduces it even further, to just 1 minute and 50 seconds. This is a 69.4 percent reduction in load times, which is absolutely incredible given that only two functions have been modified.
0 Comments