Resource icon

C3X: EXE Mod including Bug Fixes, Stack Bombard, and Much More Release 22

Another thing I've been thinking about doing for a while and intend to do for R16 is add an option for upgraded barbarian unit types. My idea is that there will be a list in the config file of barbarian unit types unlocked at certain tech levels. ... My current plan is to make it so that each encampment has its own tech level based on cities in its vicinity, for example an encampment could spawn longbows if there is a city within a certain number of tiles (say 10 - 15) that is owned by a player that has unlocked Chemistry. Another idea I had was to make it so the barbs own any tech already owned by at least two civs. ...
I'm also pretty sure that this is similar to how the "Barb-upgrades" worked in CivDOS.
Aye, Civ1 and Civ2 upgrade their barbs as soon as the requisite tech is reached by anyone. Tailoring it to relative development is something I never even imagined possible. :eek:
 
Flintlock, these are great new additions for R16! :clap:

Some thoughts about the great new feature for upgrading Barbarians:

To create in the config file a list of barbarian unit types unlocked at certain tech levels, enlarges that file to more and more big dimensions considering all the other lists that can be written in that file. So it should be reflected, how these features could be done without such lists in the config file.

Every unit in the unit rules registry of the editor can be set to be available to the Barbarians. The problem is, that this setting is overwritten by the setting for Barbarian units 1 and 2 (and the naval unit) in the general settings of the editor. Now when this barrier can be overcome with R16, every Barbarian unit still can be set in the editor - and this unit is still be connected to a tech in the editor, making the list in the config file no longer necessary.

Barbarian Units.jpg


Now the questions are starting:

In the screenshot above, the unit needs the resource Iron. Barbarians have no access to resources. Can this unit been built by Barbarians even without having access to the resource Iron ? If this is not the case, it would be no problem for modders to integrate a unit in the upgrade chain, that is only available for Barbarians and doesn´t need such a resource (in this case Iron).

The other problem is, which civ must have reached the necessary tech (in this case the tech Iron Working). Here I tend to connect the upgrade of barbarians to the tech, that the human player has researched. This solves the problem of "research at the other end of the globe". The level for Barbarian units when connected to the tech level of the player is always centered to the region of the human player.

The next problem is, if the upgraded Barbarians are only spread with new produced units by the Barbarian villages or if still existing Barbarian units on the map are automatically upgraded, too.

All in all, if it could be possible to simply connect the upgrading of Barbarians to the settings in the editor, the option in the config file could be reduced to
Advanced Barbarian Upgrading: false/ true
 
Now I don't know the back end, but I presume the camps aren't producing units like cities but spawning them through internal script, so resources should be a moot point. I imagine the unit classes designated in the .biq are loaded into the script when the game starts, so Flintlock's patch would replace them at the appropriate milestones during play. Being able to parse straight from the units' default specs would certainly streamline it on the modder's end.
 
Also I did some work optimizing those improvement loops like I described earlier (still haven't gotten around to posting a thread about that, but I will eventually). Another thing I've been thinking about doing for a while and intend to do for R16 is add an option for upgraded barbarian unit types. My idea is that there will be a list in the config file of barbarian unit types unlocked at certain tech levels. Something like: barb_type_1_upgrades = [Chemistry: Longbowman, "Motorized Transportation": Guerrilla] so barbs would spawn longbowmen instead of warriors when players have reached Chemistry and similarly for guerillas. I'm still considering how to determine a tech level for the barbs. My current plan is to make it so that each encampment has its own tech level based on cities in its vicinity, for example an encampment could spawn longbows if there is a city within a certain number of tiles (say 10 - 15) that is owned by a player that has unlocked Chemistry. Another idea I had was to make it so the barbs own any tech already owned by at least two civs. That has the advantage that it's a simple rule and consistent with the rules for barb uprisings, but the downside is a barb encampment could tech up based on research happening on the other side of the planet. Anyone who's interested in this feature, feel free suggest something.
That sounds very similar to my idea that I posted a long time ago! :D The only thing I had differently was to have the game check on barb spawning for whether the closest human player has said technology.

To create in the config file a list of barbarian unit types unlocked at certain tech levels, enlarges that file to more and more big dimensions considering all the other lists that can be written in that file. So it should be reflected, how these features could be done without such lists in the config file.
The config file's size doesn't seem to be an issue to me, just like the size of PediaIcons hasn't stopped anyone from making a mod. Things should go where they can be best implemented and adjusted by Flintlock, and cramming new functionality into the unmodified Firaxis editor will only get more daunting with time.
 
The config file's size doesn't seem to be an issue to me, just like the size of PediaIcons hasn't stopped anyone from making a mod. Things should go where they can be best implemented and adjusted by Flintlock, and cramming new functionality into the unmodified Firaxis editor will only get more daunting with time.
No extra functionality to the Editor is needed: the .biq already specifies which units are available to each Tribe, including the "Barbarian Chiefdom".
 
Last edited:
No extra functionality to the Editor is needed: the .biq already specifies which units are available to each Tribe, including the "Barbarian Chiefdom".
:yup: Yes, this is the point - and additionally the biq already specifies the prerequisite tech for that unit.
 
In the screenshot above, the unit needs the resource Iron. Barbarians have no access to resources. Can this unit been built by Barbarians even without having access to the resource Iron ? If this is not the case, it would be no problem for modders to integrate a unit in the upgrade chain, that is only available for Barbarians and doesn´t need such a resource (in this case Iron).
It occurs to me that it might not even matter.

Exhibit A: in the epic-game, Barbs can spawn Hordes'o'HorsemenTM, so they are clearly not subject to the same "Requires: Horses" restriction on Horseman-builds that the playable tribes are.

If that lack of restriction applies to any unit made available to Barbarians in a .biq, then a modder could assign whatever units they wanted the Barbs, up to modern tanks + warships (possibly not planes, though?)
 
In the Original Editor, I have given Barbarians Samurai, War Elephants and Dromon that required Resources and the Barbarians got them without the Resources.
Resources are not Required for Units concerning Barbarians.

In the Original Editor, Air Units are not listed for Barbarians so it appears Barbarians are limited to Land and Sea Units.
 
Well, via the config file you could give barbarians units at techs that real players would have already gotten. Like longbowmen at gunpowder in Flintlock's example. Doing that based on the editor would require introducing duplicate units for everything the barbs are supposed to make.
 
I like this idea! Could you maybe use similar code as already used for the Great Library, to give the Barbs those techs?
I don't know if the game even tracks techs for barbs, although it probably could since there's a barbarian player object in the first slot of the players list. In any case, I think it's easiest to evaluate the barb tech level and upgraded unit type at the point where barb units are spawned. I've already found the game's unit spawning method and where it gets called to spawn barb units. It would be pretty simple to intercept those calls and swap out the unit type to something else.
yes, i have also already starred the c3x repo
Alright, it's probably best to collaborate through GitHub since it's been designed for that. I also signed up on Telegram (username cfcflintlock), I'll try sending you a message.
Every unit in the unit rules registry of the editor can be set to be available to the Barbarians. The problem is, that this setting is overwritten by the setting for Barbarian units 1 and 2 (and the naval unit) in the general settings of the editor. Now when this barrier can be overcome with R16, every Barbarian unit still can be set in the editor - and this unit is still be connected to a tech in the editor, making the list in the config file no longer necessary.
I would like to rely on the editor as much as possible since people have told me multiple times that the text config is awkward to fill in. How big of a problem is it that the "available to" list gets overwritten by the general settings for barb units? Is there any way for modders to work around that? If it's not possible through the Firaxis editor, it's possible to require the use of a third-party editor instead. That's already the case for the free improvements from small wonders mod feature, so it wouldn't be the first time.
Now the questions are starting:
(1) My current plan is to ignore the resource requirements for barb units. I might respect the requirements though, if that's something people want. I imagine it could be useful for scenarios with preset maps, for example a mod could place an encampment on an iron resource and let it spawn swordsmen unlike others. That particular encampment would be more difficult to disperse but also more valuable for whoever manages to do it. On random maps, I don't see resource requirements being useful since it's so rare for encampments to randomly spawn on resources.
(2) I'd rather not add any special rules for the human player if possible. Also keep in mind there may be multiple human players in a game, so even with that rule you'd still have the problem of deciding on a threshold for the number of players to have a tech before it's given to the barbs.
(3) I intend to upgrade barb units too, but only if they're sitting in an encampment and not out on the map.
Now I don't know the back end, but I presume the camps aren't producing units like cities but spawning them through internal script, so resources should be a moot point. I imagine the unit classes designated in the .biq are loaded into the script when the game starts, so Flintlock's patch would replace them at the appropriate milestones during play.
Exactly right. Barb unit spawning is separate from city production. I can intercept the call to the unit spawning method from the barb logic, and swap out the type of unit to be spawned with something else. The replacement type could be any other unit from the scenario. The requirements like resources, etc. don't matter unless you all want them to.
 
Disabling founding cities on foreign territories would also be nice. Combat settlers make human artillery even more overpowered.
 
Settling cities inside enemy borders in order to turn their railroads into yours. Then you bring your artillery up as Predator described and start turning the handle on the meat grinder.
 
Settling cities inside enemy borders in order to turn their railroads into yours. Then you bring your artillery up as Predator described and start turning the handle on the meat grinder.
Surprise ... a "cheat" I hadn't thought of. :shake:
 
No problem! I hope to fix the trade network collapses for R16. I've already found what might be the cause. If I'm right, the collapse should only occur when the number of resource generating buildings plus the number of map tiles equals exactly 65536. So when you experience the collapse, building another resource generator should fix it. If you could test that theory, it would be helpful, although I'll fix that issue I found in any case.

The fact that the limit depends on the number of tiles and the number of resource generators is odd, but it's a result of the way resource generation is implemented. Basically, when the game goes to propagate resources through trade networks, it processes every tile on the map checking each of them for a resource. To make building-generated resources possible, the mod alters that by causing the game to process additional tiles beyond those actually on the map, one for each resource generating building. The mod then alters the way the mod accesses those additional tiles so their location matches the city each resource generator is in and the resource type matches the generated resource. It's a clever setup, if I do say so myself, since it means generated resources work like map resources for all purposes, for example I didn't need to do anything additional to make generated resources work with trade between players. The catch is it creates this weird coupling between the number of tiles and the number of resource generating buildings.

Hey Flintlock

First off, I can confirm, that the problem of the collapsing trade network can actually be avoided by playing on smaller maps.
Thank you for this very good idea!
Unfortunately, in my little test session, the error could not be fixed by building additional buildings that generate resources.
The trade network can only be restored by selling buildings to fall back below the limit once exceeded.

Also, another interesting aspect to this bug:
The collapsing trade network appears to be somehow related to the raw materials required for each building.
My scenario works with a simple system of raw materials placed on the map and the goods made from them in buildings.
The weaver needs cotton within a city radius, the fur trader needs furs, the rum distillery needs sugar and so on...
It seems I can completely prevent the bug if the goods-producing buildings do not require any raw materials to be built and operating (it was just a test, of course it doesn't make sense in the scenario itself).
 
Last edited:
Here are some observations from the wonderful world of stealth bombardment.

-Aircraft using stealth bombardment can attack enemy air units on their list that are stationed in cities and on carriers. For carriers, the bombing aircraft can actually choose to destroy the air units instead of the carrier itself. As always, aircraft have lethal bombing enabled against enemy air units.
-Air units on airbases are completely immune to stealth attacks and damage. They cannot be selected by the bombarding aircraft, nor can they be hit if all ground units are eliminated or redlined. Air units that are pre-placed on land tiles are likewise invincible to air attacks and stealth bombardment.
-Land artillery units cannot select air units as targets for bombardment, even if they are on the list. They can select land or sea units as targets. They need lethal bombard corresponding to type to eliminate units, as per usual. If land artillery targets a city with only air units, it will not hit them.
-Sea units can stealth bombard air, land and sea units just like aircraft do. Again, lethal bombard is automatic against air units, and must be checked off for land and/or sea units. Stealth bombarding sea units can also pick aircraft off the decks of carriers.
-Defenseless units like catapults and workers have hit points. Not sure if this has been verified before but I've long suspected this. They can be stealth bombarded, and will have that little percussion sound when they are hit, but of course have no hit point bar. So defensive units may take multiple bombardments depending on the attacker's rate of fire before they die. But die they will. Interestingly, units without lethal land bombard can "damage" these units, and then units with lethal bombard can finish them off. The hit points are assigned in the biq. If given veteran or elite status they will have the extra hit points, although they still have no hit point bar. You can count the hits with bombard effects. Similar behavior is visible in CCM when enslavers attack workers, and you can see them "counting down" the damage until the worker is killed.
-Defenseless units that are stacked with units that have hit points (be they land, sea or air), can be targeted by stealth bombardment. On tiles that have only defenseless units, however, they cannot be bombarded at all. If alone in a city, the city can still be bombarded normally. But if they are out in the open, they are invalid targets. This applies to stacks of different types (e.g. a worker and a catapult), but this immunity is lost if a unit with a hit point bar shares the tile.
-AI air units like to target land units first when they have a choice between stealth bombing air or land units in a city. This is interesting, because with normal bombing the AI always likes to eliminate air units first, before land units. Stealth bombing artillery was the lowest priority after defensive land, sea units, offensive land, and air units.
 
Similar behavior is visible in CCM when enslavers attack workers, and you can see them "counting down" the damage until the worker is killed.
:yup: ... and when attacked by a 1 MV unit, the 2 MV CCM workers can escape.
 
Back
Top Bottom