Quick Modding Questions Thread

You can only load 1 folder in the mod folder.

So for example you could have

My Traits Mod
My Civics Mod

and only be able to play with 1 or the other.

Or

My Civics and Traits Mod
with all the changed files inside, keeping the folder path from bts e.g.

assets/xml/gameinfo/CIV4civicsinfo.xml (or whatever the specific paths and names actually are. That was done from memory.)

To modify an existing civic, find it in the info file and change the values contained within it. To make a brand new extra civic, copy and paste an existing one into the file and then change the values.
For info on what everything does, look in the modiki, it has tag definitions/explanations for xml.
 
You can only load 1 folder in the mod folder.

So for example you could have

My Traits Mod
My Civics Mod

and only be able to play with 1 or the other.

Or

My Civics and Traits Mod
with all the changed files inside, keeping the folder path from bts e.g.

assets/xml/gameinfo/CIV4civicsinfo.xml (or whatever the specific paths and names actually are. That was done from memory.)

To modify an existing civic, find it in the info file and change the values contained within it. To make a brand new extra civic, copy and paste an existing one into the file and then change the values.
For info on what everything does, look in the modiki, it has tag definitions/explanations for xml.

Thanks. That helps a lot! :)
 
So, I made a mod for a new civic, but when I load it from the main menu, and start up a game, the ui is completely missing, so I can't tell if it's working or not. When I put it in the custom assets folder, it just doesn't load.
 
Is it just really the CIV4CivicInfos.xml that you edited? If not, what else?

Do you get an error message at the loading of the mod?
 
Is it just really the CIV4CivicInfos.xml that you edited? If not, what else?

Do you get an error message at the loading of the mod?

That's the only thing I edited. I duplicated one of the civics, and made a few changes to it. I didn't get a loading error, but upon starting a new game, before seeing the whole "your people are ready to settle" thing, a large window named "Technology Advisor", which was blank, popped up. I either had to click exit, or let it sit there forever (literally).
 
This is not normal and should not happen with simple modifications of the XML. Could you rar or zip your whole mod considering that it should still be quite small and post it as an attachment?
 
A good workaround for the promotions issue is to allow Machine Guns to attack, but reduce their offensive strength with 100%.
 
I HAVE ONE PROBLEM WITH DEBUGGING, I really think that my steps are correct, but I do not know what causes this problem, PLEASE SEE:

I am download this BTS source which is upload ASAF
http://forums.civfanatics.com/downloads.php?do=file&id=16274
http://forums.civfanatics.com/downloads.php?do=file&id=16273
after that i am extract both in "C:\Documents and Settings\Aleksandar\My Documents\Visual Studio 2010\Projects"
and rename extracted folder in "SUPERSPY" instead "CvGameCoreDLL", example
"C:\Documents and Settings\Aleksandar\My Documents\Visual Studio 2010\Projects\SUPERSPY"

After i am download again "Super Spies v2.0 (BTS 3.19) ", extract mod in Mods folder, open "Mods\Super Spies v2.0\C++ Changed" and
copy all source files from here to my project "C:\Documents and Settings\Aleksandar\My Documents\Visual Studio 2010\Projects\SUPERSPY"

i am configure my makefile, i am use one from my Creatures in War mod which is good configure and work
(with that makefile i am build Creatures in War dll, which work good)

My Make:

Spoiler :
Code:
#### Civilization 4 SDK Makefile 1.0 ####
####  Copyright 2010 Danny Daemonic  ####
#########################################

#### Paths ####
TOOLKIT=E:\Program Files\Microsoft Visual C++ Toolkit 2003
PSDK=C:\Program Files\Microsoft SDKs\Windows\v7.0A
CIVINSTALL=E:\Program Files\Firaxis Games\Sid Meier's Civilization 4\Beyond the Sword
GLOBALBOOST=$(CIVINSTALL)\CvGameCoreDLL\Boost-1.32.0
GLOBALPYTHON=$(CIVINSTALL)\CvGameCoreDLL\Python24
## Uncomment to have newly compiled dlls copied to your mod's Assets directory
#YOURMOD=$(CIVINSTALL)\Mods\MyMod

#### Tools ####
CC="$(TOOLKIT)\bin\cl.exe"
CPP="$(TOOLKIT)\bin\cl.exe"
LD="$(TOOLKIT)\bin\link.exe"
RC="$(PSDK)\bin\rc.exe"
## Uncomment to build dependencies using fastdep
FD="$(MAKEDIR)\bin\fastdep.exe"

#### BLACKLIST ####
## Uncomment to block CvTextScreen (accidentally included by Firaxis)
BLACKLIST=CvTextScreens

#### You shouldn't need to modify anything beyond this point ####
#################################################################

#### Target Files ####
Debug_BIN=Debug\CvGameCoreDLL.dll
Release_BIN=Release\CvGameCoreDLL.dll

!IF [IF NOT EXIST CvGameCoreDLL.rc EXIT 1] == 0
Debug_RESOURCE=Debug\CvGameCoreDLL.res
Release_RESOURCE=Release\CvGameCoreDLL.res
!ENDIF

Debug_STATICLIB=Debug\CvGameCoreDLL.lib
Release_STATICLIB=Release\CvGameCoreDLL.lib

Debug_LIBDEF=Debug\CvGameCoreDLL.def
Release_LIBDEF=Release\CvGameCoreDLL.def

Debug_PCH=Debug\CvGameCoreDLL.pch
Release_PCH=Release\CvGameCoreDLL.pch

Debug_PDB=Debug\CvGameCoreDLL.pdb
Release_PDB=Release\CvGameCoreDLL.pdb

Debug_OTHER=Debug\CvGameCoreDLL.exp Debug\CvGameCoreDLL.ilk
Release_OTHER=Release\CvGameCoreDLL.exp

#### CFLAGS ####
GLOBAL_CFLAGS=/GR /Gy /W3 /EHsc /Gd /Gm- /DWIN32 /D_WINDOWS /D_USRDLL /DCVGAMECOREDLL_EXPORTS /Yu"CvGameCoreDLL.h"
Debug_CFLAGS=/MD /Od /D_DEBUG /RTC1 /Fp"$(Debug_PCH)" $(GLOBAL_CFLAGS)
Release_CFLAGS=/MD /O2 /Oy /Oi /G7 /DNDEBUG /DFINAL_RELEASE /Fp"$(Release_PCH)" $(GLOBAL_CFLAGS)

#### LDFLAGS ####
GLOBAL_LDFLAGS=/DLL /NOLOGO /SUBSYSTEM:WINDOWS /LARGEADDRESSAWARE /TLBID:1
Debug_LDFLAGS=/INCREMENTAL /DEBUG /PDB:"$(Debug_PDB)" /IMPLIB:"$(Debug_STATICLIB)" $(GLOBAL_LDFLAGS)
Release_LDFLAGS=/INCREMENTAL:NO /OPT:REF /OPT:ICF /PDB:"$(Release_PDB)" $(GLOBAL_LDFLAGS)

#### INCLUDES ####
GLOBAL_INCS=/I"$(TOOLKIT)/include" /I"$(PSDK)/Include" /I"$(PSDK)/Include/mfc" /I"$(GLOBALBOOST)/include" /I"$(GLOBALPYTHON)/include"
PROJECT_INCS=/IBoost-1.32.0/include /IPython24/include
Debug_INCS=$(PROJECT_INCS) $(GLOBAL_INCS)
Release_INCS=$(PROJECT_INCS) $(GLOBAL_INCS)

#### LIBS ####
GLOBAL_LIBS=/LIBPATH:"$(TOOLKIT)/lib" /LIBPATH:"$(PSDK)/Lib"  /LIBPATH:"$(GLOBALBOOST)/libs" /LIBPATH:"$(GLOBALPYTHON)/libs" winmm.lib user32.lib
PROJECT_LIBS=/LIBPATH:Python24/libs /LIBPATH:boost-1.32.0/libs/ boost_python-vc71-mt-1_32.lib
Debug_LIBS=$(PROJECT_LIBS) $(GLOBAL_LIBS) msvcprt.lib
Release_LIBS=$(PROJECT_LIBS) $(GLOBAL_LIBS)

#### Objects ####
Debug_LINKOBJS=$(Debug_OBJS)
Release_LINKOBJS=$(Release_OBJS)

#### Auto SOURCES/OBJS ####
!IF [ECHO SOURCES= \> sources.mk] == 0 && \
    [FOR %i IN (*.cpp) DO @ECHO. "%i" \>> sources.mk] == 0 && \
    [ECHO.>> sources.mk] == 0 && \
    [ECHO Debug_OBJS= \>> sources.mk] == 0 && \
    [FOR /F "delims=." %i IN ('dir /b *.cpp') DO @ECHO. Debug\%i.obj \>> sources.mk] == 0 && \
    [ECHO.>> sources.mk] == 0 && \
    [ECHO Release_OBJS= \>> sources.mk] == 0 && \
    [FOR /F "delims=." %i IN ('dir /b *.cpp') DO @ECHO. Release\%i.obj \>> sources.mk] == 0 && \
    [ECHO.>> sources.mk] == 0
!INCLUDE sources.mk
!IF [DEL sources.mk]
!ENDIF
!ENDIF

#### Targets ####
#################

.PHONY: all clean Debug_clean Release_clean Debug Release

all: Debug Release

clean: Debug_clean Release_clean 

Debug_clean:
	@FOR %i IN ($(Debug_BIN) $(Debug_STATICLIB) $(Debug_LIBDEF) \
		Debug\*.obj Debug\*.@ $(Debug_RESOURCE) \
		$(Debug_PCH) $(Debug_PDB) $(Debug_OTHER)) DO @IF EXIST "%i" DEL "%i"

Release_clean:
	@FOR %i IN ($(Release_BIN) $(Release_STATICLIB) $(Release_LIBDEF) \
		Release\*.obj Release\*.@ $(Release_RESOURCE) \
		$(Release_PCH) $(Release_PDB) $(Release_OTHER)) DO @IF EXIST "%i" DEL "%i"

Debug: Debug_DIR Debug_unfinished $(Debug_PCH) $(Debug_BIN)
!IFDEF YOURMOD
	-COPY "$(Debug_BIN)" "$(YOURMOD)\Assets\."
!ENDIF

Release: Release_DIR Release_unfinished $(Release_PCH) $(Release_BIN)
!IFDEF YOURMOD
	-COPY "$(Release_BIN)" "$(YOURMOD)\Assets\."
!ENDIF

Debug_DIR:
	-@IF NOT EXIST "Debug\." MKDIR "Debug"

Release_DIR:
	-@IF NOT EXIST "Release\." MKDIR "Release"

Debug_unfinished:
	@ECHO.>Debug\unfinished.@
	@FOR /F "delims=@" %i IN ('dir /b Debug\*.@') DO \
		@IF EXIST "Debug\%i" DEL "Debug\%i"
	@FOR /F %i IN ('dir /b Debug\*.@') DO \
		@IF EXIST "Debug\%i" DEL "Debug\%i"

Release_unfinished:
	@ECHO.>Release\unfinished.@
	@FOR /F "delims=@" %i IN ('dir /b Release\*.@') DO \
		@IF EXIST "Release\%i" DEL "Release\%i"
	@FOR /F %i IN ('dir /b Release\*.@') DO \
		@IF EXIST "Release\%i" DEL "Release\%i"

$(Debug_BIN): $(Debug_LINKOBJS) $(Debug_RESOURCE)
	$(LD) /out:$(Debug_BIN) $(Debug_LDFLAGS) $(Debug_LIBS) $(Debug_LINKOBJS) $(Debug_RESOURCE)

$(Release_BIN): $(Release_LINKOBJS) $(Release_RESOURCE)
	$(LD) /out:$(Release_BIN) $(Release_LDFLAGS) $(Release_LIBS) $(Release_LINKOBJS) $(Release_RESOURCE)

.cpp{Debug}.obj:
	@ECHO.>"$*.obj.@"
    $(CPP) /nologo $(Debug_CFLAGS) $(Debug_INCS) /Fo$*.obj /c $<
	@DEL "$*.obj.@"

.cpp{Release}.obj:
	@ECHO.>"$*.obj.@"
    $(CPP) /nologo $(Release_CFLAGS) $(Release_INCS) /Fo$*.obj /c $<
	@DEL "$*.obj.@"

$(Debug_PCH) Debug\_precompile.obj:
	@ECHO.>"$(Debug_PCH).@"
	@ECHO.>"Debug\_precompile.obj.@"
	$(CPP) /nologo $(Debug_CFLAGS) $(Debug_INCS) /YcCvGameCoreDLL.h /Fo"Debug\_precompile.obj" /c _precompile.cpp
	@DEL "$(Debug_PCH).@"
	@DEL "Debug\_precompile.obj.@"

$(Release_PCH) Release\_precompile.obj:
	@ECHO.>"$(Release_PCH).@"
	@ECHO.>"Release\_precompile.obj.@"
    $(CPP) /nologo $(Release_CFLAGS) $(Release_INCS) /YcCvGameCoreDLL.h /Fo"Release\_precompile.obj" /c _precompile.cpp
	@DEL "$(Release_PCH).@"
	@DEL "Release\_precompile.obj.@"

.rc{Debug}.res:
	@ECHO.>"$*.res.@"
	$(RC) /Fo$@ $(Debug_INCS) $<
	@DEL "$*.res.@"

.rc{Release}.res:
	@ECHO.>"$*.res.@"
	$(RC) /Fo$@ $(Release_INCS) $<
	@DEL "$*.res.@"

!IFDEF BLACKLIST

Debug\$(BLACKLIST).obj: $(BLACKLIST).cpp
	@ECHO.>"$*.obj.@"
	@ECHO.>"$*-dummy.cpp"
	$(CPP) /nologo $(Debug_CFLAGS) $(Debug_INCS) /Y- /Fo$@ /c "$*-dummy.cpp"
	@DEL "$*-dummy.cpp"
	@DEL "$*.obj.@"

Release\$(BLACKLIST).obj: $(BLACKLIST).cpp
	@ECHO.>"$*.obj.@"
	@ECHO.>"$*-dummy.cpp"
	$(CPP) /nologo $(Release_CFLAGS) $(Release_INCS) /Y- /Fo$@ /c "$*-dummy.cpp"
	@DEL "$*-dummy.cpp"
	@DEL "$*.obj.@"

!ENDIF

!IFDEF FD

!IF [IF NOT EXIST $(FD) EXIT 1] == 0
!IF [$(FD) --objectextension=pch -q -O Debug CvGameCoreDLL.cpp > depends] != 0 || \
    [$(FD) --objectextension=obj -q -O Debug $(SOURCES) >> depends] != 0 || \
    [$(FD) --objectextension=pch -q -O Release CvGameCoreDLL.cpp >> depends] != 0 || \
    [$(FD) --objectextension=obj -q -O Release $(SOURCES) >> depends] != 0
!MESSAGE Error running fastdep.
!ENDIF
!ELSE
!IF [ECHO "fastdep.exe" NOT FOUND! && \
     ECHO Please edit Makefile to reflect the correct path of fastdep. && \
     ECHO. ]
!ENDIF
!ENDIF

!ENDIF

!IF EXIST(depends)
!INCLUDE depends
!ENDIF


after that i am open VS2010, FILE -> OPEN -> PROJECT/SOLUTION






Coversion Report:



DEBUG, i am do this:



Output message after DEBUG:
Code:
Build succeeded.

Time Elapsed 00:04:53.23
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

I am copy "CvGameCoreDLL.dll" from Debug folder



in "Mods\Super Spies v2.0\Assets"

After that, i am lanch my BTS and load "Super Spies v2.0" mod.

I am do NEXT:



and in game do this:



after mission activation i am get this and i choose DEBUG:



I am get this in VS2010 and i choose BREAK:



I do double click on " CvGameCoreDLL.dll!CvGameTextMgr::setEspionageCostHelp() + 0x163a bytes " in "Call Stack" and VS2010 give me this result:



Option "Go To Source Code" is unavailable:



After this i click on "Stop Debugging" and exit from everything.

And that's all, i really don't know better explain.
 
This looks to me like the game is picking up a debug dll, or the it is not the one associated with the source code in the solution.

The first thing I would do would be to do a quick sanity check as the size of the dll file as a debug one is significantly larger. As an example, for my custom dll the release version is around 5.5 MB and the debug version over 15 MB.
 
You should try copying the .pdb file along with the .dll file. Same file name but different extension and probably a good 7 or 8 times bigger, it is also made when you build the debug DLL and has the info necessary to match things in the binary DLL file with the corresponding source code.
 
Does the Python function getLatitude on CyPlot return a positive number for the northern hemisphere and a negative number for the southern hemisphere?
 
I want to mod having the city plot unimproved when the city is founded. If you know of an existing mod that does this, please point me to the code for it, or if you know where the Civ4 code is that improves the city plot when the city is founded, please let me know so I can comment out this code. I actually want this for Civ4Col but most Civ4 code applies directly to Civ4Col. However, if you know were to locate the code that improves the city plot on colony founding in Civ4Col, even better!
 
You should try copying the .pdb file along with the .dll file. Same file name but different extension and probably a good 7 or 8 times bigger, it is also made when you build the debug DLL and has the info necessary to match things in the binary DLL file with the corresponding source code.

I am do that God-Emperor, and again is same.
Can you describe how you do that when merge or write source files in few steps?
I am read Asaf tutorial and i am follow step by step their tutorial.

I am try to do this with some another mod and i am deliberately make error, and i am again get similar like this, compiler don't send me to line error, i just get again Disassembly. I am try this in VS 2008 and in VS 2010 and results are same.
 
Hi all,

With regards to editing a .DLL for a mod:

Does the basic paradigm of Civ4 automatically using identical functions in child folders (i.e the mod) instead of parent folders (i.e. the Vanilla game) still hold true?

Example:
Spoiler :

If I copy-pasta a function (let's say the function that determines how your empire's upkeep is calculated, for example) into my mod's CvGameCoreDLL. Will the game now calculate my empire's upkeep using my new formula automatically?

Or will I have to explicitly call/define this somewhere else for the game to read my function?

 
Hi all,

With regards to editing a .DLL for a mod:

Does the basic paradigm of Civ4 automatically using identical functions in child folders (i.e the mod) instead of parent folders (i.e. the Vanilla game) still hold true?

Example:
Spoiler :

If I copy-pasta a function (let's say the function that determines how your empire's upkeep is calculated, for example) into my mod's CvGameCoreDLL. Will the game now calculate my empire's upkeep using my new formula automatically?

Or will I have to explicitly call/define this somewhere else for the game to read my function?

Keep in mind you have to compile your .cpp and .h files into a .dll first (see this guide. If you paste the .dll into the /Assets directory of your mod, the game will use your whole .dll.
You can't simply add a function, neither can you override single functions without recompiling the whole CvGameCoreDLL.
The game engine (e.g. the .exe) uses some functions with fixed names; so to alter the upkeep calculation you'd have to find the responsive functions and edit it (and recompile afterwards, of course).
 
Top Bottom