Official 1C Company forum (http://forum.1cpublishing.eu/index.php)
-   King's Bounty (http://forum.1cpublishing.eu/forumdisplay.php?f=180)
-   -   Modding Darkside / WotN without the Editor (http://forum.1cpublishing.eu/showthread.php?t=229817)

 MattCaspermeyer 09-28-2016 04:51 AM

Modding Darkside / WotN without the Editor

I've been asked how I modded the game.

Here is the tool you need:

KB_DB_EDIT

You should be able to search these forums to get it and it should still be available. If not, let me know and I'll post it here.

What you need to do with KB_DB_EDIT is read the README.TXT file and learn how to decompile and compile the binary game files.

You will need to decompile the LOC files (these are basically the map data files) if you want to change stuff that appears on the maps / shops, etc.

Once the file is decompiled, you need to use your favorite text editor to make changes to the file.

The files have sections like this:

Code:

{Y}{embs}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 2 elements {         {Y}{els}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{1} // 13 elements         {                 {Y}{-N/A-}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 9 elements                 {                         {U}{rndid} = {2701106889}                         {A}{n} = {Aguzik_Big_Axe}                         {A}{aa} = {npc_dying_aguzak}                         {U}{f} = {33}                         {U}{cnt} = {1}                         {Y}{ii0}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 5 elements                         {                                 {X}{p} = {66660842DC1A8044CDCC2A420000803F}                                 {F}{a} = {6.04}                                 {F}{s} = {1.00}                                 {U}{u} = {1964}                                 {Y}{vp}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 2 elements                                 {                                         {Y}{hint}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 2 elements                                         {                                                 {U}{flags} = {0}                                                 {W}{strg} = {itext_m_tristrem_start_1964_hint}                                         }                                         {Y}{msg}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 2 elements                                         {                                                 {U}{flags} = {0}                                                 {W}{strg} = {itext_m_tristrem_start_1964_msg}                                         }                                 }
These are typically large files and so you need to search for the ATOM's of the units you want to change, for example:

Code:

                {Y}{-N/A-}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 8 elements                 {                         {U}{rndid} = {1784720102}                         {A}{n} = {embryo_4}                         {A}{aa} = {army_shaman}                         {U}{f} = {33}                         {U}{cnt} = {1}                         {Y}{ii0}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 5 elements                         {                                 {X}{p} = {CDCC6441AB1480449A99DC420000803F}                                 {F}{a} = {-0.84}                                 {F}{s} = {1.00}                                 {U}{u} = {1986}                                 {Y}{vp}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{1} // 0 elements                                 {                                 }                         }                         {Y}{aov}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{1} // 0 elements                         {                         }                         {Y}{e}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 8 elements                         {                                 {W}{name} = {}                                 {I}{jnt} = {-1}                                 {U}{tdf} = {0}                                 {Y}{choice}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 1 elements                                 {                                         {Y}{10}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 10 elements                                         {                                                 {W}{name} = {??????}                                                 {U}{bod} = {1}                                                 {U}{hero} = {0}                                                 {U}{lead1} = {1000}                                                 {U}{lead2} = {2000}                                                 {A}{script} = {}                                                 {U}{disp} = {1}                                                 {U}{arra} = {1}                                                 {A}{beh} = {Joining}                                                 {Y}{troops}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{1} // 1 elements                                                 {                                                         {Y}{-N/A-}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 8 elements                                                         {                                                                 {A}{races} = {}                                                                 {A}{units} = {shaman}                                                                 {A}{level} = {}                                                                 {A}{perc} = {100}                                                                 {A}{kolvo} = {1}                                                                 {U}{prob} = {10}                                                                 {I}{ext} = {-1}                                                                 {U}{fillt} = {0}                                                         }                                                 }                                         }                                 }                                 {U}{chance} = {100}                                 {U}{uid} = {6}                                 {U}{wuid} = {153791718}                                 {A}{class} = {army}                         }                 }
Buried in here is the number of Shamans you'll get from a stack (army_shaman) of friendly shamans that appear on the map::

Code:

                                                        {                                                                 {A}{races} = {}                                                                 {A}{units} = {shaman}                                                                 {A}{level} = {}                                                                 {A}{perc} = {100}                                                                 {A}{kolvo} = {1}                                                                 {U}{prob} = {10}                                                                 {I}{ext} = {-1}                                                                 {U}{fillt} = {0}                                                         }
{A}{units} = {shaman} refers to the ATOM file for that unit and {A}{kolvo} = {1} is the number you'll get. You can make simple changes, for example: {A}{kolvo} = {2 } will give you 2 shamans. You can save the TXT file and then compile it back into a LOC file with KB_DB_EDIT. Make very simple changes like that at first and then test it.

I can't stress the testing part enough because if you mess up the TXT file and recompile it and run the game with it, it will probably crash.

There is a steep learning curve for doing this, but I had to figure it out when I was creating my H3B mod for TL in order to make some of the changes I made to the game.

You can also use KB_DB_EDIT in combination with the AP / CW editor and then decompile simple maps you create, then make a slight change, and note the differences (use a file compare tool like WinMerge) in the two files.You can also learn the syntax used to do unit ranges / probabilities and other types of things via this type of method.

With KB_DB_EDIT you can mod the entire game without the editor plus there are certain things that I never figured out (for example you'll see rndid or uid and other codes that I have no idea how to generate), but you can always perform a trial and error change and see if it works. I did this a lot with TL and discovered that some of the ID's you can ignore while others you cannot.

See this post for an example of where to put the files you change: http://forum.1cpublishing.eu/showpos...1&postcount=21

Experimentation is key!

By the way, I haven't modded the game in about two years and so I had to go mostly off of memory (which is quite fuzzy) and I also don't frequent the forum much any more, but if you have questions, post them here and hopefully I'll swing by to answer them in the near future.

Good luck with trying to mod the game!

:-)

Matt

 jahes64 09-29-2016 07:29 AM

Thanks for the guide.

In prologue campaign of demoness in DarkSide, last stack is positioned very badly that we can't fight it! How to correct it?

Also how to load DarkSide maps in editor? I copied "darkside" folder from "sessions" folder of darkside's main directory to "sessions" folder of crossworlds's main directory, then started editor and chose "darkside", but all I got after choosing one of maps, was a crash!

 MattCaspermeyer 10-05-2016 03:23 AM

Quote:
Okay, KB_DB_EDIT is here:

Quote:
 Originally Posted by jahes64 (Post 714266) In prologue campaign of demoness in DarkSide, last stack is positioned very badly that we can't fight it! How to correct it?
If you are really good with KB_DB_EDIT and deciphering the LOC file in question, you should be able to reposition units with it. I'd suggest starting with Daert and playing with m_vampire_start\m_vampire_start.embryos.loc. Fiddle with this file because it is very small and you can use it to learn a lot about the file structure by making changes and starting a new game since you can immediately see your changes. Also look specifically at embryo_0 through 2.

Here is what I have for embryo_2 (I changed to give you female vampires):

Code:

                {Y}{-N/A-}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 8 elements                 {                         {U}{rndid} = {2709136742}                         {A}{n} = {embryo_2}                         {A}{aa} = {army_vampire_woman}                         {U}{f} = {33}                         {U}{cnt} = {1}                         {Y}{ii0}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 5 elements                         {                                 {X}{p} = {6666904200008044333388420000803F}                                 {F}{a} = {0.72}                                 {F}{s} = {1.00}                                 {U}{u} = {50}                                 {Y}{vp}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{1} // 0 elements                                 {                                 }                         }                         {Y}{aov}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{1} // 0 elements                         {                         }                         {Y}{e}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 8 elements                         {                                 {W}{name} = {}                                 {I}{jnt} = {-1}                                 {U}{tdf} = {0}                                 {Y}{choice}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 1 elements                                 {                                         {Y}{10}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 10 elements                                         {                                                 {W}{name} = {??????}                                                 {U}{bod} = {1}                                                 {U}{hero} = {0}                                                 {U}{lead1} = {1000}                                                 {U}{lead2} = {2000}                                                 {A}{script} = {}                                                 {U}{disp} = {1}                                                 {U}{arra} = {1}                                                 {A}{beh} = {Joining}                                                 {Y}{troops}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{1} // 1 elements                                                 {                                                         {Y}{-N/A-}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 8 elements                                                         {                                                                 {A}{races} = {}                                                                 {A}{units} = {vampire_woman}                                                                 {A}{level} = {}                                                                 {A}{perc} = {100}                                                                 {A}{kolvo} = {2}                                                                 {U}{prob} = {10}                                                                 {I}{ext} = {-1}                                                                 {U}{fillt} = {0}                                                         }                                                 }                                         }                                 }                                 {U}{chance} = {100}                                 {U}{uid} = {3}                                 {U}{wuid} = {1384780455}                                 {A}{class} = {army}                         }                 }
Note that I *think* the position is controlled via:

Code:

                                {X}{p} = {6666904200008044333388420000803F}                                 {F}{a} = {0.72}                                 {F}{s} = {1.00}                                 {U}{u} = {50}                                 {Y}{vp}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{1} // 0 elements                                 {                                 }
Note that the really long hexidecimal value after {X}{p} I never figured out how to generate. In my H3B mod I just ignored it and it seems to have caused no harm.

I'm guessing that these two deal with position: {F}{a} and {F}{s}? I'm not certain, but you'll have to experiment to find out. If those don't do anything, then I have no idea where they'd be - you'll have to use the editor to add a unit, save the session, copy the LOC, move the unit, save the session, and do a file compare of the old and new decompiled LOC text files.

Quote:
 Originally Posted by jahes64 (Post 714266) Also how to load DarkSide maps in editor? I copied "darkside" folder from "sessions" folder of darkside's main directory to "sessions" folder of crossworlds's main directory, then started editor and chose "darkside", but all I got after choosing one of maps, was a crash!
The editor creates a new session under your Windows User Name and somewhere down in AppData or something like that. Launch the editor, create a new session, and then go find it on your hard drive. I don't have AP / CW installed right now, so I'll have to install them to verify where the stuff is located...

Once you find it, then you can load LOC files from there, but the editor does crash a lot so you have to have a lot of patience with it.

All be sure to read all posts in the King's Bounty Editor Forum if you haven't done so already.

Good luck!

:-)

Matt

 jahes64 10-05-2016 09:16 PM

1 Attachment(s)

Btw I went for KBscaner for scanning saves to choose the best save before I start a new game, then I noticed that KB_DB_EDIT_0.75_eng.zip exist in my KBScaner archive! After comparing the file that I found with the one that you uploaded, I noticed that the file that I found in KBScanner archive is twice larger and its time stamp is newer than yours but its icon is of lower quality :confused: even though version number of both are the same.
Not sure but I think what I found is newer, so I attached it here.

Quote:
 The editor creates a new session under your Windows User Name and somewhere down in AppData or something like that. Launch the editor, create a new session, and then go find it on your hard drive. I don't have AP / CW installed right now, so I'll have to install them to verify where the stuff is located... Once you find it, then you can load LOC files from there, but the editor does crash a lot so you have to have a lot of patience with it.
I made a new session and saved it but it was saved in same directory that the editor asked its address when i started it for the first time. But I failed to load LOC files in it for edit purpose!
At best I managed to load LOC file from Misc/view storage file... just for viewing purpose. And what is more, after loading LOC map was not loaded, I just got a list!
How to load Darkside maps in it?

Quote:
 All be sure to read all posts in the King's Bounty Editor Forum if you haven't done so already.
Ok, I will do it.

 MattCaspermeyer 10-07-2016 02:54 AM

Quote:
My bad, I should have checked the ZIP file - I've edited my post and added another ZIP that includes the README and another "0.75" version of KB_DB_EDIT. Just use the one that you find works best as I'm not sure why there are so many "0.75" versions!

Quote:
 Originally Posted by jahes64 (Post 714350) Btw I went for KBscaner for scanning saves to choose the best save before I start a new game, then I noticed that KB_DB_EDIT_0.75_eng.zip exist in my KBScaner archive! After comparing the file that I found with the one that you uploaded, I noticed that the file that I found in KBScanner archive is twice larger and its time stamp is newer than yours but its icon is of lower quality :confused: even though version number of both are the same. Still README.TXT is missing. Not sure but I think what I found is newer, so I attached it here.
I forgot that KBScanner includes KB_DB_EDIT - the whole savegame file is dumped as if it is a LOC file (and other files, too).

Quote:
 Originally Posted by jahes64 (Post 714350) I made a new session and saved it but it was saved in same directory that the editor asked its address when i started it for the first time. But I failed to load LOC files in it for edit purpose! At best I managed to load LOC file from Misc/view storage file... just for viewing purpose. And what is more, after loading LOC map was not loaded, I just got a list! How to load Darkside maps in it? Ok, I will do it.
Someone loaded the Legend maps into it - there is a post about it in the Editor forum, so hopefully it gives you some hints how to do it.

I can see I'm going to have to go find the folder for you where it stores the sessions you're working on...

Matt

 MattCaspermeyer 10-07-2016 03:52 AM

Editor Data Is Here

Okay, here is where the King's Bounty Editor game data is located if you're going to use it:

<WINDOWS DRIVE>:\Users\<USER NAME>AppData\Local\VirtualStore\Program Files (x86)\1C Company\King's Bounty. Armored Princess\sessions

On my system, mine is located here:

C:\Users\Matt\AppData\Local\VirtualStore\Program Files (x86)\1C Company\King's Bounty. Armored Princess\sessions

So you should be able to find your King's Bounty Editor sessions under there that will include any new data you create (maps, etc.).

I made a new session and called it "sunset" so there is a sunset folder under there...

Good luck and keep posting questions here...

Matt

 jahes64 10-07-2016 03:05 PM

Quote:
 Originally Posted by MattCaspermeyer (Post 714362) My bad, I should have checked the ZIP file - I've edited my post and added another ZIP that includes the README and another "0.75" version of KB_DB_EDIT. Just use the one that you find works best as I'm not sure why there are so many "0.75" versions!
Thanks, but that readme file is in Russian, which is of no use to me. Is there no English version of it?

Quote:
 Originally Posted by MattCaspermeyer (Post 714362) I forgot that KBScanner includes KB_DB_EDIT - the whole savegame file is dumped as if it is a LOC file (and other files, too).
You mean this tool can edit saves too?

Quote:
 Originally Posted by MattCaspermeyer (Post 714362) Someone loaded the Legend maps into it - there is a post about it in the Editor forum, so hopefully it gives you some hints how to do it.
Ok, I will try to find that post.

Quote:
 Originally Posted by MattCaspermeyer (Post 714362) I can see I'm going to have to go find the folder for you where it stores the sessions you're working on... Matt
For me "1C Company" folder does not even exist here:
<WINDOWS DRIVE>:\Users\<USER NAME>AppData\Local\VirtualStore\Program Files (x86)\

I made another session and saved it, but again it saved in the folder that I had given its address to the editor first time that I ran the editor. (I chose a folder outside windows drive because damned "windows" folder of win7 grows up as time passes.)

That session is saved here for me (a single .strg file):

Anyway, I copied m_atrixus folder from
D:\GOG Games\King's Bounty - Dark Side\sessions\darkside\locations
to
and ran the editor, this time its name was in the list for me to choose for loading it in the editor.I loaded the map, found that bad positioned stack, corrected its location and saved it. But none of those files were updated (all had same checksums), instead a new file was created with .strg extension! I put it in mods folder, ran the game and went to fight that stack but nothing was changed!!! Then I closed the game, moved that file from mods folder to m_atrixus folder beside the files that it corrects, and ran the game again, but still position of that stack was not changed.

Should I put .strg files elsewhere to work???

 jahes64 10-07-2016 08:57 PM

After not getting desired change, I said to my self: Updated file might be somewhere in editor's directory and so went to find it. Fortunately enough, I was right! :-P
And found updated files here:
D:\GOG Games\Kings Bounty Crossworlds GOTY\sessions\orcs\locations\m_atrixus

I was surprised when I saw more than one file has been updated for a simple position change! Here is their names:

m_atrixus.atoms.loc
m_atrixus.embryos.loc
m_atrixus.land.loc
m_atrixus.lus.loc

I copied those updated files to mods folder and ran the game. Fortunately now position of that stack is corrected, but some textures such as Texture of the bridge before that stack are missing.:eek:

Do you know how can I fix this problem?

 MattCaspermeyer 10-08-2016 02:22 AM

Quote:
 Originally Posted by jahes64 (Post 714368) Thanks, but that readme file is in Russian, which is of no use to me. Is there no English version of it?
Man! I can't believe I keep screwing this up! Okay, I now updated the ZIP file to contain both the Russian and English README file - sorry about that!

Quote:
 Originally Posted by jahes64 (Post 714368) You mean this tool can edit saves too?
Yes and no - you can use it to edit save game files, but there is a checksum that I don't know where it is stored and so if you edit it, recompile, and continue, when you finish the game it will label you a cheater when you get your final score.

However, you can use it to create cheater save games if you want to try out stuff!

Quote:
Okay, you have the GOG version of the game and I have the Gamer's Gate version. It looks like they store stuff in different places, but it looks like you have it figured out...

By the way, the STRG files I could never get to work properly with KB_DB_EDIT - they seemed to hang it so be wary of that if you try to mess with them.

Quote:
 Originally Posted by jahes64 (Post 714375) After not getting desired change, I said to my self: Updated file might be somewhere in editor's directory and so went to find it. Fortunately enough, I was right! :-P And found updated files here: D:\GOG Games\Kings Bounty Crossworlds GOTY\sessions\orcs\locations\m_atrixus I was surprised when I saw more than one file has been updated for a simple position change! Here is their names: m_atrixus.atoms.loc m_atrixus.embryos.loc m_atrixus.land.loc m_atrixus.lus.loc I copied those updated files to mods folder and ran the game. Fortunately now position of that stack is corrected, but some textures such as Texture of the bridge before that stack are missing.:eek: Do you know how can I fix this problem?
I'm not sure how to fix the texture problem as I think that is something to do with the editor - you'll have to check the editor threads and see if someone ran into a similar problem.

But now that you have a new LOC file, you can do a file compare by decompiling both the old one and new one with KB_DB_EDIT (hopefully the file doesn't change massively, but if it does, just find the stack and compare the data). You should then manually be able to edit the decompiled LOC TXT file and then recompile it and you shouldn't have to worry about the texture problem.

By the way, the fact that more than one LOC file is generated could mean that the position of the unit is stored in a different file - that EMBRYOS file has info on the game's "embryos", but I don't know if it stores their position. One thing you can do, though, when you find the stack in the decompiled LOC file is note the various ID's associated with it and you can search on those (typically) and find that ID in the other decompiled text file(s).

Well, it sounds like you're starting to get dangerous ;-) and figuring stuff out on your own!

Keep plugging away at it and you'll be a pro in no time! Then you can school us! :-)

Matt

 jahes64 10-08-2016 12:11 PM

Quote:
 Originally Posted by MattCaspermeyer (Post 714380) Man! I can't believe I keep screwing this up! Okay, I now updated the ZIP file to contain both the Russian and English README file - sorry about that!

Quote:
 Originally Posted by MattCaspermeyer (Post 714380) Yes and no - you can use it to edit save game files, but there is a checksum that I don't know where it is stored and so if you edit it, recompile, and continue, when you finish the game it will label you a cheater when you get your final score. However, you can use it to create cheater save games if you want to try out stuff!
Then I won't bother with editing saves.

Quote:
 Originally Posted by MattCaspermeyer (Post 714380) Okay, you have the GOG version of the game and I have the Gamer's Gate version. It looks like they store stuff in different places, but it looks like you have it figured out... By the way, the STRG files I could never get to work properly with KB_DB_EDIT - they seemed to hang it so be wary of that if you try to mess with them.
Before finding updated files I changed extension of that file from .strg to .loc and put it on mods folder, which resulted at receiving error when I tried to run the game. Guess those are some temporary files that are useless.

Quote:
 Originally Posted by MattCaspermeyer (Post 714380) I'm not sure how to fix the texture problem as I think that is something to do with the editor - you'll have to check the editor threads and see if someone ran into a similar problem. But now that you have a new LOC file, you can do a file compare by decompiling both the old one and new one with KB_DB_EDIT (hopefully the file doesn't change massively, but if it does, just find the stack and compare the data). You should then manually be able to edit the decompiled LOC TXT file and then recompile it and you shouldn't have to worry about the texture problem. By the way, the fact that more than one LOC file is generated could mean that the position of the unit is stored in a different file - that EMBRYOS file has info on the game's "embryos", but I don't know if it stores their position. One thing you can do, though, when you find the stack in the decompiled LOC file is note the various ID's associated with it and you can search on those (typically) and find that ID in the other decompiled text file(s). Well, it sounds like you're starting to get dangerous ;-) and figuring stuff out on your own! Keep plugging away at it and you'll be a pro in no time! Then you can school us! :-) Matt
Ok, I decompiled all those 4 files and then compared them with "total commander", and it found at least 100 differences in each file!

After some testing I figured out that {X}{p} is dealing with position of stacks! Probably x,y and z along with their decimals make that number.

So a simple replacement of that number did the job and now everything is alright.

Now I am off to read modding forum and play previous installment a few times before trying to mod the game. Developer really have abandoned the game midway! Warriors of the north along with its expansion was the best in series (though companion part of it was its biggest flaw).