# Thread: Creating a World - Developer's Setup Kit for Sound Editing

1. ## Creating a World - Developer's Setup Kit for Sound Editing

IntroductionThe most common way of providing custom sound in a mod is to include the generated IDX an DAT files, usually omitting the TXT files and any supporting sound files. This provides a major inconvenience when having to update sounds: a newly generated IDX\DAT set will have to provided which can run into hundreds of MB in the case of 'music' regardless of the extent of the change.

Winner of 3rd place in the 2019 'Favorite Tool & Resource for TW2 Engine' competition

Easy AlternativeThis installation provides an easy to use base for editing sound and animation files as well as a one click solution to generate new IDX\DAT files.
The ease of use principle should encourage modders to provide their mods with the original sound and animation files while encouraging the modding efforts of others. It also makes updating a mod extremely simple affair and in the case of sounds keeps the update to a low file size.
The InstallerWith the above in mind I have created an installer that will provide a working mod folder (battles only**) dedicated to the working with sounds and animations. It contains the following:
• The original sound TXT files as available here
• The animation files provided here plus the updated ram animations from kingdoms
• A set of zero byte IDX\DAT files for sound and animation (more in the 'The BAT file' section)
• A custom BAT file automating the generating of IDX\DAT files (more in the 'The BAT file' section)
• A CFG file with a dedicated log section, the log itself easily available by the provided desktop shortcut

** To test in a campaign simply copy the data\world folder from the default game into the mod, these files were not provided to keep the download small and uncluttered.
The BAT fileThis is the heart of the process and works as follows:
• copies the zero byte IDX\DAT files into their respective directories, forcing the game to generate new files
• renames the original game's data\animation directory
• starts the mod in Steam compatible mode
• after a wait of 20 seconds reverses the directory renaming

All of this effectively means that you only have to edit your files and start the mod to be able to test.

Spoiler for BAT file coding
Code:
@echo off
REM --- copying zero byte files
xcopy data\animations\_zerobytefiles\*.* data\animations /q /y
xcopy data\sounds\_zerobytefiles\*.* data\sounds /q /y
REM --- going up two levels to main game level
cd ..\..
REM --- going to the data subfolder and renaming the main game's animation folder
cd data
ren animations animations_backup
REM --- going back up one level to main game level
cd .\..
REM --- standard universal batch file
IF EXIST kingdoms.exe (start kingdoms.exe @%0\..\Configuration.cfg) ELSE (
IF EXIST medieval2.exe (start medieval2.exe @%0\..\Configuration.cfg) ELSE (
echo ERROR: Cannot find the M2TW or Kingdoms executable.
echo You probably installed this mod into the wrong folder.
pause
)
)
REM --- pausing the processing of commands for 20 seconds
timeout 20
REM --- reversing the renaming AFTER timeout has expired:
REM --- going to the data subfolder and renaming the main game's animation folder
cd data
ren animations_backup animations
Set up for upload in a larger modGeneral
Use the provided BAT file for your mod (no edit required)
To use the provided CFG file simply edit the mod folder name in the [features] section, edit the log's name at your convenience
Sound
Provide all sound TXT files and the full content (including zerobytefiles folder) of the data\sounds directory without any DAT\IDX files
Should your mod generate IDX\DAT files beyond the set in the zerobytefiles folder then create the additional requirement by a simple copy\rename of existing zero byte files
Animation
Provide the descr_skeleton file and the full content (including zerobytefiles folder) of the data\animations directory without any DAT\IDX files
Note
The BAT file will generate the required IDX\DAT files at the first start of the mod
Working Examples and Application
Animations
• Open descr_skeletons.txt and go to line 290
• Replace the CAS file entry (Strat_Diplomat_stand_A_idle.cas) with the one from the 'die_to_back_right_1' line (Strat_Diplomat_backward_1.cas)
• Save
• Start Dev Kit with the desktop shortcut
• Play as England and have your diplomat in France attempt diplomacy in Angers
• Watch him fall over backwards instead of doing his diplomatic dance

To implement that in your properly set up mod will only require to upload the edited descr_skeleton file.
Tip: always keep custom files in custom folders for easy updating.
Sounds
• Create the data\sounds\music directory
• Place into it a MP3 file of your choice
• Rename the file to (Credits)_We_are_all_one
• Start Dev Kit with the desktop shortcut
• Go to Options\View the Credits and listen to your sound track

To implement that in your properly set up mod will only require to upload the new sound track
This is one of my 'click through' installations. As long as your registry is fine the installer will find the correct installation path. If not, simply follow the instruction displayed in the installer

2. ## Re: Creating a World - Developer's Setup Kit for Sound Editing

Good one, Gigantus.

renames the original game's data\animation directory
You mean in the data folder of the base/core game not the mod's data folder, yes? Why does it need to do that? I've never worked with animations so maybe that's a noob question.

The BAT file will generate the required IDX\DAT files at the first start of the mod
That sounds like it only happens the first time you run the mod. But wouldn't it generate them on every running of the mod? Or is this BAT only intended to be used on the first run, and after that players should launch it in the normal way?

3. ## Re: Creating a World - Developer's Setup Kit for Sound Editing

For some reason animations require the default game's IDX\DAT files to be unavailable for generating to be able to use the 'unpacked' animation files for generating. Very unlike sound generation.

The generating will happen every time you start the mod - the music generating causes a delay of roughly 2-3 seconds at start up depending on your processing power, animations is barely measurable. I have yet to experiment with file calling within a BAT file - it would require a second BAT file to replace this one with a regular one for use in updates.
The rather short delay however did not seem to warrant that.

4. ## Re: Creating a World - Developer's Setup Kit for Sound Editing

Oh Man, this (the sounds) couldn't come at a better time. I'll have a look at it. Many thanks for this Gig

Edit: quick question: is the sounds kit works for all versions of the game? I mean - if this seems to be ok for a Steam version, what about the disk version of the game, especially the non-english one?
I'm asking because for my mod, there are some sounds and voices missing for the non-english version of the game.

5. ## Re: Creating a World - Developer's Setup Kit for Sound Editing

The language used\installed shouldn't really matter as I would think the TXT files are the same**, nor does it matter if it is the steam or disk version. It works just the same for all.

For some languages the local sound (mp3) files are missing and hence some accents are not working. I am guessing you are talking about German, check here how to fix that particular issue. It's a very simple matter of re-allocating the accent of some of the factions in descr_sounds_accents.

** I changed the local language in my desk version to German to test the issue in the linked resource and generated new IDX\DAT files from these TXT files after the descr_sounds_accent adjustment without a problem.

6. ## Re: Creating a World - Developer's Setup Kit for Sound Editing

I thought some version didn't get the same amount of accent compare to the english one? It seems that the french disk version of the game has some missing voices with SSHIP

7. ## Re: Creating a World - Developer's Setup Kit for Sound Editing

That's exactly was I was saying - the language specific stuff (mainly strat voices and all the data\text files) is in the localized.pack file - for the German version (the link I gave) no sound files were provided for the Eastern_european and Scottish accent, hence the relevant factions were totally mute on the strat map.

Check which accent the mute factions have in the French version and adjust descr_sounds_accents accordingly, then generate a new set of IDX\DAT files. You have the means now for that easy a fix, don't you?

Once again - it's not the TXT files that are the culprit, it's the missing sound files of the localized pack files. To be a bit cheeky - if CA had used my update system they only would have had to provide an edited descr_sounds_accents file and they would have been spared this embarrassment of mute factions

8. ## Re: Creating a World - Developer's Setup Kit for Sound Editing

I don't have a french version of the game. My both versions (disk and Steam) are in english. Ironic for a French, isn't it?

Seriously, if I get you right, I just need to ask the guys who reported that issue to send me or to check their descr_sounds_accents.txt file to find out. But there's a modified version of that file in out latest release. Could this be due to missing entries in the voice folder, itself located in the sounds folder? If yes, I'd just need to extract the sounds folder from the original game (in English) and would need to include in in my mod. At least, it will work in english. Am I right?

9. ## Re: Creating a World - Developer's Setup Kit for Sound Editing

Correct, default would be to simply cross check the mute factions against their accent allocation and change to it 'live' accent. that change only affects the events.dat\idx files (6MB max, compressed less then1MB) so you could simply provide these files plus the edited TXT file as interim solution

10. ## Re: Creating a World - Developer's Setup Kit for Sound Editing

I'll see what Ican do
Many thanks for your help again

11. ## Re: Creating a World - Developer's Setup Kit for Sound Editing

UPDATE

Winner of 3rd place in the 2019 'Favorite Tool & Resource for TW2 Engine' competition