Wiser Orcs (a FfH II mod)

Version 0.03 is out. I hadn't looked at the code in a while, so all I did was a merge with Shadow.
 
  • Release 0.04 - tenative
    • Work on AI_plotValue, AI_yieldValue (make worked tile choices make more sense)
    • fix healing display. (defect from 0.02)
  • Look more at the Hyborem food logic.
  • Work on Technology choices.
  • Workers shouldn't build non-mana improvements on mana nodes.
  • Work on adept mana node building. (This may be more general - any non-worker building)
  • Workers shouldn't destroy mana nodes.
  • AI protects its own heavily promoted units more.
  • AI targets enemy highly promoted units more.
  • Choice of what tiles to work should be re-examined. It seems that the present algorithm can easily get into holes where a city won't grow. It seems that this can cripple entire AI civilizations.

The Hyborem food logic is very interesting - as of version 043 of Fall Further, we'll have two Fallow civs, one of which is available at game start. Having the AI for that handled correctly would be very useful to them.

I've had a brief look at it and I think Xienwolf also planned to poke at it at some later point, but if you've already got some progress in that area, I'd love to discuss it...
 
Wiser Orcs 0.04 released. The big change is that I actually uploaded the correct dll. I also went through and fixed a number of 0-food issues.

The Hyborem food logic is very interesting - as of version 043 of Fall Further, we'll have two Fallow civs, one of which is available at game start. Having the AI for that handled correctly would be very useful to them.

I've had a brief look at it and I think Xienwolf also planned to poke at it at some later point, but if you've already got some progress in that area, I'd love to discuss it...

Yeah, as of 0.04, it pretty much works. I've even gotten the display fixed so that it no longer shows "Starving" all the time.

If you use Wiser Orcs, all you have to do for a new Fallow mechanism is to make certain that it gets through to:

void CvPlayer::setIgnoreFood(bool bNewValue)

Which a trait using the present mechanism should.

Note that a grep on Wiser Orcs.*Food should catch all the code associated with 0 food and 1 food logic.

Note also that technically since the city material uses CvCity::isIgnoreFood (which presently is just a pass-through for the above function), it should be possible to have variable amounts of food per population (varying on the city). I have no idea if this would be of use to you.

The main issue you may have with the code is that when food is being ignored, the Food Emphasize button no longer functions. That's only a few lines of code, which I can point out if you want to emphasize food for some reason when you're ignoring it.

Warning: Wiser Orcs through 0.04 has a defect in the variable food logic. It will be fixed on the next release.
 
One of the things which almost immediately drove me towards working on Wiser Orcs ASAP was that in my first game in 0.25, I had a city with Dragon Bones in its radius.

That city never grew until I realized the problem, and manually over-rid the worked plot selection - note that I had Emphasize food turned on, which was plenty in Smarter Orcs to ensure growth.

I've had to do this frequently ever since the BtS merge in 0.25 - even using the buttons to focus on food can get you caught in a trap where your city won't grow until you manually override its plot selection.

When you realize that the AI can't manually override (after all, the automatic algorithm, with very tiny changes, is its algorithm), you realize pretty fast why occasionally an entire AI civilization will have its growth paralyzed without war or barbarians; they're just choosing bad plots to work.

This release attempts to fix that, and it appears to succeed (frankly, it seems to do better than I'd thought possible with this small of a change). While it may not always use an optimal growth algorithm, cities put a much higher emphasis on growth, at least up to their happy cap. Note that you can override this feature by focusing on Production, Commerce, or Avoiding Growth - all these buttons will return to the use of the older algorithm, among their other functions.

Question: In cases where a civilization can rush via population (ex: Slavery), how large should cities attempt to grow?

The other features are more minor - fixes to city radius and size (mostly a Kuriotates fix), fixes to the food logic from a defect injected in the last release, a bunch of minor speedups, and a few minor fixes. This also has a merge to d.
 
so this doesn't work only for the AI, but even for the human player whenever he chooses to automate city plot selection? good stuff, that selection is seriously messed up in BTS. the worst part of it is when you tell it to stop growth to avoid unhappiness, and it just seems to ignore the avoid growth command and happily continue to grow >.<
 
Sweetness :) And the previous fix for Fallow Civilizations keeps them making good plot decisions as well?


I personally don't rush population, but I would assume that growing 2 Angry Citizens is about as far as a Slave Whipper would want to push things, unless they planned to rush a wonder.
 
I personally don't rush population, but I would assume that growing 2 Angry Citizens is about as far as a Slave Whipper would want to push things, unless they planned to rush a wonder.

you should definitely give it a try, it's very effective :D I as well was very uninclined to sacrifice population before trying it, but now I'm addicted XD
when you got tons of food and little hammers ( which tends to happen a lot to me as I love farms and despise cottages/workshops ) , it's invaluable.

OT I know, I'm sorry :(
 
[to_xp]Gekko;7178711 said:
so this doesn't work only for the AI, but even for the human player whenever he chooses to automate city plot selection? good stuff, that selection is seriously messed up in BTS. the worst part of it is when you tell it to stop growth to avoid unhappiness, and it just seems to ignore the avoid growth command and happily continue to grow >.<

I should note that I've yet to directly address the proper stopping of growth (merely the starting of growth). While I seem to be getting this effect anyway, I think that's just chance.

I'll consider looking into it in detail for the next release.

Comment: One major difference between AI growth and Human Player growth is that Human player growth limits are one higher (i.e. they will create an unhappy population by default). I think that the idea is to use this as an indicator to a human that they need more happiness in that city.

Question: Barring the ability to sacrifice population for production, should human players' growth be capped at the happiness cap?
 
[to_xp]Gekko;7178765 said:
you should definitely give it a try, it's very effective :D I as well was very uninclined to sacrifice population before trying it, but now I'm addicted XD
when you got tons of food and little hammers ( which tends to happen a lot to me as I love farms and despise cottages/workshops ) , it's invaluable.

OT I know, I'm sorry :(
Since you are an addict, how many unhappy people would you prefer your cities to grow when you can sacrifice population?
Does it change how you view the value of food vs. production when you can sacrifice population (do you consider food more valuable, and/or production less valuable?
Do you only find it valuable when you have a high Food:Production ratio?
 
Question: Barring the ability to sacrifice population for production, should human players' growth be capped at the happiness cap?

you're talking about city automation right?

if you are, then my answer is 100% YES. no unhappyness and no unhealth should be the default situation the automation aims too. then if somebody wants to increas pop even more, he can choose to do so himself. maybe change it a little if the city has pillar of chains if it's possible?
 
1)Since you are an addict, how many unhappy people would you prefer your cities to grow when you can sacrifice population?

2)Does it change how you view the value of food vs. production when you can sacrifice population (do you consider food more valuable, and/or production less valuable?

3)Do you only find it valuable when you have a high Food:Production ratio?

well, I'm not really an addict, I just meant I really like how it works, not that I use it all the time, but I'll answer anyway ok? :D

1)I still hate unhappy faces and try to avoid them as much as I can. I always rush pop ASAP if it allows me to get rid of them, so that I can keep my cities happy all the time. I will rush military units if under attack and caught flat-footed, but I usually use it to rush invaluable buildings like courthouses, AND buildings that raise happyness so that I can then rush more :D

I don't take food vs production much in consideration actually. if a city has a lot of food, I will rush pop, if it has lots of hammer it will usually not need it anyway. I'm not a good enough player or micromanager to think "ok let's run slavery as long as possible and build as many food-giving improvements as possible. no, I will usually build farms everywhere I can, mines on hills and cottages if I can not build a farm ( which happens rarely cuz I usually try to get irrigation-spreading farms ASAP ) . later in the game, I will reshuffle and usually substitute some farms with watermills and build lumbermills if I still have forests ( I tend to avoid cutting them until it is really needed or my workers have already improved every other tile available ) . substitute some mines with windmills if the city has very little food, and I simply never build a workshop.

so, simply said, it won't change how I view food and hammers, I'll just use it whenever it feels useful in a city ( rule of thumb for me is: if the population it deletes is at least 1/2 the # of turns it would have taken to finish that building, I will use it. 1/3 is better though. i.e. granary in 6 turns, would take 2 pop to finish? rush it! granary in 7 turns, 4 turns to finish? not worth rushing imho. I'm actually not sure if this is a good way of using it at all, if someone has a better plan please share :D

also, it should be noted that I like to rush with money way more than I like rushing with pops, cuz it's much easier to manage, so I'll switch to caste system or something that lets me rush with gold ASAP.

3) definitely yes. It's not useful if you can build stuff quickly already but it takes ages to grow back to max size.
 
One intrinsic problem with FfH II's AI is that the AI lack any strategy that's distinguishable from the standard BtS strategies; that is, they take little or no advantage of FfH II's unique features. For example, nearly every strategy on the strategy forum is presently impossible for the AI to execute.

The question (since sometime in Smarter Orcs) was how to implement this; ideally, we want something that is:
1) effective at emulating virtually any strategy imaginable.
2) fast
3) easy to modify for non-C++ coders (ideally XML, otherwise python hooks)

So here's the idea:

Basically, I plan to create a framework. Much like Spells or Events, Strategies will have its own XML file, with entries for each strategy, each with sub-headings allowing each strategy feature to be turned off or on with some independence (for example, there might be a list of flavors with weights, which would indicate the flavor changes under that strategy (flavors control Tech choices)).

The transition points between various strategies would hook into (new) python code.

Furthermore, LeaderHeadInfo would gain a new hook into new Python code which would save the present strategy.

The idea would be to eventually allow a modmodmodder or scenario builder who works off of this code the ability to create their own strategies (within the parameters that are coded) and to transition between strategies with just XML and python knowledge.

Obviously, to start with, this feature would have a fraction of its eventual expressive power (I'd likely start with 1-2 strategies, possibly ones that are already coded in the C++ code). However, I think I now have a good enough grasp of what I want to do that I can start on looking into it.

Let me know if you have any comments/suggestions.
 
First thing I would allow each Strategy Type to contain is a flavor Array. The current Strategy Type Flavor would add to the Leader Flavors. This will be very versatile as you can create new flavortypes to directly control the AI in various methods (ie - Flavor_Runes would be placed on each Tech required to found RoK, with the numbers set to force "Smart Order" of Mysticism first)

Next I'd add Arrays of Unit/Building Infos with AI weight values which will add to the basic AI Weight Values.



Do you plan to have only 1 Strat active per player at a time?
 
First thing I would allow each Strategy Type to contain is a flavor Array. The current Strategy Type Flavor would add to the Leader Flavors. This will be very versatile as you can create new flavortypes to directly control the AI in various methods (ie - Flavor_Runes would be placed on each Tech required to found RoK, with the numbers set to force "Smart Order" of Mysticism first)

Next I'd add Arrays of Unit/Building Infos with AI weight values which will add to the basic AI Weight Values.



Do you plan to have only 1 Strat active per player at a time?

Yes; I think both would be useful.

I was just thinking about that. I think that ideally, I'd have multiple strategy classes, so, for example, one strategy class could be worried about the value of melee units with Bronze vs. melee units without Bronze, whereas another strategy class could vary on the player, whereas another could vary on if the player's at war.

So the idea is that each AI could have 1 strategy instance from each strategy class. If the definition of both is done in XML, that would make this potentially extremely generic.

Of course, this is another layer of complexity on something I've never done before. So I'll have to think about it.

I'll have to think about it further.
 
The Strategy Classs having a file to themselves would work well. Some fields for there:

bAtWar - Strategy Category valid if at war
bPeaceTime - Strategy Category valid if not at war
iDogpiledBy - Strategy Category valid if at war against multiple factions
iDogpiling - Strategy Category valid if at war with support
i__UnderFirst, i__OverSecond - One pair per power graph, making the Category valid if far enough behind/ahead
iDebtRatio - Category made valid when bleeding :gold: to maintenance


Though on review maybe these are more fitting on the Strat Types. Oops
 
Glad to see you're back, xanaqui :) The strategy classes idea sounds really good. I played a game with an unmodded ffh033e last night and I steamrolled a number of civs with iron-upgraded champions vs non-upgraded warriors. Tech prioritization still seems really bad: they did build lots of stuff like adepts and priests but didn't use them, so since the last time I played with the FFH ai, not much seems to have changed.

Will you have a version of Wiser Orcs for f soon or should I use the one that's up now? (0.05 I think)
 
Did I scare him off?
 
Sorry; I just check this thread infrequently (usually around the time I'm ready to release). I much more frequently adjust the first few posts, as they are pretty much my notes for the mod.

The present internal one (and presumably the next one to be released) is based off of e. I suspect that the merge to f is small, if that's a priority - but from reading the defect log, I'm considering skipping over to g (or whatever the next main mod release is).

So far, I haven't encountered any major stumbling blocks - a couple design flaws, but both are ones I've addressed before, so it's going pretty smoothly. The initial release of the strategy framework isn't going to have much implementation, though. Presently, I'm aiming for giving the Lanun a chance of really wanting Octopus Overlords in the beginning of the game, mostly as a proof of concept that the framework functions.
 
so a new versions is coming out soon? sweeeet. a much needed improvement to the dumbness of the AI as anyone in here will tell you. and if it gets in FF too I'll be happier than a beaver in his dam :D
 
Back
Top Bottom