CivCounter / Grigori Adventurer Counter

Terkhen

King
Joined
Aug 1, 2011
Messages
917
Location
Granada
This thread contains both a CvGameCoreDLL ModComp (CivCounter) and a python/XML ModComp that requires it (Grigori Adventurer Counter). Both are described in this post.

CivCounter

CivCounter is a ModComp created by Valkrionn for the Rise from Erebus ModMod. This CvGameCoreDLL ModComp adds the following methods to CyPlayer: getCivCounter, changeCivCounter, setCivCounter, getCivCounterMod, changeCivCounterMod and setCivCounterMod. These methods can be used to consult and modify an internal counter associated to each player. These methods are exposed to Python.

This number can be used for things like triggering a certain event for a specific civilization when the value reaches a certain point. You can check the Rise from Erebus ModMod to check some examples of its usage, but I ported it to More Naval AI because I also wanted to adapt Rise from Erebus' Grigori Adventurer mechanic to it.

Grigori Adventurer Counter

With this ModComp, Grigori Adventurers are no longer generated by the Great Person Point mechanic. This prevents the "Great Person Point" pollution issue that Grigori always had with Adventurers. This mechanic was designed and implemented for Rise from Erebus, this is just an adaptation to More Naval AI. Check these pages for more details about the original implementation: Grigori Overhaul and Grigori Adventurers. How my adaptation works is described below:

Adventurers are created in the Grigori capital when the Adventurer counter (shown at the upper left part of the screen) reaches a certain value. Whenever the player gets a new adventurer, the value required to get the next adventurer will increase.

All cities can increase the global counter, depending on their buildings. The Grigori Palace gives the highest increase (40 points each turn), while the Adventurers' Guild, the National Epic and the Heroic Epic increase the counter by 20 each turn. Command Posts increase the counter in 6 each turn. Buildings that allow to build units allowed as upgrades for Adventurers (Archery Ranges, Hunting Lodges, Infirmaries, Mage Guilds, Stables and Training Yards) increase the counter only by 1 each, but many of them can be built on every city.

The Grigori get a Courthouse replacement, called the Citizen's forum. In addition to the regular Courthouse effects, the Citizen's Forum allows each one of the Specialists of the city it has been built in to increase the Adventurer Counter in 1 every turn. The Citizen's forum can be built faster by Philosophical leaders. The Grigori Tavern no longer has any special abilities, but it increases the adventurer counter in 10 each turn.

Finally, certain civics such as Republic and Pacifism multiply the rate at which the Adventurer counter increases each turn by 1.10. The Grigori world spell, Ardor, now allows to reset both the Great Person count and the Adventurer Counter. Note that all of these values are specified for Normal game speed, and they will scale if a different game speed is chosen.

Download

This download includes both ModComps. To get CivCounter you only need the CvGameCoreDLL files; the rest are for the Grigori Adventurer Counter. The DLL has been compiled with r1281 of More Naval AI, and therefore it should be compatible with MNAI 2.41. Feedback is welcome ;)

EDIT: The download attached to this post is outdated, both because of the version of More Naval AI that it was made for and that it does not include more recent changes. My most recent version of CivCounter is included in ExtraModMod, which is available here. If you only want to get Civcounter or AdventurerCounter to use them in other mods, you can extract its source code following these steps:

1) Download ExtraModMod source code, which is always bundled with ExtraModMod releases found here: ExtraModMod downloads page. If you want the latest development version, you can also click on "Download repository".

2) Once you have the source code downloaded and uncompressed, the first step would be extracting the CivCounter changes and moving them to your mod. You can find them searching by CivCounter in the CvGameCoreDLL. All code related to CivCounter is between tags like these ones:

Code:
/*************************************************************************************************/
/**	CivCounter			               		10/27/09    						Valkrionn		**/
/**										Stores Spawn Information								**/
/*************************************************************************************************/

Code:
/*************************************************************************************************/
/**	CivCounter								END													**/
/*************************************************************************************************/

3) If you only want CivCounter, you can stop here. For AdventurerCounter, you can search by AdventurerCounter in the XML and python folder. For python, the changes are between tags like these:

Code:
#AdventurerCounter Start (Imported from Rise from Erebus, modified by Terkhen)

Code:
#AdventurerCounter End

In XML, the related code is between tags like the following ones:

Code:
<!-- AdventurerCounter Start (Imported from Rise from Erebus, modified by Terkhen) -->

Code:
<!-- AdventurerCounter End -->
 

Attachments

  • CivCounter.zip
    3.3 MB · Views: 141
Great! I always wanted this in standard FfH! I'll try it.
I remember there was a mod who changed Adventurerers to replace Great Generals, but with that you are of course way more flexible. Did you consider to add something like winning combat or exploring lairs increments adv counter?
And, does the AI unterstand this?
 
[to_xp]Gekko;12142719 said:
excellent! :)

Great! I always wanted this in standard FfH! I'll try it.

Thanks :)

Did you consider to add something like winning combat or exploring lairs increments adv counter?

I was pondering about introducing a mechanic for the Doviello that would also make use of CivCounter, which would grant them free wolves after a certain number of killed units. I remember that one of the FFH2 modmods does something like that, but I don't remember which one right now.

I did not consider giving adventurer pointers to the Grigori for killing units, but I think that your suggestion of making lair exploration increase the adventurer counter fits with the theme and if the number of points awarded increases with the "evilness" of the lair it also gives the Grigori a big risk big reward strategy :)

And, does the AI unterstand this?

The AI does not understand this mechanic, which is why it is given a 1.2 multiplier for each turn's adventurer points. I'm thinking that a better solution for the AI problem may be giving a bigger iAIWeight to the unique Grigori buildings that contribute to the Adventurer Counter (Adventurers' Guild, Grigori Tavern and Citizens' Forum). Hopefully, this should point the AI in the right direction. Besides this, the only option that occurs to me is hardcoding Grigori specific behavior for the AI in the DLL, which is a solution that I don't like.
 
if I might barge in:
on paper I'm not sur the number are balanced..
40for palace..
adventurer 20
archery 1 ??? you need 10 cities with archery+training field+barracks+hunters guild to be equal to 1 palace?
or +1 per specialist from the citizen forum ? that's low.

having a variation of 1 to 40 is too much imo.
maybe tone it down:
-citizen forum : +1/specialist
-palace +10 (huge)
-adventure guild : +3 (if per city, +8 if it is a national wonder)
-heroic /national epic +5
-buildings for units : +1 (hunter hall, mage guild, training hall, bowyer, garden (for druid/beastmaster), stable, barracks...Etc)
-command post : +3

-grigori tavern : +10%
-inn : +10%

or something like that.
(really, giving 40 to palace.. means it will take a very long time to be able to increase noticeably your counter production rate.. to get 80 without epics, guild will be long.

and your other number means you have +100 with epics, guild and palace... it will be very hard to double that numbers... ).

well it will have to be tried out.

then you could add :
-explore hut/village : +1
-explore lair/ruins : +5
-explore natural wonders : +10 ; more so when risk of evil is more important.

further add : hoard of the dragon... gets a parallel wonder for grigori : hoard of dragon "bis" that gives +10 to counter.
..etc
 
having a variation of 1 to 40 is too much imo.
maybe tone it down:
...

Bear in mind that the palace number is there to simulate the original speed at which you get your first adventurer. With a 40, in the current version, you should get your first (and second) adventurers at roughly the same turns as with impolluted Adventurer Great Person Points in the vanilla FFH2 mechanic. Having said that, I'm inclined to agree with your analysis; it is quite complicated to raise the rate at which you get adventurers right now. If it works at intended, it should be as difficult as getting a lot of adventurers with the vanilla mechanic (which is no bed of roses either), but maybe it is more difficult. If it is, I would scale other point increases but the palace points would always be the value by which other buildings are measured. Testing will answer this question :)

Spoiler :
The Dragon's Hoard already gives adventurer points in the current version. It was intended to be an easter egg, but it seems that it wasn't as hard to guess as I would have hoped.
 
Bear in mind that the palace number is there to simulate the original speed at which you get your first adventurer. With a 40, in the current version, you should get your first (and second) adventurers at roughly the same turns as with impolluted Adventurer Great Person Points in the vanilla FFH2 mechanic. Having said that, I'm inclined to agree with your analysis; it is quite complicated to raise the rate at which you get adventurers right now. If it works at intended, it should be as difficult as getting a lot of adventurers with the vanilla mechanic (which is no bed of roses either), but maybe it is more difficult. If it is, I would scale other point increases but the palace points would always be the value by which other buildings are measured. Testing will answer this question :)

Spoiler :
The Dragon's Hoard already gives adventurer points in the current version. It was intended to be an easter egg, but it seems that it wasn't as hard to guess as I would have hoped.
haha.. sorry for the hoard (see as they got anti-dragon units as UU... :D

well, I don't really care one way or the other;
to speed the early adv, you could reduce palace bonus and reduce the thresholds, or keep the thresholds and the palace bonus, but increase the value of other bonus

but IMO, what is important is that there is not too MUCH difference between palace and lower revenue. a 10:1 (10 to 1) ratio is already a big difference, even if you have much possibilities to rise the number of sources.(look at culture or gold or science : you have no building that gives a strait 10)

if it becomes too easy, maybe remove the "unit-building" bonus (or only for T2 / T3 units and keep it for bowyers and the garden-thingy.

IMO, you can really use the 4 mechanics :
-strait "counter yield"
-%increase
-counter yield given to specialists
-counter increase with exploration or "feats" : hero-unit kills a unit, normal unit kills a unit with less than 60%chances to survive, kill / subdue / command unique units : the animals ones, the barb heroes, religious heroes, national heros;..etc any unit with world-number limited to 1...Etc (but that would demand python i think)
 
Hmm ...

Yes, I rather like the idea of Dragons Hoard increasing the Adventurer counter.

Question: As it stands, can other civs get adventurers from capturing the Hoard as well?
 
Hey,

I'm considering using this in v12 of EitB. Was this implemented pre- or post- the BUG merge?

EitB makes some changes to the .dll as-is. Is there a listing somewhere of the exact changes that the CivCounter Modcomp makes to the .dll, so I can make them myself?

I'm not sure whether the (relatively extensive, IMO) alterations will be appropriate for EitB. How difficult would it be to adapt your implementation so that the Adventurer Counter simply functions the same to the GP counter, except incremented separately and affected civ-wide?

Thanks, Q.
 
I'm considering using this in v12 of EitB. Was this implemented pre- or post- the BUG merge?

Post-merge, I think. Since the post did not gather much interest, I stopped doing MNAI updates here and I worked only in the ExtraModMod code, so it is quite outdated.

EitB makes some changes to the .dll as-is. Is there a listing somewhere of the exact changes that the CivCounter Modcomp makes to the .dll, so I can make them myself?

I have updated the first post with detailed instructions on how to extract both CivCounter and AdventurerCounter code from the current ExtraModMod code. It shouldn't be complicated.

I'm not sure whether the (relatively extensive, IMO) alterations will be appropriate for EitB. How difficult would it be to adapt your implementation so that the Adventurer Counter simply functions the same to the GP counter, except incremented separately and affected civ-wide?

CivCounter only establishes two numbers associated to a player, CivCounter and CivCounterMod, that can be incremented or decremented via python. CivCounter is used to store the "current" value of the Adventurer Counter, while CivCounterMod is used to store the current value that needs to be reached. Therefore, you can import the CivCounter code in the dll exactly as mentioned in the first post as the same implementation will serve you.

You can certainly adapt the AdventurerCounter code to make buildings grant exactly the same number of points, to make civics multiply them by the right value and so on. But I foresee a problem; the problem is in the number of points that have to be reached before granting an adventurer, as I don't know exactly how to calculate that value from python. In the worst case, if it is not possible to calculate the value you could always hardcode it following what this article says.

The key part of the AdventurerCounter code sits at the doTurnGrigori, doChanceAdventurerSpawn and scaleInverse methods in the CustomFunctions.py file. doTurnGrigori is tasked with initializing CivCounterMod the first time, when it is found to be below what should be its minimum value. Also, whenever CivCounter is greater than CivCounterMod, it also handles the adventurer spawning (which does not need to be changed) and moving CivCounterMod to its next value (which should be adapted to follow the same rules of increase used for Great People Points).

doChanceAdventurerSpawn is what calculates the number of points gotten each turn. This is where you would need to adapt the mechanic to mimic the original code. Since you should only need to make buildings grant points and to make civics multiply the amount gotten, I think that you can use the existing code just needing to adapt what each building and civic does to your needs.

scaleInverse is what I use to scale the adventurer counter according to speed. You would need to modify it to mimic how scaling is handled for Great People Points.

I would adapt the rest of the AdventurerCounter code (XML and python parts) in the following steps. The parts that I don't mention should not require changes.

  • Since you want an implementation similar to the vanilla feature, ignore all XML code related to the new building, the Forum.
  • In CvSpellInterface, AdventurerCounter also modifies the Ardor world spell. in the reqArdor method you will need to modify both getCivCounterMod. The first condition indicates that the spell should not be available until at least a great person or an adventurer has been generated, so the getCivCounterMod value should be equal to the value required to get the first adventurer. The second condition indicates that the AI should considerate casting the spell when the AI has gotten 6 great people or 6 adventurers, so the value should be modified accordingly. In spellArdor, setCivCounterMod should be set to the first value required to get an adventurer. I have seen that my version is bugged, as it does not take into account the scaleInverse method.
  • The AdventurerCounter code in CvGameUtils.py forces the AI to build certain buildings that grant Adventurer Points. This is needed because the AI will not understand how to get adventurers. You would need to adapt this code to make it build the buildings affected your changes.
  • I would also include and adapt the TXT_KEY_CONCEPT_ADVENTURER_COUNTER_PEDIA to describe your changes. I find that having concept Civilopedia pages for mechanics like this one that are otherwise invisible to the player is quite helpful.

Let me know if I can help you more with this :)
 
Top Bottom