How I Cut GTA Online Loading Times By 70%
Vložit
- čas přidán 5. 12. 2023
- Recorded live on twitch, GET IN
/ theprimeagen
Become a backend engineer. Its my favorite site
boot.dev/?promo=PRIMEYT
This is also the best way to support me is to support yourself becoming a better backend engineer.
Reviewed article: nee.lv/2021/02/28/How-I-cut-G...
MY MAIN YT CHANNEL: Has well edited engineering videos
/ theprimeagen
Discord
/ discord
Have something for me to read or react to?: / theprimeagenreact
Kinesis Advantage 360: bit.ly/Prime-Kinesis
Hey I am sponsored by Turso, an edge database. I think they are pretty neet. Give them a try for free and if you want you can get a decent amount off (the free tier is the best (better than planetscale or any other))
turso.tech/deeznuts - Věda a technologie
btw, the reward he got of 10K was highly pushed by the GTA Online community world-wide because of how ground-breaking and game changing his fix was. I heard many people, even friends that this made them return to gta online. The pressure on rockstar was so much that they could have faced extremely high backlash if they didn't gave him at least that much, or hired him to work for the company.
10k is nothing tho
yeah when i read 10k i was astounded lol.@@ALLSTARDECOURO2
@@ALLSTARDECOURO2 10k is absolutely something, very naive to say.
@@katto1937for a problem that big 10k is nothing, especially for a company like Rockstar
@@adisipunct9562 It's a lot more than their in-house developers who ended up redoing the bugged code would have got. It's all about perspective.
Imagine the carbon footprint of the guy that wrote that inefficient code. Probably like an entire year -or many years depending on the country- of some country's entire power consumption.
This is hands down the best comment
LMOA
"carbon footprint" ... -_-, cant understand why IT world can be so clever & dumb in the same time
Gta slow, pc load for long time. PC uses power, most power comes from non-green energy sources. Not stupid.
@@Bluepaccaosure ! am just done with carbon footprint scam. their is no "green energy" but in green lantern movie
Even more crazy how nobody fixed it even though it is obviously obnoxious and not as bad in RDR2
I bet 'investigate slow online load' was on the backlog forever but not considered important enough by PO
lmao fax
You need a state-of-the-art profiler for that. Called Task Manager.
This hits way too hard.
During my internship i had to add new functionality to a simple java .jar files updater so that it will send just the files that have been changed between versions. it took about 20 minutes to process the new ~100MB package, I asked the guy that was working there for few years why is it so slow and he just told me it is like this and I shouldn't bother. During unit tests i couldn't wait so long so i used profiler to check why it's like this. It was so slow becouse during unpacking of the jar the files where copied byte by byte between file streams in a loop in which it also was creating an instance of some class, just simple addition of a 1024 bytes buffer sped it up to ~10s
That is so silly, IOPS for sequential 16 MB is fast but its literally doing 1 B. like 10 million times slower. lol
Thankfully you bumped it up to 1 KB, but I wonder if it would be even faster at 1 MB buffer reads/writes.
wait, they were reading every single fucking byte in a loop, writing it to disk unbuffered one by one!?
Allocate some dev time to shortening load times and making the game objectively better?
Or allocate all dev time to microtransactions?
Hummm, that's a tough one.
nah, if they reduce loadtimes, people spent more time in-game. More time in-game is more time to spend on micro transactions ;)
"Hummm, that's a tough one."
Not for Rockstar lol
@@iWhacko Prove it. -some exec who doesn't move a chair unless there's a 100% proven and significant profit margin in it
Every time i've thought about playing some more gta5 over the years, it's always the memory of the loading times that kept the game uninstalled. Good game but not good enough to put up with all the waiting.
@@xellestar GTA IV loads much faster and still holds up today.
This guy probably saved 10s of thousands of hours for people playing GTA
Given how popular the game is, he'd have saved 10s of thousand of hours within the first 24 hours of this going live.
He made rockstar a lot of money too, since every minute not loading is time people playing their game.
@@iWhacko True but the load time itself is also a hurdle. There's been plenty of times where I chose not to play gta online simply cause I didn't want to wait 5 minutes to load in
@@PoomulusRobsBanksOnTV that's what I was saying, now that it's fixed, it doesn't put people off, so they play the game MORE, and thus make more money for Rockstar
Not probably. Not 10s of thousands. Definitely millions of hours
prime wantewd the gta revenue
Respect the grind!
Can't blame him😂
Work smart, work hard.
💀💀😂😂
he wearily wantwed it
How is this guy finding out all that from just memory addresses? I don't understand shit. He's truly on another level.
I am sure with some time dedicated to it, you would understand. It is like another language in itself, cannot expect to understand it without studying it.
It takes a lot of time, lot of debugging bs and shi im ngl. Really a pain in the ass
Patter recognition my man.
study assembly that's literally it
those memory addresses were static because he dumped the running game's exe or dll or whatever it was, and those memory addresses point to a function, which in IDA when disassembled (and decompiled with hexrays) would give you a pretty good look at what it does
Glad you linked the article, I couldn't bare skipping ten times waiting for you to finish yapping
on god sir yaps a lot
Rips the title off like his own. I guess reading some content out for literal Twitch babies is easy money?
i like his yapping
Nothing better than programming while listening to Prime speak truths
I think you have prime's split brain...
Why are we still talking about a 10 year old game? Are modern games that bad?
@@BillClinton228 most them, yeah
Yes@@BillClinton228
This guy is frkn irritating. His voice is just disturbing.
I am immediately thinking of Casey Muratori's suggestion that software might be running 10x slower or more than they theoritically should. Bugs like these could be one in many many at various places. Even dropping to 2 minutes loading after the improvement still seems too much to me. It only makes sense after this article pointed out what was the problem. Previously I would have seen the original code and wouldn't suspected anything. Most people make excuses and are like "it must be taking so much time for a good reason". I would also think "Have you seen how huge GTA5 is? Of course a virtual reality world is gonna take 5 minutes to load!". Yet,. it was a tiny bottleneck in some code having nothing to do with the enormity of this engine. Imagine if such bottleneck spots exist all over our modern software in random undiscovered places. It would make instantly sense why our modern PCs with billions of instructions per second still take time to open a simple application. We have to be suspicious when things run slow in PCs that are otherwise 1000 times faster than what we had in the 90s. But people have an aversion to caring for performance, they think it's something of the past and not a priority. Then they make assumptions when things get slow like it's normal and expected.
this is kind of inevitable when people are taught not to look at performance.
they argue, "oh, but safety and readability matters more than anything". true, a lot of performance changes likely have little impact, but if you get used to not think about performance, you also end up missing the higher gains ones
After reading a scientific study about fruit, I think what CS is missing is more science. When we benchmark programs to talk about performance (which we should do), we should treat it like a scientific case study about the program. Follow scientific processes, don't assume results before testing, etc.
It is not necessary.
broke: it came to me in a dream
Woke: After reading a study about fruit
@@johnyewtube2286 It is better, and it being necessary is not a necessity. There's requirement, and there's improvement.
@@johnyewtube2286 You a Rock* dev?
CS major here. Well that depends. Doing that for every single thing would be way to inefficient and expensive. Normally you only do that if you see a problem already there (or don't like in this case). That is for software development. In cs (like in r&d and academic studies) you absolutely do that.
Love this channel, definitely sparked more inspiration to dig in to the technical stuff more. Your coverage on these types of articles is fantastic
*1000 developers at Rockstar:* "lol idk how to fix it ¯\_(ツ)_/¯"
*1 guy from gtaforums:* "bring it on!"
GTA V was written in JDSL. Rockstar hired Tom and Tom. Is a genius.
Modders & developers doing better job than the game companies that's why i like guys like this good work !
My absolute favourite article about programming, and now I can listen to The Primeagen talking about it! 😍
I'm honestly surprised how noone had found it, good job t0st!
I love reversing! It's always nice to hear stories like this :)
I need a t-shirt that's just Prime's mustache with the words "I forgot to disable Twitch alerts" below it
it will happen
Pro strat to record this a week or so ago but hold the release until the GTA6 trailer drops. I'd expect nothing less @@ThePrimeTimeagen
Person looks at your shirt and asks:
"Is that a dr disrespect reference?"
Petition to get T0ST his own character in GTA6
yes sirr, LFG
As a big fan of yours and the GTA franchise I'm glad to see you cover this. I'd gladly watch more GTA content from you.
At work we have a system which can process 1GB of JSON in a very short amount of time using PHP. I am quite surprised that they managed to struggle that much with just 10MB, but with the given explanation it does make sense.
@CesarLP96 We use JsonMachine, it uses a file stream instead of parsing the whole thing at once. It is really memory efficient and fast.
I didn't fully get the explanation for the json optimization to be honest. From my understanding, is the entire 10mb json being parsed for every single element in the json file? And thus the strlen parses 10mb of data for every individual json element?
I do understand the not a 'hash map list thing' part as that one's straightforward. Instead of iterating through the whole container to see if the element's already in it, just place it in since all elements are unique and the check was redundant to begin with.
@@human-ft3wk yes, the sscanf %d to parse for number, sscanf calls strlen each time, and strlen searches for end of string each time. end of string is 10mb long.
@@human-ft3wk That's pretty much it regarding the JSON, yes.
The array looked like a hash map initially because all of the items had a hash value, which was unique per item. However, instead of just using a hash map which would deduplicate automatically, they also had that unnecessary duplicate check when all items were already unique.
@@human-ft3wk Not the json, but the strlen call. Apparently, they were calculating the remaining json length after reading the next token. And they did so using a naive approach of searching for a NULL character. For every single token inside json
I cut load times by 100% by finding better time investments
I think a project like this is a really good time investment since it shows a high level of skill and it's something you can actually show on your resume as it's not something like cracking denuvo
I found this article mentioned in CPP references just last week reading about file I/O functions from the C library. What a coincidence!
Interesting coincidence how I was recently coding a script to parse JSON-like lists (except it was a Lua tables) and paste the data into a spreadsheet, and I noticed that if I was really lazy I could program major inefficiencies like this into it. But despite being an amateur programmer I definitely wanted to avoid looping multiple times (even over just a small section where it wouldn't have cost much to do), so I figured out a way to do it all in a single pass. It involved Regex though which is probably(?) a bit CPU heavy itself, but still it was definitely fast enough for my purpose (which wasn't even time-sensitive at all)
Regex might be super fast, if it's optimized
Regex has different issue than performance. If you write a little more advanced Regex, you slowly build it up one step at a time. If you then come back to the code after 2 weeks searching for a bug, you have no idea what the Regex does and you end up rewriting it, regardless of whether or not it was the issue.
How did they debug the game when it took 6 minutes to even load up?
Problem is most devs how no conception of how long things should take, given the raw CPU capability so they don't even notice if things are ten times slower then it could be. They will only notice if it's slower than it was the week prior.
Also the JSON was probably way less when the script first written
But if it takes 5+ minutes to load then they should get suspicious if they ever played an online game before.
@@poppers7317 they just dont care. They have blatant bugs in the game.
Like, im not joking, one of the main heist of the game, in order to olay it you have to attempt it for like an hour to find a bug-less run.
Yes, literally you sitting there doing the mission hopelessly again and again in order to find one that isnt glitched. And every section of the heist (there are like 10) there are multiple breaking glitches (soft lock, kick out of session, or outright crash the game) in each section.
No one doing this anymore, only a few try to do achievement or trying things out.
And that is just one of the heist.
These bug existed for years. They just dont care.
They are not incompetent, every single glitch that have anything to do with money was fixed faster than i could debug a function in my code. They are so efficient and so quick with the fix that you will feel ashamed for your dev skill.
But bug that dont affect their shark card, good luck
Jon Blow actually made a video discussing this exact thing. Programmers really don't fully grasp how insanely fast modern processing power is, and when something is awry we just miss it. On the other side of the coin, people making things like games overthink optimization and every last little line of code when the code they're anxious over is not even remotely going to be a bottleneck/problem on their performance.
Don't put "I" in the title if you weren't the one to do it.
Immediately closed the video after I saw who it was. I knew it wasn't him, don't know why I clicked in the first place.
bro took it personally
Shut up nerd lol
That's the name of the article he reads in this video. It's literally the first few seconds of the video.
It in NO WAY suggests he was the one to do it
didn’t gta 5 source code just leak?
It’s impressive that he did this but also surprising to me in all that time rockstar never found it by doing benchmarks themselves.
is there any way to see vods of your streams?
Online loading lime was the only time developers had for resting in the R* crunch factory
Reading aloud to others was one of my biggest fears growing up. Here, ‘gen turned that into a quite the career. Amazing
Channel manager stroke of genius to hang onto this one for right after the GTA VI trailer drop
I always find it very funny that you parse through code fairly easy, but that malignant prose obfuscates you, haha
Nice one lol
Would it not be crazy if Tom wrote that crazy process and the JSON thing?
Damn! I played online just a couple of times because it took years to load in my PS3. Amazing debugging.
they should hire this man for gta 6. i mean theprimeagen
Subscribed you, bro. You are awesome
man saw gta 6 trailer and said REUPLOAD. i aint mad cause this one is sick.
Playing 4d chess on the timings of publishing vids
Ok can someone tell me like the tldr; meaning - is there something the average user can do or do I need to be a hecker?
thanks
Reading with Prime is my new favorite thing.
Language model inference on Intel Arc GPU with accelerate and ipex is really slow on the current driver (49xx). I am not sure what is wrong but looking at task manager shows that GPU usage is all memory, not even compute at all.
Where do you find all these random articles?
Ghidra is the decompiler made by the NSA. I downloaded it once, couldn't get it to run -- they wrote it in Java, on Windows, and I could not for the life of me get it to run in Fedora despite running "sudo dnf install java" (that is actually the limit of my technical expertise) despite trying for two days. It is FOSS, though -- maybe I'll try building it from source one day when I'm smarter than I am today.
Where did he fine the function names in the disassembly?
A lot of C's stdlib functions live in a static location, so you can just cross-reference the address used by compiling your own program and looking at the address. I'd bet that the reason he couldn't get sscanf's address is because it's file IO and supposed to be secure, so there's some ASLR going on in the kernel specifically to prevent attackers from abusing programs that call sscanf.
i remember reading this a while ago, pretty impressive
Is Aviras scanner called Luke Filewalker?
I've read about this a long time ago, is this still the case?
I mean just imagine all the users from the very beginning, ever loading screen combined and calculate the wasted power consumption. Usually loading screens run on high frames as well, that's CPU and GPU.
Loading screens run on high FPS? As an Overwatch player, this is news to me. OW caps all menus and loading screens at 60 FPS no matter what hardware you're running it on.
@@mage3690 Also true for most other online pvp games. You can cap FPS in menus and background
I just cap it using RivaTuner
Gta 6 trailer reaction when, Reactiongen? 🧐
Big brain dropping this the day after gta6 trailer.
This dude is legend.
The loading time for the most profitable entertainment product in human history.
I approve-egean too.
Articles like these rekindle my passion for coding.
Wasn't expecting they'd fix it. And the bounty? Totally did not expect that from rockstar of all people. But then again, gta V online is their cash cow, so it makes sense
This is only for GTA Online, right?
No advent of code?
This is old news but cool nonetheless, sometimes I randomly think about it! Now prime reading it, nice
@15:13 "someone didn't watch the FEMDSA"?? what is that?
BTW, that profiler's name reminded me Avira's Luke Filewalker (antivirus scanner)
7:15, well that aged just great
where do you even start learning this stuff, im not tech illiterate but this is some deep programming
there is some weird noise in the left audio channel
Yay riding that wave 🌊
Rockstar introduced a new bug. Many people can´t inject ENB+ReShade anymore without using Windows 7 or Windows 7 compability mode.
If I played GTA Online I'd be my load time would be at least 11 minutes. loading some highly modded Project Zomboid servers takes over 5 minutes with a fast SSD. Seems like a CPU bottleneck in its case as well ( I notice high CPU usage when loading), but I'm surprised that loading uses so much CPU. CPU is like 13 years old now, so it's kind of understandable, but still I never thought of load time being CPU thing.
I'm guessing PZ has some similar inefficiency with loading as well. I wonder if it too will ever be fixed. The game itself is great, but has a lot of jank code. One neat thing about the game is that since it's written in Java and Lua you can decompile the Java and read the Lua, making it somewhat easy to mod. Probably not worth the downsides of having a Java game though >:\
Days until primeagen forgot to turn off the alerts: -1
Thorston Ball is seething right now.
What an awesome story.
The first time I played GTA Online was after the free Epic games drop that was in 2020. might have to look into this again.
Prime is living Michael Scott
I feel like most big game companies have a deadline and after that point you're not allowed to touch anything, until the CEO's gives an OK for a major update, and some problems that still "works" just don't get looked at cause, they "work". Let's not dig up the foundation, just build on top.
Oh I remember this, good times
hey man my load times even on non fiber connections have never been more than a minute for online or 30s for story mode. wtf is wrong with everyone else's pc is my biggest question from this... and i was running a ryzen 2600 oc to 4.2 Ghz with 1070ti also oc'd that had a vbios mod... oh and a little memory performance mod i made.
hw accelerated resource/mem sheduling is pretty tight i even had the mod working in linux on nvidia gpus (1070ti and 1050ti tested) as well as multiple generations of amd/ati cards.
I had cyberpunk 2077 running really nice even on a amd radeon 270x
On my last PC I was probably alt f4ing 2/3rds of the time because of the load. If I didnt exit It could be up to twenty minutes sometimes less.
This is like the gospel of coding with uncle prime.
so you aint do shit but read this thingy on your screen and titled the video as if you did it
scanf is relatively dangerous, so it is surprising to see it in the gta v code base
Im slamming like for the remark about JSON parsing with optional trailing comma.
hey, HEY, haaaaaaaaaaaaaaaaaaaaaaaaaay; Where is this JSON chart thing?
I think it took me 30 minutes once if not more, i can't even remember on Ryzen 2700x and 1070Ti... i have never in my life experienced this kind of load times... it took so long that i did many things in the mean time and was losing my mind...
4:30 Prime where is your alt ASMR channel?
Time to do the same work on gta 6 😅😅
Was this the article of the actual guy who got reported few years ago as ''modder solved gta loading times'' ? I basically started to play after this fix implemented. So thanks to him Rockstar just got a year of my time xd
Amazing, super, awesome, cool etc
french toast is a great name for the tsunami warning app we have in the usa
+1 for the comma ;)
And what about comments in JSON ??
"Old but decent CPU" Bro that CPU was fucking garbage the day it came out 10 years ago
Appreciate what you have and you'll be a lot more content with your life
They really need to improve wait times. Every so often i pick up gta again but the delays are so numerous and they tune out the music. You listen to wind for nearly a minute. Staring at clouds. My beast of a pc is no faster than when running on my Xbox360
The title makes it sound like you did it. Stop with the clickbait.
On my Current Computer it takes 30 min. It pains me XD.
splendid! amzing job!!
lil bit too late tho...
Could someone find a challenge to do some work on ETS2 or ATS for that matter? Its a trucking game by a company called SCS that many people enjoy. Problem is we miss many features for heavy haul or special transport. I do mods myself but game engine is beyond my know-how.
What we miss is: trailer axle steer remote control, entire trailer lift/lower, support for Schnabel trailer set up aka self-centering rear dolly, pendle axle support, ballast trailer axle support, proper front steering angle of wheels on dolly trailers (now its around 70deg should be 85.)
Game engine is needing much more than above to be honest, but lets say this would be the start if someone could take a look at least.
t0st updated the copyright note in the footer to 2021-2023 since the video came out, maybe he is Tom after all 🤔
neah, had problems with the donation processor, had to remove the link ^^; my name does happen to be Tom tho
first load into singleplayer, then load into online. its somehow always waaaay faster than straight jumping into online.
You can also speed it up by alt tabbing out and pausing the gta exe for like 15 seconds, start it again and alt tab back. That's weird.
Lol it could be due to some telemetry
Turns out, GTA V was written in JDSL!
Based R* for the bounty.
great clickbait title