Aspiring modmaker seeks advice/help

Nikas Kunitz

Chieftain
Joined
Jun 17, 2016
Messages
79
Location
Yoshkar-Ola, Russian Federation
Hello, Civ4 community! For many years I played Civ4, mostly with various mods. And for many years I contemplated on what a "perfect version" of a mod would be for me. Usually, this resulted in making small (or not so small) changes in existing mods, personal modmods, so to say. But only by now I decided to try making my own mod and thus I'm writing here.
The mod type I envision is a "general expansion" of vanilla gameplay, like Realism Invictus or History Rewritten, perhaps not as much diverging from vanilla. Specifically, I already outlined usual mod changes to civs&leaders, tech tree, civics, units and buildings, with general aim at balance between historical realism and clear civ gameplay. Over that, I might try to add some of more advanced mechanics I have ideas about, but that really would need more expertise. Years of personal modmoding gave me some experience and understanding of XML modding (with a little bit of Python), so adding XML stuff should be fairly possible, even if labourous. Other than that, I have near zero experience with proper coding and Python and also with modmaking as it is.
So, what I'm seeking with this thread? As I understand for start it would be better to construct a base mod with various mod components, and build XML things upon it. There's a lot of various things on this forum and browsing through them all is an adventure of its own, which I am in. Nevertheless, I would like to ask an advice about what mod components (and versions) I should include and, crucially, how they should be combined without issue. As I can see at the moment, I would need advanced AI (K-mod), Platy worldbuilder, revolutions, advanced diplomacy, advanced slavery and some specific components that allow more options for buildings, units etc (like, more specific prereqs I've seen in most mods), as well as some other things that give more quality and ease modding. So, I would appreciate advice and help in making this base mod, even a link to a optimal version of a mod component. Perhaps, someone made a base mod like that before and can share it? Or even help directly in making this mod.
 
While I'm not the best to specify which mods and mod components would be the most interesting for you, one thing I will say is nobody should start modding based on vanilla. The list of vanilla bugs fixed in mods is significant, so starting a new mod starts with the question of which updated mod makes the most sense to use as base for your new mod.
 
While I'm not the best to specify which mods and mod components would be the most interesting for you, one thing I will say is nobody should start modding based on vanilla. The list of vanilla bugs fixed in mods is significant, so starting a new mod starts with the question of which updated mod makes the most sense to use as base for your new mod.
Thank you for pointing to that! Well, you added another question to starting a base mod, so let's see what others will recommend.
 
The only mods I can think of that have combined K-Mod and Revolutions and Advanced Diplomacy (AD) are Realism Invictus (includes K-Mod and Revolutions) and History Rewritten (AD was included in one of the latest versions, but with only some of the new agreements working properly – as far as I understand). Should be a rather challenging merge. RevDCM includes BBAI (predecessor of K-Mod) and Revolutions. It's still pretty close to BtS, so if Revolutions are important to have from the start, RevDCM (or possibly its successor Legends of Revolution) could be an option. Upgrading that to K-Mod at a later point is probably not realistic. If you go with K-Mod, then Revolutions and AD should probably be defered until, say, version 1.x of your mod.

I haven't done so myself, but my impression has been that PlatyBuilder is not all too difficult to integrate even with larger mods like K-Mod. I guess because most mods don't modify the WorldBuilder at all. More options for buildings sounds like additions to the XML schema. That will involve DLL changes too. Recompiling the DLL shouldn't be a big hurdle. The C++ code changes tend to be more tedious than difficult, but could also happen to conflict somehow with DLL changes already present in K-Mod. Not sure what mod component is meant by advanced slavery.

You may want to give K-Mod on its own a try before you commit to it. If you haven't already, that is. Perhaps just experience with Realism Invictus is also sufficient to form an opinion about K-Mod. Its balance changes are fairly easy to undo if you want to make entirely different ones, but you might find the AI behavior too warlike or the UI too basic. There are limited possibilities for adjusting the AI through just XML, Python is no real help and, through the DLL, it'll still be difficult to make well-aimed changes. Regarding the UI, K-Mod lacks a number of BUG features that involve the DLL. (Several other BUG features have merely been disabled by default.) On the other hand, K-Mod has a few UI improvements of its own. If you like K-Mod, then you might consider starting from Kek-Mod (some additional tweaks, focused on PitBoss multiplayer), MMod (extra civs, more diverse artwork; KatMod a possible alternative) or my own inofficial K-Mod update (mostly just additional bugfixes).

For BBAI, clean merges exist with BULL (Better BUG AI) and BAT (Better BAT AI). And there's RevDCM. Not the latest and greatest AI code, not a great difference from BtS really, but maybe that's what you prefer.

Then there's my own mod AdvCiv with AI changes on top of K-Mod, especially in the realm of planning war and making peace. The UI should at least be on par with BULL (BUG with all its DLL changes), but doesn't include all of BULL and won't be entirely familiar to players used to BULL. The AdvCiv DLL should be easier to extend than K-Mod's for modders who know C++ well, but, for beginners, it's an obstacle because just copying code from some DLL mod component will usually not (quite) work. And AdvCiv has more substantial balance changes than K-Mod and plays even more differently from BtS overall than K-Mod does. The balance changes don't affect individual elements of play so much, it's more a matter of broader mechanical changes, e.g. how revolt chances are calculated or how Barbarians are placed.
 
Then there's my own mod AdvCiv with AI changes on top of K-Mod, especially in the realm of planning war and making peace.
One important part to point out here is that AdvCiv is under active development. This means you could gain access to updates in C++ even if you end up not modding C++ yourself. In other words it could provide future bugfixes, but at the same time future updates might make changes to features, which doesn't match your goals or changes, which requires you to update xml files to match. There are benefits and tradeoffs from leeching off another mod like that, which should be considered.

Also in general it would be polite to reach out to a modder before starting a mod based on another mod if the modder(s) for said mod are still reachable.
 
Thank you a lot for such extensive outlook on the essential mods! It really made me way less confused.
After some examination, I think I'll start my mod on RevolutionDCM. It incorporates several things I've seen in other modpacks that I'll need and revolutions are essential for the dynamic gameplay I want to get. And it also is just BtS content-wise, so I can add XML things I want from scratch. Maybe there are some mod components you would recommend to add to RevDCM? Also, would there be any trouble adding Advanced Diplomacy to RevDCM?
Right at the moment, I really need this little PakBuild program to pack and unpack graphic assets I want to use, the download link here https://forums.civfanatics.com/threads/civ4-pakbuild.136023/ doesn't work and I couldn't find it anywhere else. So, if anyone is willing to provide me with this program I would be VERY pleased!
By advanced slavery I meant the slavery mechanic in RI and some other mods, with capturing slaves from defeating units and capturing cities (also could be great to have a chance for capturing a slave from pillaging farms/cottages). Also including slave/serf revolts. I have some ideas to improve this system even further, so I need this component to see what can be done as well.
I'm really scared of touching DLL at the moment, so it would be sad if changing prereqs unavoidably requires that. For example, of what I can think at the moment, I would need adding prereq for having certain bonus in city radius to build a building. And, for some units I have idea about, is it possible to make hidden nationality ("controlled barbarian") units have normal, visible nationality inside owner's cultural borders, as well as in civs with open borders? Maybe there are some mod components that add such options?
Also, what mod components allow terrain preference for civ starting locations? I would like to make that rather strict, so some civs would definitely spawn on coast, while others only inland, also on very specific terrain type or feature.
By the way, would it be useful if I'll write some of (advanced or even crazy) ideas I have here, to discuss how possible it is to implement them and what might be needed? Maybe someone done or tried adding similar ideas in past years? Or, maybe, someone would be interested in trying to add them…
 
PakBuild is in the resource database: https://forums.civfanatics.com/resources/pakbuild.2384/

Merging any two mods that have modified the DLL will require merging their respective modified C++ code and recompiling the result. Given the scope of your plans, I doubt that not touching the DLL is workable. But hopefully you could at least start out with just XML, artwork and a couple of Python mod components to be added to RevDCM. Speaking of RevDCM, some caveats, if only to absolve myself from responsibility :): My crib sheet says that it was developed from 2008-2013, with antecedents in 2005 (DCM was worked on from 2005-2011). The final published version RevDCM 2.9 is apparently from early 2011. There is more recent code on SourceForge, which even includes K-Mod 1.40 (the latest currently is K-Mod 1.46), but it's unclear whether those late additions are functional, let alone stable. At any rate, it's been dead for quite some time, but has had a fairly long life. Looking at the last few pages of the RevDCM main thread, the last time one of the mod's authors posted there was in 2015, and this post hints at some open issues. Doesn't sound too grave for a mod that had already not been updated for 4 years then. Still, I doubt that any competent modder or even any active CFC user still plays RevDCM, so it'll be difficult to get advice on issues that are specific to that mod. Well, most mods don't have much life in them these days.

I recall reading in the Realism Invictus thread that Walter Hawkwood wasn't really happy with the Revolutions system, made some changes, but still decided to leave it disabled by default and to invest no further time. So, if you're familiar with Revolutions from a recent version of RI, you might find that it doesn't work as well in RevDCM. I think Revolutions are mostly Python code, so it's possible that some of the RI changes could be applied to RevDCM just through Python. A broader point: When starting from a complex mod, it's easy to get sidetracked into customizing, polishing, completing that mod – rather than implementing your own vision. So looking into the unreleased RevDCM 3.0 or porting Revolutions tweaks from RI is perhaps not actually a good (early) idea.

If you write the slavery code pretty much from scratch, you could probably get it done in Python. That said, game rule changes are at least in some respects easier to implement through the DLL, certainly with fewer restrictions.
I'm really scared of touching DLL at the moment, so it would be sad if changing prereqs unavoidably requires that.
I've noticed in the RevDCM thread that it includes the World of Civilization module system; but I don't think this fundamentally expands what XML-based mods can do. That said, when you wrote about "more options for buildings," I was thinking of variations of existing building effects. I think those tend to be implemented as DLL mods – the author just copies C++ code of the most similar existing effect and then makes some adjustments. For more unusual effects, there's a better chance of finding a Python-only mod component.
[...] I would need adding prereq for having certain bonus in city radius to build a building.
Probably can be done without a DLL change, easier through the DLL. For one thing, there are plenty of examples in the C++ codebase of BtS for how to go through all tiles around a city. I doubt that the BtS Python code ever does such a thing – though I believe the Python API supports it and modders probably have written code in that vein. I surmise that the exact thing you've described is already implemented somewhere, maybe as part of one of the large DLL mods (RoM, C2C, RI, HR) if not as a mod component. The hidden-nationality idea is likely too deep in the weeds for Python, but should be a pretty concise change in the DLL, the main difficulty being to find the right spot.

For starting biases, only Culturally-Linked Starts comes to mind, which doesn't deal with geography at all, will only e.g. place Rome and Greece near each other. That mod involves DLL changes, but a map script could probably do the job too. I've implemented starting biases as a game option in AdvCiv (mostly through DLL changes), but that's not going to be easily portable (and doesn't really accomplish what you have in mind either). There might be other implementations, maybe one of the complex map scripts (Smart Map, Planet Generator, Full of Resources) has a suitable option? Starting requirements strike me as a challenging concept. For example, if we assume just 3 civs on the map, A, B and C, the game will generate 3 starting locations X, Y and Z spaced somewhat equally apart. Perhaps X and Y will be valid for A, only Y for B and none of them for C. (Maybe they're all coastal and C needs to be inland.) Even just an algorithm for satisfying the conditions as best as possible isn't trivial to devise. Altering the starting locations, e.g. by trying to move one of them a bit inland will require a lot of details to be worked out. Taking the requirements into account already when choosing the original locations will require understanding the BtS procedure for choosing them and the requirements will have to be weighed against each other and against other goals such as fairness.

Advanced Diplomacy: I see that Lemon Merchant has been able to merge it into Better BAT AI (her post about it). That's encouraging because RevDCM and Better BAT AI have BBAI in common and because Lemon Merchant is (or was at the time) not much of a DLL modder; at least I think she mostly limited herself to adopting code from other mods.
By the way, would it be useful if I'll write some of (advanced or even crazy) ideas I have here, to discuss how possible it is to implement them and what might be needed? Maybe someone done or tried adding similar ideas in past years? Or, maybe, someone would be interested in trying to add them…
I feel you already have a lot on your plate with what you've posted so far. But, if you want to excite people about this project, grander ideas could of course be useful. For my part, I'm quite unlikely to implement anything and may not even comment regarding feasibility. I'm more interested in helping modders get started or when they're stuck – a little, if I (easily) can.
 
And, for some units I have idea about, is it possible to make hidden nationality ("controlled barbarian") units have normal, visible nationality inside owner's cultural borders, as well as in civs with open borders?
bHiddenNationality is a BtS tag for units.
Look through the modiki before you decide to add something. Maybe it's already there. Or something very similar 🙂


By the way, would it be useful if I'll write some of (advanced or even crazy) ideas I have here, to discuss how possible it is to implement them and what might be needed? Maybe someone done or tried adding similar ideas in past years? Or, maybe, someone would be interested in trying to add them…
Personally I love brainstorming and sharing ideas/dreams. But as F1rpo said... don't overdo it. I mean, don't start many mini projects simultaneously. Start and finish a few or just one. Maybe put them aside if you are struck. Stay focused. It's more satisfying to see few things finished than many just started.
 
Thank you so much! Now I can scavenge anything I need from other mods! Ahem, I mean use already made graphics.
Yeah, at the moment I'm just adding stuff over RevDCM. So far I integrated Cultural Citystyles and, while adding Varietas Delectat, figured out civ unit styles, so I'll remake it from scratch when I'll update unit tree, using graphics from VD, RI and other mods if needed. Besides that, I implemented number of my usual personal changes I add to other mods and also added all bonuses I wanted. So far it is not so hard to add stuff, than to optimise and polish it to be good looking, especially PlotLsystem file. By the way, I added logging camp improvement and want to make it produce sounds like workers chopping trees, how can this be done?
If you write the slavery code pretty much from scratch, you could probably get it done in Python. That said, game rule changes are at least in some respects easier to implement through the DLL, certainly with fewer restrictions.
I'll try to added slavery system when time comes, but finding ready code could be nice still.
For starting biases, only Culturally-Linked Starts comes to mind, which doesn't deal with geography at all, will only e.g. place Rome and Greece near each other. That mod involves DLL changes, but a map script could probably do the job too.
The starting plot system I want is actually implemented in Civ4 Reimagined I played and modmodded before starting my own mod. It is nicely written in CivilizationInfos with terrain, feature and bonus biases tags. I wonder if Reimagined author added this themself or used some mod component. I probably should ask in Reimagined thread, but not sure if anyone will respond. Maybe this is the same code as that you used?
 
bHiddenNationality is a BtS tag for units.
Look through the modiki before you decide to add something. Maybe it's already there. Or something very similar 🙂
I know about HiddenNationality, but as I remember it makes unit look barbarian even inside owners borders, so it can be attacked by units from civs with open borders. What I mean that unit should look barbarian outside friendly (owners and civs with open borders) borders and look normal when inside. This is not about making it hidden really (as I want to use it for viking unique unit, so owner is clear), but giving opportunity for harassing others without declaration of war.
Yeah, I often checked out modiki over the years of modmodding and of course will do so for my mod.
Personally I love brainstorming and sharing ideas/dreams. But as F1rpo said... don't overdo it. I mean, don't start many mini projects simultaneously. Start and finish a few or just one. Maybe put them aside if you are struck. Stay focused. It's more satisfying to see few things finished than many just started.
Well, I meant just sharing ideas, not necessarily implementing them. At the moment I want to add fairly usual stuff, so that requires more routine working than thinking new ideas.
 
That sounds like swift progress. I guess having Varietas Delectat already onboard was one of the advantages of Legends of Revolution over RevDCM in my mind. Glad to hear that you're able to address that deficit and indeed make the artwork even better.
The starting plot system I want is actually implemented in Civ4 Reimagined I played and modmodded before starting my own mod. It is nicely written in CivilizationInfos with terrain, feature and bonus biases tags. I wonder if Reimagined author added this themself or used some mod component. I probably should ask in Reimagined thread, but not sure if anyone will respond. Maybe this is the same code as that you used?
Ah, I remember now. I'm pretty sure Team NP (two brothers, I imagine, based on the names on their GitHub page) are the original creators of that system. The Git commit history shows how it was gradually implemented and refined. I've kept a link in my notes to what struck me as their most relevant bits of C++ code: CvGame.cpp#L1039
My understanding is that they stick with the starting locations generated by the BtS algorithm; compute a fitness value for each pair of player and starting location, then reassign them in a way that maximizes the overall fitness. Seems more akin to the starting biases in Civ 5 – best effort – than guaranteeing certain conditions; although, if the conditions are easy enough to meet, it might satisfy them most of the time. Anyway, this seems like a very good starting point for what you described.

There's some overlap between AdvCiv and CReim (for lack of a shorter abbreviation; "RI" would collide with Realism Invictus). Had I known about their project when I started with AdvCiv, I would've been interested to join forces, but neither of us had released anything yet. A few years later, I was aware of their starting biases (they were added to CReim in 2021), but what I had in mind was different enough that adopting code from them didn't make sense. (In particular, I wanted the geographic latitude to play a big role, and I'm choosing the best fit for the given starting locations from among all 35 civs in the game and this replaces the selection of civs at random.)

If you've been playing CReim, then of course you're well familiar with K-Mod. I think the CReim modders had also made some tweaks to rein in K-Mod's few excesses, e.g. the overuse of Slavery. That'll be a bit of a step down then to BBAI.

Hidden Nationality: It's probably CvUnit::getVisualOwner that needs to be modified. I've made a small tweak (code on GitHub) there that gives the privateer owner away when it shares a tile with another unit. (Because it's then obvious that the privateer and the other unit are on the same side.)
 
That sounds like swift progress. I guess having Varietas Delectat already onboard was one of the advantages of Legends of Revolution over RevDCM in my mind. Glad to hear that you're able to address that deficit and indeed make the artwork even better.
Legends of Revolution had too much stuff of its own and I prefer clear BtS content to build from scratch. Concerning making artwork better… Trying to integrate new bonuses into CulturalCitystyles-modified PlotLSystem is really a headache for me right at the moment, never touched this file before.

most relevant bits of C++ code
So, I can simply add them and recompile the DLL, it will work?
Hidden Nationality: It's probably CvUnit::getVisualOwner that needs to be modified. I've made a small tweak
Will try and see later.

Also, concerning AI. I actually played quite a few longer games, as I usually feel the game lacking something for me (whence modmodding and this new mod I started. I hope with my mod I finally will play longer). Even less so I kept watchful eye on AI behaviour (especially since I played more RFC mods in the past). So, what's general difference between AI behaviour in vanilla, RevDCM and K-Mod? And will AI be competent enough to build economy, combine stacks, use artillery, aviation and ships effectively in RevDCM? I mean, I don't need some super agile AI, but atleast one that makes senseful decisions. Of course, I had seen mine share of AI, but I want someone else's opinion.
 
PlotLSystem is really a headache for me right at the moment, never touched this file before.
I've never touched it either, and I'm no help with the chopping sounds. Someone else, hopefully.
So, I can simply add them and recompile the DLL, it will work?
Doesn't look like RevDCM has changes in that area, so I suppose it should work pretty smoothly. The CReim code also doesn't seem to rely on earlier (K-Mod) changes. It might compile straight away – although that's a pretty rare occurrence in general when working with compiled languages; one should normally expect error messages that need to be puzzled out. For a clean merge, my best bet would be to apply all pertinent Git commits. Seems that all of those have the word "bias" in the title of their commit message, so this is perhaps a complete list:
So, what's general difference between AI behaviour in vanilla, RevDCM and K-Mod? And will AI be competent enough to build economy, combine stacks, use artillery, aviation and ships effectively in RevDCM? I mean, I don't need some super agile AI, but atleast one that makes senseful decisions. Of course, I had seen mine share of AI, but I want someone else's opinion.
I haven't played with DCM. I think there is some very basic code that lets the AI make use of the novel (optional) features. I recall reading a comment from Dale along the lines of him always adding (some) AI support for his mechanisms. Inadequate AI support was one gripe of RI players with the Revolutions component, but I don't think the AI is entirely ignorant of it. Haven't played with BBAI really either. I know most of its code because it's in my own mod via K-Mod, but I'm hazy about which changes were already in BBAI and which in K-Mod. Even plain BtS vs. K-Mod is difficult for me to compare because it's been quite some time that I've played without AI mods. The K-Mod AI is a good deal more effective at decisions that the player won't usually pay attention to, such as citizen assignment, worker builds, city production orders, city placement, tech choices, use of Slavery (though this probably goes a bit over the top). Lots of bugfixes, many not terribly consequential, but there should be noticeably fewer instances of bewildering AI plays, e.g. bringing only siege units to attack a city. Perhaps the most important effect of K-Mod strategically is that the AI is able and willing to produce more military units and, perhaps as a consequence of that, will start more wars than the BtS AI.

AI Auto Play (Ctrl+Shift+X) is included in BBAI, so one can easily get some broad impressions of the AI behavior of any BBAI-based mod, e.g. the frequency of wars, tech pace, typical diplomatic relations in the middle of a game, city placement, worker builds. The changelogs are too long to read through, but could still be worth a glance: K-Mod 1.46, BBAI 1.01.
 
Check out my mod:

This mod has a tonnn of changes, but still has that out-of-the-box Civ feel. I limited myself to XML changes and Python changes, because I didn't want to recompile the DLL. I am using a different DLL, but it is one where the only change is the max number of civs is increased to 34. You can see a summary of all my changes in the 32CivsMod_ReleaseNotes_README doc in the download.

Let me know if you have any XML or Python questions, I'd love to help out!
 
I think there is some very basic code that lets the AI make use of the novel (optional) features.
Yeah, that's my main concern. I plan to add a lot of new units (generally similar to what usually is added in other modpacks for realistic representation), so I hope AI will have no problem with using them. I also want to expand unit categories (like, dividing "mounted" into light and heavy cavalry). Furthermore, I plan to make advanced mechanical units be available only with certain building in a city (like tank factory for tanks), AI shouldn't have trouble with identifying what buildings it should build for what? Other than that, I gave a look on BBAI changelog and it seems it provides sufficient improvements for base game.
 
Check out my mod:

This mod has a tonnn of changes, but still has that out-of-the-box Civ feel. I limited myself to XML changes and Python changes, because I didn't want to recompile the DLL. I am using a different DLL, but it is one where the only change is the max number of civs is increased to 34. You can see a summary of all my changes in the 32CivsMod_ReleaseNotes_README doc in the download.

Let me know if you have any XML or Python questions, I'd love to help out!
Even if I will not find time to play it, I certainly will give a look at your mod (I like to see just what various modpacks add)! Instant question: how you made stacks limitied to 16 units per tile? And doesn't AI have any problems with that (like, making good combined stacks of different units)? I actually thought about making stacks limitied too as it seems to be a good balance between Civ4 doom stacks and Civ5/6 one unit per tile (both really ruin the scale of game for me).
 
Even if I will not find time to play it, I certainly will give a look at your mod (I like to see just what various modpacks add)! Instant question: how you made stacks limitied to 16 units per tile? And doesn't AI have any problems with that (like, making good combined stacks of different units)? I actually thought about making stacks limitied too as it seems to be a good balance between Civ4 doom stacks and Civ5/6 one unit per tile (both really ruin the scale of game for me).
In CvGameUtils.py, you can write Python Callback functions.
For the function "UnitCannotMoveInto", use this code:
# <---------- begin unit stack changes ----------------->
myPlot = gc.getMap().plot(iPlotX, iPlotY)
myUnit = gc.getPlayer(ePlayer).getUnit(iUnitId)

if(myPlot.getNumUnits() >= 16 and myPlot.getNumVisibleEnemyDefenders(myUnit) < 1):
return True
# <---------- end unit stack changes ----------------->
and set the "USE_UNIT_CANNOT_MOVE_INTO_CALLBACK" value to 1 in PythonCallbackDefines.xml.
This code is read as follows....

Get the plot and the unit
If the plot hase 16 or more units, and no visible enemy defenders,
return True, that is that the unit CANNOT move onto the plot.
Otherwise, return False, meaning the unit CAN move onto the stack.

The AI has no issues with this, and still makes stacks of various units. Hope that helps!
 
Yeah, that's my main concern. I plan to add a lot of new units (generally similar to what usually is added in other modpacks for realistic representation), so I hope AI will have no problem with using them.
If it's too disappointing, then maybe some other DCM-based mod has made some small but significant improvement. Rise of Mankind might be the best candidate. Which btw also combines RevDCM with Advanced Diplomacy, perhaps a hopeful sign. Oh, and the Evolution modpack also combines the two, plus K-Mod. But the latest version at least isn't really playable. (The savegame issue that players have been reporting at the end of the thread is probably easy to fix, but its presence suggests that the author had hardly tested that latest version at all, which does not bode well.)
Furthermore, I plan to make advanced mechanical units be available only with certain building in a city (like tank factory for tanks), AI shouldn't have trouble with identifying what buildings it should build for what?
Some AI code exists and shouldn't be difficult to tweak a little if the AI isn't interested enough in those buildings.
 
In CvGameUtils.py, you can write Python Callback functions.
For the function "UnitCannotMoveInto", use this code:
# <---------- begin unit stack changes ----------------->
myPlot = gc.getMap().plot(iPlotX, iPlotY)
myUnit = gc.getPlayer(ePlayer).getUnit(iUnitId)

if(myPlot.getNumUnits() >= 16 and myPlot.getNumVisibleEnemyDefenders(myUnit) < 1):
return True
# <---------- end unit stack changes ----------------->
and set the "USE_UNIT_CANNOT_MOVE_INTO_CALLBACK" value to 1 in PythonCallbackDefines.xml.
This code is read as follows....

Get the plot and the unit
If the plot hase 16 or more units, and no visible enemy defenders,
return True, that is that the unit CANNOT move onto the plot.
Otherwise, return False, meaning the unit CAN move onto the stack.

The AI has no issues with this, and still makes stacks of various units. Hope that helps!
Added this code to CvGameUtils and changed cannot move callback, but the game crashes at launch. Maybe there's something else?
 
Progress at the moment: gradually adding new units. Everything is good, but there's one issue, maybe someone can help. I added a transport steamship unit. I used commonly used paddlewheeler graphic, taking it from RFCDoC, and also tried the same with RI graphic. In both cases, unit looks as good as it should with model and animations. However, when I command it to move, game screen freezes as if something is wrong with moving graphics. Also, game screen notably freezes for a couple of seconds when I add this unit on the map. What can be the problem and how can it be fixed?
 
Back
Top Bottom