[PY MODCOMP] BarbarianCiv - Barbarian cities settle down into full civs

jdog5000

Revolutionary
Joined
Nov 25, 2003
Messages
2,601
Location
California
*** NOTE ***
strategyonly has updated this mod component for BTS, you can get it here!


BarbarianCiv Description
Version 0.85
By jdog5000


The goal

In this mod, barbarian cities, if left to their own devices, will eventually "settle down" into full blown civs!

Note on this version

BarbarianCiv is a component of my modpack, Revolution Mod, and has been released as a stand-alone component primarily to allow it to be added to other mods that may not want the rest of the Revolution functionality. This component comes in two flavors which work slightly differently: Python only and SDK enabled. The Python only version is provided mainly for modders who would like to avoid changes to the SDK for whatever reason. The differences between the two versions are:

In Python only:
- Must set DoGameStartKill = True to see any effect
- A few AI civs will be killed off before the first turn of the game. These can then take over barb cities later.

In SDK version:
- Do not need to kill civs off at game start (little potential gain from doing so)
- Completely new civs, not previously in the game will appear when barb cities "settle down"

The Basic Idea

Barb cities will settle down probabilisticly, with several factor determining the odds. When a civ takes control of some barb cities, they're given a bunch of freebies to make them competitive. How the new civ is chosen depends on whether you're doing Python only (random from list of killed off civs) or SDK enabled (random from never alive).

More details
Spoiler :

The decision to have barbarian cities "settle down" into a full-fledged civ is based on the properties of the barb cities. At the end of every turn, all barbarian cities are examined for two things: total population of neighboring barb cities, and culture. The city with the highest population (including neighboring barb cities) and the city with the highest (non-zero) culture have a chance of organizing. The higher the total barb population around a city, the higher the odds it and its neighbors turn into a civ. Once a barb city starts to get some culture, it has pretty good odds of spawning a civ.

Once the cities for the new civ are selected. There are two types of barbarian consolidation, militaristic and builder. Both get a base set of defensive units and workers in every city, plus all techs known to a majority of the world. The new civ also gets a great person (to symbolize the leader who organized the horde), with the GP type depending on the type of consolidation. The populations of all the cities are increased. Their captial is given walls and a granary. If the cities have some culture, the new civ gets half of the total. These general effects for both types of "rise of the barbs" are intended to partly catch them up with the rest of the world.

Militaristic consolidation is the most interesting in my view. It's intended to mimic the affect of Ghengis Khan or the Vikings. The new civ is given a crap load of offensive units and will declare war on a random opponent in the area. If there are no other civs in the area, the new civ is given some boats to go raiding! Odds of a militaristic buildup increase if the new leader is Aggressive or Expansionist. Militaristic new civs will be behind in economic or social technology. They also get free barracks. Gameplay spoilers: This aggressive new civ will have a very tough first wave, and often succeed in taking a couple cities and pillaging large areas. However, they don't have the infrastructure to maintain the drive and will usually stall or lose their gains (unless you're really unprepared).

Builder consolidation is intended to mimic the rise of a new civ that isn't particularly militaristic. This type of civ gets additional techs from the list of known techs. They are not explicitly given any new techs, but may use their GL to discover something new. They are also given a bunch of extra infrastructure: extra worker, free settler, and some buildings like libraries, lighthouses, and forges (if they have the tech). Gameplay spoiler: While not as exciting as the Military buildup, this type is the more dangerous in the long run. If they start up in a big empty area (like on a Terra map), they can grow into the upper echelon of the game. However, if attacked early, they will crumble.


Notes on use

If you want to see some barbarian cities settle down, make sure there's enough space for them on the map. A full standard map game will probably only see a couple of barb civs emerge.

One fun experiment is start a large world with only a handful of civs, then let the barbarians fill in the gaps. (To do this with the Python only version, you would need to set KillFraction to something high)

On Terra maps, the "new" world will not be as empty as before.

Note to modders

If you want to play around with the mod, turn on DebugMode in the ini file. This enables a keyboard shortcut Ctrl-Shift-B that forces the creation of a civ from barb cities if there are any (and empty slots that can be filled). It also turns on some debug output (if your CivIV.ini file has debug logging turned on). Then with the world builder you can see what the mod would do if the random roll had created a new civ in that particular instance.

How to merge

This mod component uses DrElmerGiggles custom event manager and config parser components, many thanks to him for putting them together! I highly recommend you adopt this convention for your mod, it makes merging event driven components much easier. If you are using these conventions, the only needed changes are:

Move BarbarianCiv.py to your mod's Assets\Python folder. If using SDK version, also copy over dll to your mods Assets folder.

Copy the BarbarianCiv settings from BarbarianCiv.ini to "(Your ini file name).ini"

Make sure CvConfigParser can find your mod folder, probably by changing the contents of CvModName.py.

In CvCustomEventManager.py, add import BarbarianCiv to the top of the file. Then, in __init__, add:
config = CvConfigParser.CvConfigParser("(Your ini file name).ini")
if( config.getboolean("BarbarianCiv", "Enable", True) ) :
BarbarianCiv.BarbarianCiv(self, config)

Done! BarbarianCiv will register its own event and popup handlers and you're on your way. If you're not using this convention, then you need to figure out how to register the events and popup handlers covered in BarbarianCiv's __init__ file and make sure it can find the config settings.

Compatibility

This mod should be quite compatible with any mod that adds units, civs, or technologies. When giving the former barbs units, I search for the best buildable ones by UnitClass or AI type. The main potential source of compatibility problems would come from not using the custom event manager convention, you then have to be sure events are passed to all the appropriate functions.

The Files

SDK enabled version: here

Python only: View attachment BarbarianCiv.zip
 
This seems like alot of work! Do you know that Rhye has done something similar with spawning new civilizations? In any case, this could be useful for representing migrations of people and settlement in new areas (ie the Slavs in Europe)... probably TheLopez is working on just that with his Wandering Immigrants Mod.
 
Hey JDog. Just wanted to concur with Shqype in saying that this looks like an amazingly HUGE mod. I was hoping to make just a few comments/suggestions-if you don't mind?

1) Rather than have 25% of the AI civs randomly disappear-which could be frustrating for a player who has cultivated a game-long friendship-couldn't you set certain parameters for drop-out? Like minimum # of cities; minimum average population; minimum tech level or minimum average culture per city? If they fail then they get that civ gets dropped-to be potentially replaced with an emerging 'barb' civ. This can be as well as a civ simply getting killed off by barbs, other AI civs or human players

2) Another thing worth considering is merging your mod with Trip's Rebellion mod. If you are unfamiliar with it, it had a chance of 'barbs' getting spawned if your cities got too unhappy/unhealthy and/or you switched religions and/or civics-or lost your Capital. These barbs represented rebels unhappy with your rule who might try and capture your cities from you. Obviously, combined with your mod, this could really help to represent the 'Rise and Fall' of Civilization' feel that has long been missing from this game!

Anyway, this does look AMAZING-hope I get to try it out soon :).

Aussie_Lurker.
 
Shqype said:
This seems like alot of work! Do you know that Rhye has done something similar with spawning new civilizations? In any case, this could be useful for representing migrations of people and settlement in new areas (ie the Slavs in Europe)... probably TheLopez is working on just that with his Wandering Immigrants Mod.

I had noticed Rhye was planning on doing rise and fall, but it came off the to do list since last I checked ... they've been working hard over there! I'll check out his ideas ... thanks for the update.
 
Aussie_Lurker said:
Hey JDog. Just wanted to concur with Shqype in saying that this looks like an amazingly HUGE mod. I was hoping to make just a few comments/suggestions-if you don't mind?

Suggestions are always welcome!

Aussie_Lurker said:
1) Rather than have 25% of the AI civs randomly disappear-which could be frustrating for a player who has cultivated a game-long friendship-couldn't you set certain parameters for drop-out? Like minimum # of cities; minimum average population; minimum tech level or minimum average culture per city? If they fail then they get that civ gets dropped-to be potentially replaced with an emerging 'barb' civ. This can be as well as a civ simply getting killed off by barbs, other AI civs or human players

Right now, the civs are killed off before the game really starts ... they're gone at 4000bc, so no civ you've cultivated a relationship with will disappear. As mentioned, in the SDK version, new civs will simply appear without anyone having to die.

Aussie_Lurker said:
2) Another thing worth considering is merging your mod with Trip's Rebellion mod. If you are unfamiliar with it, it had a chance of 'barbs' getting spawned if your cities got too unhappy/unhealthy and/or you switched religions and/or civics-or lost your Capital. These barbs represented rebels unhappy with your rule who might try and capture your cities from you. Obviously, combined with your mod, this could really help to represent the 'Rise and Fall' of Civilization' feel that has long been missing from this game!

Anyway, this does look AMAZING-hope I get to try it out soon :).

Aussie_Lurker.

I will definitely check out the rebellion mod ... I've been thinking of things along those lines, but instead of barb units, they'd be some new civ who would declare war on you. Certainly opens up lots of interesting options!

Hope you enjoy it!

JD
 
This looks incredible. I hope it finds it's way into some mods.
 
I must say this is probably the most interesting modcomp I've seen so far. I can't wait to try it on a terra map, things should get very... exciting ;). Awesome job and I can't wait for the SDK implementation :goodjob:
 
Great work JDog, have you considered maybe adding some INI configurable options allowing players to fine tune your mod as they want?

... huh, I guess I can now scratch off the emerging civilizations item off my to-do list since you have basically implemented what I was going to do, thanks!!!
 
Sounds interesting. My concern, however, is that the map tends to fill up rather quickly. Is there really space for a new civilization to emerge? I suppose on a terra map where one continent essentially has half the game to develop on its own could and would spawn new civilizations. On the other hand, that would also dramatically reduce the "Age of Discovery" effect because a full-fledged civilization will be controlling the place you want to colonize. Nevertheless, great work and I look forward to trying this out!
 
This is EXACTLY why this modcomp needs to be combined with both the Rebellion Mod by Trip, and a mod which restricts early movement (a combination of 'unit attrition' and impassable terrains for specific units). That way there will be MUCH more available space for future emerging civs AND New Civs can emerge as a result of internal upheaval.

Aussie_Lurker.
 
This is awesome and exactly what I've been looking for. I was not aware that emerging civs was still on the "to-do" list for Rhye, so it's great to have a breakthrough in that front.

We definitely have need for this in our mod, though with a very specific application and use:our "barbarians" are the natives of a planet that eventually evolve into a civ with which you can negotiate. This is somewhat different than your implementation (one specific civ is always pre-set and then "killed off;" all barb cities are turned over to that civ; if no such cities exist, they will be created...) but I think it's only a small hop, esp. if we could enlist your help at such time when we're ready to implement this feature.

Anyway, what a great idea -- look forward to trying it out!
 
TheLopez said:
Great work JDog, have you considered maybe adding some INI configurable options allowing players to fine tune your mod as they want?

... huh, I guess I can now scratch off the emerging civilizations item off my to-do list since you have basically implemented what I was going to do, thanks!!!

INI config settings are one reason the SDK version hasn't been released yet ;) Your welcome!
 
Padmewan said:
This is awesome and exactly what I've been looking for. I was not aware that emerging civs was still on the "to-do" list for Rhye, so it's great to have a breakthrough in that front.

As he's focusing on an Earth, history based scenario, he has later civs like the Germans or Americans spawn part way through the game. I believe only Egypt, China and India actually start at 4000 BC! His mod is certainly sounding interesting. I haven't fully checked out his implementation yet, but this is a much more general version of rising civs. The impetus for "settling down" comes from the qualities of the Barb cities themselves.

Padmewan said:
We definitely have need for this in our mod, though with a very specific application and use:our "barbarians" are the natives of a planet that eventually evolve into a civ with which you can negotiate. This is somewhat different than your implementation (one specific civ is always pre-set and then "killed off;" all barb cities are turned over to that civ; if no such cities exist, they will be created...) but I think it's only a small hop, esp. if we could enlist your help at such time when we're ready to implement this feature.

Anyway, what a great idea -- look forward to trying it out!

I believe what you describe could be completely acheived in Python and would not be too difficult, as you say, just a hop away from what's done here. Giving the "barb" cities to another civ would be simple, figuring out where to put new cities would be more difficult. But, there is example code in the SDK that currently places the barb cities ... worse comes to worse you could just force a call to that function until you had enough barb cities, then give them all to the new civ :p I would be happy to help out ...

Enjoy!
 
jdog5000 said:
I believe what you describe could be completely acheived in Python and would not be too difficult, as you say, just a hop away from what's done here. Giving the "barb" cities to another civ would be simple, figuring out where to put new cities would be more difficult. But, there is example code in the SDK that currently places the barb cities ... worse comes to worse you could just force a call to that function until you had enough barb cities, then give them all to the new civ :p I would be happy to help out ...

Enjoy!

Wowsers. :cool: Follow my sig to the Roanoke forums where Pad can convince you to work with us. This would be awesome on Planet V.
 
Aussie_Lurker said:
This is EXACTLY why this modcomp needs to be combined with both the Rebellion Mod by Trip

Ask and you shall receive? I make no promises about the balance or utility of the Rebellion addition, only that it does work the same as Trip's original. You will have to start a new game with this addition, as it requires some data set up for every city on the planet. My only change to Trip's code was to make it compatible with DrElmerGiggles custom event manager.

As I haven't done more than run through 100 turns to prove it worked, I won't post this in the top post as it's really a try at your own risk ...

Note: Rebels will spawn early! At like 3200 BC, they can be knocking at your door. You have been warned.

EDIT: This version wasn't any fun ... removed. My modpack Revolution includes a much more gameplay friendly version of Rebellion. I will also release the rebellion part seperately soon.
 
Actually Rhye already did implement the Rise and Fall feature into his mod. It is true that only Egypt, India, and China actually start in the game, the other 15 civs are born at specified historical dates (the precise date is actually semi-random each game). In ealier builds of the mod there was also a feature where certain old civs would have a chance to collapse and have some or all of their cities turn barbarian, however, this feature was removed since it wasnt really all that fun or balancing. The main problem was that there could only be a total of 18 civs in the game, so removing one of them at some point means that that slot can never be replaced. It might be re-implemented after the Warlords expansion pack once more than 18 civs are allowed.
 
woodelf said:
That is good news. Smugglers, splinter republics, other?

Yes, but also I really thought this was a good idea in December, never go time to do it, now I'm really happy that someone has done it. But I think I'll wait for the SDK version
 
Top Bottom