How Sega brought Shenmue back to life on PC

null

D3T is the UK studio behind the recent re-release of Shemue I & II on PC. It's a quality port, and the games hold up surprisingly well at high resolutions. But how do you go about getting a 20-year-old console game to run on modern hardware? I asked tech director Noel Austin about the process.

PC Gamer: Why do you think people still love Shenmue?

Noel Austin:
The love and passion that went into the original is clear. The team cared so deeply about the player experience, and it has rightly reached cult status. The controls and some of the mechanics seem clunky nowadays, but so many aspects of the game were groundbreaking at the time.

The world is incredibly detailed and well researched. Shenmue really gives the feel of living in Yokosuka in the late 1980s. There is very little hand holding. The player is expected to find their way around using maps and talking to people, which is quite refreshing in this modern age of constant objective markers.

When did you start work on the project?

We first took possession of the Shenmue archive back in October 2015. Ramp up was slow while we picked through the massive data archive and planned the approach we would take to porting the project. Over the lifetime of the project, probably at least 20 people have touched the code, although the peak team size was probably around 10 developers.

This project has been way more difficult than we ever expected and has been a real labour of love for the core team. We feel passionate about the game and we’re over the moon with the positive feedback we’ve received.

Was bringing a 20-year-old game to modern PCs difficult?

Incredibly difficult! At D3T we have worked on some very challenging projects, but this was by far the toughest. For example, there was no source code for the Dreamcast libraries, but luckily the Shenmue 2 Xbox version had source for the ported Xbox libraries.

It was definitely not  a case of dropping the Xbox libraries in and building Shenmue, but it gave us a good starting point. Even with that there were still many files missing which we had to reverse engineer from assembly code.

The Dreamcast and Xbox had 32-bit processors, but PS4 and Xbox One are 64-bit. This has a big implication with how memory and data are handled. It was a massive engineering effort to convert the code and resulted in many obvious and many subtle bugs, some of which were still being found close to release.

Working on a Japanese-developed game must’ve been tricky too...

The original code was written by Japanese developers, so all the comments are in Japanese. We used Google Translate a lot to try and get a handle on what the code was doing, but it’s often not clear. Shenmue 1 had the additional problem for us that the game logic was written in a separate scripting language and ALL the function names and variables were in Japanese too!

Interestingly, we found that once the resolution was increased existing bugs became more apparent. There’s also the issue of widescreen, with the game being designed to run in a 4:3 ratio. This meant many of the cutscenes didn’t work correctly, so we had to add black bars at the sides.

The original games were technical marvels and they were highly tuned for the specific hardware platforms, which didn’t give us as much performance headroom as we were expecting, given their age.

Were there any quirks of the Dreamcast hardware that made getting the first game working on PC especially difficult?

The Dreamcast hardware had some features which would prove difficult to emulate, particularly the audio and graphics systems.

The audio on the Dreamcast is mainly driven by a completely different chip to the main CPU. This chip is loaded with different programs defined by the original developer, specifying things such as loop points, reverb, volumes, envelopes, etc. We didn’t have the source data for this, which meant a lot of reverse engineering to get it sounding okay.

Regarding the graphics, the Dreamcast GPU had some powerful and unique features not found on modern cards. The two features which caused us the most headaches were the modifier volumes used for shadows and light volumes, and the ability to sort transparent geometry on a per pixel level. The lack of modifier volumes on our target platforms led us to use a hybrid stencil shadow approach similar to the Xbox version of Shenmue 2. This is different to the original and artefacts can occasionally be seen because of this.

Shenmue has a crazy passionate fan community. Did you consult with any hardcore fans during the project?

We spent a lot of time looking through fan sites and forums to collect information. In fact, they were incredibly useful. Special thanks to Shenmue Dojo and Shenmue Translation Pack in particular, as well as the many community members who have made modding tools public domain.

You must have felt a lot of pressure being in charge of re-releasing such a beloved series of games...

The pressure was immense, both from the expectation of the community and the importance of Shenmue as a brand within Sega. We know how passionate the community is about the series, and rightly so. The community worked very hard in pushing for these re-releases and we’re very grateful to have been given the opportunity to work on such iconic games. I hope that the fans can get some understanding of the difficulties in resurrecting these titles, and that the new features we’ve added have been positive additions to the games. On a personal level I am still amazed that a game I played so many years ago is now available in full HD on my console at home!

Did you find anything interesting in the source code?

The moon in Shenmue 2 is not a texture. It’s an actual 3D object in the distance correctly lit by the sun direction. This produces accurate phases. We were surprised by this level of detail! The Lucky Hit games adjust the physical behaviour of the ball based on the weather and temperature, calculated by the time of day. For cutscenes, the game switches to high definition heads and hands, which allow for more expression. In Shenmue 1 the game logic is all written in a scripting language. For Shenmue 2 they got rid of it and wrote the logic in C code directly.

Did you look into remastering extras such as the ‘What’s Shenmue?’ pre-order demo or the Shenmue Passport disc?

We did investigate the feasibility of porting these, but were unable to find the complete source code for these extra components.