PDA

View Full Version : How do you make a Campaign?



Bj007pro
July 4th, 2013, 05:38
I just want to make Campaign levels, - how do-I-do that?????? :)

DragonsLover
July 7th, 2013, 23:04
It's somehow a bit complicated. You must build your campaign by using the files of the original one. Even though it is possible to make new separate levels, you're kinda forced to use the texts and sounds of the original campaign since there's no solution to use custom ones that easily.

Skarok
July 8th, 2013, 09:02
Actually, there is a rather easy solution to modify the texts using the SFR tool, you can even change the names of creatures if you feel like it. Technically you can also change the speeches around, and if you'd be able to record MP2 files you could easily add those in too. The problem is that whenever you change a sound file, it'll cut out after something like 2 seconds in-game. No idea as to why that happens, since it appears even when you replace a 15 second long speech with a 3 second long one.

DragonsLover
July 8th, 2013, 23:21
No, there's a way to fix that. You must do some hex editing so that it respects the length of the sample.

Here's the quote of a private message I did with mefisto:



struct SDTIndex {
int isize; // index struct size (= 0x28)
int size; // file size
char filename[16];
int unknow1;
int unknow2;
int nsamples;
int unknow4;
};

That number is a total amount of samples in file.

Digital sound is written as a series of numbers which shows how the mechanic wave (-> sound wave) should change over time. Amount of those numbers (samples) in every second is usually constant and called "sampling rate". If the sampling rate in your example file is 44100, then the length of the sound is 135448/44100 = 3 seconds.


Hey Mefisto! :)

Maybe you could help me, I don't understand about something on the Dungeon Keeper 2 SDT sound files.

For every sound file contained into the SDT file, there are data which tells the size of the file, its name and other things. Here's what I know so far:

28 00 00 00 7A 49 00 00 63 6F 75 6E 74 30 30 31 2E 6D 70 32 00 00 00 00 22 56 10 24 00 00 00 00 18 11 02 00 ... [Mp2 file data]

File separator
Sound file size
File name (here, it's "count001.mp2")
Unknown
Sound file length?

I have a problem with the latest data (in cyan) where it seems to be some kind of sound file length. There was a problem with a mentor speech in French version where a file contained two speeches and longer in size, and one of them was empty and shorter in size. When I brought the corrections, making the shorter file being longer by taking the part from the longer one, the speech during the game is cut like if it kept the same sound file length as before. When I checked about that in the SDT file, it seems that the data in cyan isn't changed at all by MAStudio, which seems to be a problem.

What's the meaning of this data? I know it must be related to the sound file length, but how? I thought it was in milliseconds or such, but it's not. Do you think you could have an idea?

Thanks a lot! :)

Metal Gear Rex
July 8th, 2013, 23:25
Looks like I'll be able to include custom voices for my campaign after all. Thanks DL. Here's a cookie. [Cookie (http://keeperklan.com/members/349-MeinCookie)]

Skarok
July 8th, 2013, 23:29
Holy shit, that's awesome! And I was giving up on the idea of having new VAs for DKII already. Thanks!

DragonsLover
July 8th, 2013, 23:31
Glad it helps. :)

*Noms the cookie then stops* Oh geez, what I am doing? :o

Bj007pro
July 9th, 2013, 01:32
It's somehow a bit complicated. You must build your campaign by using the files of the original one. Even though it is possible to make new separate levels, you're kinda forced to use the texts and sounds of the original campaign since there's no solution to use custom ones that easily.

So like copy the regular Campaign files and then change the copied Campaign files?

DragonsLover
July 11th, 2013, 02:06
Kinda. You must replace the original campaign with your own.

Skarok
July 11th, 2013, 10:37
Kinda. You must replace the original campaign with your own.

Or you could simply release the maps as a campaign pack and make them playable via the commando line. I prefer this way as you don't have that much of a hassle to make extra backups of the original levels, plus you don't need to edit the Debriefing screens which in turn would require you to have a backup for the text file too.

But about the Hex editing again, how exactly would you do that for MP2s if you are completely new to such programs? I only used it once to somewhat modify a Text file, but I have no idea how tu use it for Sound files, nor what I'd really have to do. I just see hundreds of numbers and have no idea as to what i really have to do, so a short tutorial would be really helpful! :)

DragonsLover
July 11th, 2013, 23:56
Yup, you must have some knowledge on hex editing. Here's a very basic tutorial:

- Before you bring the change, open the .MP2 file into a sound editing software like Audacity. Note the duration of the sound in seconds and round it. Like, if it's 4,7 seconds, round it to 5.
- By using MAStudio 2002, import your speech file you desire into an existing slot. Note the size of the file.
- Once done, open the .SDT file you just altered using an hexadecimal editor such as XVI32. Search for the name of the .mp2 file used inside that file.
- Before the name, you should have two 00 bytes and right before, you should have the file size (represented in orange in the quote above). The size bytes are small endian, which means they're read backwards. In the example above, it should be 49 7A, which, in decimal, means 18810 bytes. Check if the file size is the same as the one you've noted earlier and brings the correction if necessary. Do NOT write in INSERT mode.
- If you move the hex cursor to the right, you should meet four 00 bytes after the file name, four random bytes, four extra 00 bytes and then you'll reach the sampling rate thing. Here, multiply the duration of the sound you noted earlier by 44100 and this should give you a number. Change this number in hexadecimal and revert it in small endian. Write down that value by replacing the old one in the SDT file where the cursor is. Then save the file.

If everything goes fine, you should hear the complete sound into the game.

Skarok
July 12th, 2013, 01:00
- Before the name, you should have two 00 bytes and right before, you should have the file size (represented in orange in the quote above). The size bytes are small endian, which means they're read backwards. In the example above, it should be 49 7A, which, in decimal, means 18810 bytes. Check if the file size is the same as the one you've noted earlier and brings the correction if necessary. Do NOT write in INSERT mode.
- If you move the hex cursor to the right, you should meet four 00 bytes after the file name, four random bytes, four extra 00 bytes and then you'll reach the sampling rate thing. Here, multiply the duration of the sound you noted earlier by 44100 and this should give you a number. Change this number in hexadecimal and revert it in small endian. Write down that value by replacing the old one in the SDT file where the cursor is. Then save the file.


I am somewhat confused. This is what I got right now, the Line that is marked Blue is the one I want to edit. The original MP2 I'm editing has a size of 15361 bytes.

http://img824.imageshack.us/img824/43/r2dp.png (http://imageshack.us/photo/my-images/824/r2dp.png/)

Now I have no idea what the name even is, I just used CTRL F to fund LvlSpe05.mp2 and this is what it showed me. I assume it is 76, as the two 00's are almost diirectly before it, which would make the 6C my file size. Now the decimal I'd get from 6C is 108 and the Binary is 1101100. Both of them are nowhere like the file size of my innitial file, so I'm not sure whether I'm loking at the right numbers.

Instead of the four 00's I have 5, though i assume that the first one is actually one of the random numbers. After them I have FF, which would be 255 in decimals and 11111111 in binary. Do I only change this or also the diggits after it? Also, 'Small endian' means stuff like 6C and similar values, right? And to edit it, would I simply use the 'Overwrite String' options?

Mothrayas
July 12th, 2013, 11:03
Look at the two bytes right before the two 00's: they say 01 3C. The system uses little endian, so in hex it actually reads 0x3C01. 0x3C01 in decimal is 15361. So those two bytes are the file size.

And from the look of it, the sample count would be where "68 94 05 00" is in your file. This would convert to 0x59468 which in turn is 365672 in decimal. Assuming 44100 samples/second, that would be a bit over eight seconds. Dunno if that's accurate, but I suppose it might be.

Quick note about little endian:
Say you have a hex number 0x12345678. In little endian, you put the bytes in reverse, so that number would be put in as "78 56 34 12". The opposite is big endian, where the number would appear as "12 34 56 78".

Skarok
July 12th, 2013, 11:36
And from the look of it, the sample count would be where "68 94 05 00" is in your file. This would convert to 0x59468 which in turn is 365672 in decimal. Assuming 44100 samples/second, that would be a bit over eight seconds. Dunno if that's accurate, but I suppose it might be.


I think I somewhat understood it now. Little endian means I simply put every byte into the reverse, so the last one becomes the first and the first the last. And I always have to take four bytes. Is it possible that there is something else aside from a 0 at the beginning though? So that I'd have something like 1x1234657? Also, the speech file I have is only 2.5 seconds long, so I'd need to multiply it with 44100 which would give me 110250. Now I'm confused as to why it suddenly gets so much bigger, considering the speech I used is relatively short while the former was way longer. Am I doing something wrong? Sorry for my confusion, I was always really bad at Math. But thanks for your help nevertheless!

Mothrayas
July 12th, 2013, 11:53
And I always have to take four bytes.

Not necessarily always, but in this case, yes. Four bytes are equal to 32 bits, and 32-bit computers work most efficiently with such numbers. They also have a good enough range for most purposes, either unsigned (0 to 4294967295) or signed (-2147483648 to 2147483647).


Is it possible that there is something else aside from a 0 at the beginning though? So that I'd have something like 1x1234657?

No. "0x" is just notation that signifies a hexadecimal number. There's no such thing as "1x" or anything like that.


Also, the speech file I have is only 2.5 seconds long, so I'd need to multiply it with 44100 which would give me 110250. Now I'm confused as to why it suddenly gets so much bigger, considering the speech I used is relatively short while the former was way longer. Am I doing something wrong?

I think you're supposed to change that number in the file so that it matches the new file. So convert the bytes "68 94 05 00" to what it should be (which is 110250 -> 0x1AEAA -> "AA AE 01 00").

Skarok
July 12th, 2013, 12:07
Thanks, I think I got it now! At least the test file I used doesn't have that "s-s-s-s-s-s-s-s sound" after the speech got played. Just one more question; I would like to use the completely empty Demo STD files to store new speeches. The problem is that they seem to lack any of these important numbers plus they apparently use WAV files instead of the usual MP2s. This is how it looks like with the sound file I loaded into it.

http://img845.imageshack.us/img845/4432/cxia.png (http://imageshack.us/photo/my-images/845/cxia.png/)

Now can I simply fill in these blank spots myself or is this not going to work? It looks to me like it says that there isn't even a file at all, so I'm not sure as to whether that would work.

Mothrayas
July 12th, 2013, 12:26
The file size would still be behind the filename, I guess. Scroll up one line and the filesize, followed by the 00 00s, should be visible on the end of the previous line.

Also, the sample count should still be put in the same spot as it used to be (the four bytes in between two other sets of four 00s), except now the original value is 0x00000000. Just put your sample count number where it should be.

Also, I'd replace the ".wav" with ".mp2" just in case. (Assuming you don't use wav, of course).

Skarok
July 12th, 2013, 12:49
The weird thing was that DKII doesn't use any WAV files for the speeches, it's MP2 everywhere else. So what I did was just copy the files from the Mentor STD over to replace that one and now I have 1500 MP2 slots again that seem to actually work. Should be easy enough now to add new speeches in, thanks for your help!

Syntheticdawn
February 20th, 2014, 16:01
It's somehow a bit complicated. You must build your campaign by using the files of the original one. Even though it is possible to make new separate levels, you're kinda forced to use the texts and sounds of the original campaign since there's no solution to use custom ones that easily.


No that is not correct you have an editor for the str filesw hich should in theory help people to put text . its at http://keeper.lubiki.pl

Skarok
February 20th, 2014, 18:27
No that is not correct you have an editor for the str filesw hich should in theory help people to put text . its at http://keeper.lubiki.pl

Yes, you can create new text messages, but you are forced to use the already existing files for this and each one can only hold 60 lines of text.