Merkava's Mods

The author managed to have one civic which you could choose but for the Nomad/Settled civic it was set depending on if you had a tech or not. There was no possibility that your nation would revert to nomadic once you got agriculture. That does happen:- the Nabataeans (of Petra fame) were "desert" nomads, became bandits, then became a settled nation as taxes and services are much more profitable and easy than raiding. But then they got invaded, while their army was busy else where ( a great time to invade:D) so abandoned their cities and went back to being nomadic for awhile. Eventually settling down again.

Now THAT is interesting. I hadn't even considered going from settled back to nomadic...

I am envisioning a random event... "Since the war is going badly, would you like to pack up and move into the wilderness?"

LOL


My own take of the types goes something like:-
  • Hunter/gatherers or seasonal nomads - moving from one seasonal camp to another, can be from one source of resources to another or maybe following wild herd migrations of a mix.
  • "advanced" seasonal nomads - some plant or herd management. If there is enough food it would allow for one small settlement (no more than a hamlet) probably the centre of religion. It may not be occupied throughout the year.
  • pastoralist nomads - the herds are now domesticated and go where humans decree. ditto
  • settled herders - most of the tribe stay in one place and just those herding the animals move about. Restricted to temperate regions eg from history where the herds winter in the valley and move up and down the mountains with the weather. Allows villages)
  • settled - most food from farming and non-migratory animals.

I think I will be doing something like this, slowly building from the top one to the bottom one using different techs. But at any point the player could just keep going in the direction they are going and forget that whole "sedentary" thing. (The problem will be convincing the AI's that this is a fine way to do things. They don't really know how nomadism works.)
 
Civ4 Tactical Combat Mod


Basic idea:
  • Tactical attacks can be added to units through an XML file SpecialAttackInfos.xml.
  • These attacks have a wide range of possible effects - damage, indirect fire, explosions, spawning units, suicide, graphical effects, applying promotions, etc.
  • The AI uses these attacks if it can!
  • In addition to normal AI use, attacks can be used on you automatically through opportunity fire and return fire.
  • Units can have armor and camouflage given to them through a second XML file SpecialUnitStats.xml.
  • "Camouflage" can be a flat random chance of being spotted, or a camo/spotting system similar to World of Tanks where spotting is impossible at a certain distance. Either way the unit needs to have INVISIBLE_CAMOUFLAGE as their invisible type.
  • "Armor" is based on directions and where the unit faces, so you can have different values for front vs. side armor. An attack's "Penetration" determines whether or not the attack can do damage to an armored target.
  • I also added "strategic objectives" and a "strategic victory" based on capturing these objectives. You can set up a few objectives around the map in worldbuilder, then whichever team captures them all first wins.
This mod could be used for
  • World War II tactical combat mods (as it was designed for)
  • Tactical combat mods for any time period (I intentionally made that possible)
  • Spell systems with lots of weird effects via promotions, spawning units, etc.
  • Mods adding new strategic-level attacks, like skirmishing, bombarding, etc. (similar to Dale's Combat Mod, but more configurable)
  • Just a random invisibility system - you can completely ignore the tactical attacks and still use this mod for random invisibility.


Spoiler Motivation :
Since July or so I've been working on a mod to add tactical combat to Civ4. The basic idea is
  1. Ranged attacks that are actually interesting
  2. Which the AI also uses
  3. Which can be added via XML.
Civ4 already has a ranged attack system, but it's based on the combat system for air strikes, and you can only do a certain range of damage (which varies depending on the setting in GlobalDefines). It does change based on combat strength but not enough to be very useful in a tactical mod - I tried making a World War II mod with it once, and ended up with tanks that could be insta-killed by 10 infantry firing together - not my ideal!

I wanted to make my own system but didn't know how to get the AI to do it or how to load them through XML. Then I had a brainwave reading TC01's python action button tutorial - what if I forced the AI to use attacks every turn?

This mod is the result! I hope you like it.


Spoiler Credits :

Thanks to TC01 for the excellent python action button tutorial that prompted this mod. Also thanks to TheLopez and others for exploring how to reveal invisible units.
The XML loading copies The_J's XML loading from SpawnACiv, which is brilliant, and the method CutString is copied and pasted from that mod.
Other sources of inspiration include Zebra's python actions, Jeckel's unit stats, and a long thread discussing tactical combat mods.
I'm pretty sure there's a python spell system out there, too, that was pretty advanced but had no AI yet. That was also inspiration.

The explosion crater artwork is from Kathy's bucket wheel excavator.
The art effect I reference for my example attacks is actually a vanilla civ effect.


Included with the mod are several txt files that outline in detail the python methods and XML tags I've included, as well as a guide to adding your own XML tags if you want to do that.

I did use a little SDK in this mod so keep that in mind if you're planning on merging things. All I did was expose the function canSeePlot in CyPlot to python - this allows me to tell if a unit can attack a plot or not. It should be pretty easy to merge if you use Leoreth's fantastic DLL guide. I think I included all the SDK files that were affected but I might have missed some (sorry). Let me know if you need help merging it or anything.

Now the most important question: How does the AI use this?
Spoiler AI :

  • At the beginning of each AI player's turn, the program looks through all of the AI's units. For each unit, it looks at the unit's attacks, loads attacks that will actually be effective into a list, and then selects the most damaging attack from the list and uses it. Each attack is added to the list once for every target it could affect, so the AI chooses the most damaging possible.
  • I also have the AI able to use defensive attacks if you set <bCanAttackSelf> to 1 and <bDefensiveEnemyNear> or <bDefensiveEnemyFar> to 1 in the XML. The AI will use these types of attacks on itself at the end of every turn.
  • Unfortunately I am not very good at SDK, so I have not yet written a UnitAI to handle these attacks or unit stats. As a result, the AI will wander around wondering why its enemies are getting obliterated without positioning for, preparing for, or reacting to any attacks anyone makes. Eventually I want to write some good old UnitAI's for this mod to work properly, but I have not gotten to that yet.
  • The AI has no idea how camouflage or armor work at all. I have given the AI the ability to rotate its armored units to show their strongest armor to the most dangerous enemies at the end of each turn, though. So you won't have Panther tanks running by you wantonly showing their weak spots.
  • The AI also has no idea what strategic objectives are. Use these carefully - if you place them around a map far away from the AI, you'll be quite likely to capture them all before you even see any enemies.


My suggestions on how to use special attacks in an AI-friendly way:

Spoiler :

  • Make attacks lethal or very damaging! This will give the AI a boost as it only gets to use attacks when you are nearby.
  • Give AI units' attacks opportunity fire (set <bOpportunityFire> to 1) or return fire (<bReturnFire>1) to give them more opportunities to attack.
  • For strategic objectives, put AI units on them at the very beginning, and give yourself one, so that you are trying to capture the AI's strongholds as well as other points on the map. Otherwise you (or the AI's spammed scouts) might capture all the objectives without anyone seeing each other.
  • Or, just play multiplayer. Another human will always be better at this game than an AI, even without these attacks :)


Current Issues with the Mod, which I might fix with SDK later -
Spoiler :

  • As mentioned above, the AI uses attacks but does not prepare or position for them.
  • The way random invisibility works in python is to reveal a whole tile, not just the spotted unit. Beware, if your giant stack of invisible spies creeps up on the enemy and one of them slips on a coconut, the whole stack is revealed!
  • The AI might disband strategic objectives. I have not witnessed this but I can't prevent it either. Also, the AI has no idea how to achieve a strategic victory and won't even try to do it on purpose.
  • There is some slowdown in between turns, and if you have a lot of attacks, there might be significant slowdown in between turns or even as you make attacks. I will keep testing things as I use the mod more and hopefully get rid of some of the slowing, or at least keep it to just in between turns.


Spoiler Future plans :

  • Soon, I will merge Fires into this mod for flamethrower units/explosions/etc.
  • I will also be making mapscripts to generate building features.
  • Also thinking about how to make hover text that tells you whether you can penetrate an enemy's armor or not. (Possibly CyInterface().addImmediateMessage)
  • I will eventually be turning this into a full conversion mod for Civ4, modeling World War II combat on a tactical scale.
  • I also want to make this mod very compatible with fantasy mods and spell systems, so I'll be thinking about what needs to be added for that. (I'm thinking of attack types and spell resistance and stuff.)
  • I will also continually refine the AI's function for deciding if attacks are effective as I play the mod and see how it works out.


Enjoy!


Update 10/11/2020
Spoiler changes :

  • Units now use their rangedstrike animation when attacking. They might stay in that pose until you do something else though. (Also, it only applies to the "first" unit graphic, so if you have more than one soldier comprising a unit, only one soldier will fire.) This can be turned off for any attack by setting the attack's bUseUnitAnimation to 0 in the xml.
  • (One thing to note about that: bFaceTarget will make your unit face the target and use its animation. But if your unit has armor, bFaceTarget will also rotate different points of armor toward the enemy. So if you don't want to expose your armor but DO want to shoot at an enemy, you may end up with tanks shooting at things behind them without turning, and weird stuff like that. CIV has no turrets, so I can't really fix that right now.)
  • Added suppressive fire. Through iSuppressionChance in the xml, an attack can add a "Suppressed" promotion to an enemy unit after the attack is finished. "Suppressed" units have -10 moves and cannot use opportunity fire or return fire. I made suppression unable to affect air/armor/siege units by default but you can change that through globals in the SpecialAttacks.py file
  • Fixed a bug where a unit would be unable to attack a target if the target was not listed as such in the xml.
 
Last edited:
Fires

(This post was originally going to be the full Disasters mod but that mod evolved away from this Fires mod setup, and this is now obsolete.)

Spoiler Fires :

  • Have a chance of spawning randomly on forests
  • Spread to nearby tiles, more often to forests, less to deserts
  • Can destroy improvements on tiles
  • Fires can spread to cities and kill people/destroy buildings
  • Fires have a chance of starting when cities are razed or when units pillage a tile
  • Units are not allowed to enter tiles with fire in them
  • Fires are purely a python object with a graphical effect - not a feature, terrain, or unit - so they can show up anywhere on the map without any weird effects
  • All of these are configurable in the Disasters.py file.

Spoiler How to save fires :

  • Fires are now saved every time you save the game in a little file called "firesave.txt" in Assets/Python. This only saves the last games fires.
  • If you want to save your fires, but you also want to start a separate game with the mod, you can move the firesave.txt file to a different spot. Then when you're ready to keep going with the previous game, put the firesave.txt file back and it will still load all the fires from before.
  • If you want to seriously mess things up, you can add a bunch of random numbers to the firesave.txt file. This will spawn fires everywhere (or might break the game if the fires are out of bounds lol) :crazyeye:

Spoiler Issues with fires :

  • Units cannot enter tiles with fires in them, but if a fire starts on a unit, the unit will be able to stay there. I don't think this is much of a problem right now, but you may end up with an untouchable stack of enemy AI units in a fire at some point.
  • I don't make fires hurt units for this reason. Don't want to punish the AI for not running away from something it can't see.


Thanks to FFH2 for the fire effect (I think, it was a while ago I started making this :p ).
 
Last edited:
Spoiler Issues with fires :
  • Units cannot enter tiles with fires in them, but if a fire starts on a unit, the unit will be able to stay there. I don't think this is much of a problem right now, but you may end up with an untouchable stack of enemy AI units in a fire at some point.
  • I don't make fires hurt units for this reason. Don't want to punish the AI for not running away from something it can't see.
  • If you close the game and reload, all the fires will be put out. Working on a fix for this.
In AND2 the AI understands terrain damage and avoids it but I guess it's a different mechanism here.
A possible solution could be:
  • the tile does damage units
  • only AI units cannot enter such tiles, human units can but will be damaged
  • if fire is spread to a tile with AI units on it, than the AI units are pushed to nearby tile (damage them or not? Maybe it could be random)
 
very nice ideas from you my israeli tank modder.

keep at it.
im working on a ranged strike mod on my mod, batched together from various mods.
so i like what you are doing.

also natural disasters is cool!

Thanks man! Lemme know how your ranged strike mod goes, I am always interested in that area of modding.

In AND2 the AI understands terrain damage and avoids it but I guess it's a different mechanism here.
A possible solution could be:
  • the tile does damage units
  • only AI units cannot enter such tiles, human units can but will be damaged
  • if fire is spread to a tile with AI units on it, than the AI units are pushed to nearby tile (damage them or not? Maybe it could be random)

That would be a way to do it. I'll look at scooting AI units around as soon as I'm done with diseases...one thing I don't want is for the human to be able to start a fire by pillaging and then force the AI to evacuate the city and get killed. Although, now that I think about it, that probably has happened in history :p
 
one thing I don't want is for the human to be able to start a fire by pillaging and then force the AI to evacuate the city and get killed. Although, now that I think about it, that probably has happened in history
Hmm.. If a city is on fire things could work different:
  • units are NOT pushed out of a city and entering a city is still possible
  • the more units are in the cite, the greater the chance to put out the fire (say 5% for each unit. This should be configurable, so siege units, great person, captured animals, etc. don't count)
  • add a new building xml tag: iFireFighter. Increases the chance of putting out a fire by this percent, so a city with a Fire Station save itself from the fire without the aid of military units. And buildings with this tag are immune to fire. Would be lame to see the Fire Station burn to ashes :lol:
  • you could even add a new promotion to increase the chances of firefighting but I doubt that the AI would understand it, so it's rather unnecessary IMO.
 
Hmm.. If a city is on fire things could work different:
  • units are NOT pushed out of a city and entering a city is still possible
  • the more units are in the cite, the greater the chance to put out the fire (say 5% for each unit. This should be configurable, so siege units, great person, captured animals, etc. don't count)
  • add a new building xml tag: iFireFighter. Increases the chance of putting out a fire by this percent, so a city with a Fire Station save itself from the fire without the aid of military units. And buildings with this tag are immune to fire. Would be lame to see the Fire Station burn to ashes :lol:
  • you could even add a new promotion to increase the chances of firefighting but I doubt that the AI would understand it, so it's rather unnecessary IMO.

I like this. here's what I'm thinking so far -
  • Fires do damage to units unless the fire is in a city. (City fires do damage to cities, not units)
  • AI units cannot enter fires.
  • AI units that somehow end up in fires will be teleported 3 squares away in a random direction (in case there are a lot of tiles on fire)
  • Units in cities have a chance to put out the fire, added for more units.
  • Buildings can add to this chance too - perhaps just a few specific buildings, or maybe creating a new DisasterPrevention.xml file or something. (I could see the same thing being useful for diseases, storms, etc.)
  • Firefighter units can enter fires without being damaged and put them out with a certain chance. Firefighters are otherwise completely useless units (but maybe have a larger firefighting chance for cities?)
  • The AI will be given firefighter units if lots of fires start in their territory.
  • Each turn, a check for fires in AI territory will teleport the AI's firefighter units to fires so they can fight them.
I think all of this would balance it out fairly well. I will probably add the first three very soon, and the others after I finish other disasters (I want to get all of the disasters into one mod before I do disaster prevention stuff).

interesting,
do you wish to assist maybe?

Sure? I'm pretty busy with school, and I hate C++, but I do love me a good rangedstrike. :lol:
 
I see good ideas here. I already have Volcanoes and Earthquakes in my mode, but maybe we could help. You're more about functions, I'm more about the model that dissaster represents, but it doesn't matter. :)
 
I see good ideas here. I already have Volcanoes and Earthquakes in my mode, but maybe we could help. You're more about functions, I'm more about the model that dissaster represents, but it doesn't matter. :)
Mm your volcano is beautiful, I've used it in personal mods before. I was definitely planning on pilfering it for the disasters mod :mischief:

Do you know of any good storm models/effects? That one has me stumped.
 
General news update - I'm still working on the diseases mod, but the semester is over and I'm taking this next semester off to mod civ to do work and research, so I will have a little more time to work on this. I really want to get Dynamica running as an actual mod soon, so here's to big goals. :beer:
 
I also searched harddiscs from older computers, but the promised file ended up somewhere in the abyss of history. I'm sorry - I only found this.
 

Attachments

  • rain.rar
    7.8 KB · Views: 127
Hey that's way better than anything I've got. Many thanks. I think I can steal clouds from the old FFH mod too, patch up a good storm that way.
 
Progress update for anyone who's watching these mods:
  • Dynamica: I've decided to base the full mod on Keldath's Dawn of the Overlords, plus a few more SDK mods I throw in. Waiting until I finish Disasters to get working on that.
  • Disasters: I made a whole disasters mod this week but it's terrible and full of enough bugs to require a full retry. Going to move to a system more like Civ4's random events (but my own, so that I can control probabilities).
  • Diseases: had a huge overcomplicated mod developed back in 2020 that I would like to revamp to be simpler. That's up next after Disasters.
  • I might combine Disasters and Diseases but I'm not sure.
I've also been bouncing around a new idea - Factions. Basically simulating groups within your cities; each group would have influence (adding to 100% total; your government would have a certain amount of influence to start with, depending on civics) and satisfaction (groups will have civics, religions, and other groups they hate, and will become pleased/displeased based on your actions). A powerful and unhappy faction = high potential for revolutions, hostile takeovers, changing your city's production because they disagree, etc.

It'd basically be a revolutions mod but could also be used for religious schisms, civics that reflect reality (feudal lords with their own agendas, for example), terrorist group, mafias, political revolutionaries, tribes, etc.
 
  • Dynamica: I've decided to base the full mod on Keldath's Dawn of the Overlords, plus a few more SDK mods I throw in. Waiting until I finish Disasters to get working on that.

im honored!
let me know if i can assist.
if you need access to more stuff from me.
also - interested in what mods you added!
 
Top Bottom