XSEED Games

Official XSEED Games tumblr. We publish video games and like Onii dolls. Consider this a revival of our XSEED blog, but rebloggable!

We'll try to keep the news out and the fun and personal details in. Someone might post a blobfish or two. You never know.

If you would like to read about our early adventures, you can read them here!
Official XSEED Games tumblr. We publish video games and like Onii dolls. Consider this a revival of our XSEED blog, but rebloggable!

We'll try to keep the news out and the fun and personal details in. Someone might post a blobfish or two. You never know.

If you would like to read about our early adventures, you can read them here!
  • ask me anything
  • rss
  • archive
  • The Legend of Heroes: Trails of Cold Steel PC Guest Blog #1 from Peter “Durante” Thoman - Performance

    When XSEED approached me about contributing to their in-progress The Legend of Heroes: Trails of Cold Steel port, I was immediately excited about the prospect. The Trails in the Sky series features some of my favourite JRPGs on PC, so I looked forward to making this later game in the franchise the best it can be on PC.

    Of course, back at that point I didn’t quite anticipate just how involved I would get - I was expecting to do some optimization here and there, maybe amounting to a week or two of full-time work. Reality would turn out different, and in this series of articles I’ll give you some idea of why.

    The series is currently planned in 3 parts, leading up to the release of the game on August 2nd:

    • The first part, which you are reading right now, deals with performance aspects, primarily framerates and loading times.
    • The second part will describe the graphical enhancements and options available in the PC version, and how they came about.
    • Finally, the third part will go into some specific features of the PC port that aren’t direct graphical enhancements, and explain some of the challenges in implementing them. 

    The Beginning of the Performance Story

    It seems appropriate for a story about a program to begin with loading, and the initial issue that I was consulted on were in fact loading times. In the PC version of the game at that point, even on a fast machine, loading would routinely take upwards of 20 seconds. And these were not some infrequent large loads, but rather loading which occurred e.g. every single time a battle started and ended. Additionally, significant loading stutters were present frequently throughout the game.

    This was of course not an acceptable state of affairs. After a lengthy analysis, I figured out that the primary reason for both the stutters and the loading was that the game’s engine used Nvidia Cg (a - by now - very outdated and unsupported high-level shading language toolkit) to compile and load shaders at runtime. By caching and reusing shader compilation results, I was able to reduce loading times (after the initial load) to ~2-3 seconds, and also eliminate most stutter after a startup phase. Satisfied with the progress on the particular issue I was contacted about, I reported my findings and code.

    Standards

    Some time later, I was tasked with polishing up the game for its eventual release. While I spent some time improving graphical aspects in the game’s Cg-based version which existed at that point, with more playtesting I grew increasingly dissatisfied with its performance.

    As the game was originally released on PS3 and even Vita (though the PC version only uses PS3-level assets and effects or better), you would expect a fast desktop system to churn through it with incredible ease. However, at that point I had already discovered a specific scene and camera perspective in which my PC dropped down to 45 frames per second, completely CPU limited. Using a variety of profiling tools I discovered that the issue was primarily related to how the OpenGL/Cg rendering backend of the engine managed shader state, ending up with dozens of state setting calls for each individual draw call. By doing some of the more obvious optimizations and tweaks, I brought performance in my testing scene up to 55 FPS. At that point, I estimated that by fully optimizing the Cg-based renderer I might get the game up to around 80 FPS on my PC in that scene at best.

    That wasn’t going to be good enough.

    I could never accept a port with my name on it for a game that ran on PS3 at 30 FPS which only gets up to 80 FPS on my fast 2015 desktop system. In fact, I’d personally like to run a game like this on a low-power portable like the GPD Win, and with that level of performance this wouldn’t be possible.

    Changing Horses Midstream

    The only true solution to the performance issue would be to completely replace the rendering backend. The underlying engine already had a DX11 backend, but unlike OpenGL/Cg it was clearly not used by Falcom during the development of Trails of Cold Steel, and the game and its assets used a very large array of features not available or not functioning in the same way in in the DX11 backend. As such, switching to the different renderer was actually a larger change in some ways than all of the PC porting work that had been done up to this point.

    To give you a better understanding of what this means, here is the first screenshot I took during development of the DX11 version – and note that this was already after fixing a number of issues that would prevent the game from even starting:

    image

    In this screenshot you can see over a dozen separate rendering issues, some of which required fundamental engine extensions and reworking to fix. However, they were still just a subset of a final tally of 57 separate classes of rendering problems (not individual instances) related to changing the rendering backend. There’s no way I can go into all of them, but here is a particularly amusing one I was tracking at a much later point during development - as you can tell by everything no longer being a horrible mess:

    image

    The Result

    Regardless of all these issues and the effort required for porting to an entirely different rendering backend, it was all worth it in the end. The following chart gives you an idea of the (CPU) performance of the game on my PC at various stages in development:

    image

    The current state of the game, designated as “Optimized DX11 version”, is more in line with what you would expect from a good PS3 to PC port.

    I’d like to note one important fact about this chart: please don’t quote it as some kind of argument for how much faster DX11 is compared to OpenGL - this result is a direct consequence of how these APIs are used in their respective rendering backends in the underlying engine. I assume that the GL/Cg version is designed more as a development aid to very closely resemble the console targets than for performance on PC.

    Reaching almost 300 FPS on a high-end PC is nice, but ultimately rather pointless in a turn-based JRPG. What is more interesting and the real fruit of all this effort is performance on a really low-end system, such as the GPD Win portable. This video shows the game running on that device, and as you can see the mission of smooth gameplay on a portable at native 1280x720 resolution was accomplished. In terms of settings, this video uses the game’s “portable” settings, and what exactly that means - and also some ways in which the PC version will allow you to spend the massive performance overhead on a fast desktop PC - will be the topic of my next post about Trails of Cold Steel on PC.

    • July 19, 2017 (1:39 pm)
    • 143 notes
    • #xseed games
    • #xseed
    • #xseed blog
    • #the legend of heroes
    • #trails of cold steel
    • #guest post
    • #durante
    • #long post
    1. hamodimahmoud80-blog liked this
    2. brazillianwizard liked this
    3. ultra-violet-heart liked this
    4. the-warrior-of-hearts liked this
    5. obelisk729 liked this
    6. sirnightmareshadow liked this
    7. nufazdoodles liked this
    8. skeith-reaper liked this
    9. chosenherosync liked this
    10. hexy-hexley liked this
    11. farusantos liked this
    12. eccentric-opinion liked this
    13. tumblunni reblogged this from xseedgames
    14. hupiom liked this
    15. chrispynutt liked this
    16. crimsoninfinity90 liked this
    17. kleggskjegg liked this
    18. yoyoenix91 reblogged this from xseedgames
    19. yoyoenix91 liked this
    20. popcultureadventures liked this
    21. darkogamiya liked this
    22. ezekial52787 reblogged this from xseedgames and added:
      Just take my money already yo! First you gotta price it already though!!!!
    23. ezekial52787 liked this
    24. madcurry liked this
    25. 8-bitadonis liked this
    26. kyattchan liked this
    27. kaas liked this
    28. kaas reblogged this from xseedgames
    29. nuke117 liked this
    30. mahdijeddi liked this
    31. falmung liked this
    32. piercingbright liked this
    33. kinglongz liked this
    34. alantstark liked this
    35. mister-69 liked this
    36. freedomseekr liked this
    37. yeloazndevil liked this
    38. liryl liked this
    39. lazyandrelaxandcake liked this
    40. ounous liked this
    41. rovan84127 liked this
    42. chemultra liked this
    43. xseedgames posted this
    44. Show more notesLoading...