Wednesday, March 7, 2018

XING on PS4 and PSVR - Adventures in making a UE4 PS4 game

It's time to address the elephant in the room. We often get asked this question: When is XING: The Land Beyond coming to PS4 and PSVR?


And the answer?

Uh, a few months, maybe. Depends on a few things. BUT IT WILL BE WORTH THE WAIT!  Let's get into the details.

The Good Stuff


Not looking for a lengthy tirade on my trials and tribulations with the PS4? Here's a quick TL;DR about the upcoming PS4 version of XING: The Land Beyond.

Screenshot from our PS4 Exclusive Volcano level "Agnirok"

  • It's a 1:1 port of the PC version, plus an additional level. Every feature and location will be available with no compromises
  • We will ship with PS VR support right out of the box - no separate version necessary 
  • We'll be offering multiple graphics-quality settings to go along with PS4 Pro support
    • Base PS4
      • "Speed": Mix of medium and high settings, 1080p unlocked framerate, usually averaging around 40+ fps
      • "Quality": Mostly high settings, 1080p, locked 30 fps
      • PS VR: Low settings, slightly upscaled to native res, locked 60 fps
    • PS4 Pro
      • "Speed": Mostly Ultra settings, 1080p, unlocked framerate, usually averaging around 50+ fps
      • "Quality": Mostly high settings, 1800p upscaled to 4k, locked 30 fps
      • PS VR: Mix of low and medium settings, downsampled to native res, locked 60 fps
  • XING will support DS4 on televisions, and DS4 or Move in PS VR mode
  • It's currently running super well and feels awesome on PS4. Aside from a few minor technical issues and some performance considerations, I'm nearly ready to submit the game to certification. I'm shooting for submission by the end of this month, fully expecting to have to resubmit at least once. 
  • And yes, there are trophies!

Aw yeah first trophy winner right here

Right off the bat I'd like to say there are things I can't specifically go into due to NDAs and such, but I'll try to broadly cover my journey into PS4 development.


History with Sony


Believe it or not, we actually started development (and ran our Kickstarter, and founded WLI!) before the PS4 was even released. At that time, we were developing using UDK (Unreal Engine 3), and had absolutely no plans or hopes of releasing XING on anything but PC. Consoles seemed like only a possibility for those releasing pretty big games, or indie arcade-like titles. The PS3 was really showing it's age at that time as well, and like Jon Snow, I really knew nothing about development beyond pressing "compile" and hoping it works.




Fast forward to 2014. At this point we were really getting caught up in the buzz surrounding VR since we casually added Oculus DK1 support to our Kickstarter goals. Companies were starting to notice us due to our attendance at GDC and E3 that year, and we started a rapport with Oculus, NVIDIA, Epic, and others, each providing hardware and/or support for our humble game. We also switched to Unreal Engine 4 at this time - knowing full well we would be redoing a lot in exchange for modernity and flexibility.

That flexibility almost immediately payed of with our trip to PAX Prime (West) that year. Admittedly, we somewhat front-loaded our trade and consumer show trips throughout development, but it was at PAX where we first ran into Sony. We had heard about an unnamed PS VR prototype at E3, and they told us to talk to them at IndieCade. One more show later and we were on the list to receive a PS4 devkit!

I think at one point we had 7 PS VR devkits - they kept on revising it!

At that point XING was still pretty prototype-y. We had a few demo versions of the final levels, and a very rough layout of how the final game was going to be like. (We'll do a postmortem at some point detailing how flawed our approach was!) Still, I just got a PS4 devkit and I wanted to see how the game would run on it. After a month or so I was able to port our beach demo to the system, and things were looking good!

Then:
Some things familiar, some things not so much (9/2/2015)
Now:



Based off of our test on PS4 and Sony's eagerness to get us on their platform, we officially committed to a PS4 version in late 2015. We were hoping to get a simultaneous release in late 2016.

Remember that aside about "planning" earlier?

Turns out releasing a fully 3D and detailed 15-hour game on two SKUs with support for three brand new headsets and five different input methods with a company comprised of only three recent collage grads is a somewhat unreasonable goal.


Nope

Midway through 2016 we knew that there was no way we were going to hit our goals. I had to make a difficult decision:

I knew that if I released XING simultaneously on all these new platforms right when they were beginning to take off, we could expect the best sales. Vive and Rift had just come out and people were extremely hungry for content, especially for anything longer than a short demo. PS VR was set to launch in October, and naturally the thought of being a launch title was appealing. Sony had already inquired about our readiness, and we really wanted to deliver. Every opportunity seemed like it was on ticking clock.

I had a choice:
  1. Cut literally everything that wasn't 100% working (which would have been a lot), shore up all the loose ends in the game as quickly as possible, dump in a "you win" screen, and focus all remaining effort on making sure the game technically worked on all platforms.
  2. Bite the bullet and tell Sony we weren't ready. 
I knew that if I chose option two, we would lose out big financially. We would lose out on all the marketing opportunity of launch, the hype of VR, and the momentum of our recent trailers and shows. Going forward we would also lose the ability to simultaneously launch, as our company's bank account was starting to deplete and we would be more than tapped before finishing up work on both platforms.

Despite all this, I decided to wait.



I had a hard look at my goals, and at what I wanted out of this project. Ultimately, above all else I wanted to create, and create something I was proud of. I knew that by spending another year on development, the game would be simply more enjoyable, and I realized I'd rather have fewer people really enjoy their purchase than lots being frustrated by something that was just unfinished.

And so sing the muses. We ended up releasing on PC / VR just about a year later, as a complete experience, and I couldn't be more proud of it.


Or alternatively,

Proof that we made it in this industry

My decision was not without consequence. I had effectively shelved PS4 development while finalizing the game for PC, only having completed the simple demo nearly a year ago. While I had some work done, it was time to start looking at PS4.

The nitty gritty - PS4 development


My experience porting the demo was just about the best thing I could have done for prepping the game for PS4. I went into the port having absolutely no idea what I was doing. Things I quickly learned:
  • This thing is not a PC, but it kinda is
  • Performance is...weird
  • No, you can't just press the "Make PS4" button
  • Holy crap this is cool working with what usually is seen as a mysterious black box

Screenshot from our PS4 Exclusive Volcano level "Agnirok"

To low-level, or not to low-level...


One thing sticks out to me about my experience with PS4 development so far. I'm working with a million-plus lines of code Unreal Engine, and an equally complex PS4 SDK. Literally millions of man-hours have been put into the construction of both of these systems, all done by seasoned veterans of programming. 

Here's a story. In 2016, I went to GDC. My PS4 rep mentioned that Sony was doing technical evaluations of PSVR games and recommended I get XING submitted. I made a small build of XING to get evaluated and brought it into the engineers at the Sony booth. There were two guys from Sony there, and one from Epic. I fired up the game on their test kit, and they linked in a PS4 profiling tool. 

This was maybe 1/3 of the screen they had up
Immediately the one of the Sony engineers starts talking about some of the numbers on the profile we just took. I started furiously writing down everything he was saying. Frame pacing. GPU bubble. GPU Wait Time. Stream processor. Fetch Shaders. Memory Bus Bandwidth. Pretty soon it was just the Epic and Sony employing discussing these topics while I slowly stopped writing.

Here I was, showing my little game in a big fancy booth at GDC, listening to representatives from massive companies talk about things I had absolutely no idea were relevant. This was literally a game that I had been working on for years at that point and they might as well have been talking about biochemical engineering. I kept expecting them to boil down to "Well because of this you should probably move those trees over there" or "If you reduced the instruction count on your water shader, this scene would be running better", but they never came to those conclusions.

When I went home, I began researching everything they had said. I opened up the profiling tools myself and started studying graphics programming. I probably spent a week reading up exactly how a PS4 renders a scene, not really getting anywhere.




I suddenly realized something. 

These guys were never going to tell me how to make my scene run faster, because that's not what they do. They are engineers at AAA companies - they are going to take what the artist/designer gives them and MAKE it work. They were looking at my game and talking about how to render exactly what I showed them faster from an engine perspective. I realized as an indie developer, I don't have that luxury. I, for better or for worse, am at the mercy of other companies figuring out the low-level issues, because simply my time is better spent on the high-level work.

Why this is taking so damn long?


1. I'm the only one working on getting XING to run on PS4. 

Remember when I said we would lose out financially if we didn't release simultaneously in 2016? Turns out you need money to hire people to do work for you. Well, I've got the time and the hardware, so lets get to work.

2. Testing on the devkit is slow. 

When I'm working on fixing bugs for PC, it's typically a really fast iteration time. I can in-editor attempt a fix, then test it right away to see if things are good. Even for issues pertaining to the difference between a cooked build and the editor, the build is fast and typically testable with a standalone uncooked build.

On PS4, the differences are far more extreme. Also, not only do the builds take longer to make, I have to actually push them to the devkit, install them, turn on my TV, test them, attach them to the VS debugger, then finally start diagnosing the problem.




3. Supporting: PS4, PS4 + PS VR, PS4 Pro, PS4 Pro + PSVR

Sony is now mandating that all PS4 games come out with PS4 PRO support. In retrospect this is super cool and was relatively easy to get working because XING already supported a huge variety of graphics options in the PC version, but I still had to get a new devkit to work with, and spend time tweaking the graphics options and coding in some switches to get the game to know which kit it was running on. Not only that, but since I'm supporting PS VR I had to come up with settings for VR on base PS4 and PRO, further complicating things.

I had to create separate assets for all the button prompts in the game, including support for the Move controllers. The menu system also had to be rearranged quite a bit to make sense for PlayStation. Fortunately I had already implemented gamepad support, so there were not any drastic changes necessary.

That's not motion blur? -_- wut.

4. Little weird inexplicable bugs during gameplay.

It is actually incredible how identically everything works between PC and PS4 when using Unreal. However, little itty bitty differences can cause cascading problems. Timers sometimes don't quite work the same way. Audio is handed on a hardware level rather than software, resulting in weird timing and volume levels. Shaders get corrupted or simply look different, or shader level features are missing. The save system is synchronous by default on PS4, for some reason. Things are threaded weirdly. Ram allocation is bizarre. I need to address all of this while keeping complete compatibility with the shipped game on Steam and Oculus Home.

5. Optimization. 

Sony is very particular with exactly how well the game runs on PSVR, and I had a big challenge in pushing this graphically intense game on the system. The latest update on PC lists out many of the changes I made to get the game running better specifically on the PS4. This has been taking the majority of the time to get right, and will be one of the things that will be looked at the closest during certification

I have no idea what I'm doing.
6. Did I mention certification? 

Yeah, we have to go through that as well. Without going into specifics there are two certs we have to pass, each with comprehensive tests of performance, comfort, usability and technical stability. This stuff is ultimately great for the end-user, but absolutely delays shipping. We have yet to submit, though in all likelihood I'll be ready to by the end of this month. I'm being ultra critical about every system in the game as well as extra focused on making sure we maintain frame-rate throughout the game on every configuration and every level.

~End Thoughts~

I'm going CRAZY over here! Writing all this down is very cathartic - it's easy to lose sight of things while staring at a compiler and not feeling like you are getting much done. I know some of you are eagerly awaiting to play this game, and that really does keep me going. Like we mentioned in our previous post, PS4 is likely our last best home for the future.

Thanks for reading! Here's a pretty shot from the game for those who made it to the end: