Babysteps towards modding

Force44

King
Joined
Dec 8, 2015
Messages
625
Location
The Low Countries
I am trying to make my first small adjustment to the game.

The goal is to change the Inca UP from two food and one production per mountain top into two food and one free citizen per mountaintop.

However (sofar) I have neiter knowledge of programming nor experience in modding.

So the first step I took was asking help from the community (in the Modmodding Q&A thread).

1) What programs do I needto edit the necessary files?
2) And where can I find those files?

I received a very helpful and encouraging reply from Merijn.

"The Incan UP (and many other UPs) are in the CvGameCoreDLL. You can find a folder in the mod folder with that name that contains all source files for building the DLL. Editing the DLL requires 2 steps. The first is editing the code itself, which is done by editing the code in the source files. The second is building the DLL. The link below has a tutorial how to set up everything in order to build the DLL. (The author of that tutorial should be familiar)
https://forums.civfanatics.com/threads/the-easiest-way-to-compile-a-new-dll.608137/"


I located a file named CVGameCoreDLL.dll in the folder…/Sid Meier's Civilization 4 Complete/Beyond the Sword/Mods/RFC Dawn of Civilization/Assets

Sofar so good (I hope)

Now I am taking babysteps with this project, so before bulding the DLL (step 2) I'd like to sucesfully edit the code itself once (step 1)

Besides, sofar I have no idea what a DLL is and why I would need (another) one.

"The language of the DLL source files is C++. Editing the source files can be done with any text editor, but I highly recommend not using just any. Visual Studio (required anyway for building the DLL) can be used for editing the source files for the DLL. Notepad++ is IMO also a good option, and that one can also be used for editing python. (And has a very useful "search in files" function)"

(I understand) Both Visual Sudio and Notepad++ are mentioned as programs that enable editing the CVGameCoreDLL.dll file. Notepad++ seemed recommended most to me because it was mentioned last and because it has a neat searchfuntion.

So I downloaded (and installed) Notepad++

From within Notepad++ I opened the file CVGamecoreDLL.dll and was faced by what seemed a lot of gibberish on first sight.
I copypasted the first 11 lines under the spoiler
Spoiler :

MZ ÿÿ ¸ @ º ´ Í!¸LÍ!This program cannot be run in DOS mode.

$ v˜/2tö|2tö|2tö|±|«|0tö|!|Ÿ|0tö|7x©|4tö|7xù|7tö|ò|¼|0tö|7x«|4tö|²|5tö|2t÷|Àtö|7x–|Xtö|7xª|3tö|7x¬|3tö|Rich2tö| PE L ìîÿ] à .!
= ð LÆ: = T “F R( LkF ´ PM „¶ _B H = Ì .text
ü< = `.rdata b« = ° = @ @.data † ÀH à ÀH @ À.reloc f¢ PM ° L @ B ‹AÃÌÌÌÌÌÌÌÌÌÌÌÌ‹AÃÌÌÌÌÌÌÌÌÌÌÌÌ‹A+AÃÌÌÌÌÌÌÌÌÌ‹AÃÌÌÌÌÌÌÌÌÌÌÌÌ‹AÃÌÌÌÌÌÌÌÌÌÌÌÌ‹AÃÌÌÌÌÌÌÌÌÌÌÌÌ‹AÃÌÌÌÌÌÌÌÌÌÌÌÌŠA$ÃÌÌÌÌÌÌÌÌÌÌÌÌ‹T$‹A(Q‹L$ˆˆÂ ÌÌÌÌÌÌÌÌÌ‹A,‹L$‹T$ˆˆÂ ÌÌÌÌÌÌÌÌÌÌÌÌ‹T$‹A0Q‹L$ˆˆÂ ÌÌÌÌÌÌÌÌÌ‹A4‹L$‹ˆÂ ÌÌÌ‹T$‹A4Q‹L$ˆˆÂ ÌÌÌÌÌÌÌÌÌ‹A8‹L$‹ˆÂ ÌÌÌ‹A<‹L$‹ˆÂ ÌÌÌ‹A@‹L$‹ˆÂ ÌÌÌ‹AD‹L$‹ˆÂ ÌÌÌV‹t$ƒþ1u!‹qH‹†Ä ™+ÂÑø‰†Ä ‹AH‹€Ä ^ ƒþ-Wt4ƒþ.t/ƒþ-|‹QH‹²<²™ƒâÂÁø‰‹AH‹°_^ ‹IH‹±_^ ‹QH‹²<²™ƒâÂÁø‰‹AH‹°_^ ÌÌÌÌÌÌÌÌÌÌÌÌ‹AH‹T$V‹t$‹°W<…ÿ}÷؋ЋIH±±_^ ÌÌÌÌÌÌÌ‹AL‹L$‹ˆÂ ÌÌÌ‹AL‹L$‹T$‰Â ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌ‹AP‹L$‹ˆÂ ÌÌÌ‹QP‹A‹L$+ŠÂ ‹AP‹L$‹T$ˆˆÂ ÌÌÌÌÌÌÌÌÌÌÌÌ‹AT‹T$3É9ŸÁŠÁ ÌÌÌÌÌÌÌÌÌÌÌÌ‹AX‹T$3É9ŸÁŠÁ ÌÌÌÌÌÌÌÌÌÌÌÌ‹A\‹L$‹ˆÂ ÌÌÌ‹A\‹L$‹T$‰Â ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌ‹I`‹D$‹TÁ‹ÁRPè ƒÄ ÌÌÌÌÌ‹Ad‹L$‹ˆ‹D$‹‚ ÌÌÌÌÌÌÌÌÌÌÌÌ‹Ah‹L$‹ˆ‹D$‹‚ ÌÌÌÌÌÌÌÌÌÌÌÌ‹Ah‹L$‹ˆ‹D$‹L$‚‚ ÌÌÌÌÌ‹Al‹L$‹ˆ‹D$‹‚ ÌÌÌÌÌÌÌÌÌÌÌÌ‹Al‹L$‹ˆ‹D$‹L$‚‚ ÌÌÌÌÌ‹Ap‹L$‹ˆÂ ÌÌÌ‹Ap‹L$‹T$ˆˆÂ ÌÌÌÌÌÌÌÌÌÌÌÌ‹At‹L$‹ˆÂ ÌÌÌ‹At‹L$‹T$ˆˆÂ ÌÌÌÌÌÌÌÌÌÌÌÌÇÿÿÿÿÇAÿÿÿÿÃÌ̸(°LÃÌÌÌÌÌÌÌÌÌÌ‹D$…À|‹Q¯Q;Â}‹ÐÁâЋA4Ð 3À ÌÌÌÌÌÌÌÌ¡Œ°L€x( S‹\$V‹pW‹|$t‹Ã+Ç™‹È3Ê+Ê‹Æ™+ÂÑø;È~+ñ_‹Æ^[ËÃ+Ç™_3Â^+Â[ÃÌÌÌÌÌÌÌÌÌÌÌÌ¡Œ°L€x) S‹\$V‹pW‹|$t‹Ã+Ç™‹È3Ê+Ê‹Æ™+ÂÑø;È~+ñ_‹Æ^[ËÃ+Ç™_3Â^+Â[ÃÌÌÌÌÌÌÌÌÌÌÌÌ‹D$‹‹L$;}‹ÁÃÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌSV‹ñ‹Fp3Û;ÃÇÔ=tPèr ƒÄ‰^p‹Ft;ÃtPèr ƒÄ‰^t‹F(;ÃtPèñq ƒÄ‰^(‹F,;ÃtPèÞq ƒÄ‰^,‹F0;ÃtPèËq ƒÄ‰^0‹F4;ÃtPè¸q ƒÄ‰^4‹F8;ÃtPè¥q ƒÄ‰^8‹F<;ÃtPè’q ƒÄ‰^<‹F@;ÃtPèq ƒÄ‰^@‹FD;ÃtPèlq ƒÄ‰^D‹FH;ÃtPèYq ƒÄ‰^H‹FL;ÃtPèFq ƒÄ‰^L‹FP;ÃtPè3q ƒÄ‰^P‹FT;ÃtPè q ƒÄ‰^T‹FX;ÃtPè
q ƒÄ‰^X‹F\;ÃtPèúp ƒÄ‰^\‹F`;ÃtPèçp ƒÄ‰^`W3ÿ‹Fd‹;ÃtPèÎp ‹NdƒÄ‰ƒÇÿÈ |Ü‹Fd;ÃtPèp ƒÄ‰^d3ÿëI ‹Vh‹;ÃtPèp ‹FhƒÄ‰ƒÇÿÈ |Ü‹Fh;ÃtPèop ƒÄ‰^h3ÿ¤$ ‹Nl‹;ÃtPèPp ‹VlƒÄ‰ƒÇÿÈ |Ü‹Fl;Ã_tPè.p ƒÄ‰^l^[ÃÌÌÌÌÌSV‹ñ‹Fp3Û;ÃWtPèp ƒÄ‰^p‹Ft;ÃtPèùo ƒÄ‰^t‹D$ŠL$‰F‰^‰^‰^‰^‰^‰^‰^ ˆN$3À‹V(‰‹N,‰‹V0‰‹N4‰‹V8‰‹N<‰‹V@‰‹ND‰‹VH‰‹NL‰ƒÀ=È |º3À› ‹VP‰‹NT‰‹VX‰ƒÀ=È |ä3ÀƒÏÿ‹N\‰<ƒÀ=È |𸠋N`Pèʉ9‰y‹N`L
‰9‰y‹V`Lø‰9‰y‹N`ȉ9‰y‹N`LƒÀ(=¨ ‰9‰y|»3ɍI ‹Vd‹‰‹Vd‹‰X‹Vd‹‰X3Àd$ ‹Vh‹‰‹Vl‹‰‹Vh‹‰\‹Vl‹‰\‹Vh‹‰\‹Vl‹‰\‹Vh‹‰\‹Vl‹‰\ƒÀ=° |¨ƒÁùÈ Œyÿÿÿ8\$…‡ ¹(°Lè5d ÀÀPè+n ƒÄ¹(°L‰Fp3ÿèd …À~ëI ‹Fp‰¸¹(°LƒÇèýc ;ø|é¹(°Lèg ÀÀPèåm ƒÄ¹(°L‰Ft3ÿèsg …À~‹Nt‰¹¹(°LƒÇè\g ;ø|é_^[ ÌÌSVW‹ù¹(°L3Û3öèc …À~3‹Gpƒ<° ~V¹(°LèUx ‹Èè>K „ÀtƒÃ¹(°LƒÆèjc ;ð|Í_^‹Ã[ÃìSUVW3ÿ‹é‰|$3Û¡”¼Lèb= „Àtl‹D$ ƒøÿt;Øu_‹”¼Lj L$Qè<t ‹ð…ötD› ‹ÎèÈ ‹@;Eu‹L$Q‹ÎèÅ^ „ÀtƒD$¡”¼Lj T$Rè8D ‹ð…öuÇD ƒÃÿHk Œnÿÿÿ‹D$_^][ƒÄ ÌÌÌÌÌÌÌÌÌÌÌÌÌÌ̃ìSUVW3ÿ‹é‰|$3Û¡”¼Lè¢< „Àtq‹D$ ƒøÿt;Øud‹”¼Lj L$Qè|s ‹ð…ötI› ‹ÎèYÇ ‹@;Eu‹L$$‹T$QR‹Îè÷ „ÀtƒD$‹
”¼Lj D$PÏèsC ‹ð…öu½ÇD ƒÃÿHk Œiÿÿÿ‹D$_^][ƒÄ ÌÌÌÌÌÌÌÌÌ̃ìSUVW3ÿ‹é‰|$3Û¡”¼Lèâ; „Àtl‹D$ ƒøÿt;Øu_‹”¼Lj L$Qè¼r ‹ð…ötD› ‹Îè™Æ ‹@;Eu‹L$Q‹ÎèU] „ÀtƒD$¡”¼Lj T$Rè¸B ‹ð…öuÇD ƒÃÿHk Œnÿÿÿ‹D$_^][ƒÄ ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌ€y$ tV‹q¹(°LèœW ;ð^¸ Ã3ÀÃÌÌÌÌÌÌÌÌÌÌÌÌÌÌU‹l$…íV‹ñt^€~$ SWt‹~¹(°Lè_W ;ø³ë2Ûn€~$ ‹~t¹(°Lè?W ;ø¸ ë3À_:Ø[t‹
Œ°Lè¼ ‹
Œ°LèV¾ ^] ̋T$…Òt*‹D$‹I8‹ÐÁâ+ÐÒ+ÐÁâС”¼L‹ÿR$ ÌÌÌÌÌÌÌÌÌÌÌ‹T$…Òt*‹D$‹I<‹ÐÁâ+ÐÒ+ÐÁâС”¼L‹ÿR$ ÌÌÌÌÌÌÌÌÌÌÌ‹T$…Òt*‹D$‹I@‹ÐÁâ+ÐÒ+ÐÁâС”¼L‹ÿR$ ÌÌÌÌÌÌÌÌÌÌÌ‹T$…Òt*‹D$‹ID‹ÐÁâ+ÐÒ+ÐÁâС”¼L‹ÿR$ ÌÌÌÌÌÌÌÌÌÌÌW‹|$…ÿ„… ‹ATV‹t$‹°<°‹ITƒ<± °ŸÀ…ÒŸÁ:Èt`‹´¼Lõ +ƍ<@Áçèâ¹ ¡´¼Lè•¹ ‹
T°LèzQ ;ðu'‹


I tried searching for Inca but the only results I received sofar are with inCa referring to part of the word DomainCargo.

I then changed the syntaxis to C++ in hopes of magically transforming the gibberish into something less "gibberishy". I noted no changes.

Then I figured I'd try just following the manual in hopes of uncounciously making some necessary steps I failed to take consciously sofar.

I figured I, since I was doing this for the first time, I wanted to make a Setup from Scratch.

(copypasted from the guide made by Leoreth)

"Setup from Scratch


1) Install the Windows SDK and Visual C++ toolkit


Download the Install Wizard and run it, following the instructions. It will try to install by default to <Program Files>\Civ4SDK\, whatever the name and drive of your primary program files folder is (e.g. C:\Program Files (x86)\). If you choose a different location, please keep note of it for later.

2) Install Visual Studio 2010 Express

Download the ISO File, mount and run it. The installation will also offer to install other tools, but you only need Visual Studio 2010 Express.

3) Get the source code, Makefile and project setup

If you are using git, run "git clone https://github.com/dguenms/beyond-the-sword-sdk.git". Alternatively, you can download it as a ZIP archive from here.

You are downloading the CvGameCoreDLL folder for your new mod. Conventionally, you would put this folder next to the Assets folder in your mod directory, i.e. in Beyond the Sword\Mods\MyMod, and it is preconfigured assuming you do so. Theoretically, you can put it wherever on your computer though.

Depending on your previous choices, you might have to adjust the Makefile in the following ways:
- if you chose a different location during step 1, you have to change lines 34-35 so the TOOLKIT and PSDK variables point to the right locations (remove $(PROGRAMFILES)\Civ4SDK\, and replace it with your chosen location)
- if you did not put the CvGameCoreDLL folder inside your mod directory, put a path to your mod directory into the YOURMOD variable in line 37

4) Launch your project in Visual Studio

Double click on the CvGameCoreDLL.sln file, it should open in Visual Studio with an already configured project.

To test if everything is working, run Build ... -> Rebuild Solution."


I have my C++ toolkit up and running (Notepad C++) so I have to continue with step 2)
while typing this I figure Notepad C++ and this C++ toolkit might not be interchangeable so I downloaded the program from the link whilst making this post."

I downloaded the file from the link.
I don't know what mounting it means. But after some clicking I got the option to install

VisuaCl# 2010express
VisualBasic 2010express
VisualC++ 2010express
Visual Web Developer 2010express

And now I don't know what to pick.

So here is where I am stuck.
I think I want to try step 1) from leoreth's guide first. (better safe than sorry, even if that program and Notepad C++ work similar)
For step 2), (Which of) these four programs is/are Visual Studio 2010 Express? Or are these the other tools Leoreth is referring to in the post?

Any help is greatly appreciated. I figured I'd start a new thread because I consisder my problems in modding
to qualify as problems in modding only with a liberal amount of imagination.
 
I am trying to make my first small adjustment to the game.

The goal is to change the Inca UP from two food and one production per mountain top into two food and one free citizen per mountaintop.

However (sofar) I have neiter knowledge of programming nor experience in modding.

So the first step I took was asking help from the community (in the Modmodding Q&A thread).

1) What programs do I needto edit the necessary files?
2) And where can I find those files?

I received a very helpful and encouraging reply from Merijn.

"The Incan UP (and many other UPs) are in the CvGameCoreDLL. You can find a folder in the mod folder with that name that contains all source files for building the DLL. Editing the DLL requires 2 steps. The first is editing the code itself, which is done by editing the code in the source files. The second is building the DLL. The link below has a tutorial how to set up everything in order to build the DLL. (The author of that tutorial should be familiar)
https://forums.civfanatics.com/threads/the-easiest-way-to-compile-a-new-dll.608137/"


I located a file named CVGameCoreDLL.dll in the folder…/Sid Meier's Civilization 4 Complete/Beyond the Sword/Mods/RFC Dawn of Civilization/Assets

Sofar so good (I hope)

Now I am taking babysteps with this project, so before bulding the DLL (step 2) I'd like to sucesfully edit the code itself once (step 1)

Besides, sofar I have no idea what a DLL is and why I would need (another) one.

"The language of the DLL source files is C++. Editing the source files can be done with any text editor, but I highly recommend not using just any. Visual Studio (required anyway for building the DLL) can be used for editing the source files for the DLL. Notepad++ is IMO also a good option, and that one can also be used for editing python. (And has a very useful "search in files" function)"

(I understand) Both Visual Sudio and Notepad++ are mentioned as programs that enable editing the CVGameCoreDLL.dll file. Notepad++ seemed recommended most to me because it was mentioned last and because it has a neat searchfuntion.

So I downloaded (and installed) Notepad++

From within Notepad++ I opened the file CVGamecoreDLL.dll and was faced by what seemed a lot of gibberish on first sight.
I copypasted the first 11 lines under the spoiler
Spoiler :

MZ ÿÿ ¸ @ º ´ Í!¸LÍ!This program cannot be run in DOS mode.

$ v˜/2tö|2tö|2tö|±|«|0tö|!|Ÿ|0tö|7x©|4tö|7xù|7tö|ò|¼|0tö|7x«|4tö|²|5tö|2t÷|Àtö|7x–|Xtö|7xª|3tö|7x¬|3tö|Rich2tö| PE L ìîÿ] à .!
= ð LÆ: = T “F R( LkF ´ PM „¶ _B H = Ì .text
ü< = `.rdata b« = ° = @ @.data † ÀH à ÀH @ À.reloc f¢ PM ° L @ B ‹AÃÌÌÌÌÌÌÌÌÌÌÌÌ‹AÃÌÌÌÌÌÌÌÌÌÌÌÌ‹A+AÃÌÌÌÌÌÌÌÌÌ‹AÃÌÌÌÌÌÌÌÌÌÌÌÌ‹AÃÌÌÌÌÌÌÌÌÌÌÌÌ‹AÃÌÌÌÌÌÌÌÌÌÌÌÌ‹AÃÌÌÌÌÌÌÌÌÌÌÌÌŠA$ÃÌÌÌÌÌÌÌÌÌÌÌÌ‹T$‹A(Q‹L$ˆˆÂ ÌÌÌÌÌÌÌÌÌ‹A,‹L$‹T$ˆˆÂ ÌÌÌÌÌÌÌÌÌÌÌÌ‹T$‹A0Q‹L$ˆˆÂ ÌÌÌÌÌÌÌÌÌ‹A4‹L$‹ˆÂ ÌÌÌ‹T$‹A4Q‹L$ˆˆÂ ÌÌÌÌÌÌÌÌÌ‹A8‹L$‹ˆÂ ÌÌÌ‹A<‹L$‹ˆÂ ÌÌÌ‹A@‹L$‹ˆÂ ÌÌÌ‹AD‹L$‹ˆÂ ÌÌÌV‹t$ƒþ1u!‹qH‹†Ä ™+ÂÑø‰†Ä ‹AH‹€Ä ^ ƒþ-Wt4ƒþ.t/ƒþ-|‹QH‹²<²™ƒâÂÁø‰‹AH‹°_^ ‹IH‹±_^ ‹QH‹²<²™ƒâÂÁø‰‹AH‹°_^ ÌÌÌÌÌÌÌÌÌÌÌÌ‹AH‹T$V‹t$‹°W<…ÿ}÷؋ЋIH±±_^ ÌÌÌÌÌÌÌ‹AL‹L$‹ˆÂ ÌÌÌ‹AL‹L$‹T$‰Â ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌ‹AP‹L$‹ˆÂ ÌÌÌ‹QP‹A‹L$+ŠÂ ‹AP‹L$‹T$ˆˆÂ ÌÌÌÌÌÌÌÌÌÌÌÌ‹AT‹T$3É9ŸÁŠÁ ÌÌÌÌÌÌÌÌÌÌÌÌ‹AX‹T$3É9ŸÁŠÁ ÌÌÌÌÌÌÌÌÌÌÌÌ‹A\‹L$‹ˆÂ ÌÌÌ‹A\‹L$‹T$‰Â ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌ‹I`‹D$‹TÁ‹ÁRPè ƒÄ ÌÌÌÌÌ‹Ad‹L$‹ˆ‹D$‹‚ ÌÌÌÌÌÌÌÌÌÌÌÌ‹Ah‹L$‹ˆ‹D$‹‚ ÌÌÌÌÌÌÌÌÌÌÌÌ‹Ah‹L$‹ˆ‹D$‹L$‚‚ ÌÌÌÌÌ‹Al‹L$‹ˆ‹D$‹‚ ÌÌÌÌÌÌÌÌÌÌÌÌ‹Al‹L$‹ˆ‹D$‹L$‚‚ ÌÌÌÌÌ‹Ap‹L$‹ˆÂ ÌÌÌ‹Ap‹L$‹T$ˆˆÂ ÌÌÌÌÌÌÌÌÌÌÌÌ‹At‹L$‹ˆÂ ÌÌÌ‹At‹L$‹T$ˆˆÂ ÌÌÌÌÌÌÌÌÌÌÌÌÇÿÿÿÿÇAÿÿÿÿÃÌ̸(°LÃÌÌÌÌÌÌÌÌÌÌ‹D$…À|‹Q¯Q;Â}‹ÐÁâЋA4Ð 3À ÌÌÌÌÌÌÌÌ¡Œ°L€x( S‹\$V‹pW‹|$t‹Ã+Ç™‹È3Ê+Ê‹Æ™+ÂÑø;È~+ñ_‹Æ^[ËÃ+Ç™_3Â^+Â[ÃÌÌÌÌÌÌÌÌÌÌÌÌ¡Œ°L€x) S‹\$V‹pW‹|$t‹Ã+Ç™‹È3Ê+Ê‹Æ™+ÂÑø;È~+ñ_‹Æ^[ËÃ+Ç™_3Â^+Â[ÃÌÌÌÌÌÌÌÌÌÌÌÌ‹D$‹‹L$;}‹ÁÃÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌSV‹ñ‹Fp3Û;ÃÇÔ=tPèr ƒÄ‰^p‹Ft;ÃtPèr ƒÄ‰^t‹F(;ÃtPèñq ƒÄ‰^(‹F,;ÃtPèÞq ƒÄ‰^,‹F0;ÃtPèËq ƒÄ‰^0‹F4;ÃtPè¸q ƒÄ‰^4‹F8;ÃtPè¥q ƒÄ‰^8‹F<;ÃtPè’q ƒÄ‰^<‹F@;ÃtPèq ƒÄ‰^@‹FD;ÃtPèlq ƒÄ‰^D‹FH;ÃtPèYq ƒÄ‰^H‹FL;ÃtPèFq ƒÄ‰^L‹FP;ÃtPè3q ƒÄ‰^P‹FT;ÃtPè q ƒÄ‰^T‹FX;ÃtPè
q ƒÄ‰^X‹F\;ÃtPèúp ƒÄ‰^\‹F`;ÃtPèçp ƒÄ‰^`W3ÿ‹Fd‹;ÃtPèÎp ‹NdƒÄ‰ƒÇÿÈ |Ü‹Fd;ÃtPèp ƒÄ‰^d3ÿëI ‹Vh‹;ÃtPèp ‹FhƒÄ‰ƒÇÿÈ |Ü‹Fh;ÃtPèop ƒÄ‰^h3ÿ¤$ ‹Nl‹;ÃtPèPp ‹VlƒÄ‰ƒÇÿÈ |Ü‹Fl;Ã_tPè.p ƒÄ‰^l^[ÃÌÌÌÌÌSV‹ñ‹Fp3Û;ÃWtPèp ƒÄ‰^p‹Ft;ÃtPèùo ƒÄ‰^t‹D$ŠL$‰F‰^‰^‰^‰^‰^‰^‰^ ˆN$3À‹V(‰‹N,‰‹V0‰‹N4‰‹V8‰‹N<‰‹V@‰‹ND‰‹VH‰‹NL‰ƒÀ=È |º3À› ‹VP‰‹NT‰‹VX‰ƒÀ=È |ä3ÀƒÏÿ‹N\‰<ƒÀ=È |𸠋N`Pèʉ9‰y‹N`L
‰9‰y‹V`Lø‰9‰y‹N`ȉ9‰y‹N`LƒÀ(=¨ ‰9‰y|»3ɍI ‹Vd‹‰‹Vd‹‰X‹Vd‹‰X3Àd$ ‹Vh‹‰‹Vl‹‰‹Vh‹‰\‹Vl‹‰\‹Vh‹‰\‹Vl‹‰\‹Vh‹‰\‹Vl‹‰\ƒÀ=° |¨ƒÁùÈ Œyÿÿÿ8\$…‡ ¹(°Lè5d ÀÀPè+n ƒÄ¹(°L‰Fp3ÿèd …À~ëI ‹Fp‰¸¹(°LƒÇèýc ;ø|é¹(°Lèg ÀÀPèåm ƒÄ¹(°L‰Ft3ÿèsg …À~‹Nt‰¹¹(°LƒÇè\g ;ø|é_^[ ÌÌSVW‹ù¹(°L3Û3öèc …À~3‹Gpƒ<° ~V¹(°LèUx ‹Èè>K „ÀtƒÃ¹(°LƒÆèjc ;ð|Í_^‹Ã[ÃìSUVW3ÿ‹é‰|$3Û¡”¼Lèb= „Àtl‹D$ ƒøÿt;Øu_‹”¼Lj L$Qè<t ‹ð…ötD› ‹ÎèÈ ‹@;Eu‹L$Q‹ÎèÅ^ „ÀtƒD$¡”¼Lj T$Rè8D ‹ð…öuÇD ƒÃÿHk Œnÿÿÿ‹D$_^][ƒÄ ÌÌÌÌÌÌÌÌÌÌÌÌÌÌ̃ìSUVW3ÿ‹é‰|$3Û¡”¼Lè¢< „Àtq‹D$ ƒøÿt;Øud‹”¼Lj L$Qè|s ‹ð…ötI› ‹ÎèYÇ ‹@;Eu‹L$$‹T$QR‹Îè÷ „ÀtƒD$‹
”¼Lj D$PÏèsC ‹ð…öu½ÇD ƒÃÿHk Œiÿÿÿ‹D$_^][ƒÄ ÌÌÌÌÌÌÌÌÌ̃ìSUVW3ÿ‹é‰|$3Û¡”¼Lèâ; „Àtl‹D$ ƒøÿt;Øu_‹”¼Lj L$Qè¼r ‹ð…ötD› ‹Îè™Æ ‹@;Eu‹L$Q‹ÎèU] „ÀtƒD$¡”¼Lj T$Rè¸B ‹ð…öuÇD ƒÃÿHk Œnÿÿÿ‹D$_^][ƒÄ ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌ€y$ tV‹q¹(°LèœW ;ð^¸ Ã3ÀÃÌÌÌÌÌÌÌÌÌÌÌÌÌÌU‹l$…íV‹ñt^€~$ SWt‹~¹(°Lè_W ;ø³ë2Ûn€~$ ‹~t¹(°Lè?W ;ø¸ ë3À_:Ø[t‹
Œ°Lè¼ ‹
Œ°LèV¾ ^] ̋T$…Òt*‹D$‹I8‹ÐÁâ+ÐÒ+ÐÁâС”¼L‹ÿR$ ÌÌÌÌÌÌÌÌÌÌÌ‹T$…Òt*‹D$‹I<‹ÐÁâ+ÐÒ+ÐÁâС”¼L‹ÿR$ ÌÌÌÌÌÌÌÌÌÌÌ‹T$…Òt*‹D$‹I@‹ÐÁâ+ÐÒ+ÐÁâС”¼L‹ÿR$ ÌÌÌÌÌÌÌÌÌÌÌ‹T$…Òt*‹D$‹ID‹ÐÁâ+ÐÒ+ÐÁâС”¼L‹ÿR$ ÌÌÌÌÌÌÌÌÌÌÌW‹|$…ÿ„… ‹ATV‹t$‹°<°‹ITƒ<± °ŸÀ…ÒŸÁ:Èt`‹´¼Lõ +ƍ<@Áçèâ¹ ¡´¼Lè•¹ ‹
T°LèzQ ;ðu'‹


I tried searching for Inca but the only results I received sofar are with inCa referring to part of the word DomainCargo.

I then changed the syntaxis to C++ in hopes of magically transforming the gibberish into something less "gibberishy". I noted no changes.

Then I figured I'd try just following the manual in hopes of uncounciously making some necessary steps I failed to take consciously sofar.

No worry. This is what you should be expected when opening the .dll file. The .dll (Dynamic-Link Library) is the file you get after you build the solution. This file contains machine language which no human understands, with possible Rain Man being the only exception. The file you are looking for are the files in the CvGameCoreDLL folder, which is in the main mod folder. This folder contains many .cpp and .h files. These are the files that should be edited. The content of these files should make a lot more sense.

The .cpp and .h files contain the code that a human can read and edit. But a computer does not understand this. The human readable source code has to be "translated" into computer understandable language, which is done in the building step. Leoreth's tutorial shows you how to set up Visual Studio, which is a program you can use to "translate" your code to computer langauge. (It also does some other things, like optimalizations of code)

I figured I, since I was doing this for the first time, I wanted to make a Setup from Scratch.

(copypasted from the guide made by Leoreth)

"Setup from Scratch


1) Install the Windows SDK and Visual C++ toolkit


Download the Install Wizard and run it, following the instructions. It will try to install by default to <Program Files>\Civ4SDK\, whatever the name and drive of your primary program files folder is (e.g. C:\Program Files (x86)\). If you choose a different location, please keep note of it for later.

2) Install Visual Studio 2010 Express

Download the ISO File, mount and run it. The installation will also offer to install other tools, but you only need Visual Studio 2010 Express.

3) Get the source code, Makefile and project setup

If you are using git, run "git clone https://github.com/dguenms/beyond-the-sword-sdk.git". Alternatively, you can download it as a ZIP archive from here.

You are downloading the CvGameCoreDLL folder for your new mod. Conventionally, you would put this folder next to the Assets folder in your mod directory, i.e. in Beyond the Sword\Mods\MyMod, and it is preconfigured assuming you do so. Theoretically, you can put it wherever on your computer though.

Depending on your previous choices, you might have to adjust the Makefile in the following ways:
- if you chose a different location during step 1, you have to change lines 34-35 so the TOOLKIT and PSDK variables point to the right locations (remove $(PROGRAMFILES)\Civ4SDK\, and replace it with your chosen location)
- if you did not put the CvGameCoreDLL folder inside your mod directory, put a path to your mod directory into the YOURMOD variable in line 37

4) Launch your project in Visual Studio

Double click on the CvGameCoreDLL.sln file, it should open in Visual Studio with an already configured project.

To test if everything is working, run Build ... -> Rebuild Solution."


I have my C++ toolkit up and running (Notepad C++) so I have to continue with step 2)
while typing this I figure Notepad C++ and this C++ toolkit might not be interchangeable so I downloaded the program from the link whilst making this post."

Notepad++ (without the C) and the C++ toolkit are indeed not the same thing. Notepad++ is an advanced text editor. You use it do open the source files. These are the files that contain the code that the human can understand. Notepad++ is not required for building the .dll file. You can ignore it during Leoreth's tutorial. It will only come into play when you actually write your own new lines of code.

The C++ toolkit is, as the name suggests, a toolkit. I'm not exactly sure what it does, but as far as I know it has some tools that help building the DLL file. (You only need to install this and don't look at it again.)

I downloaded the file from the link.
I don't know what mounting it means. But after some clicking I got the option to install

VisuaCl# 2010express
VisualBasic 2010express
VisualC++ 2010express
Visual Web Developer 2010express

And now I don't know what to pick.

The iso file can be seen as a virtual CD/DVD. You can see mounting as putting a virtual CD/DVD in a virtual disk drive to run it. Deamon tools is a program that creates a virtual disk drive for you to do so.

You have to choose the VisualC++ variant, because C++ is the programming language that is used.

So here is where I am stuck.
I think I want to try step 1) from leoreth's guide first. (better safe than sorry, even if that program and Notepad C++ work similar)
For step 2), (Which of) these four programs is/are Visual Studio 2010 Express? Or are these the other tools Leoreth is referring to in the post?

Any help is greatly appreciated. I figured I'd start a new thread because I consisder my problems in modding
to qualify as problems in modding only with a liberal amount of imagination.

One more thing, you should ignore step 3 of Leoreth's tutorial. Instead, you should use the source code from DoC. That is the CvGameCoreDLL folder that is in the main mod folder. (the source files from the link are the vanilla BTS files and don't contain the changes of DoC)
 
Last edited:
I Could not find the folder CvGameCoreDLL in the DoC folder. (I can still only find a CvGameCoreDLL.dll file in the Assets folder)
According to Leoreth it should be placed in close proximity of the assets folder. Perhaps it is hidden somehow?
I tried downloading and installing the mod once again but sofar to no avail.

I took a look at some outdated DoC folders I kept and I found the CvGameCoreDLL folder at the designated location in version 1.13

After DoC version 1.13 the folder CvGameCoreDLL no longer appears (visible).

So I opened the CvPlot.cpp file (from 1.13) with Notepad ++ , typed in Inca in the search function, and the second of the two results I received is the one under the spoiler.

Spoiler :
//Rhye - start UP
if (isPeak())
{
if (eTeam == INCA)
return 0 + GC.getYieldInfo(eYield).getLakeChange() + GC.getYieldInfo(eYield).getLakeChange() + GC.getYieldInfo(eYield).getHillsChange() + GC.getYieldInfo(eYield).getLakeChange();
else
return 0;
}
//Rhye - end UP


I figure what this code does is divide the yield of peaks into two categories...

category 1 = Inca
if (eTeam == INCA)
return 0 + "bonus yield for mountains"

category 2 = everyone else
else
return 0

...and specify the bonus yield
+ GC.getYieldInfo(eYield).getLakeChange() + GC.getYieldInfo(eYield).getLakeChange() + GC.getYieldInfo(eYield).getHillsChange() + GC.getYieldInfo(eYield).getLakeChange();

+1 food (the bonus food from lake tiles over ocean tiles) +1 food (again the lakebonus, so the food a mountaintile yields now went up from 0 to 2) +1 production -1 food (the modification hills give to a plains or grasslands tile, deserts already yield 0 food, I guess a tile is not allowed to yield negative amounts of food) (for a temporay +1 food and +1 production) and finally +1 food (another bonus from the lakes) for a total of 2 food and 1 production per mountaintop.

Removing the last two bonusyields (hills and lake) should bring the yield of a mountaintop down to only two food.

In the future I probably want to add a bonus specific to mountains (ao -1 food under republic) for balance and ai reasons (i probably want the ai to prefer working tiles that yield more food over mountains)

On a sidenote. Changing the mountain bonus into another lakebonus gives a result close to the free citizen I want the mountain to yield. (+4 food allows for one citizen to be assigned to an urban profession).

Right now I am stuck trying to find the (hidden ?) CvGameCoreDLL folder

But I will take a look at the CvCity.cpp and see what I can make out of that code.

Thanks again for all the help.
 
In the CvCity.cpp file (version 1.13)

on line 658 I found code that read: m_iFreeSpecialist = 0;

Perhaps I want to change that into something like
//Force44 - Start UP Inca
if (isPeak())
{
if (eTeam == INCA)
return 0 + m_FreeSpecialist = 1;
else
return 0;
}
//Force44 - End UP Inca

The first and last line are to tell it was me who wrote/copypasted this messy code.
With the code inbetween (which probably won't work) I want to divide the amount of free specialists gained to be divided into two categories.

category 1) The Inca
category 2) everyone else

furthermore I want the amount of free specialists the Inca receive to be dependent upon the amount of mountaintops the city occupies.

Aside from a different phrasing in code I also distrust this modification because I fear it will give the Inca an amount of free specialists equal to the amount of mountaintops in its BFC because I do'nt recognize any part of the code that tells the program it has to work the mountaintop for this part of the code to be eligible.

I'll continue searching for snippets of code that peak my interest ;)
 
lines 839 to 850 are about specialists
Spoiler :
FAssertMsg((0 < GC.getNumSpecialistInfos()), "GC.getNumSpecialistInfos() is not greater than zero but an array is being allocated in CvCity::reset");
m_paiSpecialistCount = new int[GC.getNumSpecialistInfos()];
m_paiMaxSpecialistCount = new int[GC.getNumSpecialistInfos()];
m_paiForceSpecialistCount = new int[GC.getNumSpecialistInfos()];
m_paiFreeSpecialistCount = new int[GC.getNumSpecialistInfos()];
for (iI = 0; iI < GC.getNumSpecialistInfos(); iI++)
{
m_paiSpecialistCount[iI] = 0;
m_paiMaxSpecialistCount[iI] = 0;
m_paiForceSpecialistCount[iI] = 0;
m_paiFreeSpecialistCount[iI] = 0;
}

It feels as though this is about the maximum amount of specific specialists assignable (amount of Merchants, scientists, priests etc.) though.
 
The DLL sources are not excluded in the installer version anymore. Download the git repository to get them.
 
Lines 8574 to 8605 are (also) about free specialists. Specifically the free specialist Italy receives until the end of the renaissance (their UP)
Spoiler :


int CvCity::getFreeSpecialist() const
{
// Leoreth: Italian UP, only until the industrial era
int iItalianSpecialists = 0;
int iCoreSpecialists = 0;

if (getOwner() == ITALY && GET_PLAYER((PlayerTypes)ITALY).getCurrentEra() < 4)
{
iItalianSpecialists = 1;
}

//Leoreth: handle free specialists for core here for simplicity
if (GET_PLAYER(getOwner()).getCoreFreeSpecialist() > 0)
{
if (plotDistance(getX(), getY(), GET_PLAYER(getOwner()).getCapitalCity()->getX(), GET_PLAYER(getOwner()).getCapitalCity()->getY()) <= 3)
{
iCoreSpecialists = GET_PLAYER(getOwner()).getCoreFreeSpecialist();
}
}

return m_iFreeSpecialist+iItalianSpecialists+iCoreSpecialists;
}


void CvCity::changeFreeSpecialist(int iChange)
{
if (iChange != 0)
{
m_iFreeSpecialist = (m_iFreeSpecialist + iChange);
FAssert(getFreeSpecialist() >= 0);

AI_setAssignWorkDirty(true);
}
}
 
Lines 9455 to 9466 this snippet of code looks especially interesting because I figure it allows buildings to give free specialists. If that is the case the prerequisite of a building could be substituted by the prerequisite of a worked mountainpeak.
Spoiler :
// Specialists
for (int iI = 0; iI < GC.getNumSpecialistInfos(); ++iI)
{
if (kBuilding.getFreeSpecialistCount((SpecialistTypes)iI) != 0)
{
iExtraRate += getAdditionalBaseYieldRateBySpecialist(eIndex, (SpecialistTypes)iI, kBuilding.getFreeSpecialistCount((SpecialistTypes)iI));
}
}
}

return iExtraRate;
}
 
At line 12244 there begins a long part of code about specialists. My guess right now is this is a part I could learn a lot from.
But right now I feel a bit dizzy after all these lines. I'll try to download the git repository and see if I can alter the productionvalue of the mountaintops for the Inca.
 
I completely forgot that the installer version doesn't have the CvGameCoreDLL folder, but I see that you now know where to find it. I used git from the beginning, so for me that folder has always been present and it didn't occur to me that not everyone has access to it by default.

In the new version, the Incan UP is much better coded. This is how it looks like in the current version. It should be obvious which part is responsible for the production on peaks.
(Lakes provide a 1 food bonus. Hills provide a 1 production bonus. The code from v1.13 is a very convoluted (Rhye) way of giving peaks 2 food and 1 production)
Code:
   //Rhye - start UP
    if (isPeak())
    {
        if (eTeam == INCA)
        {
            if (eYield == YIELD_FOOD)
            {
                return 2;
            }
            if (eYield == YIELD_PRODUCTION)
            {
                return 1;
            }
        }
        else
            return 0;
    }
    //Rhye - end UP

You shouldn't change the free specialists. That will give (as the name says) a free specialist. This are specialists that you have to assign yourself and need slots for. (Like the Statue of Liberty provides) I assume that you want forced citizens, like how GP are assigned to a city.

For this you want to use the CvCity::changeFreeSpecialistCount(SpecialistTypes eIndex, int iChange) function.This gives a free specialist of a certain type. (Or removes it if iChange is negative). CvCity::setWorkingPlot(int iIndex, bool bNewValue) is used when a plot is started or ended being worked, which is probably where you want to implement it.

BTW, if you post some code on the forums, it is best to put it in a
Code:
block. This makes code easier readable. (You can find this in the same menu as the spoiler command)
 
This may sound like unhelpful advice but at this point you have enough input and theoretical knowledge to just try some stuff and see what happens. It's the most effective way of getting some experience and understanding what works and what doesn't. But definitely start from the current develop branch sources.
 
I downloaded the latest developmentpatch (the zipversion on 2-6(june)-2012) and now I can acces and modify the CvGamecoreDLL-folder in Notepad++

what follows is the code I modified
(I tried to change the yield from mountaintops from 2 food and 1 production to 4 food and 0 production.

sidenotequestion: is this the correct way to modify it or should I disable the Original code and rewrite it enabled with my alterations?)
Code:
//Rhye - start UP
 //Force44 changed return from 2food1prod to 4food0prod
 if (isPeak())
 {
  if (eTeam == INCA && !GET_PLAYER(GET_TEAM(eTeam).getLeaderID()).isReborn())
  {
   if (eYield == YIELD_FOOD)
   {
    return 4;
   }
   if (eYield == YIELD_PRODUCTION)
   {
    return 0;
   }
  }
  else
   return 0;
 }
 //Rhye - end UP

But this change does not show up in the game.

Oddly the changes I made are retained when I close Notepad C++. When I reopen Notepad C++ and then reopen the CvPlot.cpp file the changes I made are still there.

I figured I needed to launch my project in visual studio first to get to see the changes I made.

So now I am trying to find the CvGameCoreDLL.sln file
(Step 4 from Leoreths guide on how to compile a DLL https://forums.civfanatics.com/threads/the-easiest-way-to-compile-a-new-dll.608137/)

To my shame sofar I am unable to locate the file CvGameCoreDLL.sln
(Notepad C++ even claims no such file exists)
 
It almost feels like magic. I search for over half an hour. Leorth tells me the file really is there and now I can find it.
Are all *.sln files Microsoft Visual Studio Solution files? (I figure I didn't connect the suffix *.sln with Microsoft Visual Studio Solutions)

But for now, onwards to the next babystep!
(and to whoever is still reading, thanks for the effort of reading through my ramblings and all the help given to set me a little less crooked;)!)
 
Yes, *.sln files belong to Visual Studio, it's fine to let Windows associate them. The DoC DLL (and the guide I made for the base game) is deliberately set up for Visual Studio, that's why those files are in there. It would work differently with other IDEs but I figured it's easier to make the choice for everyone, which allows me to have more detailed and concrete instructions.
 
Top Bottom