Binary Conversion Batch File

SoaSE is a somewhat dated game that was designed to run well on older PCs at the time of its release, so I realized that it's probable that many modders are running the game on inferior hardware.

It's clear that storing .brushes, .entity, .mesh, and. particle files in binary format greatly improves performance, but it has also always been clear that this is in no way conducive to the convenient development and testing of a mod. I hope I've discovered a useful compromise. Before I continue, I'm aware of the existence of harpo's conversion GUI, hopefully this is something slightly different and useful for a specific purpose.

I've written a batch file that copies all .brushes, .entity, .mesh, and .particle files from your mod directory to a secondary directory for binary files. As a convention, I name the directory with the binary copies identically to the mod directory with "_bin" added on. Running the batch file again will compare the timestamps of the text and binary files, and replace modified files with newer copies. If you've ever coded for Sins, you may have noticed that all files have either BIN or TXT at the top depending on their format. The batch file looks for any files in the _bin folder with the TXT string in their contents and outputs a list of those files which are then fed as input to the appropriate conversion command. Also, files that no longer exist in the mod folder will be removed from the "_bin" folder.

Briefly, you can make edits, run the batch file, and see the edits in-game, but with the higher performance afforded by binary format files, all in seconds (sometimes longer.)

The only catch is that it uses the 'robocopy' command, which is only standard in Windows Vista, Windows 7 and Windows Server 2008.

From here on, the folder that contains your mod will be referred to as "mod", and the folder that contains binary copies of your files will be referred to as "mod_bin". Replace all instances of the word "mod" with the name of your mod.

It is important that the name of the folder that contains your mod does not contain any spaces. The command line program will interpret this as the declaration of a new command or parameter.

Instructions for use:


Original Sins of a Solar Empire

Copy the conversion executable "ConvertData_OriginalSins.exe" from "C:\Program Files\Stardock Games\Sins of a Solar Empire" to "C:\Users\%username%\AppData\Local\Ironclad Games\Sins of a Solar Empire\Mods-v1.193", where "%username%" is your user account name. The AppData folder is hidden. To show hidden files and folders, open Windows Explorer, click Organize, click Folder and search options, click the View tab, and click the Show Hidden Files and Folders radio button. In "Mods-v1.193", create a new Windows Batch File(file extension ".bat"), right-click the batch file and click edit, then copy and paste the following text into it:

robocopy mod\Window\ mod_bin\Window\ *.brushes /purge /xo
robocopy mod\GameInfo\ mod_bin\GameInfo\ *.entity /purge /xo
robocopy mod\Mesh\ mod_bin\Mesh\ *.mesh /purge /xo
robocopy mod\Particle\ mod_bin\Particle\ *.particle /purge /xo
for /f "usebackq" %%g in (`findstr /c:^"TXT^" /m mod_bin\Window\*.brushes`) do ConvertData_OriginalSins brushes %%g %%g bin
for /f "usebackq" %%g in (`findstr /c:^"TXT^" /m mod_bin\GameInfo\*.entity`) do ConvertData_OriginalSins entity %%g %%g bin
for /f "usebackq" %%g in (`findstr /c:^"TXT^" /m mod_bin\Mesh\*.mesh`) do ConvertData_OriginalSins mesh %%g %%g bin
for /f "usebackq" %%g in (`findstr /c:^"TXT^" /m mod_bin\Particle\*.particle`) do ConvertData_OriginalSins particle %%g %%g bin

Use the find and replace command (Ctrl+H) to replace all instances of the word "mod" with the name of your mod. Save the file and close the text editor.


Entrenchment

Copy the conversion executable "ConvertData_Entrenchment.exe" from "C:\Program Files\Stardock Games\Sins of a Solar Empire" to "C:\Users\%username%\AppData\Local\Ironclad Games\Sins of a Solar Empire\Mods-Entrenchment v1.053", where "%username%" is your user account name. The AppData folder is hidden. To show hidden files and folders, open Windows Explorer, click Organize, click Folder and search options, click the View tab, and click the Show Hidden Files and Folders radio button. In "Mods-Entrenchment v1.053", create a new Windows Batch File (file extension ".bat"), right-click the batch file and click edit, then copy and paste the following text into it:

robocopy mod\Window mod_bin\Window *.brushes /purge /xo
robocopy mod\GameInfo mod_bin\GameInfo *.entity /purge /xo
robocopy mod\Mesh mod_bin\Mesh *.mesh /purge /xo
robocopy mod\Particle mod_bin\Particle *.particle /purge /xo
for /f "usebackq" %%g in (`findstr /c:^"TXT^" /m mod_bin\Window\*.brushes`) do ConvertData_Entrenchment brushes %%g %%g bin
for /f "usebackq" %%g in (`findstr /c:^"TXT^" /m mod_bin\GameInfo\*.entity`) do ConvertData_Entrenchment entity %%g %%g bin
for /f "usebackq" %%g in (`findstr /c:^"TXT^" /m mod_bin\Mesh\*.mesh`) do ConvertData_Entrenchment mesh %%g %%g bin
for /f "usebackq" %%g in (`findstr /c:^"TXT^" /m mod_bin\Particle\*.particle`) do ConvertData_Entrenchment particle %%g %%g bin

Use the find and replace command (Ctrl+H) to replace all instances of the word "mod" with the name of your mod. Save the file and close the text editor.


Diplomacy

Copy the conversion executable "ConvertData_Diplomacy.exe" from "C:\Program Files\Stardock Games\Sins of a Solar Empire" to "C:\Users\%username%\AppData\Local\Ironclad Games\Sins of a Solar Empire\Mods-Diplomacy v1.34", where "%username%" is your user account name. The AppData folder is hidden. To show hidden files and folders, open Windows Explorer, click Organize, click Folder and search options, click the View tab, and click the Show Hidden Files and Folders radio button. In "Mods-Diplomacy v1.34", create a new Windows Batch File (file extension ".bat"), right-click the batch file and click edit, then copy and paste the following text into it:

robocopy mod\Window mod_bin\Window *.brushes /purge /xo
robocopy mod\GameInfo mod_bin\GameInfo *.entity /purge /xo
robocopy mod\Mesh mod_bin\Mesh *.mesh /purge /xo
robocopy mod\Particle mod_bin\Particle *.particle /purge /xo
for /f "usebackq" %%g in (`findstr /c:^"TXT^" /m mod_bin\Window\*.brushes`) do ConvertData_Diplomacy brushes %%g %%g bin
for /f "usebackq" %%g in (`findstr /c:^"TXT^" /m mod_bin\GameInfo\*.entity`) do ConvertData_Diplomacy entity %%g %%g bin
for /f "usebackq" %%g in (`findstr /c:^"TXT^" /m mod_bin\Mesh\*.mesh`) do ConvertData_Diplomacy mesh %%g %%g bin
for /f "usebackq" %%g in (`findstr /c:^"TXT^" /m mod_bin\Particle\*.particle`) do ConvertData_Diplomacy particle %%g %%g bin

Use the find and replace command (Ctrl+H) to replace all instances of the word "mod" with the name of your mod. Save the file and close the text editor.


Rebellion

Copy the conversion executable "ConvertData_Rebellion.exe" from "C:\Program Files\Stardock Games\Sins of a Solar Empire" to "C:\Users\%username%\Documents\My Games\Ironclad Games\Sins of a Solar Empire Rebellion\Mods-Rebellion v1.031", where "%username%" is your user account name. In "Mods-Rebellion v1.031", create a new Windows Batch File (file extension ".bat"), right-click the batch file and click edit, then copy and paste the following text into it:

robocopy mod\Window mod_bin\Window *.brushes /purge /xo
robocopy mod\GameInfo mod_bin\GameInfo *.entity /purge /xo
robocopy mod\Mesh mod_bin\Mesh *.mesh /purge /xo
robocopy mod\Particle mod_bin\Particle *.particle /purge /xo
for /f "usebackq" %%g in (`findstr /c:^"TXT^" /m mod_bin\Window\*.brushes`) do ConvertData_Rebellion brushes %%g %%g bin
for /f "usebackq" %%g in (`findstr /c:^"TXT^" /m mod_bin\GameInfo\*.entity`) do ConvertData_Rebellion entity %%g %%g bin
for /f "usebackq" %%g in (`findstr /c:^"TXT^" /m mod_bin\Mesh\*.mesh`) do ConvertData_Rebellion mesh %%g %%g bin
for /f "usebackq" %%g in (`findstr /c:^"TXT^" /m mod_bin\Particle\*.particle`) do ConvertData_Rebellion particle %%g %%g bin

Use the find and replace command (Ctrl+H) to replace all instances of the word "mod" with the name of your mod. Save the file and close the text editor.


Run the batch file. Then add the directory containing the binary copies to your Enabled Mods list by editing "EnabledMods.txt". Add "EnabledModName "mod_bin"" at the top of the list, where "mod" is the name of your mod, and increase the EnabledModNameCount value by 1. Save and close the file.

Run the batch file after anytime you edit your mod. It should take only a few seconds after the first time, unless you make many changes. You won't see changes in-game unless you run the batch file again, because the mod with the binary copies is higher in the hierarchy than your mod.

Doing this will increase performance, this is why Sins files are in binary format. Your computer converts those files to binary format to read them every time you play, that costs memory and processing power. Now you can edit and play with better performance at the same time with a bit of extra effort. Hopefully this is the best of both worlds.

Sorry if someone else has suggested something similar and I missed it.

7,176 views 8 replies
Reply #1 Top

I think I will continue to use the BIN/TXT GUI converter I have already. Its just as fast and less hassle then this.

so I realized that it's probable that many modders are running the game on inferior hardware.
End of quote

Um....Thanks for the insult? Because us modders never upgrade our hardware...... :|

Reply #2 Top

I only meant that some modders' hardware is lower in quality relative to others'.

I thought it might be useful because no downloading is necessary and this immediately identifies and updates only those files that have been modified. That seems more convenient for a modder making frequent changes than launching a program in which one would presumably have to select those files that have been modified manually, or re-convert an entire directory unnecessarily.

Over on the Danman forums this was met with appreciation, I was told this might be of use to others, so I made an account and posted it here.

Reply #3 Top

it is always a good idea to have alternate methods for various tasks, but most people will use the method that they feel most comfortable with, and the main difference with my text bin gui is as you said the download (including ALL of the convertdata's and other utilities that I offer to modders), in place converting of the files and the conversion of the ENTIRE folder(s), but there is also bxextreme's gui which works differently to mine.

harpo

 

Reply #4 Top

Quoting emberblaque, reply 2

Over on the Danman forums this was met with appreciation, I was told this might be of use to others, so I made an account and posted it here.
End of emberblaque's quote

With regard to other gaming communities, the Sins one has held up pretty good through the years (even with the influx of people bugging us over issues that have been beaten to death years ago).

All I will say is that any Sins work you do would be better dedicated to other aspects instead of txt to bin conversion.  This would mark the 3rd or 4th tool we've got for this.

Reply #5 Top

harpo's GUI, the Dekhranic SoaSE Mod Tool GUI (by Zanyth0x42, last updated three years ago), and the Sins Data Converter (by BCXtreme) are all general purpose programs. This batch file is not meant to compete with or supersede the existing programs. This is for one very specific purpose. This checks for timestamps so that only files that have been modified since the last time the batch file was run are copied and converted into the binary directory. This is so that people can enjoy easier development by editing their files in text, but playing with their files in binary. All one must do after following the above instructions is run the batch file. It's done in seconds, and no one has to select their expansion, or the individual files or folders they want to convert.

It's a workflow solution for modders. Literally any other reason that one would have to convert Sins data files would be better supported by the currently available GUIs. This is useful for one reason.

I use this when I'm making frequent changes in the Sins of the Prophets mod files. I run Sins on an old PC with low RAM and integrated graphics, making sure I play with my files in binary format easily doubles my performance. Doing it this way is far easier for me than using any of the available GUIs. I figured there was a possibility others in my situation existed.

Reply #6 Top

Quoting emberblaque, reply 6
Dekhranic SoaSE Mod Tool GUI
End of emberblaque's quote

This is actually not even available to the public anymore.

 

Reply #7 Top

Hi emberblaque, Thanks for the detailed post.  

I have tried this several times and I cannot get it to work.  

I copied "ConvertData_Rebellion.exe" into the correct directory then created a new .bat file with your copied text in it.  I then replaced all of the instances of "mod" with my mod name and saved.  I run the .bat file and it seems to run, then closes.  

The files in my mod are not converted to binary, and nothing seems to have been created.

Anything I missed?

Thanks!

 

And of course 3 seconds after i post this I figured it out.  The mod file name cannot have any spaces in it.  Corrected and all works great.

Thank you so much! 

Reply #8 Top

Yeah that's a command line thing, it figures if there's a space in the name that a new command or parameter is being declared. Thanks for bringing it up, I'll be sure to add that important bit to the original post.

Sorry I figured this thread was buried, wasn't checking for replies anymore.

I'm glad you found it useful.