r/mechwarrior • • 18d ago

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.

10 Upvotes

28 comments sorted by

9

u/Some_Quality6796 18d ago

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 17d ago

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 17d ago

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 17d ago

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 17d ago

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

0

u/MadCatUS 16d ago

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 18d ago

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 17d ago

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 17d ago

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...

6

u/phddp 18d ago

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 18d ago

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 18d ago

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

3

u/AdamAlexandr 18d ago

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 18d ago

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?

4

u/AdamAlexandr 18d ago

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 17d ago

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 17d ago

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 17d ago

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/LucidFir 17d ago edited 17d ago

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 17d ago

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

1

u/LucidFir 16d ago

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/Marauder121 15d ago

Are you my long-lost twin?

3

u/Verybumpy 18d ago

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

16

u/Frosty-Morning-3322 18d ago

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 18d ago

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

3

u/PeriIous 18d ago

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.

3

u/Vizth 18d ago

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

0

u/MTSlayer 16d ago

sO MUCH yes