:wtf: is GTA V doing in the pause menu?



  • Pressing Esc in GTA V brings up the pause menu (map, settings, stats etc.)
    GTA V must be doing some horrible hack here because

    • Navigating the map lags
    • At least one third of my button presses and mouse clicks while navigating the menu are ignored.
    • If I Alt+Tab out of the game, ~2 out of 3 times the Windows key is virtually held down so that pressing any key brings up various Windows UIs (S search, A action center, W ink workspace...). This stays that way unless I go back to the game and exit it properly. So I cannot launch a browser and search for something.
    • Heavy CPU and/or disk usage by the game even though it's minimized by now

    There are some fixes or workarounds on Reddit and stuff, but c'mon...



  • @marczellm I noticed a similar thing on my PS4 Pro and Horizon: Zero Dawn. The game runs fine - but if I enter the character menu (map, quest log, inventory, ...) the case fan will engage almost immediately which means that some process pegs the CPU at 100%.

    But only in the character menu. The actual gameplay itself rarely makes the case fan engage.



  • game programmer here:
    UI in games is surprisingly easy to code badly (even if you're using some specialized framework), and they can be surprisingly performance-hungry when coded badly. I'm too lazy right now to go into details, but in general it has to do with:

    1. most of them using lots of transparency, resulting in lots of overdraw (situation when the same pixels are re-drawn multiple times within drawing a single frame)

    2. most of them contain quite large amount of objects (think each interactive piece being a separate object, meaning each button (usually consists even of multiple objects - background, icon, text, highlight layer), each text span, each single map icon, etc), many of them animated even when idle.

    3. the way engines usually handle UI can be weird and if you don't know or care about how to approach making and structuring the UI in your specific engine, you've got a big chance to create a beautiful bottleneck.


    i have no idea though why would it lock any function keys on system level, as you describe in GTA 5


  • area_pol

    @sh_code if they are treating each object separately, instead of batching, that would be Samsung-level stupid.


  • Discourse touched me in a no-no place

    @neighborhoodbutcher But the UI-when-paused doesn't tend to attract the same level of attention as the much more critical UI-when-playing. So I'd expect enlightened levels of problems occasionally…



  • @rhywden I've noticed similar problems in other games. I suspect those games usually have an FPS cap, but not in the pause menu, causing the GPU to unnecessarily render the menu hundreds of times per second.


  • Banned

    @marczellm still not as weird as mouse not working in GTA San Andreas unless you pin the process to CPU #1.



  • @neighborhoodbutcher there's not much batching you can do. maybe put icons on a texture atlas.
    okay. might still not work if the quads showing the icons are different sizes, which in some engines, breaks the batching.

    you've still got hundreds of characters of text, each one being a polygon with possibly 50 to 200 vertices (again, I'm talking in general, some engines handle text like this, some do it differently), all of that mesh being generated on the fly when you assign or change the text, or even when the text moves (scrolls), if you did it stupidly.

    again, these are just collected examples of what i've come across in various engines. don't take it as a "complete list of what all the engines do", just examples supposed to hint at the fact that "UI rendering is surprisingly different from the normal 3d world rendering which graphics cards are optimized for".

    If i wanted to write comprehensive and detailed explanations of how and why, it would be like 3 pages at least, and I'd have to go and re-study some of the engine manuals to check/remind myself of the specific quirks, which ones have which, etc...

    also, there's always many techniques to "do things right", but many of them contain nuances which are counter-intuitive compared to how one would think about structuring and handling it in the "naiive" way.

    (and then there's things like scaleform, which I have no idea how it handles stuff, except that it basically creates an overlay/draw surface on which it runs (almost?) complete Flash runtime, I think. which... usually works surprigingly well, even though it sounds like a wtf (and it might be).)



  • @dfdub said in :wtf: is GTA V doing in the pause menu?:

    @rhywden I've noticed similar problems in other games. I suspect those games usually have an FPS cap, but not in the pause menu, causing the GPU to unnecessarily render the menu hundreds of times per second.

    Yeah, I've seen this too. Enabling/forcing vsync may settle things down in this case, since that will cap the frame rate at the screen's refresh rate (forcing a wait when swapping buffers).

    @sh_code said in :wtf: is GTA V doing in the pause menu?:

    you've still got hundreds of characters of text, each one being a polygon with possibly 50 to 200 vertices

    Eww. 😢


  • area_pol

    @sh_code actually UI is one of the easiest things to batch. QML does it extremely well. As far game engines are concerned, take a look at how UE4 does this - a dynamic texture atlas of distance-based glyphs, which is then used to batch-render all text with given font. Given GTA5 uses the same all over, you can literally draw whole text in the UI with a single draw call. One character is 6 verts, so it's extremely cheap. The same thing goes for other UI elements. Widgets? Usually rects with a single texture. Window decorations? 9 rects max with 1-2 textures. UI is easy when people are competent enough to actually read how to do it, and I suspect Rockstar has competent enough programmers.



  • @sh_code said in :wtf: is GTA V doing in the pause menu?:

    you've still got hundreds of characters of text, each one being a polygon with possibly 50 to 200 vertices (again, I'm talking in general, some engines handle text like this, some do it differently), all of that mesh being generated on the fly when you assign or change the text, or even when the text moves (scrolls), if you did it stupidly.

    I would say that rendering menu text as individual 3D models for each character is doing it stupidly to begin with.


  • Banned

    @neighborhoodbutcher said in :wtf: is GTA V doing in the pause menu?:

    @sh_code actually UI is one of the easiest things to batch.

    Compared to most other types of content you might have (static terrain, multiple instances of same objects), no, it's absolutely not one of easiest, not by a mile. It might still be fairly easy in absolute terms, but it depends on what exactly you're doing and how you're doing it. Also, QML isn't immediate mode like most game GUIs are.

    As far game engines are concerned, take a look at how UE4 does this - a dynamic texture atlas of distance-based glyphs, which is then used to batch-render all text with given font.

    That works for 2D text. Not sure how well it works for fancy stuff seen in current gen games.

    Given GTA5 uses the same all over, you can literally draw whole text in the UI with a single draw call.

    But you have to rebuild all buffers from the scratch almost all the time.

    One character is 6 verts, so it's extremely cheap. The same thing goes for other UI elements. Widgets? Usually rects with a single texture. Window decorations? 9 rects max with 1-2 textures. UI is easy when people are competent enough to actually read how to do it, and I suspect Rockstar has competent enough programmers.


  • area_pol

    @gąska said in :wtf: is GTA V doing in the pause menu?:

    @neighborhoodbutcher said in :wtf: is GTA V doing in the pause menu?:

    @sh_code actually UI is one of the easiest things to batch.

    Compared to most other types of content you might have (static terrain, multiple instances of same objects), no, it's absolutely not one of easiest, not by a mile. It might still be fairly easy in absolute terms, but it depends on what exactly you're doing and how you're doing it. Also, QML isn't immediate mode like most game GUIs are.

    In absolute terms, you'll always find something easier to batch. That's why I said one of the easiest, not the easiest. In the case of UI, you are batching per material with uniforms in a dynamic buffer. That's entry-level easy.

    As far game engines are concerned, take a look at how UE4 does this - a dynamic texture atlas of distance-based glyphs, which is then used to batch-render all text with given font.

    That works for 2D text. Not sure how well it works for fancy stuff seen in current gen games.

    Same. With text rendering you're batching per material (= font).

    Given GTA5 uses the same all over, you can literally draw whole text in the UI with a single draw call.

    But you have to rebuild all buffers from the scratch almost all the time.

    Rebuilding is extremely cheap, and given the low volume of data, very fast to update.



  • @neighborhoodbutcher said in :wtf: is GTA V doing in the pause menu?:

    actually UI is one of the easiest things to batch. QML does it extremely well

    how many times do I need to say that what I wrote are WTFs collected across several engines, as an example list, and not an end-all be-all list of "this is what ALL the engines to wrong"?

    EX-AM-PLES. where each specific implemenntation solves some of the WTFs while creating its own.
    congratulations in pointing out one of the issues and pointing out ONE or TWO of the (dozens) UI libs that solves the issue. u so smert. u invalidated my whole comment in one example. congrats.
    </sarcasm>



  • @hungrier said in :wtf: is GTA V doing in the pause menu?:

    I would say that rendering menu text as individual 3D models for each character is doing it stupidly to begin with.

    not each character. even the worst offenders I know generate the whole textbox/textblock as a single mesh.
    which has the advantage of eating less cpu and gpu time when just displayed and moved.
    ...and has the disadvantage of having to re-generate the whole text block mesh even if you change just a single character.

    seriously, dudes, EXAMPLES.
    and balancing acts. optimize for one thing, pay for it via other things.
    ...am I in an IT forum, or not? seems like I am not, because I'd expect not to have to spell these things out if I were in IT forum.

    the core is: GPUs are optimized to show relatively small number of relatively complex objects - wanna draw 1 object with 10 million polygons? okay, no prob.
    UI is a relatively large number of relatively simple objects - wanna draw 10 million objects with 1 polygon each?
    choking commences.


  • Banned

    @neighborhoodbutcher said in :wtf: is GTA V doing in the pause menu?:

    @gąska said in :wtf: is GTA V doing in the pause menu?:

    @neighborhoodbutcher said in :wtf: is GTA V doing in the pause menu?:

    @sh_code actually UI is one of the easiest things to batch.

    Compared to most other types of content you might have (static terrain, multiple instances of same objects), no, it's absolutely not one of easiest, not by a mile. It might still be fairly easy in absolute terms, but it depends on what exactly you're doing and how you're doing it. Also, QML isn't immediate mode like most game GUIs are.

    In absolute terms, you'll always find something easier to batch.

    That's relative, not absolute.

    As of the rest. I'm no expert, so I'm not gonna judge whether you're right or wrong. But if every major game studio fucks up this one thing over and over again for years, maybe - just maybe - it isn't as simple as it sounds after all. Especially considering they have to work around all the quirks of their game engine.



  • @neighborhoodbutcher said in :wtf: is GTA V doing in the pause menu?:

    Rebuilding is extremely cheap, and given the low volume of data, very fast to update.

    in this one specific example of combination of Engine+UI lib.

    I was talking generals, collecting all the WTFs i've encountered in my 10 years across many engines, ranging from GameMaker, through Construct, Unity, CryEngine, Unreal...

    so congratulations on finding one single specific and thinking it makes sense to use it to counter my post about general issues with this stuff.


  • Notification Spam Recipient

    FWIW our performance tanks hard in areas where we've set up dynamic widgets (I. E. Not just a splat texture) to display store items name and cost. Bad things happen....


  • area_pol

    @sh_code said in :wtf: is GTA V doing in the pause menu?:

    so congratulations on finding one single specific and thinking it makes sense to use it to counter my post about general issues with this stuff.

    Holy crap, dude chill out. If you're not doing the things you wrote, good for you and your products.

    @gąska said in :wtf: is GTA V doing in the pause menu?:

    But if every major game studio fucks up this one thing over and over again for years, maybe - just maybe - it isn't as simple as it sounds after all.

    Now that's a broad statement... Not that I'm defending game studios in general, but a lot of them are doing those things right.



  • @neighborhoodbutcher said in :wtf: is GTA V doing in the pause menu?:

    I suspect Rockstar has competent enough programmers.

    I suspect those were working on the game itself and the rest did the menu.


  • :belt_onion:

    @marczellm said in :wtf: is GTA V doing in the pause menu?:

    @neighborhoodbutcher said in :wtf: is GTA V doing in the pause menu?:

    I suspect Rockstar has competent enough programmers.

    I suspect those were working on the game itself and the rest did the menu.

    IIRC most (all?) GTAV UI stuff is scaleforms. Also, knowing enough from modding/scripting it... It's a pretty big pile of :wtf: under the hood. It wouldn't at all surprise me if they were doing something idiotic in the menu.


Log in to reply