A Call For Dx12 - Engine.ini Optimizations For Ue V4.26

Discussion in 'TSW General Discussion' started by geloxo, Dec 29, 2021.

  1. philnash69

    philnash69 New Member

    Joined:
    Jun 20, 2021
    Messages:
    3
    Likes Received:
    3
    Started playing the game again after Commute London went on offer. The lag is annoying even with geloxo's help. It's an odd game as GPU will sometimes sit @ 60% in detailed areas and often hit 100% on less. Game appears to top out at 8GB VRAM and maybe that's causing stutttering as I'm running 4k ultra settings.
     
  2. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,695
    If you were fine with the older settings just stay with them. The last modification should help anyway, even if you don´t notice it as it makes game thread to sync with another thread which is more independant so to say, as it´s the one acting as interface to your HW. Then the render thread follows game thread just 1 frame behind. This prevents the bottleneck during tile loading and still kepts game and render synced.

    The variable can be set to sync game thread with the Vsync process as well when using a value of 2 but it´s a bit more complex. It´s explained in the documentation link I shared. I personally didn´t see any improvement but maybe that´s because I run a G-sync monitor so my FPS are bouncing all the time. Maybe it would help in the case of people with fixed refresh rates monitors.

    Performance has degraded a lot recently, yes. Even my system which is quite high end suffers in empty areas that shouldn´t be a challenge for it while it can handle Munich station without big problems, which was indeed a challenging tile for it with the old version of the engine. Something is hidden that is eating or blocking all resources after update to v4.26... I hope devs can take a look to this.

    Cheers
     
    Last edited: Jan 3, 2022
  3. robski

    robski Member

    Joined:
    Jul 11, 2019
    Messages:
    72
    Likes Received:
    89
    I just went back and deleted all the .ini settings to test the difference between optimized and non optimized.
    and man I tell you what a difference @gelaxo you are a living legend, thanks for all your work :cool::D
     
    • Like Like x 2
  4. dhekelian

    dhekelian Well-Known Member

    Joined:
    Nov 24, 2020
    Messages:
    2,054
    Likes Received:
    2,671
    What are your specs? And did you use dx12? What did the game noticeably do worse running vanilla? Sorry for the questions but find this interesting.
     
  5. robski

    robski Member

    Joined:
    Jul 11, 2019
    Messages:
    72
    Likes Received:
    89
    I have a RTX 2070 Super and 8700K both overclocked (not extreme), I did use DX 12 although I didn't really notice a difference in frames, just a little less stuttering.
    The game in vanilla has a lot, and I mean a LOT of micro stutters and general hitching, dresden even becomes close to unplayable sometimes. The loading of tiles is also a little worse on the vanilla client I think.
     
    • Helpful Helpful x 1
  6. philnash69

    philnash69 New Member

    Joined:
    Jun 20, 2021
    Messages:
    3
    Likes Received:
    3
    My system was built to run Star Citizen @ 4K (e.g. R9 5900X, RX3090, 64Gb and 4th Gen M.2 NVMe). I didn't imagine TSW2 would be an issue.
     
    • Like Like x 2
  7. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,695
    It is an issue yes. I thought the same, but it hurts performance no matter which NASA system you have. The main problem is the combination of a heavy tile loading + moving trains inside. This is the worst case situation and there´s nothing to do to scape from that as of today. Even with really low settings there will be a freeze there. They need to review the source code as it seems there´s something that forces the running threads to delay or stop until tasks are finished to be processed and that loading process is not optimized at all. The fact is that as soon as you are inside the tile you can get pretty high FPS even if multiple trains moving inside and tons of objects spawned. So it´s the tile generation itself what hurts not the rendering of the scene itself. Either they are putting too much load to very small caches/buffers, or there are some hardcoded frame timers that delay the threads. I don´t know what is but I couldn´t find any improvemet beyond what I posted to fix it.

    Cheers
     
    Last edited: Jan 3, 2022
    • Like Like x 5
  8. Dinosbacsi

    Dinosbacsi Well-Known Member

    Joined:
    Sep 20, 2017
    Messages:
    3,312
    Likes Received:
    8,665
    Tile loading was an issue and generated pretty ugly stuttering in TS as well. No wonder it's a big challenge though, most games don't require long distance movement like this, so I suppose game engines don't support them perfectly either.
     
  9. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,695
    MSFS is based on multiple threads as well as UE is (game thread, rendering thread, etc). Indeed it has just 4 threads and runs DX11 as well. But it loads things more efficiently because they schedule the tasks more frequently. It renders far more complex scene than TSW needs to render. I think the problem is that the tiles in TSW are just too big in size so a lot of info needs to be handled in just ms and it gets stuck in a giant queue of pending tasks to do.

    If they could pre-process the tile some more meters ahead of its boundary limits (so basically much earlier than it becomes visible) that may solve the issue as the 3D rendering workload once you are inside the tile is not so extreme nor for the GPU nor for the CPU as I said before. Another option could be to handle trains separately from the rest of other objects as loading a heavy tile without moving trains inside or just parked trains does not hurt so much.

    This is Dresden route with 3 moving trains plus the player train in one of the most populated areas of the route and my posted settings. The passenger trains also contain interior lights, which is more demanding for our systems. But this situation does not produce any issues at all for instance. I can get 50fps there which is really good. However loading that tile with just a train moving inside of it would kill performance.

    TS2Prototype-Win64-Shipping 2022-01-03 23-11-31.png

    Cheers
     
    Last edited: Jan 3, 2022
    • Like Like x 3
  10. fanta1682002

    fanta1682002 Well-Known Member

    Joined:
    Dec 22, 2019
    Messages:
    1,175
    Likes Received:
    561
    DX12 too much stuttering
     
  11. fanta1682002

    fanta1682002 Well-Known Member

    Joined:
    Dec 22, 2019
    Messages:
    1,175
    Likes Received:
    561
    Anything over 1.5 murders FPS
     
  12. cavok

    cavok New Member

    Joined:
    Jan 5, 2022
    Messages:
    18
    Likes Received:
    5
    Hi from a one week in TSW2´er

    On my system just changing from DX11 to DX12 give an immediate 30-40% boost in FPS (when game is set to unlimited frame rate)

    I have checked with exact same service at same settings with exactly the same things happening in the scene and the exact same viewpoint - only difference is DX11 vs DX12

    For me applying the settings (as in post#1) has transformed TSW2 from rather ugly picture with lots of LOD shifts, bad shadows and stuttering to a beautiful fluid experience with much much less perceived stuttering and pauses. Still far from ideal but absolutely better. I have increased view distance to "3" as it seems that a little bit less pop-in in distance (not fully verified yet - might be placebo :D ).

    Capping framerate to 90 FPS seems like the sweet-spot for me across most routes as the game only occasionally gets under this resulting in less overall stuttering.

    I run all on ultra settings at 125% rendering and TAA AA to reduce flickering on overhead lines on a 1440p 165Hz G-Sync monitor. Sure my rig helps a lot to attain the very good results (5950x (OC'ed), 3090 (OC'ed), 32GB DDR4@4000MT, Samsung PRO SSD´s )

    BIG thanks to geloxo for the effort here :D :D

    Cheers

    C
     
    Last edited: Jan 5, 2022
    • Like Like x 1
  13. Haribo112

    Haribo112 Well-Known Member

    Joined:
    Oct 1, 2020
    Messages:
    306
    Likes Received:
    478
    I also applied the engine.ini tweaks by geloxo. Interesting thing I found was that going from DX11 to DX12 with the settings actually decreased my FPS to around 40 at Munich - Pasing, whilst staying on DX11 with the tweaks actually gets me 60FPS. I'm sure that the main reason for the improvement is the render thread decoupling.

    Also interesting: under DX12, Windows 10 Task Manager is unable to show GPU load. I noticed the same thing in Farming Simulator 22, now I know that it's connected to using DX12.

    My rig: Ryzen 3600, RTX 2060, 32GB 3200mhz
     
  14. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,695
    Nice to see that things improved. The last thing I´m playing around is r.TextureStreaming=0 (it disables texture streaming). I found it to be the responsible setting that creates most of the remaining microfreezes during tile loading and in particular when moving trains are inside it. Indeed just using that setting alone in an empty engine.ini file has a big impact on tile loading performance. Reason for that is that distant trains spawn with their higher texture resolution.

    The impact was not that high as far as I remember with UE 4.23 cause I have used that setting for a long time but if something has changed with UE 4.26 maybe we need an alternative to this setting. Personally I hate the texture streaming as it produces a lot of LOD pop in even at short distance, but if we face a performance killer here we need to think it twice. I´ll keep you updated and thanks for the comments.

    Cheers
     
    Last edited: Jan 5, 2022
    • Like Like x 3
    • Helpful Helpful x 1
  15. rober

    rober Member

    Joined:
    Oct 15, 2021
    Messages:
    33
    Likes Received:
    12
    What about r.Streaming.FullyLoadUsedTextures=1?
    Thanks for your help
     
  16. kurtosizm

    kurtosizm Well-Known Member

    Joined:
    Oct 29, 2021
    Messages:
    251
    Likes Received:
    638
    Sorry for the noob question, but how do I enable DX12? I'm playing on Epic.
     
  17. rober

    rober Member

    Joined:
    Oct 15, 2021
    Messages:
    33
    Likes Received:
    12
    In the store, go to your profile > settings > TSW2: check aditional arguments in the command line and put -dx12 in the textbox
     
    • Like Like x 2
  18. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,695
    Yes, that´s one of the natural alternatives. I was testing it indeed now. The problem is that as soon as Texture Streaming is enabled you get blurry textures in the cab for instance. In the TGV case that´s terrible as it takes like 1s for engine to update the max resolution view. That´s one of the reasons why I always hated this feature. It saves performance, sure, but at the expense of quality. Let´s see if I can find something that works reasonably fine. Feel free to post your findings as well please, and we can check them.

    By the way the variables list is available here if you are insterested to investigate: https://digilander.libero.it/ZioYuri78/

    Cheers
     
    Last edited: Jan 5, 2022
  19. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,695
    Hi. After some testing I would recommend the usage of texture streaming instead of disabling it, as the performance hit is clearly reduced without noticeable quality loss. However some tweaks are still needed to optimize it and therefore the following variables should be used:

    r.Streaming.FramesForFullUpdate=1
    r.Streaming.PoolSize=5000
    r.Streaming.MaxTempMemoryAllowed=500

    Just replace r.TextureStreaming=0 by those variables when you want to use the texture streaming method.

    The pros:

    - Blurry textures appearing on high detailed cabs like the TGV case and in scenario are reduced by accelerating the streaming of higher quality texture MipMaps (that was the main downside effect of using it with the old version of the engine). In the worst case they can still briefly appear but just on the first time load of the cab after starting the service.
    - Less performance hit with still high quality details when used in combination with the other graphical settings tweaks.
    - Removes most of the remaining microfreezes and specially the ones when loading tiles with trains inside. Riesa-Dresden route does not suffer so much and things like the tile containing the chemical plant are loaded more fluently.
    - Allows to play heavier routes without so much workload on the HW as textures are not kept in memory for the whole ride, just when needed, and allowing to preload the high detail textures in advance before they become visible.
    - Eventual quality graphics increase now possible do to saved workload (higher viewdistance, higher LODs, etc)

    The cons:

    - Some heavy tiles are still a big challenge even with this method but the performance is overally improved in most cases and specially during regular gameplay.
    - Requires to monitor memory usage and set poolsize according to your graphics card limits to prevent overloading your card or the appearance of low detail textures in game. Go back to default pool size (2500) and increase it steps to find your best value. I proposed values which should be more than enough for cards with at least 8 Gb. Take into account that game can easily book more than 2Gb just for the standard rendering when using quality settings. This is most likely why DTG reduced the default UE value (4000 went down to 2500) to help less powerful cards but if you have VRAM available it has no sense to decrease the streaming capabilities.

    In my opinion the benefits are clear and I would vote for using texture streaming with UE 4.26 after those tweaks as streamer has been improved quite a lot compared to the 4.23 case after engine update. Those benefits are specially significant to deal with heavier routes and the ones that may come in the future. In a typical gameplay with all the settings together my card is just using 4Gb-6Gb and game is using 3Gb-5Gb (depending on the route), so memory utilization is really good and system runs below its max capabilities with GPU working almost at 90% and CPU at 20%-35% per core so that´s simply perfect as resources are not wasted while still having really good visuals and a smooth gameplay.

    Tests.jpg

    I updated the first post to keep both options for the time being. I also changed r.ShaderPipelineCache.BatchTime=1 just in case the streamer is still performing any shader computing per frame, even if we marked the shaders to be generated on load. It´s just 1ms per frame that shouldn´t hurt us too much anyway and it´s applicable only for the priority pipeline.

    I have not seen any pop in effects nor artifacts with those settings but if you find any issues please comment them here and if any fine tunning is required we can update the first post in accordance to help other users.

    Cheers
     
    Last edited: Jan 7, 2022
    • Helpful Helpful x 3
    • Like Like x 1
  20. paul.pavlinovich

    paul.pavlinovich Well-Known Member

    Joined:
    Aug 21, 2020
    Messages:
    1,684
    Likes Received:
    1,994
    Why do you think you can't record a G-Sync stream geloxo I record and stream with OBS and have G-Sync enabled. I don't face any issues. OBS just seems to figure it out and adjust to the recording and streaming FPS that I've configured.

    Paul
     
  21. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,695
    You can record, sure, but recording will not reflect what you see on the monitor while playing, because with Gsync the frequency changes (refresh rate) are done on the monitor side only. OBS just sees the graphical card output so for it that's always a card running at your selected desktop refresh rate or at the one set by game. You will be recording an output of 120Hz, 60Hz, etc all the time, but that's fixed as if you were using a regular monitor with Vsync.

    Cheers
     
    Last edited: Jan 6, 2022
  22. cavok

    cavok New Member

    Joined:
    Jan 5, 2022
    Messages:
    18
    Likes Received:
    5
    Hi Geloxo.

    Applied your new settings and yes it seems it has actually removed some of the micro stuttering I saw on the middle of the Hamburg Lubeck route :) performance wise though it seems there is very little difference in FPS between streaming or not streaming on my rig..

    Curious to understand if you have info on other variables to edit to leverage my rather big pool of VRAM (24GB) outside of the r.Streaming.PoolSize? There must be some benefit to having as much as possible already loaded in VRAM.. (with streaming I have seen 6.2GB max usage on Munich Hbh and without streaming 8.1GB - both with 4 in view distance)

    r.Streaming.PoolSize=8000
    r.Streaming.MaxTempMemoryAllowed=500

    Thanks in advance.

    C
     
  23. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,695
    My card has half the VRAM as yours and it barely hits the 6Gb usage either, so I think game does not need much more than that to run on high details with streaming enabled, which is indeed quite a lot. Maybe running at 300% or 400% resolution scaling or at 4K with 200% scaling or above may increase it. Normally antialias and resolution are the ones contributing to memory usage after the size of the 3D scene itself. But for streaming what is relevant is the amount of things which are visible in high details at the same time, so basically the foreground of the the scene.

    Take into account that the main reason to use streeming is indeed to reduce the need to load high resolution textures permanently in VRAM. With streaming they are pre-loaded before they become visible, resized to increase details as you get closer and removed as soon as object is not visible anymore. If that´s done fast enough and properly there´s no difference in terms of quality compared to have them resident in memory since loading the route and the performance hit is much lower. That´s the clear advantage of such method as it eventually allows to run more heavy tiles or trains all together in the same route without too much resources usage, as only the things which are visible are being stored in memory.

    All variables related to streaming are documented here: https://docs.unrealengine.com/4.27/en-US/RenderingAndGraphics/Textures/Streaming/Config/

    The ones that deal with the pool size are those two you posted. The first sets the pool size (VRAM usage) and the second is just setting a temporary amount of memory booked to perform those texture resizing computations that lever the quality of the textures while you approach the objects. You can just increase the second to 1Gb if you want but it should not be needed. That should be as big as the biggest MipMap that is going to be streamed and normally such big textures are only the ones of detailed satellite images for ground textures, which is not the case in this game. There´s nothing else as far as I know. Virtual texture usage appears to be disabled in game as far as I have seen in the config. The only extra that I can imagine is r.Streaming.PoolSizeForMeshes=-1. This is currently -1, so meshes and textures share the same pool. You could book some more Gb there just to be used by meshes alone but taking into account the amount of details the meshes have now this is not really needed and it´s fine to just have a shared pool which is big enough. I will test it a bit anyway...

    So basically you can set 50Gb pool size if you want but it will be just used up to the amount the game needs. Bigger sizes just ensure that the room is booked, but not that it will be always used.

    Cheers
     
    Last edited: Jan 6, 2022
    • Helpful Helpful x 1
  24. solicitr

    solicitr Well-Known Member

    Joined:
    Jun 20, 2020
    Messages:
    11,736
    Likes Received:
    17,949
    Sadly, my aging 1060 only has 3GB of VRAM.
     
  25. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,695
    Then just stay with DTG's default settings for pool size and texture streaming. That´s still enough if you are using texture extreaming and should help you a lot with your old card. Did you tried that? Don´t use the red portion of my config or just use the first variable alone (r.Streaming.FramesForFullUpdate=1). That should still give you at least a fast streaming, even if it´s not using a big pool.

    Cheers
     
  26. kurtosizm

    kurtosizm Well-Known Member

    Joined:
    Oct 29, 2021
    Messages:
    251
    Likes Received:
    638
    So I ran a test with the settings you provided in the first post, and I have to say I'm very impressed, this is the first time I managed to enjoy the Nahverkehr Dresden route. I'm not having a very powerful machine, only an i7 with a GTX 1060 6GB and 16GB RAM, but it runs around 40-45 FPS with ultra settings, some micro stutters here and there, but nothing serious. Thank you!
     
    • Like Like x 1
  27. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,695
    Thanks to you guys for providing the feedback. I´m happy to see it works well in more machines everytime. I´m enjoying myself many of the routes after the tweaks too. Just played at RRO today and Hagen tile loaded in one go with just two ultrashort microfreezes. It contained like 4 moving trains inside, so I was never able to achive those results in the past.

    For your info the link to post itself was reported to helpdesk some days ago. I hope Matt or devs can take some minutes to read the first post at least and adress it for investigation as it seems we could have solved many of the ancient issues that destroyed performance and playability in the past. The remaining microfreezes may just be related to the buffer sizes or the reading speed of data itself. I´m sure DTG could manage to improve that sooner or later so that we can have a more efficient engine.

    Stress test at Munich: 7Gb of VRAM usage, 5Gb of RAM used by game, GPU working at 60% and CPU working around 50% with a 75% peak on all cores during the tile loading itself. This is the worst part of that route and maybe still CPU limited because I was using a x3 viewdistance and there are tons of objects in the yards and the station together, but I still got 55 FPS there. Simply amazing :o This tile is a big challenge due to the amount of details it contains and we can´t go too crazy with quality there but DX12 is still a clear winner in this case without any doubts.

    Munich.jpg

    Cheers
     
    Last edited: Jan 6, 2022
    • Like Like x 2
  28. Callum B.

    Callum B. Well-Known Member

    Joined:
    Aug 9, 2018
    Messages:
    1,638
    Likes Received:
    2,844
    Something you might like to add to the graphical improvements section of your config is:
    Code:
    r.Shadow.FilterMethod=1
    This forces UE4 to use Nvidia's PCSS shadow technology, which makes shadows diffuse and get softer the further they are from the source object. I think it creates a really subtle effect which adds to the realism. I have not noticed any performance difference between the default ("0") and PCSS, but it might slightly affect lower end cards like a GTX 1050ti.

    Comparisons:
    [​IMG]
    [​IMG]
    [​IMG]
    [​IMG]

    Cheers
     
    Last edited: Jan 7, 2022
    • Like Like x 4
    • Helpful Helpful x 3
  29. cavok

    cavok New Member

    Joined:
    Jan 5, 2022
    Messages:
    18
    Likes Received:
    5
    Ok this is absolutely fantastic - just had an late afternoon drive with a lot of long shadows - stunning difference !!!

    BIG thanks for this.
    :D C
     
  30. Dinosbacsi

    Dinosbacsi Well-Known Member

    Joined:
    Sep 20, 2017
    Messages:
    3,312
    Likes Received:
    8,665
    Wow, that looks amazing. I have a 1050Ti, but I will give it a try and see what peformance I get.
     
  31. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,695
    I will add that setting to the shadows topic which is referenced in the first post. Many thanks Callum.

    Cheers
     
    Last edited: Jan 7, 2022
    • Like Like x 1
  32. martschuffing

    martschuffing Well-Known Member

    Joined:
    Aug 8, 2020
    Messages:
    920
    Likes Received:
    668
    Applying those settings under DX12 is a stutter fest, however, under DX11 there's is quite an improvement.
     
  33. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,695
    You can use them with both DX11 or DX12. There´s no command which is specific for any of the two DX modes. I just got better results myself while using DX12.

    Cheers
     
  34. fanta1682002

    fanta1682002 Well-Known Member

    Joined:
    Dec 22, 2019
    Messages:
    1,175
    Likes Received:
    561
    add
    r.Shadow.FilterMethod=1
    -5fps
     
  35. PegasusLeosRailwayFanatix

    PegasusLeosRailwayFanatix Well-Known Member

    Joined:
    Jul 7, 2020
    Messages:
    1,473
    Likes Received:
    1,010
    Unfortunately, i am still encountering some lag and frame drop even though I have a new build for my computer.
    I am unfortunately still using Nvidia Geforce gtx 760 which is outdated than all of you here, but i have a better motherboard which is an asus gaming motherboard rog Strix z590 with intel core i7- 11700.

    Is there a reason why i am still experiencing some lagging and blurry in the game?

    Using Asus Tuf Gaming monitor as well
     
  36. paul.pavlinovich

    paul.pavlinovich Well-Known Member

    Joined:
    Aug 21, 2020
    Messages:
    1,684
    Likes Received:
    1,994
    You will always experience some tile loading lag and every now and then the game does a little bit of thinking while you play and you can experience a brief pause then. The unreal engine wasn't exactly designed for fast moving trains :).
     
  37. martschuffing

    martschuffing Well-Known Member

    Joined:
    Aug 8, 2020
    Messages:
    920
    Likes Received:
    668
    You can say that again! But it used to run smooth.
     
    • Like Like x 1
  38. Teflon490

    Teflon490 Active Member

    Joined:
    Mar 29, 2020
    Messages:
    158
    Likes Received:
    127
    Sorry, but you answered yourself in your very post. That GPU is so old that I am actually amazed you can start the game at all.
     
  39. PegasusLeosRailwayFanatix

    PegasusLeosRailwayFanatix Well-Known Member

    Joined:
    Jul 7, 2020
    Messages:
    1,473
    Likes Received:
    1,010
    I have to use the recommended setting though, which still allows me to play the game but lag in some parts. I am still waiting for GPU to come back to normal before buying it. I am waiting for the Nvidia RTX Series price to go back to normal before buying.
     
  40. solicitr

    solicitr Well-Known Member

    Joined:
    Jun 20, 2020
    Messages:
    11,736
    Likes Received:
    17,949
    It's frickin' insane. Even old 1060s are selling for upwards of $350 US.
     
  41. graham.haddon

    graham.haddon Well-Known Member

    Joined:
    Nov 28, 2020
    Messages:
    264
    Likes Received:
    258
    With the latest adjustments for texture streaming now in my ini file tsw is as smooth as I have ever played it. The gauges on LGV dont go blurry at all. Thank you geloxo
     
    • Like Like x 1
  42. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,695
    Hi.

    I have made some changes to the variables cause I discovered that garbage collector is still creating lags which delay the other threads. We can´t get rid of it or the memory usage will grow... Death to garbage collector! :D I prevented it from being triggered while the running threads are busy registering objects, reduced the cleaning rate and increased the creation rate. That should give us a small boost with tile loading and reduce some of the existing hitching. The variables which are changed are:

    gc.TimeBetweenPurgingPendingKillObjects
    gc.NumRetriesBeforeForcingGC
    gc.MinDesiredObjectsPerSubTask
    s.LevelStreamingComponentsUnregistrationGranularity
    s.LevelStreamingComponentsRegistrationGranularity
    r.Streaming.NumStaticComponentsProcessedPerFrame

    This helps a bit for instance on Riesa-Dresden in the tiles next to the chemical plant that reproduced a continuous hitching while approaching the plant due to its high amount of details and globally when loading regular tiles. I didn´t see during tests that memory usage goes out of control but if for some reason you see that your memory grows abnormally fast simply reduce a bit the cleaning interval (first variable).

    With the low timers we are using (1ms per frame booked for the tasks) we should not need massive creation rates (last two variables) because we are creating objects very frequently, but maybe you can reduce them a bit if you find that some tiles load slower in your system than when using lower values. I just left them high so that threads can use the available time to create more objects whenever that´s possible before loading the tile. High numbers should not create problems as far as I have seen but don´t go too crazy with them anyway.

    I may fine tune those variables but first post is updated with new values anyway.

    Cheers
     
    Last edited: Jan 8, 2022
    • Helpful Helpful x 2
    • Like Like x 1
  43. dhekelian

    dhekelian Well-Known Member

    Joined:
    Nov 24, 2020
    Messages:
    2,054
    Likes Received:
    2,671
    Wow! That's like £300 yeah? I have got a spare 1080Ti might be worth flogging it.
     
  44. paul.pavlinovich

    paul.pavlinovich Well-Known Member

    Joined:
    Aug 21, 2020
    Messages:
    1,684
    Likes Received:
    1,994
    The minimum is a NVIDIA GeForce GTX 750 Ti which while its a lower number than the 760 will be more capable because its a Ti. That said, if you run at 1080 and don't be too ambitious on the settings you should be able to play but your experience isn't going to be optimal.

    You will always get some lag and hitching, Unreal could be better at massive maps and high speed moving things crossing tile boundaries, but it isn't. Read all the posts here of people on the endless quest to squeeze every last little bit of oopmh out of their systems and you'll see what I mean. Your processor and board are decent. Are you running the game from SSD? If you're not that can help too.

    Paul
     
  45. Nozomi329

    Nozomi329 Member

    Joined:
    Jun 6, 2019
    Messages:
    34
    Likes Received:
    42
    Just tried your first 6 lines of codes on LGV and the result is exciting. Didn't fix everything but definitely a dramatic improvement. Thank you very much for your effort!
     
    • Like Like x 1
  46. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,695
    Game is really needing tweaks and a deep revision. It could someday run massive maps but definitely not with the default engine parameters that were designed for running pacman in an Atari 30 years ago as it does today :D DTG needs to take this seriously as routes are worse in terms of performance after each release as they add more and more details and traffic to them. That turns them into a stuttering and freeze fest every 10 seconds.

    As an example you find ridiculously small caches for the indirect lights or shadows, which are some of the things that indeed can burn your resources when loading tiles. This together with all wasted time per frame kills the tile loading for example. Not to mention the garbage collector plage that has more than 20 variables just to save 1 Mb of RAM at the end of the day, and to do so it uses 1 year of your rendering frame time each time it´s triggered. It should be named garbage generator instead as it only creates problems.

    The only way to make this a bit healthy is to reduce the frame time delays and get rid of garbage collector as the proposed config does. But there´s still something else hidden there that freezes even the regular tiles because it doesn´t matter if you run at x10 viewdistance, with all LODs maxed at x4 or x5 and the streamer disabled or with default values you get exactly the same hitching at the same places systematically. Once the tile is loaded you have supergood FPS inside it with no lag nor stuttering at all. I think it´s something related to the lights or shadows computing but I can´t find it :(

    Cheers
     
    • Like Like x 7
  47. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,695
    More findings:

    r.IndirectLightingCache=0 (default 1)
    r.Shadow.WholeSceneShadowCacheMb=500 (default 150)
    demo.LoadCheckpointGarbageCollect=0 (default 1)

    The first variable should not be active, clearly. It enables the indirect light cache which is deprecated after UE 4.18 and replaced by volumetric lights (https://docs.unrealengine.com/4.27/en-US/RenderingAndGraphics/Lightmass/IndirectLightingCache/). When it´s enabled it´s still operating that cache and in addition to that the original cache size was ridiculous, so that put a lot of work during tile loading and regular gameplay when that was enabled.

    The second varible is the cache size for whole scene shadows. As we are running 4096 shadows this could be increased a bit (anyway we don´t need crazy values here as the shodows are not that heavy do to the short diewdistance they have. Normally something below 1Gb could be more than enough if you have some memory available).

    The last one is one of those bizarre things of garbage collector: if it´s active and you resume from an autosave (the savegames created when you complete tasks in game) there will be a call to trigger garbage collector after old actors are cleaned. For some reason this can create a huge freeze (up to 2 seconds I have seen) in some routes when loading the new tile which exists after the savegame position, specially if the tile is a detailed one. One example is the Chemical plant in Riesa-Dresden route. If you resumed game at the previous station (in case you passed a red signal for instance) you will have such big freeze when loading the tile, while in regular gameplay you don´t have it when passing the plant. Other cases that reproduced always were two freezes when leaving Hamburg station. I just don´t want to know what in the savegame content made them happen because savegames themselves are a world apart with all their problems, but the freezes are removed now anyway... :o:D

    It seems savegames are based on Unreal Replay system and they may be storing the content of whole ancient Alexandria library in each instance, and all related garbage together with them:

    https://docs.unrealengine.com/4.27/en-US/TestingAndOptimization/ReplaySystem/

    The fact is that first and third variables together prevent many of the hitching related by resuming from savegames or after savegames are stored.

    Cheers
     
    Last edited: Jan 9, 2022
    • Like Like x 5
    • Helpful Helpful x 2
  48. PegasusLeosRailwayFanatix

    PegasusLeosRailwayFanatix Well-Known Member

    Joined:
    Jul 7, 2020
    Messages:
    1,473
    Likes Received:
    1,010
    Yes, i am running under SSD, do you think that it's the graphic card that seems to be the problem, that's not allowing me to run smoothly with no lag?
     
    • Like Like x 1
  49. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,695
    Sorry but we need to forget about disabling indirect lighting cache with r.IndirectLightingCache=0. Disabling it creates frequent stuttering on some routes (specially the new ones). It shouldn´t but it does so this feature appears to be still used by game somewhere. The alternative to rezise the light cache (r.Cache.LightingCacheDimension, which defaults to 64) does not work either and it can create out of memory errors with values above 500.

    I´m now testing the third alternative, with is increasing the lights quality with r.LightFunctionQuality=2. That variable defaults to 1, which is an experimental option indeed that gives lower quality and I have changed to 2 which is the standard quality value. This works well together with disabling r.IndirectLightingCache to remove the long lasting hitches and does not produce that stuttering. If that proves to be efficient with no significant impact on performance I will add that to the first post. For the time being I have removed those things from config. The other variables can be still used.

    Cheers
     
    Last edited: Jan 9, 2022
    • Helpful Helpful x 2
    • Like Like x 1
  50. Callum B.

    Callum B. Well-Known Member

    Joined:
    Aug 9, 2018
    Messages:
    1,638
    Likes Received:
    2,844
    You say the indirect lighting cache was deprecated after UE 4.18, so perhaps it was used by the older TSW routes? Or does it also affect new ones?

    Cheers
     

Share This Page