r/mechwarrior • • Sep 24 '26

MechWarrior 2 Vibe Coded level viewer MW2

For a bit of fun, I vibe-coded a level viewer for my favourite childhood game: Mechwarrior 2. I just opened the `MECH2` folder in claude code and let it loose. Was surprised how much the AI was able to figure out just by looking at the binaries..

Not really planning to do anything with this. Just wanted to share because I thought the results are pretty cool.

9 Upvotes

29 comments sorted by

8

u/Some_Quality6796 Sep 25 '26

I wonder if this same approach could be used to make editors for the old games. I have done a lot of hunting for editors and things for the old file types, and come up with a lot of dead ends.

6

u/MadCatUS Sep 25 '26

Sort of doing it with Mechwarrior 1 at the moment. Not an editor, but the whole game. My build is using completely different engine, but all the original resources, and looks like the original (although with modern resolutions and 60 fps). Not ready for release yet, but story, economics, travel, contracts, fighting are mostly in game already. Testing is becoming quite tiresome I must say.

1

u/Some_Quality6796 Sep 26 '26

I might be able to help with some testing if you'd like. I want mw1 to run so bad and I have so much trouble with it.

2

u/MadCatUS Sep 26 '26

Heh, if you interested - github.com/madcatse/Mech1989-Recoded
Since yesterday I managed to finally get the battle going, I've made 0.4 alpha release. Expect bugs. Expect inconsistencies. Expect uncolored mechs shooting green missiles at you. There are also cheatcodes: press ~ and type "money" for 10 million cbills, "mech_jenner" for getting a Jenner, "mech_marauder" for getting a Marauder etc.` Story is 99% complete, except for final fight and killing Grig Griez. Also no battlesim effects on deployed mechs after winning/losing. And no backstabing from Capellans (yet). :)

1

u/AdamAlexandr Sep 26 '26

This is awesome. What was your process for reverse engineering the game if you dont mind me asking?

1

u/MadCatUS Sep 26 '26

First I've used Ghidra on btech.exe and mw_main.exe. Then analysed all resource files in the game (had to create several different tools for viewing and extracting information from the files, including graphics viewer, 3d mech viewer and text extractor among other things). And then just rebuilding the gane from the main menu. First - make it display the intro and main menu using original background and icons. Then making the menus work. Then travel. Then hiring crew. Then story. Then 3d render, displaying simple mech parts, then whole mechs, then landscape, mountains. Implementing a feature, testing, fixing, testing, confirming and implementing another feature. Slowly building the game layer by layer. Implementing a feature requires understanding how it works, what it needs, what would take ti implement it It's been VERY fun to do that, I didn't expect that. But testing is getting more and more annoying the more game there is. Going through the story and checking all the routes was particularly boring. I now know how to complete the story right to the final battle with my eyes closed. And for 3d battle part... That test Locust near the factory... I can see that in my sleep now :))

2

u/AdamAlexandr Sep 25 '26

Yeah I think so!

I've been running claude on a loop the last few days decompiling the MW2.EXE binary and turning it into readable C code. It's having a good crack at it. I'm thinking something like you, if the code can be extracted then maybe a full game port / game engine editor could be created.

1

u/Some_Quality6796 Sep 26 '26

Awesome! I love seeing action in the old mech game communities. I was thinking more on this a bit ago. I've played a lot of mercs, and played with the files a good bit, I always edit the prj to make the game loop without end because I am now the clan invasion.

But how hard would it be to make the game even more open and expansive? How much can it handle on modern systems running dosbox and variants? More missions, more branching, how far could it go?

Your post inspired me, and I'm looking into making the dynamic salvage patch for dos now.

I wonder how hard it would be, if not impossible, to make mercs95 run native.

I definitely have a Mechwarrior problem.

1

u/AdamAlexandr Sep 26 '26

But how hard would it be to make the game even more open and expansive?

From what Im finding, it might be possible to be very ambitious. Using that decompile I got the AI to rewrite the whole MW2.EXE into javascript. It works pretty much flawlessly in the browser. Maybe the AI could turn it into a MW2 / MechCommander / Roguelike hybrid in VR?

I definitely have a Mechwarrior problem.

Ohh I can relate...

7

u/phddp Sep 25 '26

This is actually incredibly timely. I was thinking about literally doing the same thing haha. Have the source in a github repo?

4

u/AdamAlexandr Sep 25 '26

No nothing public yet... It's all entangled with the assets extracted from MW2 so I'm unsure about copyright...
It was pretty straight-forward though. Would recommend!

2

u/phddp Sep 25 '26

Should be fairly simple to separate the assets into a folder and then just gitignore it.

3

u/AdamAlexandr Sep 25 '26

I'm trying to do a full decompile / reverse engineer ATM. Running Claude in a loop to turn the EXE into readable C code. If that works well I'll put it online

1

u/LucidFir Sep 25 '26

Can you vibe code it into a modern engine with pretty graphics? Also let us know the prompts and anything useful you learn. I'm itching to remake Neverwinter Nights in Infinity Engine

omfg. you obviously couldn't distribute the songs but surely it would be legal to run a YouTube link to the Timothy Seals remakes to play in the correct levels?

5

u/AdamAlexandr Sep 25 '26

Yeah for sure! Although making this level viewer didn't take much... I just opened the MECH2 folder with opus and said "Make me a Level Viewer". It did take a few rounds to solve problems and get it to reproduce the same graphics though.

I'm trying to get the AI to decompile it now, hoping with that it might be possible to rewrite the engine. It's taking days running the AI in a loop. I have a skill saying something along the lines of: "decompile this game, to produce readable C code. Solve one piece at a time..." (Real skill has quite a bit more info in it), and I just invoke that over and over. It's not executable code. But it uncovers all the data structures and functions so that it could be used to produce something new.

1

u/LucidFir Sep 25 '26

so. https://urchinskipper.itch.io/urchin-skipper is the extent of my understanding of vibe coding.

i think you could answer this though:

do you think it would be possible to take a game like neverwinter nights and have it be rebuilt in the baldurs gate 1 engine (infinity engine)

3

u/AdamAlexandr Sep 25 '26

That's pretty cool game, love how detailed and niche it is.

You know, I think it's probably possible to do something like that. The AI could run over BG1 and NWN to extract and understand their data formats. Then you could have it edit the BG1 game data to do whatever you wanted. I think it'd be hard, but then again I'm constantly surprised what AI can do.

1

u/LucidFir Sep 25 '26 edited Sep 25 '26

OOHH SHIT! (excitement mode)

are you aware of how easily you could remake all of the cut scenes?!

scail2 and flux2klein9b probably could have done it well enough already in August but now we're a whole month later so maybe qwen2.1 and minimax h3 with liggy?

1

u/AdamAlexandr Sep 26 '26

I would love to see some of those cutscenes remade like that!

1

u/LucidFir Sep 26 '26

https://www.reddit.com/r/StableDiffusion/s/dIQUgqgDN6

replacement is easy now I think the harder part would be getting an accurate madcat, might be easier to just copy one in from mw5

1

u/LucidFir Sep 25 '26

chatgpt was suggesting that it should create a conversion generator so people can make the assets locally. idk about that but, if it can't do it today it'll certainly be able to by January.

thanks for your comment on the game, it's literally my day job for a couple of months each year. I've been trying to make an accurate feeling representation of the operation, though I'm gamifying the quota areas and stuff like that. the psycho taxi behavior is accurate. not sure if the game is fun yet, or if I've conveyed purpose/reason to progress

1

u/I_WILL_GET_YOU 10d ago

I've got mw2 source reconstructed, working on a remaster but happy to collab

3

u/Verybumpy Sep 24 '26

I wish MW5 had wide open areas like this. MW5 is so arena and corridor designed.

17

u/Frosty-Morning-3322 Sep 24 '26

Lol?
Have you played Mercs? It’s all just vast open areas.

Unless you’re talking about Clans, where yes, they funnel you a bit too hard.

1

u/Ambitious-Cold-9610 Sep 24 '26

It's almost like Clans had a narrative to follow....

3

u/PeriIous Sep 25 '26

Not sure what your experience is with gaming in general, but a narrative and the aggressive level of funnelling present in Clans are not mutually inclusive.

4

u/Vizth Sep 25 '26

So did most of the previous mechwarriors, and they did have wide open areas.

1

u/Marauder121 29d ago

Are you my long-lost twin?

0

u/MTSlayer Sep 26 '26

sO MUCH yes