Settings

Theme

Show HN: Reversing Wing Commander to find the entity table in 64k to add co-op

fireflyk64.github.io

4 points by daniel_rh · 6 comments · 1 min read

Reader

I've always wanted to play Wing Commander with friends, so we could fly the story missions together. In 2015, I hypothesized that the full game state fit in the data segment (only 64k), and I could do small position and orientation experiments with vbindiff to discover how the memory was organized. Some fun findings: the camera was in entity index 0x3D (a "3D" joke?). My brother, Patrick, figured out Borland's overlay loader crashed the game until we made our stub look like a real stack frame. To play you need your own copy (e.g. the GOG version) and you drag setup.exe into the browser. It's a DOSBox mod: no game files are hosted. We reversed the game by hand, but LLMs were used for the recent browser/peer-to-peer WebRTC with voice chat port recently, and we continue to use them for ongoing work.

I'll be in the lobby for some hours if anyone wants to fly together.

3 threads
chengesu

An impressive saga! I enjoyed hearing about the the different tools involved at different stages of your development here. Is all the networking and job queuing happening synchronously from the game's point of view, or do you end up with potential latency when the commands come in from pilot B? It's wild to me that modern CPUs and networking is fast enough that all this extra stuff can happen the space of what would've been one tightly-scheduled frame of computation when the game was new.

  • daniel_rhOP

    Yes the old game only ran at 15-20 fps and it wasn't even synced to the clock! This endeavour also added time sync and I chose 20 fps (which makes some missions harder). Wingman shots are delayed by up to a few frames, but the system has a high latency mode that double-sends steering commands over the lossy layer. The weapon commands are at least synced with where the ships fly. I haven't tried too much in high latency scenarios (mostly LAN) so we will see how well it holds up online

    • chengesu

      I remember the lack of clock sync. When I got my 486, I had to slow it down to make WC playable. I recall I found a tool which would disable the internal cache, and also turned off the "Turbo" button.

daniel_rhOP

Here's the source code: https://github.com/danielrh/wcmulti if you notice any issues and want to file any tickets (or want to add support for X-Wing or others)

niviene

Niv was here - on behalf of Eagle-1, I'm SO EXCITED! :)

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection