• Civilization 7 has been announced. For more info please check the forum here .

Revolution: with BarbarianCiv, Rebellion, AIAutoPlay

Dom Pedro II said:
My own mod, which borrows extensively from jdog's masterpiece here, will essentially be about your leader's survival from enemies from within as well as from without.

I'm trying to mod the code to allow for what I call "subnational leaders and organizations" that you'll have to compete against for control of the civilization.

Couldn't you use this idea http://forums.civfanatics.com/showthread.php?t=178924 for your mod? (especially the culture mix system)
 
The Great Apple said:
No. IIRC that custom event manager automatically imports the events from the default event manager. As you want to change the default events, you need to change the default event manager. If you just move it to your mod folder and do the changes above it should work fine.
K, I hoped to solve it in another way, but if this is the only way, I'll have to go this way :-|
 
Caesium said:
K, I hoped to solve it in another way, but if this is the only way, I'll have to go this way :-|
Actually, there is another option I believe ... while DrEJ CEM does import the standard one, you have two options when you go to link up your function with an event: addEventHandler and setEventHandler.

Normally, addEventHandler is the better choice so your mod is more compatible with other mods (doesn't overwrite their ability to use this event. However, in this case, setEventHandler might be better. It might be possible to use removeEventHandler to remove the default handler from inside your file and the replace it, but I'm not entirely sure ... I'll investigate this and report back.

Oh yeah, and excellent spot TGA! I went looking into the popup queue in the SDK code and decided it was more than I wanted to tangle with at the time and put it off, this is a very elegant solution.
 
I have found a few important bugs in version 0.5, and so will be posting 0.55 in the next couple of days. Here are the important ones:

Revolution:
- Fixed bug where city pointer would disappear when city was given to revolutionaries
- Fixed bug where player A's city could want to join Player B, with A and B at peace. If the city had tried to revolt to player B before and now if A didn't let them go, they would revolt (and declare war) as player B instead of forming new civ
- Fixed bug where giving revolting cities independence reincarnates dead player, who doesn't forget you were at war when they died. Since you've given them new life, they now (somewhat) forgive you.

Rebellion and RevUtils:
- Fixed bug in use of Cymap::isWrapX()

None of these would cause the game to crash (all in Python), but could lead to empty Revolutionary cities etc.

There are a few other changes, including having rebels and their motherland hate each other in the beginning =) Probably posted on Tuesday.
 
jdog5000 said:
Oh yeah, and excellent spot TGA! I went looking into the popup queue in the SDK code and decided it was more than I wanted to tangle with at the time and put it off, this is a very elegant solution.
Does this mean, in 0.55 there won't be any popups during AIAutoplay?
 
Cincinnatus3 said:
thanks jdog for the info. i ended up figuring out how to turn it on (have the ini file open up as notepad but save as a BAK).

i've tried playing a couple of games, but had 3 of the 4 crash with an illegal operation message. all 3 crashes came in around 600 BC or so - a couple of turns or so after two barb civs popped up one shortly after the other. i don't know quite what's happening since i don't have all the debug tools on.
If you have a save from this game, I'd be very interested ... I assume you mean it crashed to desktop, which I experience from time to time, but I try not to release code that does that :p

Cincinnatus3 said:
the one game i did have that went without any problems lasted until the 1600's. didn't see any revolutions (probably wasn't late enough for them anyway), but did have a couple of rebellions (1 successful) and 3 barb civs emerge.

just wanted to update game progress. i'll be trying again right now.
Glad to know it's at least mostly working for you ... Revolutions start to pick up after about 1400. Before that, there are only really holy cities trying to break away from heathen civs.
 
Colin said:
I'm enjoying this very much so far. I always found it one of the most baffling design decisions in Civ4 to completely remove internal conflict - at last happiness actually means something again! I have just bought Warlords though, is this mod compatible with it at present?
Glad you like it! No, this is definitely not Warlords compatible ... the SDK portion of the game has changed for Warlords to service all the Vassal state and other changes, so I'll need to merge my modifications into the Warlords SDK code. Not sure when that will happen, as it will be a fairly big process (and I haven't bought Warlords yet ... been to busy).

Colin said:
A couple of thoughts - should rebellions/revolutions produce great generals once Warlords-compatible? It would seem the perfect place to see a Lenin or Marat emerge, really adding to flavour. On the subject of flavour, I wonder if there is some way to give any civs produced by revolutions a name based on the civ they revolted from - not new artwork or anything, just text. This would be a way of including certain minor civs that can't make the game otherwise, but have historically been a thorn in bigger civilizations sides. For instance an American revolution could produce a Cuban civ, or a Spanish revolution could produce a Basque civ.
Yes, Warlord units will certainly make an appearance sometimes in Rebellions and Revolutions, although the details are to be worked out. I'm thinking it'll be probabilistic, with odds increased if it's a big revolt or the revolting leader has great general friendly characteristics.

The civ name changing may be possible, but it's not easy. I attempted to create new leader names for civs that only have one leaderhead when there's a leadership change revolution ... basically, the issue is that, I guess for localization reasons, whenever the game wants to show 'Alexander', it asks the CvPlayer instance for the leader's XML key, then gets the name from there. There exists an override for the human player so that you can be 'jdog5000' if you want, but the code for that override is hidden in the game's exe code, so not in the SDK dll code. It'll take a bit of work to reverse engineer how the override should work, my first attempt failed ...
 
Justinian519 said:
If I just want to at the rebellion as barbs to a mod to I just put the rebellion python and the revolution.ini in it?
Basically, yeah. You need Rebellion.py, RevUtils.py, and the Rebellion portions of Revolution.ini. You then need to register Rebellion.py's and RevUtils.py's events with your mods event manager, have them initialized when your mod is, and put the ini part in your mods ini file. This mod's CvCustomEventManager.py would be a good reference ... if you have any specific questions PM me.

Justinian519 said:
Oh yea, Jdog500 I actually enjoy having the small civs of 2 cities left in the game. They can create global conflicts. They could perhaps be merged with a civ that they are friendly with, though.
Yeah, I have no desire to eliminate the small civs who actually own some territory. I've seen several one or two city civs actually run quite well, if they're a holy city they spread their religion all over and then can kind of keep up in techs even. The other night I came across Saladin, who had a single city at the corner of a continent, but had oil (Kuwait anyone?)!

So I agree that the little guys are fun to keep around ... it's the really tiny ones who capture one city as rebels but then lose all their territory because they don't have enough culture. They'll wind up with only 20% nationality in their own capital, and one square of land area. I'll create a config switch and you can decide whether you want to keep these specks around.
 
jdog5000 said:
If you have a save from this game, I'd be very interested ... I assume you mean it crashed to desktop, which I experience from time to time, but I try not to release code that does that :p

well, i suppose it did crash to desktop - kind of stalled the game altogether. it said that Civ 4 had performed an illegal operation and all that windows garbage (having to send an error report, blah blah). the 4th time it happened, i actually tried to read what the error report said :lol: so that's what trying to read Greek feels like.

anyway, the only save i have literally comes right before the crash. upon loading it, the game crashes. not sure if that will be helpful or not. problem seems to be ok now. if you still want the save game though, let me know.

jdog5000 said:
Glad to know it's at least mostly working for you ... Revolutions start to pick up after about 1400. Before that, there are only really holy cities trying to break away from heathen civs.

well, the other problem is that i'm playing on a premade map (tried to make a map specifically for this mod - lot of open spaces, distinct areas of the world each with their own luxury resources, equal starts for each civ, etc). i was starting to think that perhaps i had too many resources, though regular maps always blow me away with how much they have for resources. if it has to do with holy cities and heathen civs, that makes a little more sense.

side notes on playing again recently:
* that second bug you mentioned makes a lot of sense now. i've seen it happen in my games. thought it might have happened because i have cultural flips on????????
* really interesting AI behavior. sometimes when i asked different civs if they wanted to join a war, they told me, "We have enough on our hands right now." i could see they weren't at war with anybody else, but they either lacked in luxury resources, lacked drama, or had a territory split by religion. a side effect of the revolution mod? interesting.

back to playing again. :goodjob:
 
Caesium said:
Does this mean, in 0.55 there won't be any popups during AIAutoplay?
Yes, there will be a config switch to turn these off. Here's code I ended up doing it:

In AIAutoPlay initialization:
Code:
self.blockPopups = config.getboolean("AIAutoPlay", "BlockPopups", True)

if( self.blockPopups ) :
        self.customEM.removeEventHandler( "cityBuilt", customEM.onCityBuilt )
        self.customEM.addEventHandler( "cityBuilt", self.onCityBuilt )

Since the CustomEventManager inherits the EventManager, it then has all the EventManagers functions, ie the default event handlers for all events. You can then remove certain default handlers and create your own that look just like the ones TGA posted. It's brilliant! Did the same for the onBeginGameTurn function as well. :cool:
 
Naokaukodem said:
Why do I feel like ignored? :/
Your questions were next in the queue ... to many at once :crazyeye:

Naokaukodem said:
Well I played a game with the mod and I didn't see anything mentionned... what do I do wrong?
Odds are the mods not loading properly, two ways to test this out:

Does SHIFT-CTRL-X bring up the AIAutoPlay popup? If not, then things are not loaded right.

Another way to check, in Revolution.ini turn on ActivePopup in the [CONFIG] section. When you restart the game, it should tell you which of the Revolution components are loaded ... if not, then the mod's not loading at all.

If you start a game completely alone with BarbarianCiv turned on, you should definitely be getting popups about barb civs forming!

Naokaukodem said:
Couldn't you use this idea http://forums.civfanatics.com/showthread.php?t=178924 for your mod? (especially the culture mix system)
For now I'm focusing on getting these components fully up and running, so I don't have time to try out your ideas ... sorry. There are a few culture model mods out there as well, perhaps you can get one of those modders interested in some of your ideas. Or try it yourself ...
 
jdog5000 said:
Yes, there will be a config switch to turn these off. Here's code I ended up doing it:

In AIAutoPlay initialization:
Code:
self.blockPopups = config.getboolean("AIAutoPlay", "BlockPopups", True)

if( self.blockPopups ) :
        self.customEM.removeEventHandler( "cityBuilt", customEM.onCityBuilt )
        self.customEM.addEventHandler( "cityBuilt", self.onCityBuilt )

Since the CustomEventManager inherits the EventManager, it then has all the EventManagers functions, ie the default event handlers for all events. You can then remove certain default handlers and create your own that look just like the ones TGA posted. It's brilliant! Did the same for the onBeginGameTurn function as well. :cool:
So the popups are only blocked while AIAutoplay? What about other events from other mod comps? Are they handled as usually?
 
jdog5000 said:
For now I'm focusing on getting these components fully up and running, so I don't have time to try out your ideas ... sorry. There are a few culture model mods out there as well, perhaps you can get one of those modders interested in some of your ideas. Or try it yourself ...

I think he was referring to my post as it was the one he quoted... shamelessly promoting my own ideas in your thread again. My apologies... :lol:
 
The Great Apple said:
They will be - you'd have to block them yourself.
Exactly, this change only blocks the city naming and best civs lists while in Automation. I added another option to block the BarbarianCiv popups while in automation as well. The other popups in this modpack, like a revolution is brewing etc, only come up when you're not in automation (or in the last turn of automation), so they're not an issue.
 
OK, I'm sitting, waiting, wishing :D

Version 0.55 will be great. What about support for multilanguage?
By now, I had to translate it every time, because I'm german and though I wanted to play it in german ;)
 
Caesium said:
OK, I'm sitting, waiting, wishing :D

Version 0.55 will be great. What about support for multilanguage?
By now, I had to translate it every time, because I'm german and though I wanted to play it in german ;)

I think poor jdog might need a little assistance to do something like that... maybe people from respective countries could supply translated text..?
 
I think, I'll wait 'till release and upload my translated version.

Edit: corrected typos
 
Top Bottom