Live data from Hacker News

Shenmue (1999) reverse engineering reveals possible sun position oversight

wulinshu.com

21–30 of 86 posts

Re: Shenmue (1999) reverse engineering reveals possible sun position oversight

#23
post #12

The tl;dr (though you should read!) of the "oversight" is that there's a constant used to adjust the sun's position that's seemingly based on latitude; in the first Shenmue, it's set to 22, and in Shenmue II - which uses much of the same code - it's set to 35. This is odd, because Shenmue I takes place at latitude 35°, and Shenmue II at 22° - precisely the other way around. If that's what's going on, it's sort of har…

[deleted]

Re: Shenmue (1999) reverse engineering reveals possible sun position oversight

#25
post #16

Reminds me of a similar story about Blast Corps, specifically how they implemented logic to correctly display apparent retrograde motion vis-a-vis the orbit of Venus from the perspective of Earth...all just for what basically amounts to a background animation. [0] [0] https://www.youtube.com/watch?v=FZ6eNJi02Qk

This is one of those things where it's like if you have to program them to move, it's probably just easiest to program it to be somewhat faithful instead of making up some other values.

To me it feels like one of those escapades we go on when we want to focus on doing some "fun" work.

Re: Shenmue (1999) reverse engineering reveals possible sun position oversight

#26

Man I loved this game so much as a kid. I remember being enthralled by opening the drawers, lol. I basically played it once a year every year from ages 9 - 16. Some of the enchantment was lost when I played the remaster recently, but still such a great world they built.

An all-timer for me as well! So much strange magic in there. No game before or sense has quite that vibe. Maybe a product of it coming out at just the right time. "Do you remember... that day?" "The day it snowed?" NO! The day I got it right as it came out. A Friday after school and I played for like 4 hours straight. Yes! I remember THAT day!

I traded a bunch of PSX games for a Dreamcast just so I could play Shenmue. My parents were pissed, but what a great game (and great console).

Re: Shenmue (1999) reverse engineering reveals possible sun position oversight

#27
post #12

The tl;dr (though you should read!) of the "oversight" is that there's a constant used to adjust the sun's position that's seemingly based on latitude; in the first Shenmue, it's set to 22, and in Shenmue II - which uses much of the same code - it's set to 35. This is odd, because Shenmue I takes place at latitude 35°, and Shenmue II at 22° - precisely the other way around. If that's what's going on, it's sort of har…

I wonder if it could be linked to the original development on the Sega Saturn, if I remember well the video of the prototype, Shenmue on Saturn was spanning across both Shenmue 1 and 2

Re: Shenmue (1999) reverse engineering reveals possible sun position oversight

#29
post #9

Earlier quoted context omitted.

Well that's ANOTHER oddball, semi-forgotten, great game!

Nintendo and Rare (as "Xbox Game Studios") figured out how to work together, and as of Feb 2024, you can play Blast Corps on the Nintendo Switch Online Expansion Pack (along with a bunch of other Rare games)

It's also on Xbox via Rare Replay. And you get to keep it.

Re: Shenmue (1999) reverse engineering reveals possible sun position oversight

#30
Shenmue is one of my favorite games. I did a bunch of Ghidra reversing on the Dreamcast version last year, since I wanted to add improvements to it. Like adding bilinear filtering on the sky background, making time run a bit (faster so you can see time specific events like Christmas/New Year more easily,) getting the game to run without disc swapping on an ODE, and adding antialiasing (which would require mipmaps to improve rendering performance, which would require higher texture compression levels to get them to fit, which would require a different texture format that supports that...) I never got around to actually implementing any of that, outside of doing some experiments, like forcing bilinear on all 2D elements.

I don't think I found the sun/moon code (or more likely I did, but didn't realize what exactly it was doing, Ghidra SH4 has serious problems with floating point instructions making following anything that uses them almost impossible) but I did find most of the other time related code for updating the clock/calendar.

One weird thing I found while doing that is about the in-game watch. You always have a watch in your inventory, so you'd think it would be hard coded in, but it's treated like any other item. The game also has code to check if the watch is missing and add it back in anyways. But the code that draws the on-screen clock also checks if you don't have the watch, and won't draw the clock if you don't have it (or at least part of the UI clock logic is disabled, I haven't actually tried seeing what happens if you don't have a watch to verify if my interpretation is correct).

On the PAL version, the code that checks for a missing watch is at 0x0c180dc6 (that's where the code is loaded into memory, subtract 0xc010000 to get the address in 1ST_READ.BIN), and I think the code for drawing the clock (or at maybe it was just updating the hands of the clock?) is at 0x0c18290a.

Dreamcast Shenmue has code to support other video modes, like alternate resolutions (320x240p!), antialiasing, and 24/32 bit color. They're a bit bugged, like when using antialiasing, the 2D elements being squashed into the left half of the screen, and some strange issue with the screen position for the RAMDAC being setting incorrectly, causing the screen to vibrate left/right by a pixel or two, but the 3D models were drawn correctly.

24-bit color worked surprisingly well (even if the flag intended to enable it didn't seem to work, and I had to force it elsewhere.) I would have thought that having less video RAM free would have caused serious problems, but the game just loaded fewer NPCs. It was strange playing without dithering.

Post reply on HN