Henne / Bright-Eyes

"Bright Eyes" is a variation of DOSBox with customized support for the CRPG "Das schwarze Auge 1 - Schicksalsklinge"
GNU General Public License v2.0
19 stars 7 forks source link

traveling times for ship passages #54

Open siebenstreich opened 1 year ago

siebenstreich commented 1 year ago

I think I found a bug. Not a bug in the original game (there are many), but a bug in BrightEyes where the game behaves differently than the original one.

In BrightEyes, it occasionally happens that a sea passage is announced with a traveling time of 0 hours, which never happened to me in the original game. I observed that in these situations, negative numbers do show up in the computations in the function get_passage_travel_hours(..) in seg063.cpp. By trial and error, I was able to fix this in my fork. However, I don't understand what the real problem is and I would like to have a better understanding. It seems that BCC and gcc are interpreting some type cast in an incompatible way.

Also, I find this a bit scary. We trust BrightEyes in exactly reproducing the original game since BCC produces the same machine code from the BrightEyes C code. But as we've seen, it might happen that gcc has a different interpretation of the C code. Are there more places like this? It would be great to have an automated way to scan the BrightEyes code for potentially problematic places.

There is a second incompatibility concerning sea traveling times. In the original game, sometimes super slow passage times show up. People have witnessed announcements of 210 hours (route Prem-Hjalsingor), and real in-game traveling times of about 2 weeks, see the discussion around this post. In BrightEyes, I've never seen these excessively slow ship passages. I've studied the BrightEyes code for the sea travel times quite a bit. As a conclusion, the highest possible announced travel time for Prem-Hjalsingor should be 70 hours. It might well be possible that the BrightEyes behavior is the one which was originally intended by the Attic programmers, and that the super slow ships are the result of a (typecasting?) bug. But of course, this buggy behavior should be reproduced by BrightEyes. I've stared quite some time at the code to guess the potential source of this incompatibility, but to no avail so far. Maybe someone with better low level debugging skills might help me out ? (By looking at the development of the exact memory content during the computation of the travel times, once in the original game and once in BrightEyes...)

tuxor1337 commented 1 year ago

I think I don't have the low level skills to check this in reasonable time. But I think it's a fascinating finding. Thanks for documenting it here in such detail :)