Revolution: with BarbarianCiv, Rebellion, AIAutoPlay

jdog5000

Revolutionary
Joined
Nov 25, 2003
Messages
2,601
Location
California



(Note: While the information in the first couple posts is still correct, the main discussion for Revolution happens in the mod's sub-forum and the RevolutionDCM thread)


Revolution Mod Pack
By jdog5000
Coders: jdog5000, glider1, Dom Pedro II, octitalis
Civ Versions: BTS plus depreciated versions for Warlords & Vanilla
Multiplayer? Not yet.

Game Ready Components:
BarbarianCiv
AIAutoPlay
Revolution
TechDiffusion
DynamicCivNames
StartAsMinors

In Testing/Further Development:
ChangePlayer

The goal

The goal of this modpack is to make Civ4 more dynamic. New empires will rise in the middle of the game, over-extended empires may crumble, or colonies break away from oppressive rulers. Soon civs will be able to band into confederations, which can crumble if things don't go well.

Gameplay Components

The primary components of this mod are BarbarianCiv and Revolution. Briefly, BarbarianCiv allows Barbarian cities to "settle down" and spawn new full-fledged civs. These cities will first form single city minor civs and later, when they accomplish something notable, will be upgraded to full civs. Revolution allows colonies or groups of cities to demand changes to your empire or independence. Revolution has essentially absorbed the concepts from the Rebellion component that was in prior versions, plus there are several new Revolution types. With the SDK changes in this mod pack, these three components can spawn completely new civs that were not in the game before. Both of these components are also highly configurable and enabled by default.

Tech diffusion is essentially a tech welfare program to keep civs from being eras behind by the end of the game. If a civ falls behind by several techs, they will start to accumulate free research towards some of the techs they can research. The rate of accumulation is based on how many civs they know with tech and what their relationships are. Unless the civ is extremely far behind, they will never get a completely free tech, instead they'll get a few percent of the research points per turn. Once a certain fraction (which increases as the eras go by) has diffused, the free beakers stop and the civ must do the rest of the research themselves.

DynamicCivNames renames civs over the course of the game, based on thier civics and status. Civs spawned in rebellions will temporarily be named something like Japanese Rebels before they establish themselves. Similarly mechanisms exist for civs spawned by BarbarianCiv. A civ running Hereditary Rule and Theocracy might be named Holy Kingdom of Japan. There are quite a few variations for different civic combos.

Tools

These are components that are not directly game play changes, but instead can be used for fun or debugging. AIAutoPlay allows the player to turn over the reigns of their civ to the AI for some number of turns. Uses for this include watching the AI, "fast-forwarding" the game if you're bored or want to see the effects of mods you've made. This component is enabled by default, but makes no gameplay difference if you don't use it. ChangePlayer allows the player to switch which civ they control and the leader or civ type of any civ. There are some issues with changing the civ type of living civs, but all the other pieces are working well. This component is enabled by default and makes no gameplay difference if not used.

Configurability

This mod is designed to be very configurable. Many options and tweaks are available in the Revolution.ini config file (no coding required), including enabling and disabling each individual component. For specifics on what can be changed, check out the ini file. Note that yes, you can enable or disable a component, or change one of the other features, and continue with an in progress game. However, you will probably need to save, exit, and reload.

Revolution Mod Forum

Check out the Revolution mod forum for more info, and these special sections:

Revolution information
Download link and version info
FAQ and Troubleshooting
Notes for Modders & Mergers
Bug Reports

Gotta give my props

Thanks to Dom Pedro for joining the team and helping make support for civic mods and (soon-to-be) rebel units specification a reality!

Thanks to Caesium for sharing his adaptation of this mod (his mod pack has not yet been released on CFC) from which I have borrowed several pieces, and for translating text into German.

Thanks to Dom Pedro II, Twisted_Stixx, Goobernatorial, suspendinlight, TheGreatApple, Quijote, Cincinnatus3, GenocideBringer, Seven05, AnarhCassius, Colin, b3virq3b, Peuri, Caesium, Mrdie, Beastfeast, cbmclean and Dnomal for their ideas, bug reporting and testing.

Thanks to DrElmerGiggles for his custom event manager. Thanks to Stone-D and Teg Navanis for their work on saving mod data in compatible ways. Thanks to TheLopez for the Dead Civ Scoreboard mod component. Thanks to Lord Olleus for idea on how to call functions at the end of a players turn. Also, thanks to DrElmerGiggles, TheLopez, Kael, Rhye, eotnib, and others for their answers to questions and code I browsed for implementation ideas. Awesome Revolution logo by skylined!
 
BarbarianCiv Description

The goal:

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

How it works:

Barb cities will settle down probabilisticly, with several factor determining the odds. When a new civ takes control of some barb cities, they're given a bunch of freebies to make them competitive. These new civs are created in closed slots, ie a new player not on the initial list is added to the game. The new civ is chosen randomly from the list of unused civs, and the new leader chosen randomly from the available leaders for the civ.

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. There are four different flavors of militaristic settling, Viking, Chariot, Horse, and balanced. Vikings get boats and mostly melee units, Chariot style is for earlier barb settling and they get chariots and some axes, Horse style is mostly Horse archers or Knights if late enough, while balanced gets an assortment of units. The strength of the military is fairly random, and increases as the eras go by. 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. Militaristic barbs have a good chance of getting a Great General when spawned. 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 Great Person to discover something new. It's not uncommon for them to found a new religion. 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. BarbarianCiv also works quite well with the Revolution component that can spawn barbarian rebels.

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


AIAutoPlay Description

How to use

This component is a tool, you decide when you want to activate it and for how long. Press Ctrl-Shift-X to open the AIAutoPlay Chooser window, select a number of turns to auto play and select Full Automation from the drop down menu (or no automation). There is a new feature to have the AI only move your units. At the start of your turn, change whatever you want or move a couple units, then press Ctrl-Shift-M to have the AI do the rest of that turn. You can also cancel automation by pressing Ctrl-Shift-X again, but only when there are no popups open. To help with that, there is a config option to block some standard game popups.

In addition, there is now a config option that will fortify all units fortified by the AI at the end of automation. Without this all units start active, although refortified units will not lose their defense percentage.

Potential uses

Great for debugging or watching the behavior of the AI, as it shows you only what the AI can see. Also, if you want to skip certain sections of the game, or you're so close to winning but not quite there, let the AI play it for you! With many civs in the late game, auto play will still take a while but you won't have to do anything ... it will basically take (# of turns)*(in between turn lag + a little bit) to go through the turns.


Revolution Description

The goal:

This component allows sections of disgruntled empires to rise up together and demand changes or attempt to break away from the motherland. No matter what the source of the complaint, you will be given an option to either ignore the complaint or accept the cities demands. If their demands go unmet and situations deteriorate, the cities may give you an ultimatum and take up arms if you do not comply!

How it works:

This component is intended to add realistic dynamics to the game, making keeping your cities and regions happy more important and challenging. Each city in your empire will have factors that make it want to stay and factors that make it want to rebel. If you cannot find a balance that keeps each of your cities happy, you will face revolts! Revolts come in many different styles, including requests to change civics, requests to change state religion, and demands for independence. No matter what the scenario, you will always be given choices when confronted with a rebellious city.

This component has been updated to support Vassal states and other new features of Warlords. It also now incorporates most of the ideas from the prior Rebellion component. The AI logic appears bug free, but it's difficult to test all the human popup handling. However, it has undergone extensive testing and is in a good working state. If you do encounter a revolution popup whose results don't follow from what you selected, please let me know!

More Details
Spoiler :

Each city has a Revolution Index, and when that index gets up towards 1000 they start to get restless. You will be warned whenever a city passes over 900 and every ~15 turns while it's in the danger zone, and once over 1000 it may instigate a revolution. Other nearby cities with rev indices over 600 can join in a revolution. If a city is unhappy, things are very similar but the minimum threshold for a revolution drops quickly with the number of unhappy citizens.
There are several different Revolution styles and the situation in the Revolution instigating city determines the style. Many styles have peaceful and violent variants: denying a request will just agitate the city further, but denying a demand will lead to civil war! In order of precedence:

- Return to or reform dominant culture: Cities in which you don't have a majority culture will become increasing aggitated and may attempt to break away for cultural reasons. The instigator and nearby, similarly cultured cities will ask (peaceful) or demand (violent) to join or reform a dead rival. Denying this request will cause your relations with the rival to deteriorate, and they may choose to declare war!

- Religious differences: Cities may ask for a change away from Theocracy or to Freedom of Religion, or to switch your state religion. They can also ask or demand independence for religious reasons.

- Homeland revolutions: Ask for various different civics. May ask for you to go on a crusade to capture your religion's holy city.

- Colonial revolutions: Ask for change to representative government. (Independence handled below)

- Capital or majority of cities revolting: Cities will ask for changes in away from repressive civics, or for some form of a say in the government. They can also ask or demand a change in ruler! If you're running a representative government, accepting their requests will mean facing election. If you are replaced, the game will automate some number of turns and then return control to you (this feature can be disabled).

- Independence: If none of these particular conditions apply, the cities will ask for or demand independence. They may request full independence or assume Vassal status.

If you face civil war, the situation may become quite dier. Strong garrisons may be able to maintain some semblance of control in some of the revolting cities, but weaker garrisons may be run out of town and the revolutionaries will take the city. Your homeland will not be the same for generations if you face multiple revolting cities on the battlefield! In addition, rebellious cities that the rebels have not yet taken may turn out rebel reinforcements.


The Revolution Watch

Pressing Ctrl-Shift-W in the game will open the Revolution Watch popup. This popup displays which of your cities is in danger of rebelling, thinking about rebelling, or happy with your empire. In each category, the cities are ordered with the most rebellious towards the top. In addition, cities whose local situation is deterioirating are shown in orange. For specific information on how your civ-wide policies or the local city situation are effecting the rebelliousness of the city, scroll down and click the details button. This will open a new popup containing a lot of important information about the rebelliousness of your cities.

At the top of this detail popup is an analysis of your national policies and situation. The effect of your civics, anarchy, golden age, and fiscal situation are shown here. These affect all of your cities equally. Next is a city-by-city listing of local effects. The location of the city, the religions and cultures in the city, the happiness and healthiness of the people, the size of the city, the size of the city's garrison, and culture rate are all important factors you may see here. Your civics can have a significant effect on how these local factors are felt. For example, running a theocracy will cause cities with non-state religions to be more rebellious, but keep cities with your state religion less rebellious. Representative government civics will greatly decrease the effects of distance on outlieing cities or colonies.

If you want to understand a bit more of how all of the revolution factors work, you can enable a debug option in Revolution.ini that will add some numbers to the Revolution Watch popup. While this level of information is unrealistic for the leader of an empire, it may help you understand how the mod reacts to certain decisions you make.
 
TechDiffusion Description

The goal:

With this component, civs who fall behind in tech but have lots of friends will receive some free research.

How it works:

When a civ falls behind by several techs, they qualify for tech "welfare." Each turn that they are significantly behind, they will receive some free beakers towards techs they can research. The amount of free beakers depends on how many civs they know who already have the tech and what there relationships are, although the rate for powerful military techs is lowered since civs try harder to keep them secret. If a civ is behind by a handful of techs, they will get fractions of a percent of the research per turn. If they are behind by a dozen or more, the rate increases.

The diffusion of tech is capped so that civs don't receive techs for free but have to do the final research push themselves. The cap is low in the early eras, and moves up as the eras go on. If a civ is very far behind, the cap is ignored to try and keep them somewhat in the game.


DynamicCivNames Description

The goal:

This component renames civs based on their civics choices and other status factors.

How it works:

When a civ is created or changes their civics, they are potentially assigned a new name based on many factors. Civs spawned by either Revolution or BarbarianCiv will get temporary names indicating their status, like Mongolian Horde or Russian Rebels, until they're more firmly established. When a civ switches to Hereditary Rule their name will change to something like Kingdom of America, while under Representation or Universal Sufferage they would be American Republic. Civs with only one city in the later stages of the game may have the city name included in their title, but their civ type will always be clarified as in French Kingom of Paris. There are many different potential names, and even variations for civs with the same status to provide some flavor.

All of these civics determinations are made using the added Revolution flags in the civics xml file to support variations on the standard civics systems. Having a civic with the isCommunism bool set will cause Communist style names.

Feedback and suggestions for how to improve the names and add more variety would be great.


ChangePlayer Description

How to use

This component is a tool, you decide when you want to activate it using two keyboard commands. Press Ctrl-Shift-L to open a popup allowing you to select which player you want to control. This works quite well and is stable. Press Ctrl-Shift-P to instead select a player and change their civ, leader or team. The leader and civ type do not have to correspond. This is works okay however unit flags and player colors you can see on the screen do not update when you change a living player's civ type. Changing leader heads does work without issue, and the traits will change as well.

Potential uses

Using this, you can take control of any other player in the game. One possibility would be to build up a fantastic empire for ~250 turns, then switch to controlling a rival and see if you can take down your own creation! Or, if you take control of a rebellion for fun, but then decide you want to go back to your old empire. You can enable this component in the middle of a game, but you'll probably need to quit and reload to see the change. The popup for changing a player's civ type or leader is mainly meant to demonstrate the possiblities of the SDK changes. However, if you want to see how things would be different if Bismark took over for Fredrick, or have always wanted to have Sid control the American Empire, these things are now possible.

Known Issues

Existing unit flags do not update when you change a living player's civ type. Putting a player on a new team may result in them losing contact with other players they have met, but their new team has not.
 
Note: There are much more examples (and more up-to-date examples) in the Stories and Screenshots thread in the sub-forum.


Screen shots of Barbarian Civ in action:

Before
Civ4ScreenShot0000.JPG

During
Civ4ScreenShot0001.JPG

After
Civ4ScreenShot0003.JPG

Screenshots for Rebellion:

Offer
Civ4ScreenShot0005small.JPG

Effect
Civ4ScreenShot0006small.JPG

More screen shots:
Tale of England
 
This is great, hopefully I'll get a chance to try, too many good mods, too little time. :D

One question, are you planning on making it automatically adjust its various values (for barbs and so on) based on difficulty, map size and game speed?
 
Awesome, I'm looking forward to trying this out when we get to this point in our mod (which is a few eras into the future, but a critically important feature!).

jdog5000 said:
bool CvGame::createNewPlayer( int playerIdx, int newCivType, int newLeader, int ix, int iy )

bool CvGame::changePlayer( int playerIdx, int newCivType, int newLeader, bool bIsHuman, bool bChangeGraphics )
Do you have plans to expose these functions to Python for those of us who remain SDK-impaired?

jdog5000 said:
This function is still undergoing testing, but will change the civ type and leader of a player. The flag bIsHuman sets the slot type of the civ between taken (ie Human) and computer, while bChangeGraphics indicates whether to update the color/flag of the civ. This function could be used to change the leader or civ type of an existing civ, to say simulate the takeover of Hitler and the Nazis in Germany. Note: setting the human to control the Barbarian State (and no other civ) will end your game. Currently the function only changes the graphics and names (not leader traits).
I look forward to the possibility of having traits or AI change as well. Having Hitler take over Germany would also presumably mean that Germany will now behave differently -- or is AI already implemented, just not traits?

(In our mod when a civ is taken over by a different lifeform they also behave differently, so having AI change with the civ is important to us...)

At any rate, this is really awesome and more than I had expected from this mod!

jdog5000 said:
Finally, the following functions have been exposed to Python in CyGame:

int getAIAutoPlay() const;
void setAIAutoPlay(int iNewValue);
void changeAIAutoPlay(int iChange);
I suggest promoting this as a good way to playtest mods for both stability and AI behavior. The best way I've figured out how the AI plays is to watch my own civ automated, since WorldBuilder can only tell you so much. (Sure, I can put it all in Python logging, but it's more fun and easier to understand if I watch it!).
 
Padmewan said:
Do you have plans to expose these functions to Python for those of us who remain SDK-impaired?

Sorry if it wasn't clear, but they are already exposed to Python in CyGame(), same name, variables and return type.

Padmewan said:
I look forward to the possibility of having traits or AI change as well. Having Hitler take over Germany would also presumably mean that Germany will now behave differently -- or is AI already implemented, just not traits?

(In our mod when a civ is taken over by a different lifeform they also behave differently, so having AI change with the civ is important to us...)

This is very high on the list, will be fixed soon. The traits are the most apparent non-change, but actually I think none of the leader personality stats are changed currently. Should be easy to fix.

Padmewan said:
I suggest promoting this as a good way to playtest mods for both stability and AI behavior. The best way I've figured out how the AI plays is to watch my own civ automated, since WorldBuilder can only tell you so much. (Sure, I can put it all in Python logging, but it's more fun and easier to understand if I watch it!).

I agree, and this is how I test all the components of this mod! It's fun IMO to watch the AI, see how it reacts to situations. In addition, with the AIAutoPlay functionality, you can skip certain sections of the game if you're bored or want to get to a particular era ... you can also create a random scenario by letting the AI play the first 200 turns and then seeing where you can take it from that starting point.
 
Padmewan said:
Do you have plans to expose these functions to Python for those of us who remain SDK-impaired?
Sorry, I reread your post more carefully, which states that you do expose these in CyGame. Awesome; thanks!
 
Rabbit said:
One question, are you planning on making it automatically adjust its various values (for barbs and so on) based on difficulty, map size and game speed?
Certainly for game speed I will make the odds of barbs settling down increase/decrease ... will take a while to get all the base constants right, so if anyone has some feedback please let me know.

I can't think of anything that should change based on difficulty yet ... and since happiness scales by difficulty even the rebellion and revolution components probably won't need scaling based on this.

As for map size, I might make the radius around barb cities considered close flexible ... but since city radii don't change, 10 seems pretty good. There's space for max one city in between the "neighboring" barb cities, so the initial empire for a settled barb is not very spread out, which seems reasonable. Maybe on tiny maps this is too big? Would have to play test it.
 
jdog5000 said:
Certainly for game speed I will make the odds of barbs appearing increase/decrease ... will take a while to get all the base constants right, so if anyone has some feedback please let me know.
I think the existing mechanism for scaling barbs to difficulty is in the handicap XML; you can set the minimum distance for barb units or cities to appear, as well as the number of barb units/cities per "unowned" tile in the game. Because this functionality is handled at the simplest mod level, I would suggest keeping it, unless there is a meta-variable that controls % chance over and above these XML variables.

How this intersects with game speed and map size, I don't know. Perhaps that's where the "meta variable" I mentioned should be controlling?

Alternatively, can the XML of game speed / map size have barb values inserted (if they aren't already)?
 
Padmewan said:
I think the existing mechanism for scaling barbs to difficulty is in the handicap XML; you can set the minimum distance for barb units or cities to appear, as well as the number of barb units/cities per "unowned" ...

Sorry, I miss typed in the post you were responding to. It has been edited to make the intention more clear.
 
I haven't played it yet (comp trouble) but do they start with a population comparable to established civs?
 
Blazer6 said:
I haven't played it yet (comp trouble) but do they start with a population comparable to established civs?

They are given a population boost, but not necessarily up to the size of established civs ... without the infrastructure and connected luxuries, they cannot support large populations. Both health and happiness will be problems for them initially, but since they're given free workers they should be up and running soon ...

If anyone has feedback on ways to tweak the competitiveness of the new civs, without making them overpowered, please share!
 
jdog5000 said:
If anyone has feedback on ways to tweak the competitiveness of the new civs, without making them overpowered, please share!

One potential solution is to treat the civ as if it were a player that chose to start in the current era, e.g. given its starting cities all of the free buildings that would normally have been granted if the game had started in that era (e.g. in Classical+, a free granary). Since this is all set in XML it's also easily modded.

If the city is near other civs, extra military is crucial; otherwise, an extra settler is a big boost.

(In fact, I'm almost of the opinion that all cities should start with the free buildings of its current era and am toying with that idea for our mod).
 
atoyx said:
when i load the mod i m getting a screen without any words.. in other words i cannot see the menu and all the text... any ideas?

Which mods folder did you install in? I've been working out of the game install directory /Mods/ folder, not the My Games /MODS/ ... I've read there are some differences between how the two are handled.

The other thing to do, which you should do whenever loading a new mod, is to clear out the cache ... either hold down shift while starting up the game or manually empty /Application Data/My Games/Sid ...4/cache.

Does that help?
 
Exposing the autoplay to python was probably a good idea - I used to use the debug console to do it, but I supose you may be able to do funky things with this involving the AI taking over your Civ when you're in a revolution or something.
 
TGA, sorry if this is obvious & covered elsewhere, but how do you autoplay from the console?
 
Top Bottom