(possibly) IMPORTANT SUGGESTION FOR SDK modders: A plugin interface

I just bought it this weekend and haven't finished

Trust me Civ is not something you "finish" ;)

The CCCP or "inconvenient and constantly changing combined mod dll" as you say is underway and we have made some progress combining mods made both by members in the project and ones posted on the forum made by other folks. We always make shure we create a DLL that produces no changes in the game unless the new feature is explicity activated by XML or Python. Thus a Mod maker can include it in a Mod and use only the parts they want or an Average player can include it in CustomAssets and then load normal mods onto it.

Usaualy a new Global define or XML value is used to control the flow through the code so something like

if (NewGlobalDefine == true)
{
RunSomeNewFeature()
}else{
RunOriginalFeature()
}

If the new define isn't found in the XML the original game behavior is retained.

Dales example might require a switch statment or a doublenested if statment, rather easy for a programer to make but beyond the understanding of any kind of automation. Hand merging by skilled people is likly going to be the only reliable method for combining Mods for the forseeable future.

The most important thing for Mod makers to do is encode controls into their Mods and to comment out rather then remove the original code. I prever XML based control for most things. If their doing some kind of core rule change a Global define is easy to add, even just good commenting

// Mod starts here by SOMEBODY
.......
//Mod ends here by SOMEBODY
 
Trust me Civ is not something you "finish"

LOL... yeah, well I'm gathering that. I meant my first game because I don't have the full feel of it yet.

I tried Civ 3 and didn't like it as much as CTP2... but so far I am really enjoying Civ 4. The main mod I am interested in is a future tech mod, one that expands the features of the sea floors and the ability to colonize it. (Being discussed here in case your interested).

I want to get a feel of the game first though... that way I will know how to approach developing the mod (if and when I get the time to do it).

So you think the only feasible way right now is through the "hand stitch" method? I would think like you suggested that there is a way to resolve Dales issue but without knowing too much about the SDK and the issues involved I can't really say wether he's right or not.... not when I don't know completely what I am dealing with. I will probably get the SDK today and have a look sometime soon.
 
The most important thing for Mod makers to do is encode controls into their Mods and to comment out rather then remove the original code. I prever XML based control for most things. If their doing some kind of core rule change a Global define is easy to add, even just good commenting

I usually do that anyway... even in my own code when changing something I am not sure I am going to stick with. If I like the new code... I can always erase the comments. If I don't... well then I can always go back!
 
Basically in the SDK, you have streaming data instances, and for convenience included dummy variables (for the Python feedback - or edit part in the game - where you can enter a value in, and see what it does in the game through the Python interface - immediately -- so they included some dummy values -- looks like about 11 different kinds) and then the other parts of the SDK -- some for C++ programming (Cvwhatever.cpp) type files and then the wrappers of the classes for the python (Cywhatever.cpp) and the "h" files for those files that need an "h" file header where the classes are declared and the functions calling made with overloaded functions classes and such. I mean if up in the IDE of VisualStudio.NET 2002, 2003, or 2005 (but VS.NET 2003 was used and has to be used because all of those programs are different compiling and linking -- read errors in the *.dll file that will not work with the game then since that is done by VS.NET 2003 also, so even if those *.dll's files did work and compiled, they mainly would not work with the game *.exe file for that reason since Microsoft changed everything around again, again, again).
So you have 'classes' and up pops the pop-up window of the IDE and suddenly that class has all these functions declared and like + 17 overloaded functions all for that one 'class' declared.
To me, even if someone wanted a different 'overloaded' function or different variables in the game, I don't know if they can change that much, but when calling the functions through Python and changing the data in the XML files, then different 'functions' of the classes may be able to be made.

In other words, you have the Interface into the game core executable file, and also you have the interface to the python files, and the streaming of the data between all of it.

Perhaps, one of the simplest things to do would be to declare or change the value for MAX_PLAYERS in the game to other than 19 -- one player is for the barbarians, and 18 Civs total including the player playing the game. But if that is changed can the game really handle it, and again adding more, may make it all slower in the end. So if someone changed that MAX_PLAYER value (which easily can be change) to 33 or even 25, then yes, that could be done without too much trouble, and probably would not interfere with about anything else.

Of course when we all get 6gHz computers, the game will be faster for everyone.
But if anyone is going to change the graphics around, and create Starcraft or whatever mod, then that may take a major rewrite of the SDK parts, and that will be a major mod and not a game-type minor mod that isn't so different.

Well, adding overloaded functions to the classes or adding functions to the 'classes' sure can be done, even with perhaps different variables to include, so in the end, if no one ever calls that overloaded function of that class, or the game does not use it as in the normal game, then it will not be a problem.

In other words, some players have already made a Great Person General or something like that, and the parts they used where already there for the Great Person (Artist, Engineer, Prophet) in the game. They added what they needed, so actually, that added part should not interfere with the normal game, if they made up new functions for the classes that were different than the ones for the game already.

Cvwhatever look like C++ parts into the game core exe.
Cywhatever look like C++ parts into the python calling interface that calls the XML files.

Well, back to staring at it all again.
 
primem0ver said:
Are you saying that ModA and ModB are using two different (and incompatible) approaches to execute the attack? With my limited understanding of the source code that is the only situation in which I can see your problem being an issue. Otherwise I think their could be a standard that allows the mods to work together. I am not trying to impose a specification on people who want to use the SDK. I am just making a suggestion, hoping to encourage people who want to make compatible mods... because I think that would make game play more fun and certainly more interesting if it were possible. If you want to develop a mod that doesn't follow the spec that is not a problem... it just may not work with other mods that use the plugin interface.

No, what I'm saying is both mods occur at exactly the same point. While compatible it manually added together (it's as simple as one if statement) in the situation of a plugin they wouldn't work.

I know I've chosen a specific example. But take new xml flags as well. How does the original dll know which plugin to run to process the new xml flag? Unless someone is there constantly updating the dll to include new xml flags and where to point to for their processing.
 
Okay, forget part of the previous post.
In CvDefines.h or whatever file (which should be that one), perhaps the first thing to do is #define somewhere to put the CvGameCoreDLL.dll file for the Mods, or Scenarios. That in a sense should be easy to do, since none of the ones I have compiled have exactly come out to the same size like the original DLL file. Close but no cigar!
Perhaps it can be added, perhaps not.

List of Defines in the file: (probably squish sideways from original file)

// The following #defines should not be moddable...

#define MOVE_IGNORE_DANGER (0x00000001)
#define MOVE_SAFE_TERRITORY (0x00000002)
#define MOVE_NO_ENEMY_TERRITORY (0x00000004)
#define MOVE_DECLARE_WAR (0x00000008)
#define MOVE_DIRECT_ATTACK (0x00000010)

#define RANDPLOT_LAND (0x00000001)
#define RANDPLOT_UNOWNED (0x00000002)
#define RANDPLOT_ADJACENT_UNOWNED (0x00000004)
#define RANDPLOT_ADJACENT_LAND (0x00000008)
#define RANDPLOT_PASSIBLE (0x00000010)
#define RANDPLOT_NOT_VISIBLE_TO_CIV (0x00000020)
#define RANDPLOT_NOT_CITY (0x00000040)

#define MAX_CIV_PLAYERS (18)
#define MAX_CIV_TEAMS (MAX_CIV_PLAYERS)
#define MAX_PLAYERS (MAX_CIV_PLAYERS + 1)
#define MAX_TEAMS (MAX_PLAYERS)
#define BARBARIAN_PLAYER ((PlayerTypes)MAX_CIV_PLAYERS)
#define BARBARIAN_TEAM ((TeamTypes)MAX_CIV_TEAMS)

// Char Count limit for edit boxes
#define PREFERRED_EDIT_CHAR_COUNT (15)
#define MAX_GAMENAME_CHAR_COUNT (32)
#define MAX_PLAYERINFO_CHAR_COUNT (32)
#define MAX_PLAYEREMAIL_CHAR_COUNT (64)
#define MAX_PASSWORD_CHAR_COUNT (32)
#define MAX_GSLOGIN_CHAR_COUNT (20)
#define MAX_GSEMAIL_CHAR_COUNT (30)
#define MAX_GSPASSWORD_CHAR_COUNT (30)
#define MAX_CHAT_CHAR_COUNT (256)
#define MAX_ADDRESS_CHAR_COUNT (64)

#define INVALID_PLOT_COORD (-(MAX_INT)) // don't use -1 since that is a valid wrap coordinate
#define DIRECTION_RADIUS (1)
#define DIRECTION_DIAMETER ((DIRECTION_RADIUS * 2) + 1)
#define NUM_CITY_PLOTS (21)
#define CITY_HOME_PLOT (0)
#define CITY_PLOTS_RADIUS (2)
#define CITY_PLOTS_DIAMETER ((CITY_PLOTS_RADIUS*2) + 1)

#define GAME_NAME ("Game")

#define LANDSCAPE_FOW_RESOLUTION (4)

#define Z_ORDER_LAYER (-0.1f)
#define Z_ORDER_LEVEL (-0.3f)

#define CIV4_GUID "civ4"
#define CIV4_PRODUCT_ID 10435
#define CIV4_NAMESPACE_ID 17
#define CIV4_NAMESPACE_EXT "-tk"

#define MAP_TRANSFER_EXT "_t"

#define USER_CHANNEL_PREFIX "#civ4buser!"

#define SETCOLR L"<color=%d,%d,%d,%d>"
#define ENDCOLR L"</color>"
#define NEWLINE L"\n"
#define SEPARATOR L"\n-----------------------"
#define TEXT_COLOR(szColor) ((int)(GC.getColorInfo((ColorTypes)GC.getInfoTypeForString(szColor)).getColor().r * 255)), ((int)(GC.getColorInfo((ColorTypes)GC.getInfoTypeForString(szColor)).getColor().g * 255)), ((int)(GC.getColorInfo((ColorTypes)GC.getInfoTypeForString(szColor)).getColor().b * 255)), ((int)(GC.getColorInfo((ColorTypes)GC.getInfoTypeForString(szColor)).getColor().a * 255))

// Version Verification files and folders
#ifdef _DEBUG
#define CIV4_EXE_FILE ".\\Civilization4_DEBUG.exe"
#define CIV4_DLL_FILE ".\\Assets\\CvGameCoreDLL_dbg.dll"
#else
#define CIV4_EXE_FILE ".\\CivilizationIV.exe"
#define CIV4_DLL_FILE ".\\Assets\\CvGameCoreDLL.dll"
#endif
#define CIV4_SHADERS ".\\Shaders\\FXO"
#define CIV4_ASSETS_PYTHON ".\\Assets\\Python"
#define CIV4_ASSETS_XML ".\\Assets\\XML"

#define TUTORIAL_MOD_NAME "Mods\\Tutorial\\"

#define MAX_PLAYER_NAME_LEN (64)
#define MAX_VOTE_CHOICES (8)
#define VOTE_TIMEOUT (600000) // 10 minute vote timeout - temporary

#define ANIMATION_DEFAULT (1) // Default idle animation

// python module names
#define PYDebugToolModule "CvDebugInterface"
#define PYScreensModule "CvScreensInterface"
#define PYCivModule "CvAppInterface"
#define PYWorldBuilderModule "CvWBInterface"
#define PYPopupModule "CvPopupInterface"
#define PYDiplomacyModule "CvDiplomacyInterface"
#define PYUnitControlModule "CvUnitControlInterface"
#define PYTextMgrModule "CvTextMgrInterface"
#define PYPerfTestModule "CvPerfTest"
#define PYDebugScriptsModule "DebugScripts"
#define PYPitBossModule "PbMain"
#define PYTranslatorModule "CvTranslator"
#define PYGameModule "CvGameInterface"
#define PYEventModule "CvEventInterface"

#endif // CVDEFINES_H

Now, somewhere in the middle is the #define on where to find the CvGameCoreDLL.dll file. Perhaps another define could be added to say where a Mod CvGameCoreDLL.dll file can be found, and of course something so the game can find it also. Still thinking about it.
If mod CvGameCoreDLL.dll look in this directory, otherwise refer to original directory given, for the #define.
Also it states that those values should not be moddable, but again, let us hang ourselves with our own ropes around the neck.

If the game could be told that Mod CvGameCoreDLL.dll was named CvGameCoreDLLMod.dll file that would be handy, but I doubt it, since the game is looking for the CvGameCoreDLL.dll file, and not something else.
Well, something further to think about.

If Mod CvGameCoreDLL.dll look in same directory as what the Mod folder is given as and either move both files (the original somewhere else in the game folder directories and move the Modded DLL file to the place it needs to be, or something to tell the game it has moved and look in the Mod Folder for it.
Well, dreaming again!

I guess after looking at another thread, the *.dll can go into the Assets folder for the Mod and be included. Still, I would like to know which *.dll I am using???????
 
Sim Cuties is working on a function which will regurgitate some information (version number, Builder, date) for the DLL on the CCCP. Still you cant use a file name other then Civ4CoreDLL as thats what the exe is going to grab and run with. Likwise knowing once its been run its too late to change it so their not much point. If you need to keep track of the files then put the DLL is a named Mod.
 
Ah, well I did change the name of the DLL, but the game looks for the original name, so it could be handled with programming, but then I did not realize that a modded DLL will work in the Custom Assets folder. I could not get it to work in the "MOD" folder - note the capital letters unlike the game's "Mod" folder.

But again, it was just a thought. Sort of like having the computer update the Slots of the computer AI to show what Difficulty Level the computer is playing at, rather than only know that when the player changes his Difficulty Level, the computer AI change to that Level also (not stuck on Noble).

I suppose though that changing that could of also been done, looking around the SDK.
----------------------------------------------------------------------
Plagues with Blender virus today -- it takes off the un-install program, and removing it with Stopzilla! takes off the downloaded 2.41 version exe file also. But I think deeper levels of folders (try -- hiding it) may take care of that. Since the website may have been affected also. That is twice now for "Yazzle of OIN" on that (Adware - more like a virus to me).
Then there is another out there also: CoolWebSearch.HomeSearch also I ran into. I suppose one of those weekends coming up. Nothing of note, but time consuming a litle anyway.(the Yazzle of OIN takes off the un-install program of Blender and deletes Registry values - program still works, just can not be unstalled. -- goofy wierdness goings on.)
 
Dale:

I think the flag problem would be easy to address... because all we would have to do is require (by the standard) some tag that identifies the mod whose code should be called. However, if two mods that use the standard try to define the same tag in a different way, it would probably be considerably more tricky.

I find it strange that you used the example you did when stacks is already something the game is prepared to handle (I just noticed this over the weekend). I enabled it and found attacks occur in a different way (like they happen in CTP but without animation). I would assume the game would already have functionality to decide which call would be best in the case of stack attacks... but then again, I obviously don't know the source code yet.

As for the rest of this discussion... I have a limited amount of time so I will have to reply to it later
 
Just so you know, Civ4's stack attack is not the same as CTP's.

Civ4's stack attack is just automated 1-on-1 attacking. CTP's stack attack was combined attacking.

Dale
 
Plugin Interface is good idea for adding new functionality to existing application. Functionality of new plugin DLL can interacts with main EXE/DLL through limited plugin interface. But it requires large scale effort to retrofit to be able to change/replace existing functionality with plugin unless the base EXE/DLL is designed for that.
So I propose you all to suggest a experimental (set of ) functions/class sub system you would like to make them as plugin.
It should not be large and complex one like combat sub system, but more localized and specialized sub system.
We can implement experiemntal plug-in DLL to test its effectiveness as moding interface.
 
Excuse me if i'm wrong, but right now i'm thinking of one thing:

Only one mod can be loaded at a time. And isn't a DLL manageable within a mod folder? By that I mean that a mod can have a complete different AI Code (or whatever it's in the dll) without EVER interfering with another one.
So, I don't see how a plugin Interface (aside the pure awesomess of such a feature) could really help. Is it worth the big amount of job it requires?

Maybe I'm missing something, and i'm not at home so I can't check my mod folder structure.
 
You may be right CmdKewin... as I am new to Civ 4 and the modding scene (just started digging into the XML so far) but I thought I would bring it up since many people like to combine mods... at least that is my experience.

I don't know exactly how modding works with Civ4... only CTP2. I will say that so far it seems somewhat similar. I don't know how people combine the DLL with their mods but I will soon find out because one is being developed that I may have some interest in helping with (see the "sea colonies" discussion). I am aware of how dll programming works (having written a few non-game dll's myself) and the problems that can be associated with them... especially when 30+ people are all writing their own mods and dlls. This sea colonies mod is the kind of mod I had in mind when I started this thread... because sea colonies and other future ocean going techs and possibilites are something that would add a distinct flavor to the game. And at least in CTP2 mod developers (at Apolyton.com) liked to combine mods like these so that they would work with other mods. As a result, the modswitcher interface was developed. But with CTP2, there was no SDK (at least not until members of the CTP2 forum at Apolyton talked Activision into releasing the source code) and so the modswitcher only deals with mods that change CTP2's own counterparts of what is done in Civ 4 using python and XML.

So I thought I would start a thread that addresses the problems of combining mods when the dll undergoes minor changes (such as will take place in the one being worked on by people participating in the sea colonies discussion).

My weakness in this discussion is that I have no experience yet with the actual SDK and so I am not certain what doing so will entail... which is why I have asked other people about the value of such a possibility.
 
Top Bottom