Jump to content
Sign in to follow this  
Rokko

uncam: Combat Mission campaign extractor

Recommended Posts

Hello,

I had pretty much given up on CM back in 2016 for various reasons and mostly lost interest in anything CM related as well. The announcment of CMSF2 has brought me back somewhat and, coincidentally, I am currently learning a new programming language. So I decided to write a little application I had wanted to write even way back then, which can extract scenarios from campaign files so you can look at them in the editor or edit them. Mad Mike's ScAnCaDe is a great tool for parsing scenario files, extracting campaigns and visualizing scenario and campaign metadata. However, it does not work with the 'legacy' CM games Shock Force 1 and Afghanistan. Also, who knows if Mad Mike is still around to update it anymore for future versions. He did a great job deciphering the various campaign file formats that have existed throughout CM's lifetime and much of what I did is based on his groundwork (which involves a lot of staring at hundreds of rows of bytecode and figuring out which bytes stand for which variables), so credit where credit is due. And while according to the devs you should be able to play any old campaign in CMSF2 out of the box, now you can also extract the scenario files from these campaigns and update them to the new engine standards, even if the original creators are now longer around.

I decided to focus on the extraction part and didn't bother with any of the metadata listing and visualizing. The tool should be able to extract any campaign file from any CM game so far and should also work with CMSF2 once it's released. I originally wanted to extract every bit of information required to also recompile the campaign from the extracted data without any further input, but that proved to be more difficult than I anticipated because some of that information is compressed or decrypted within the campaign files and I have not found a way yet how to extract that. This includes the campaign victory/loss texts and the complete core units and campaign briefing data. Maybe I will manage to add this at a later point. For now the scenario extraction works really well however, but I need some feedback from others. I don't have any CM games installed currently besides Shock Force and thus have only been able to  thorougly test the CMSF stock campaign as well as many campaigns downloaded from the Scenario Depot. So if anyone finds a campaign that does not work, make sure to post or send me the error log file that should be created. Usage of the application is as simple as it can be, just put the .exe file in a directory that contains any number of campaign files and start the executable.

 

uncam-0.9.zip

Share this post


Link to post
Share on other sites

Thanks Rokko. This will definitely help folks who want to work on the old campaigns and bring them up tp 4.0 standards even on a map level.

Share this post


Link to post
Share on other sites
5 hours ago, Rokko said:

Hello,

I had pretty much given up on CM back in 2016 for various reasons and mostly lost interest in anything CM related as well. The announcment of CMSF2 has brought me back somewhat and, coincidentally, I am currently learning a new programming language. So I decided to write a little application I had wanted to write even way back then, which can extract scenarios from campaign files so you can look at them in the editor or edit them. Mad Mike's ScAnCaDe is a great tool for parsing scenario files, extracting campaigns and visualizing scenario and campaign metadata. However, it does not work with the 'legacy' CM games Shock Force 1 and Afghanistan. Also, who knows if Mad Mike is still around to update it anymore for future versions. He did a great job deciphering the various campaign file formats that have existed throughout CM's lifetime and much of what I did is based on his groundwork (which involves a lot of staring at hundreds of rows of bytecode and figuring out which bytes stand for which variables), so credit where credit is due. And while according to the devs you should be able to play any old campaign in CMSF2 out of the box, now you can also extract the scenario files from these campaigns and update them to the new engine standards, even if the original creators are now longer around.

I decided to focus on the extraction part and didn't bother with any of the metadata listing and visualizing. The tool should be able to extract any campaign file from any CM game so far and should also work with CMSF2 once it's released. I originally wanted to extract every bit of information required to also recompile the campaign from the extracted data without any further input, but that proved to be more difficult than I anticipated because some of that information is compressed or decrypted within the campaign files and I have not found a way yet how to extract that. This includes the campaign victory/loss texts and the complete core units and campaign briefing data. Maybe I will manage to add this at a later point. For now the scenario extraction works really well however, but I need some feedback from others. I don't have any CM games installed currently besides Shock Force and thus have only been able to  thorougly test the CMSF stock campaign as well as many campaigns downloaded from the Scenario Depot. So if anyone finds a campaign that does not work, make sure to post or send me the error log file that should be created. Usage of the application is as simple as it can be, just put the .exe file in a directory that contains any number of campaign files and start the executable.

uncam-0.9.zip

Please consider uploading this to CMODS III (http://cmmodsiii.greenasjade.net/) or PM @Bootie to coordinate making this generally available.  Thank you.

Share this post


Link to post
Share on other sites

It would be fantastic if you can also extract from saved files the exact number of troops lost / enemy killed by single unit !

Do you plan something like that ?  

Share this post


Link to post
Share on other sites
19 hours ago, Badger73 said:

Please consider uploading this to CMODS III (http://cmmodsiii.greenasjade.net/) or PM @Bootie to coordinate making this generally available.  Thank you.

I intend to do so, I just wanted to wait if someone reports any bugs or issues before doing so.

17 hours ago, jackal263 said:

It would be fantastic if you can also extract from saved files the exact number of troops lost / enemy killed by single unit !

Do you plan something like that ?  

No not really. The format for campaign files is pretty simple, it's basically just a bunch of files glued together, so all you have to do is find the glue. As I said Scenario (and savegame files) are much more complex and involve some sort of compression or decryption mechanism. I'm sure some reverse engineering expert could figure it out, but probably not me ;)

14 hours ago, para said:

Can you alter the mission time with this?

Not sure what you mean. You can extract scenario files from campaigns. You can open these files in the regular scenario editor then and alter whatever you like (or whatever can be altered with the editor). Repacking these (altered) scenario files back into a campaign files requires a little more input unfortunately, unless you don't mind losing the campaign briefing text/images.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×