Merkava's Mods

Discussion in 'Civ4 - Mod Components' started by Merkava120, Apr 2, 2020.

  1. Zeta Nexus

    Zeta Nexus <{[(Nexus)]}>

    Joined:
    Jan 23, 2014
    Messages:
    4,477
    Gender:
    Male
    Location:
    In a constant brainstorm...
    How about a "Natural disasters" modcomp?

    There are already event based natural disasters in mods but how about Hurricanes that move from one tile to the other and destroy forests, jungles and improvements on the tiles it enters, even some of your buildings when it hits a city and does a lot of damage to units? Tsunamis whit the same effect on 1-3 coastal tiles? Hills and peaks becoming Volcanoes damaging the nearby tiles the same way?
     
  2. Merkava120

    Merkava120 Oberleutnant

    Joined:
    Feb 2, 2013
    Messages:
    403
    Gender:
    Male
    Location:
    Socially distant
    Definitely planning on that one! I'm thinking of having storms be a feature that randomly appears/disappears on tiles, or maybe a unit (so it doesn't replace forests), and sometimes can develop twisters. Then storms that appear over warm waters can turn into tropical storms and hurricanes, which move inland and wreck stuff.

    Not sure if I should do feature, unit, or something else though (a bonus? lol).
     
  3. Merkava120

    Merkava120 Oberleutnant

    Joined:
    Feb 2, 2013
    Messages:
    403
    Gender:
    Male
    Location:
    Socially distant
    Also, seasons now has snow that actually melts, although snow is generally sporadic and rare which is bugging me. Thinking about how to rewrite that one.
     
  4. Dancing Hoskuld

    Dancing Hoskuld Deity

    Joined:
    Jul 5, 2004
    Messages:
    23,555
    Gender:
    Male
    Location:
    Canberra, Australia
    Be wary with storms at sea. We, in C2C, had all sorts of problems with it. From slowing the game down a lot, to having AI ships try and end their turns in the storm because they felt safer there:eek:
     
  5. Zeta Nexus

    Zeta Nexus <{[(Nexus)]}>

    Joined:
    Jan 23, 2014
    Messages:
    4,477
    Gender:
    Male
    Location:
    In a constant brainstorm...
    Yes, RoM-AND and all its daughters has storms a terrain feature. But I'm not experiencing slowdowns in CoM

    In CoM storms can appear on land tiles too, do damage to units and provide fresh water for nearby tiles. So you can occasionally build farms where you could not otherwise. And once I was building a wonder that requires fresh water, than I was surprised and confused why the construction stopped. Than I understood that the fresh water was from a storm :lol:

    What would be really great is if there could be 2 features on the same tile: a normal (forest, jungle, etc) and a weather effect (storm, snowfall, blizzard, tornado, etc).
    I wonder if something like that is doable :rolleyes:
     
  6. Dancing Hoskuld

    Dancing Hoskuld Deity

    Joined:
    Jul 5, 2004
    Messages:
    23,555
    Gender:
    Male
    Location:
    Canberra, Australia
    I think Alberts or Koshing managed multiple features, with dll work, early on in C2C but the second feature looked very "plastic". Literally the second feature looked like a plastic version of whatever it was.:lol:
     
  7. Merkava120

    Merkava120 Oberleutnant

    Joined:
    Feb 2, 2013
    Messages:
    403
    Gender:
    Male
    Location:
    Socially distant
    Lol 2 features would definitely do it. Do you think skirting around all this by using units would work? Could spawn a bunch of "storm" units all over the place each turn, keep them in a list (so you can delete most of them after a turn or two), turn them into hurricanes sometimes...give them ranged attacks and stuff...
     
  8. Zeta Nexus

    Zeta Nexus <{[(Nexus)]}>

    Joined:
    Jan 23, 2014
    Messages:
    4,477
    Gender:
    Male
    Location:
    In a constant brainstorm...
    No. I think that would be too problematic. Just imagine units attacking the Hurricane or the Hurricane expelled from your land by the Great Wall.

    But there are some graphical effects, like when the city is unhealthy or unhappy. Maybe you could code the damage and other effects via python or in the dll and assign a graphical effect to it.
     
  9. Merkava120

    Merkava120 Oberleutnant

    Joined:
    Feb 2, 2013
    Messages:
    403
    Gender:
    Male
    Location:
    Socially distant
    Lol yeah, I guess the AI would lemming the hurricanes to death, wouldn't it? and great wall would keep it out unless I spawned yet another separate player to play as the hurricane. (already going to have 3 extra players for my animal spawning, so...)

    but effects...now that is a good idea. I'll have to look into that. I recall Gods of Old doing effects with their natural disasters.
     
    Zeta Nexus likes this.
  10. Merkava120

    Merkava120 Oberleutnant

    Joined:
    Feb 2, 2013
    Messages:
    403
    Gender:
    Male
    Location:
    Socially distant
    Animal Spawning

    Easily the most complex python mod I've ever done. I haven't fully playtested it beyond seeing that it works, so let me know what you think.
    Spoiler Animal Spawning details :

    • Spawns animals by continent, terrain category, animal category
    • Terrain categories: hot terrain (desert/jungle), mild terrain (plains/grass/forest), cold terrain (tundra/ice). These are configurable as global variables in the python file.
    • Animal categories: predator, prey, plant.
    • When you start a new game, the mod runs through all the units in the game and determines which ones have PROMOTION_PREY, PROMOTION_PREDATOR, or PROMOTION_PLANT. It counts all of those as animals regardless of whether or not the <bAnimal> tag in the XML is set to 1 (so you can have any unit be counted as an animal).
    • It sorts animals into the three terrain categories based on their terrain natives in the XML. (Yes, an animal can be in more than one category.)
    • Then it figures out which continents have which categories, and tries to spawn at least one type of predator, prey, and plant in each temperature category of each continent.
    • The number of distinct species (i.e. wolf vs. lion vs. bear) it spawns in any category is based on the total number of available species to spawn in the world. In other words, the more animals you have in the game, the more animal types will spawn on a continent.
    • The number of individual animals spawned is based on a constant "tiles per pred/prey/plant" variable in the python file, which you can edit to adjust the number.
    • Prey, predators and plants are each controlled by a separate player spawned in the python file. This is why there is a 100-civ DLL included! (If you start a level with the max amount of civs and it tries to spawn more, best case scenario is that the mod just doesn't work.)
    • These players declare war on all players and each other at the start of the game, and their war status is set to 'permanent' so your only way to get rid of them is to eradicate them.
    • Animals reproduce with odds configured in the file; plants reproduce a lot and predators relatively little. (These are actually controlled by separate "reproduction" promotions, so you could have ravenous predator bunny rabbits reproducing up the wazoo if you wanted to.) However, most predator units are stronger than plant and animal units, so they can "eat" a lot more of them.
    • The program tries to reproduce animals onto tiles that are the same as the tile the animal is already on.
    • Mechanics-wise, the game keeps a list of animals so it's not looping through every single unit, and reloads this list when you load the game by looking at what animals are in the game.


    How to get animals to be seen by this mod
    Spoiler Guide :

    1. Mark the new unit as a prey, predator or plant by giving it the promotion PROMOTION_PREY, PROMOTION_PLANT, etc.
    2. This will also make the animal reproduce, but it has to have one of the reproduction promotions; PROMOTION_REPRODUCE_SMALL, medium, big, or huge.
    3. To make the animal provide healing when it is killed (i.e. food), give it one of the promotions PROMOTION_FOOD1, 2, 3.
    4. To control where the animal spawns, set its terrain natives and feature natives like you normally would.
    5. To force animals to stay within their natural habitats and reproduce there, set the unit's terrain and feature impassables to exclude places it should not go.




    Known issues:
    • There is a chance you will see a C++ Exception for the function "doReproduce" in AnimalSpawning.py. If you do, please let me know.
    The animals included with this mod are all swiped from C2C, which has hundreds more animals than this one. I just added some of the basic ones.

    This is the last major component of my Dynamica nomadic start mod, which I am going to start putting together now.

    Edit: I added the new modcomp "hunting" to this one too. See that post here.
     
    Last edited: Jul 5, 2020
    Zeta Nexus likes this.
  11. Dancing Hoskuld

    Dancing Hoskuld Deity

    Joined:
    Jul 5, 2004
    Messages:
    23,555
    Gender:
    Male
    Location:
    Canberra, Australia
    Mountains are not a "real terrain", sort of, the plot also has a "normal terrain" under it. This means that you need to check for terrain type and also check that it is not a mountain. Same goes for hills.

    Any thought to using biospheres? So you can have an African set of predator/prey/plant group on one continent (region) and a different set eg South American on another? No kangaroos in Canada and no squirrles in Australia.

    edit I am getting the following error
    Code:
    Traceback (most recent call last):
    
      File "CvEventInterface", line 23, in onEvent
    
      File "CvEventManager", line 195, in handleEvent
    
      File "CvEventManager", line 372, in onGameStart
    
      File "AnimalSpawning", line 220, in doInitialSpawning
    
    RuntimeError: unidentifiable C++ exception
    ERR: Python function onEvent failed, module CvEventInterface
    edit 2 Have you thought about using the BONUS tag allow, for example, spawning of horses on horse resources.

    That tag is usually used for building the units. Since these animals wont be built it should be very safe.
     
    Last edited: Jul 1, 2020
  12. Merkava120

    Merkava120 Oberleutnant

    Joined:
    Feb 2, 2013
    Messages:
    403
    Gender:
    Male
    Location:
    Socially distant
    Ahh, thank you! I added "not isPeak()" checks into the spawning and that should fix it.

    I've given it a lot of thought, but the functions given to CvArea objects are extremely limited, so it's quite difficult to split the world into bisopheres. If you have a lot of animals in your mod, the program I made should automatically sort them into different "bisophere" kind of things, where you'll have different animals in Africa than in South America and so on, but they won't be according to animal types, so you may end up with deer, pigs and elephants in South America with gazelles, kangaroos and bats in Africa, for example. I felt like it was the closest I could get with python without actually splitting the world into biomes.

    Spoiler also :
    if you look in the AnimalSpawning.py file you'll see a ton of commented-out stuff where I tried to do a sort of biome-like thing with a giant mega list full of tiles, but it didn't work at all.

    I think eventually I will move this to the SDK or something. I'm definitely not fully satisfied with just "hot" "cold" and "mild" but I'm not sure where to go from there.

    sOOO I forgot to put the .ini in the upload. Should work now. (The .ini sets it to load modular XML, without which the game has no animal civilizations to spawn. whoops.)

    That would be a very good way to spawn non-predators, but it would still put horses on all the continents and things like that (unless the map generator has the option to do more "realistic" bonuses instead of "balanced").

    I think in an ideal world, I would have tons of types of terrains with a good map generator that knows where to put them, and then just spawn animals in terrains they are suited for. For example, elephants would go in the African Savanna terrain. (You could even fake the players out by having different "savanna" terrains that are all named "savanna", so to the players it all looks like savanna, but the game sees African savanna, Middle East savanna, Argentina savanna, etc.)

    But that would require a map generator...which is definitely not out of the question, but will have to wait till later :p
     
  13. Dancing Hoskuld

    Dancing Hoskuld Deity

    Joined:
    Jul 5, 2004
    Messages:
    23,555
    Gender:
    Male
    Location:
    Canberra, Australia
    Good, downloading fixes now.

    So perhaps yet another mod, one that sets the terrain up differently in the first place.

    A lot of the region information is available during map generation but not by the time the game starts.

    C2C has over 500 animals and lots of new terrains including a number of ocean terrains:lol:. It also uses latitude and longitude of the plot to determine region. This is also used to determine placement of bonuses during map generation, rather than the default x degrees from the equator. It enables the northern and southern hemispheres to be different.

    Of course to do that C2C had to add latitude and longitude to the Bonus XML file and have a new XML file for spawn info that contained the latitude and longitude regions plus time frames. The C2C time frame covers a couple of mass extinction events.
     
  14. Merkava120

    Merkava120 Oberleutnant

    Joined:
    Feb 2, 2013
    Messages:
    403
    Gender:
    Male
    Location:
    Socially distant
    Ay wow that is a lot of animals. That plus the cool biomes/latitudes thing was a big reason I considered basing my Dynamica mod on C2C but then I saw how much stuff they've added and just went :shifty:

    I thought about trying to figure out what the regions of the world were based on terrains, and then make animals specific to each region (I mean, my eyes can do it, so why not my laptop?) but went with an easier way for now. Maybe someday...
     
  15. Dancing Hoskuld

    Dancing Hoskuld Deity

    Joined:
    Jul 5, 2004
    Messages:
    23,555
    Gender:
    Male
    Location:
    Canberra, Australia
    I have also been looking at the nomadic/sedentary eras and I remember a mod from Civ III that tried to address it also. "Paths to Glory" is its name and I started converting it to Civ IV. Basically nomads are fewer and faster, with stronger but less disciplined troops. The tech tree limited some techs by "civic", there were no civics in Civ III. In the mods view if you got Agriculture then you were Sedentary. This does not match well with archaeology where you can find sedentary hunter/gatherer settlements and nomadic peoples who plant crops.
     
  16. Merkava120

    Merkava120 Oberleutnant

    Joined:
    Feb 2, 2013
    Messages:
    403
    Gender:
    Male
    Location:
    Socially distant
    That's an interesting way to do it, so they'd basically mimic "civics" by using techs to unlock them, then those civics would unlock separate tech trees for nomads vs. sedentary?

    And yeah nomads totally can have agriculture. I think the way I'm going to go is have techs for planting, domesticating, and building, and then have a combination of building and one of the others lead to settling cities.
     
  17. Merkava120

    Merkava120 Oberleutnant

    Joined:
    Feb 2, 2013
    Messages:
    403
    Gender:
    Male
    Location:
    Socially distant
    Hunting

    Adds three major changes -
    1. Units no longer heal outside territory, and heal slowly within territory. ("Healing" now represents having access to food and supplies. Later I might change text files and add supply chain units to make this more balanced.) (If you want to remove these changes, just delete "GlobalDefines.xml".)
    2. Units take damage each turn when outside territory, roughly 3% to 10%, worse for rough terrains like deserts. You can configure which terrains are considered "harsh" or "super harsh" in Hunting.py, and you can turn off hunger entirely by changing bDisableHunger to 1.
    3. Killing animals (or any unit with the promotions "food1" and so on) heals the killer and adjacent units depending on the size of the hunted animal.
    I've also added this to the animal spawning mod.
     
  18. Dancing Hoskuld

    Dancing Hoskuld Deity

    Joined:
    Jul 5, 2004
    Messages:
    23,555
    Gender:
    Male
    Location:
    Canberra, Australia
    1. It is often suggested that if you are going to make changes to "GlobalDefines.XML" that you should make them in "GlobalDefinesAlt.XML" instead. This file "overwrites" the first and only contains new and changed items. That way you can see what variables have been changed and what the default BtS ones are. It is not something we did in C2C and it did cause some difficulties. For example if we had we could have put text in the Alt file explaining why we did the changes and would hopefully not have had to explain the same thing thousands of times. (Also improve team awareness.)

    2. Healing for a unit that is a single person if fine like you outline but what about units that are multiple people? They could be "healed" by recruiting new people or replacing wounded people with healthy ones. Basically for multi person units you might also consider recruitment which would be faster than healing.

    3. Rats, I had just merged Animal Spawning in with Dynamic techs :crazyeye:
     
  19. Dancing Hoskuld

    Dancing Hoskuld Deity

    Joined:
    Jul 5, 2004
    Messages:
    23,555
    Gender:
    Male
    Location:
    Canberra, Australia
    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.

    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.
     
  20. Merkava120

    Merkava120 Oberleutnant

    Joined:
    Feb 2, 2013
    Messages:
    403
    Gender:
    Male
    Location:
    Socially distant
    Ahh that is a super good idea, I'll get on that.

    Definitely thinking about that. I'm considering some kind of "supply wagon" later that heals units in its stack (then Civ4 would have a way to attack supply lines with actual effects, woohoo!), and maybe also a python button or ability for recruiting from villages the unit passes along the way.


    Haha nuts! :p Well I just merged those two with seasons and uploaded it so that might satisfy that.
     

Share This Page