WC1/2 clone (NOT remake) proposal

Darkmage

Vice Admiral
Kevin, I can get that to you in about a week SWC has all the speech as riff wave audio :D you just mount the cd and copy off the speech files. bit busy atm with exams
 

ZOmegaZ

Rear Admiral
Well, I've finally gotten that thesis of mine done, and last week I found a fortunately distributed backup of my work on this project. In the last week or so I've almost fully decoded the briefing files, and I've got a Python script that will unbundle the briefing file into convenient data structures, then pack it back up again after any changes. There are still some things about the animation scripting I don't understand, so the facial expressions don't behave exactly right. I also haven't worked on the branching instructions, and there are two bytes in the animation controls that I don't understand. But overall, things look very good. I can now control what the characters say, how their mouths move, their facial expressions, who's talking, the background, and the font color. If there's enough interest, I may see about putting a convenient interface on my code. Either way I'll post my format documentation once I've got it a little more finalized.
 

CptnEisen

Spaceman
Well, that does sound quite interesting actually, back when I used to play around a lot with wc1, I managed to hex edit the briefing files to show different heads and change conversations, you've obviously got a heck of a lot further! (And as someone who still enjoys tooling around with the WC games to see what I can find, this would be an awesome little tool)
 

Mace

Vice Admiral
I used to fool around with hex-editting a bit myself, as far as i could tell all cinematic dialogue is hard-coded, the pilot names, and the promotion/demotion dialogues in halcyon's office, and the funerals.

Briefing dialogues were somewhere else?

In the days pas we used to simply PKLite to pack and then unpack the file, wich brought a lot of things up you could edit in tekst again, also If back in the day you had compiled an .exe file, you would pklite it, and then hex-edit some gibberish over the pklite comments, so no-one could unpack it again :p
 

Madman

Vice Admiral
this is a really awesome idea - as a fan of OPENTTD (the transport tycoon open source project) i cannot say how long i've waited for someone to try to build a win32 exe that uses the original wc files. The advantage obviously is that the game still needs the original WC, and that you could (in time) expand it to allow you to use say SWC graphics or the sega-cd speech.
 

ZOmegaZ

Rear Admiral
I used to fool around with hex-editting a bit myself, as far as i could tell all cinematic dialogue is hard-coded, the pilot names, and the promotion/demotion dialogues in halcyon's office, and the funerals.

Briefing dialogues were somewhere else?

Actually, some of that is stored in briefing.00#. All the bar conversations, briefings and debriefings are stored in the largest and final chunk of that file. The funerals, Halcyon's office conversations, and medal ceremony are all stored before that. The data's just arranged a little differently for the office and medal scenes.

Cinematic dialog I haven't quite placed yet. There are eight bytes per mission in the camp.00# files I haven't decoded yet, though. It might be that. Or it might be mixed into the first part of the briefing files, I haven't gotten to that either.
 

CptnEisen

Spaceman
Do you have any documentation on what you've already uncovered? it'd be interesting to see, even if unfinished and maybe some others who're interested might be able to help you with working out the 'gaps'
 

Flashpoint

Rear Admiral
I have successfully interpreted much of what you have in the briefings (not de-briefings yet) for WC1. I'm in the process of learning VB to put it all into a mission+briefings editor. There's a thread on the first or second page about it.
This was my first foray into hacking a game like this, so it's a bit humbling to see how much you have accomplished in such a short time.

If you manage to somehow make the graphics extractable/editable then I would be eternally grateful if you could chuck the info my way
 

Flashpoint

Rear Admiral
I didn't realise the actual mission tree data is hardcoded - how did SM1 get away from not having a separate .EXE file?

Are you sure?
I thought this was contained in the CAMP.xxx files. There are 3 of them after all and I thought camp was short for campaign.
 

ZOmegaZ

Rear Admiral
Glad you're finding this useful! I've actually made some serious progress in the last couple days, and I'm glad to say I've almost fully decoded both the briefing and camp files! Rather than keep posting them in this thread, I'll just upload my docs elsewhere so I can update them more easily.

http://srange.net/wc1/briefing/briefing_format.txt
http://srange.net/wc1/camp/camp_format.txt

And while this code isn't at all polished, it IS functional, and may be instructive. You'll need Python to run anything, and it accepts no command line arguments, everything is set up directly in code.

http://srange.net/wc1/camp/block_expander.py
http://srange.net/wc1/briefing/block_expander.py
http://srange.net/wc1/briefing/brief_expander.py

There's still one two-byte value for each briefing screen that I don't understand the purpose of, and four one-byte values for each mission in the camp file. They don't relate to things in any way I've identified. It may be something to do with cutscene triggers, or making Halcyon happy in your debriefing, but I'm not sure. I haven't fully quantified some branching conditions that I think are based on how much damage you took during the mission. My code doesn't seem to read one SM1 mission correctly. And I haven't looked at all at the funerals, medal ceremonies, or Halcyon office scenes, beyond knowing they're there. Other than that, I seem to have full control of briefing background, character, facial expressions, timing, speech, text, and branching, as well as of who shows up in the bar, the mission tree, medals, and how many points each mission objective is worth.

I've learned a few interesting things. Some missions are designed such that you would get a medal if you killed more enemy ships than are actually present in the mission. Sometimes the margin is just a few kill points, but sometimes it's several hundred. Many missions would award medals for 2000 KP, which would be several dozen kills, even though there's nowhere near that many enemies in any mission. That would make more sense if there wasn't a flag for "no medal of any kind". Another odd thing is with the variables that can be inserted into conversations, like your rank and callsign. $N inserts your name, but so does $P. $P is never used in any briefing file, though. I'm wondering if part of the engine wasn't originally designed to let you have a first name.

My current plan is to write a set of functions to decode and reencode all the data files, of every format. I've mostly got the camp and briefing files done, and the graphics files shouldn't be too much trouble since HCl (I'm pretty sure that's an "L" not a "1", right?) kindly documented the format so well. I expect the same with missions. About the only major format that isn't documented is the saved games. I don't know if I'll go to the trouble to put a pretty interface on my code. I do have grand visions of a single program that would allow you to edit all that is editable, but that would be somewhere down the line. :)
 

Flashpoint

Rear Admiral
Cool, I shall have a look at this when I get home.
You're obviously way further ahead (and better) in terms of figuring the files out than I am.
Unless you think it's cheeky, I may just wait until you've decoded them and put all my energy into a windows GUI

I think a GUI is important, most especially for the creation of new mission maps. I intend to have a game true depiction of the mission map that the user can play with, though I will need 2 maps, one showing the actual set up of the map and the other showing what the mission map will look like to the player.

The first version of the editor I want to get going should not be too fancy, I was going to leave the guts of the mission.xxx file alone, so if a mission has 11 speaking scenes, the user has to make their briefings last 11 scenes, though they can change the characters and background. Excellent work on the phonetics btw. The main thing that had pulled me up to a halt was trying to work out how you change the expressions/talking in the briefings.
The first version would also probably follow the Vega campaign structure.

Then I could work on version 2, where you have almost total freedom. Again great work on the campaign decoding, I am very excited to get home and look at this tonight.

Then ultimately I would love to be able to put my own pilots in the game if the gfx can be meddled with in any way.

Keep up the good work :)
 

ZOmegaZ

Rear Admiral
I certainly have no problem with you waiting to use my documentation! I was hoping someone would find it useful. Shoot, you can use my code if you want. I highly recommend learning Python if you're interested. It's a very flexible language, great for parsing files, or really pretty much anything else that doesn't require tight hardware control.

A little more progress. I looked at the funeral, office, and medal scenes. Nothing really surprising, a few more branch commands I hadn't seen. I think that's all of them, though there may still be more that are just never used in the game. And I think I'm close to unifying my code for both camp and briefing. I looked a little more at that SM1 mission debriefing that was giving me trouble. No results yet, but interestingly, Halcyon's mouth moves to say "Buy more games like Wing Commander 2!" I think once I get that problem solved, I'll move on. Next is graphics. With all this information and code, I want to see if I can make a program that will reproduce the briefing scenes!
 

ZOmegaZ

Rear Admiral
Try this link instead:

http://srange.net/wc1/code.zip

A few updates. That mission that doesn't read correctly I'm starting to suspect may be a mistake in the original file. It's the only one that's formatted differently than the rest. Not sure how the original engine behaves when it sees it, since I've never actually lost that particular mission. May try it sometime. And EVERYONE in SM1 is saying "Buy more games like Wing Commander 2".

I've started on the graphics code. I've got code to handle the ships, that was pretty easy with HCl's documentation. But I think decoding the rest of the graphics is going to be an entirely new endeavor, I'm not aware anyone has done that. Work begins now. Basic code is included in the above link.
 

ZOmegaZ

Rear Admiral
The above link is updated with code that will extract any graphics from WC1, as well as code for scaling, smoothing, and displaying those graphics. You'll need Python and Pygame to execute the display code. The graphics look pretty nice after being scaled up, though still nowhere near as good as high-res graphics would. I've also got complete documentation of what files store what graphics. Tell me, when in the game did the pilot give anyone the finger? 'Cause I don't remember seeing that one in-game...

I think I now have all the code required to read the graphic files and reproduce a talking head. I plan on doing that, and producing an updated graphic format document. The mid-game cutscenes have blocks of data in them which I presume to be instructions on how the various images are drawn and moved relative to each other. Haven't decoded that yet, it's on the list too. After that, maybe the music. I want to get a working rec room clone. Then maybe code to repackage graphics into the original format, for editing purposes.
 

Mace

Vice Admiral
as for giving the finger, and the game's faces saying you to "buy more games like wing commander 2", maybe you found a socalled "ghost in the machine", or simply playbacked the standard sequence in wich the images were placed in the files?

As for the cutscene dialogue, I am positive these things are hard-coded, since when I open up WC.exe using norton disk editor, and alter the phrase that plays back when winning the game(striking the cat base), the games plays back my alterations.

As for music, in-game music and how it is detected would be a nice thing to know, the KS version messed up, since if you make a "heroic kill", that little tune keeps repeating untill you land, and when you do that at the start of a mission, ou will hear it about 50.000 times in a row.
 

ZOmegaZ

Rear Admiral
Sorry I haven't posted any updates in a while, been busy moving. I haven't made terribly much progress, but I do have the start of a working talking-head engine. I can select a mission and a bar conversation, and the appropriate characters are drawn, and move their mouths and eyes in the correct fashion. No text shows up, partially because I haven't decoded the fonts yet, but I probably will just not bother with that for now and use some other font instead. Also, the locations of expressions seem to vary with the person talking. Shotglass and Paladin look dead perfect, but Angel's eyes and mouth end up floating off to the side of her head. There's no branching, and briefings and debriefings don't work. So like I said, it's a start. :)
 
Top