Noob questions for custom .dll

trystero49

Prince
Joined
Apr 30, 2012
Messages
515
I'm looking through the .cpp and .h files trying to figure out what's what. I've been able to compile a .dll thanks to the sticky. But I have some questions.

a) When I open up the project, it has two sub-folders, one that builds a vanilla .dll and one that builds an expansion .dll. If I know that I am not going to build a vanilla .dll, can I just get rid of the other folder, or does one reference the other?

b) I am trying to change up some of the limiting values in the game. I've found the #define that determines the max number of wonders (whether or the change will do anything I still have to test). But I am having a hard time finding values for Max Promotions and Max Civs. Is there an easy way to look for this stuff other than typing each combination of "Max" "Civs" "Major" "Player" "22" "#define" that I can think of? Also, how can I tell how much of a performance hit any of these changes make?

c) This is the first time I've seen "#pragma once" but I think wikipedia cleared up what it does for me. However, I don't think I know how to use it. How do I know that I should use #pragma once in any code that I write?

Thanks.
 
I just know c)

when u include a file in more than one file, #pragma once will ensure its compiled only once, its much to get ride of "already referenced errors" at compile time so you don't have to search where to remove the include
 
about B, you can refer in the name used in Lua.

search for MAX_CIV_PLAYERS or MAX_MAJOR_CIVS, they are in CvDLLUtilDefines.h

but I'm afraid it won't be a matter of simply changing the value, game crash on load with MAX_MAJOR_CIVS > 22 for me.

edit:

this file is in the "include" path, not the solution/project files, you may have to change the search option
 
about B, you can refer in the name used in Lua.

search for MAX_CIV_PLAYERS or MAX_MAJOR_CIVS, they are in CvDLLUtilDefines.h

but I'm afraid it won't be a matter of simply changing the value, game crash on load with MAX_MAJOR_CIVS > 22 for me.

Code:
This header includes all macros and defines that are external to the DLL

I got that from that header file. This header file is part of the CvGameCoreDLLUtil folder, which isn't a part of the VC2008 or VC2010 .sln file. Why's that the case? I thought it was kind of bizarre. I thought the .sln file was supposed to contain everything that you would need to build a custom .dll.

Are these external files precompiled or something like that so that the .cpp and .h files in the .sln can use it? Does that mean for changing MAX_MAJOR_CIVS you have precompile a new something?

Full disclosure: I am a total amateur.
 
a) When I open up the project, it has two sub-folders, one that builds a vanilla .dll and one that builds an expansion .dll. If I know that I am not going to build a vanilla .dll, can I just get rid of the other folder?

Probably, but why bother. Just right click the G&K dll sub-project and select "clean" or "build" from there and it will only build that part of the project
 
about B, you can refer in the name used in Lua.

search for MAX_CIV_PLAYERS or MAX_MAJOR_CIVS, they are in CvDLLUtilDefines.h

but I'm afraid it won't be a matter of simply changing the value, game crash on load with MAX_MAJOR_CIVS > 22 for me.

Remember this is only the GameCore part of the Civ5 program - there may be other references to "22 major civs" in undisclosed parts of the program (eg the database caching code) - not very good design, but entirely possible
 
Also, how can I tell how much of a performance hit any of these changes make?

For the duration of the game or even a turn, that's like trying to measure a piece of string.

Within a specific function, check out cvstopwatch - you can use that to time a block of code - so get the time(s) before you make any changes (other than adding the cvstopwatch stuff) and then get the time(s) after you've made your changes
 
I have a suggestion for anyone who is going to be doing the initial analysis of the CiV DLL capabilities. There is a minidump modcomp for Civ 4 which allows you to get a memory dump to debug crashes post-mortem, for instance if it crashes when you aren't using a Debug DLL. Writing one of those would probably help diagnose issues people are reporting with changing things (as would running a debug build).

Anyhow, I am excited about this and will keep one eye open to see what happens from here.
 
I have a suggestion for anyone who is going to be doing the initial analysis of the CiV DLL capabilities. There is a minidump modcomp for Civ 4 which allows you to get a memory dump to debug crashes post-mortem, for instance if it crashes when you aren't using a Debug DLL. Writing one of those would probably help diagnose issues people are reporting with changing things (as would running a debug build).

Anyhow, I am excited about this and will keep one eye open to see what happens from here.

I am eagerly waiting on these initial analyses. I'm not a coder at all. I look at something, see how it's done, and use what I learn to do my own thing.

I need to see some example stuff before I can start doing anything ><

You know I didn't know the first thing about Civ 5 modding until the very day I announced Sumer?
 
I am eagerly waiting on these initial analyses. I'm not a coder at all. I look at something, see how it's done, and use what I learn to do my own thing.

I need to see some example stuff before I can start doing anything ><

You know I didn't know the first thing about Civ 5 modding until the very day I announced Sumer?

Lots of people are in this boat, actually. Kael's guide is great and other tutorials are great, but the best way to learn IMO is to look through other people's mods and take them apart and see how they work.
 
Back
Top Bottom