Smarter Orcs (a FfH II mod)

How the hell did it become 00:40am? I'm almost done, I swear! (and then I have to playtest still... damnit, this is quite some work)
 
Well, Better AI surely does introduce some changes to the tech selection algorithms. Those threw me off a lot. I'll need to compile a version with my own debug statements to see what kind of flavorings I'll need now. I've attached the current files for techs, but they don't seem to be doing a LOT yet. They DO exclude magic (so don't be surprised if you don't see the AI doing any magic), so that's a performance boost right there already, but otherwise they flavors don't quite work as I want them to yet. I'll have to talk to xanaqui and experiment some more.

So, again: this is an alpha. It does NOT work as intended yet, but feel free to play around with it. Oh and civfanatics doesn't allow .rars, so I called this .zip, but it isn't. Just rename it back to rar and unrar it as normal.

Download the file into your Assets dir and unrar in place.
 

Attachments

Sorry for that, it was just stupid me getting a certain elven leader
in a random game and not paying attention -.-

Still was not able to finish the game.
Repeatable crash on AI-Turn (turn 421).
No python error, no warning,
just a Civ IV.exe has caused a problem in module CvGameCore.dll...
'ello desktop.

Will give it another try this weekend without any modification
and see if it happens again and get some saves.

If you have the saved game and instructions on how to replicate it, I'd be interested. I've squashed a number of defects and a couple reasons for crashing on the present version on sourceforge, but I don't intend to release the .dll again until I'm not aware of a specific crash defect (there's at least one left).
 
Alright, I should really learn to read my own notes. I simply set the flavors by a factor of 5 too low. That would explain why they didn't work as intended. Ahum. Apologies for the delays etc.

Here's a version I'm still calling alpha2, but I had two extremely enjoyable games with it, so I'd say it's almost a first beta, as far as the techs are concerned. I've done all the flavoring by intuition, so it definitely needs a LOT of fine tuning, but if there is interest in this kind of thing I think I'll enlist some community members to help me with that, because honestly? This is an incredible amount of work. Let it be known that my respect for Kael and co quadrupled over the last three days.

What do these xml files do?
In short: the AI won't research magic techs, and it will specialize on one branch of weaponry. Also, certain civilizations should tend toward things that are logical for them. Hippus will actually build horses etc. Furthermore, AIs will research religions faster and you will pretty much see Hyborem in every game with an evil civ, and pretty early too.

If you want more in depth information on what I'm doing (or trying to), have a look at the wiki where I describe my cunning plan.

Installation
Download the .rar.zip file attached to this post, rename it .rar, put it in your Assets dir, and extract in place. It will overwrite three files in Assets/xml.

This is meant to be played with xanaqui's dll, so grab it from the first post.

Let me know how this works for you all!
 

Attachments

Hmm, I definitely applaud your work. Sorting through AI stuff has always daunted me. Anyway, I did want to offer a thought on your most recent post.
I am not really sure if removing the AIs desire to go after Magic techs is really a great idea. Especially when you look at Civs that have Traits and Buildings that specifically boost the effectiveness of magic units for them.
Just a thought.

Cheers!
 
Blaze, disabling Magic is a temporary thing. The reasoning behind it is clear: The AI cannot use magic, at least not in any kind of meaningful way. I've observed a lot of games between AI players with and without magic, and the AI always handicaps itself when it goes for magic. Until we've come up with routines that make the AI use magic well, we're keeping it out.

The AI *does* perform a lot better when it doesn't waste hundreds of rounds of research on magic techs. It's quite a difference, you should give it a try.
 
I will.. I tend to forget about those little shortfalls that are still in the AIs...

Cheers!
 
One suggestion. The AI knows how to use summons [at least I saw griffons many times] so you could extract a tech patch for Sheiam to beeline their Eater of dreams.

Also considering Sheiam there should be a special path for them for their buildings that attract their planar monsters.

Why can the AI summon griffons and cant summon firebals?
 
The AI doesn't know how to use summons efficiently either. They will summon some of the time, but they do not use all their summoning enabled units to summon when this would be favorable and they do not know that they can suicide their summons (they will only attack with them if they have somewhat of a chance of winning that combat). So even the summoning tree is currently a handicap.

Coincidentally, in my current version of the xml, Os-Gabella is one of the strongest AI players, even without summons. The way I test my changes is to run a small map with three or four AIs and let them play by themselves. Who wins one of those games doesn't matter--I just run them to look at their tech decisions--but most of them time, when she's in one of them, Os-Gabella wins.
 
I'd be interested in helping with the xml if you're still after minions. You'd need to give me some guidance on what the goals are and how to achieve them, though.
As far as summoned units go, the solution that comes to my mind to create a few new unit ais - that said, I don't know how difficult it is. Would it be possible to take an existing ai (a common one like melee, say) and change the odds at which the ai is happy to attack? In terms of when to summon, that sounds like a job for xanaqui's model of asking experts their techniques and finding a way to code them.
 
I'd surely like some help with the xml, but before I'll go about recruiting volunteers, I'll need to do two things:
1) (and I'll probably do this tonight or tomorrow) is to compile my own version of the DLL with plenty of debugging statements (I saw that betterai already has a tech debug logging system in place, and that'll make my job a lot easier). I need to figure out what kind of values actually do make sense, because evidently those ranges have changed from vanilla (where a value under 1000 made the AI just very slightly more likely to research a certain tech while a value over 10,000 practically forced the AI to research the tech as soon as it could; this time round I've had techs with values of over 20,000 sitting there unresearched for the longest time. I have some theories as to why this is)
2) I need to come up (with xanaqui's help) with a plan of things that we actually want to accomplish with the xml, short-term and long-term. I anticipate that these will be quite different things, and that the short-term goals will be very temporary (as in, emulate a certain kind of behavior until it's in the C++ code) and as such potentially frustrating (why go to all that trouble only to have your work removed in a few iterations anyway?). We'll need to come up with some sort of scheme that makes our short-term work as useful as possible for long-term goals (such as some sort of semantic tagging of techs to substitute/extend the AI's valuing of them: for instance, instead of looking at the units that IRON_WORKING grants and deciding based on that information that it's a pretty valuable tech for anyone going for the MELEE branch, the AI could look at IRON_WORKING's FLAVOR_MELEE tag and based on that come to the same conclusion. At this point I'm not at all sure if this sort of semantic tagging will help at all; in a perfect world, the AI should be able to gather all this from the game itself, which would lead to a much more dynamic system and save us from having to adjust flavor tags every time there's a major balancing change in FFH)

To give you some perspective, in the beginning I didn't really think I could accomplish anything but disabling the magic tree using the XML. I've made some progress toward minor goals at first (teaching Calabim to go for Feudalism, for instance, and Luchuirp to beeline Construction). Then I made those civs that lack a certain branch of the military tree (like the Khazad, who lack any archery units beyond the dwarven slinger) avoid those techs. Finally I realized that I could maybe emulate some of the things that we will eventually want to put into the xml, like encouraging the AI to concentrate on ONE military branch (since branching out in FfH is almost always handicapping yourself; for more details see http://civ4wiki.com/wiki/index.php/FfH_New_AI_XML). This is way suboptimal: the same leader will always prefer the same path (predictable equals weak) and he will not be able to react to a changing environment (enemy pumping axemen with shock? Maybe research Bowyers rather than Iron Working). So this last part I fully expect to remove again once we have that in the C++ code. However, I've become attached to the idea of giving more flavor to the leaders--the dwarves heavily preferring melee, the elves going archery or recon, and so on--and I believe that some of that will be used lateron when we have a logic in place that'll make the leaders choose one kind of military strategy early on. Also I think that the flavors on techs can be useful once we have a sort of leader-chooses-strategy-and-sticks-with-it logic in place since the capabilities of the AI to look at a tech and decide how useful it is for a certain strategy can be less than perfect. I imagine a hybrid system where the base value of a tech for a certain strategy comes out of the flavor attached to that tech, but on top of that the AI adds contextual information, like this: both Celerity and Precision are good last tier archery techs, but the enemy we're currently at war with is using low strength but dangerous units (assassins? mages, if the AI can ever use them?) protected by stronger units that aren't as dangerous, so we should go for Precision rather than celerity. (this is WAY off in the future, btw).

Uhm. Rambling too much. In short: yes, I'd love any kind of help with the xml, but we're not quite there yet. Don't wanna waste your time. If you'd like to help us plan stuff, you're more than welcome. I'll setup sth on the wiki soon.
 
A separate forum for such planing and ongoing work would be handy :>

Also a subversioning project would be helpful too. Others could look at the files as you go, post suggestions, propose changes. Those who have the permission could make the changes when they have time. :>
 
Well, the subversion has been up and running for about a week now, but we didn't want to make it public. Well:

http://sourceforge.net/projects/smarterorcs

Here it is. No guarantees for any kind of stability of any time, of course.

I think that wikis can easily be used like a forum as well, but if we really need a forum I can whip up a Simple Machines forum in less than five minutes.

We still haven't REALLY started planning. All that text up there? That was just me ranting. Planning includes some ORDER to those thoughts, and I haven't started ordering things yet ;)
 
Here it is. No guarantees for any kind of stability of any time, of course.
Actually, at the moment, I can do better than that. I can guarantee instability. The call to CvUnitAI::AI_update is crashing the program, likely because it's being called by an invalid unit. (i.e. the pointer is pointing to an invalid address). I don't know why the pointer is invalid, yet - that's what I'm presently researching.

Shortly after I think that we have a stable version, I'll re-release the .dll.
 
Just do a separate branch for stable releases so the interested will know what to look for and can be assured it will work.

Remember to tag it, then we only have to know the tag and can beta test it for you.
 
We could do that, or we could just release the dll and upload a zip of the sources used to make it, whatever xanaqui prefers.
 
Long time no see.
I seem to have tracked down my crash.. and to my complete surprise, it was not something related to the game itself, but to a mixture of having Windows Taskbar autohide on and maximising the window before having played a single turn. As i tend to play CivIV fullscreen, when not using your .dll i never thought of the taskbar/window combo being the source of the problem. Maybe it screwed something in the part of the code where the interface is initialized.

While i was now able to finish some games i took notice of some odd things:

Evil Civs are sorely underperforming atm.. I think it mainly has to do with the diplomatic choices, read Open Borders, so they suffer from a lack of trade. If possible evil civs should focus more on having open borders with at least other evil civs; preferable neutrals, too.

Additionally they do not grab land in any reasonable manner. While the good and neutral civs tend to expand quickly, some evil Civs (Sheaim & Calabim in 2 of my games) will not expand even if they sit on a chokepoint and have lots of unsettled land behind them, while the rest of the continent is so crowded, the first border wars are sparked. They DO have settlers in their capitals and a decent force of combat units ot protect them, but they simply do not expand. Expanding through any body of water (read as settling islands) is another point. The AI simply will not do it, even if the complete island is inside their empires influence border and rich in ressources they sorely lack.

Unit production choices are now pretty reasonable. Techs are still awful, but that was expected. What bothers me is their choice of city buildings. Even when suffering from unhappiness they will go for a Granary instead of some kind of happiness building. Same goes for health. Most of the time the AI cripples itself because it always goes for growth instead of focussing on money or production and avoiding growth, when the happy/health cap is reached.

But it was a vast improvement combatwise. Not only i encountered many more units compared to games without Better AI, but i encountered them in stacks, and sometimes even in good defensive positions (hills, forts).

A last note goes to Bringa, when weighting techs maybe it would be a good idea not only to focus on the "flavour" line of combat units but to priorize the hero unit at least for those civs, which can get it early on (Barnaxus, Gilden, Brambur, ..). Most of the time, they are just prey, when they start showing up. Disciple units may be another point that should be priorized more.

I'll try my next few games with your XMLs, but i won't get up my hopes too high. Blocking magic from the AIs research path may make them more focussed on their combat line, but the main problem with FfH2 still remains. Most units have a very distinctive role and the standart AI scripts simply are unable to handle them. That goes especially but not exclusively to magic units. AI cannot even promote mundane units reasonably (always going for combat 1-5 and then shock). Units with high withdrawal rates (horsemen, catapults) are underperforming as well (same problem as summons, i guess). Offensive / Defensive strength are taken into considerance while deciding if to attack or not, but not while producing units or building stacks. Spells like Scorch for tundra and Spring for desert are not used by the AI. Those really make a difference once the "green pastures" are settled or armageddon hits.

Last but not least there are still some kinks with Basium showing up. So in one of my game the Grigori and the Elohim had a pretty nice defensive alliance running for most of the game (with me being the only other non-evil Civ in that game). Then the Grigori called Basium, Basium declared war on the Sheaim, which were across the Elohim empire. Grigori joined, which canceled the defensive pact. Both Grigori and Basium moved units into the Elohim borders and a few turns later Basium/Grigori and Elohim were at war. While the 2 biggest empires were now at war for near 40 years, the evil civs laughed their ass off and rebuild. When the war was over, they simply crushed what remained of the 2 nations that had been dominant for near 400 turns. Good for me (as i most probably won because of that), but bad for the AI.
 
I was playing some more last night, and I wanted to know whether other people had had the same experience as me - my computer is quite old (4y) so perhaps I notice this more, but basically my between turn times are pushing 2min during the midgame. I think the set up was 5 civs, small great plains map, epic speed, and it took me around 2 hours to play 55 turns (~210 to ~260) despite not much going on (just a bit of skirmishing against the calabim who were picking on my co-religionists to the south). Regular FfH is slower than vanilla civ too, but I don't think by this much until much later in the game (~500). I'm not complaining, as I assume that better ai requires more calculations, but I was wondering if it was just me or not.

Secondly, I was wondering if you had planned to do a 0.22 version of the better AI - I know it's only just come out, but I'm curious. It would be understandable if you weren't going to bother until the next phase to re-merge the sdk.
 
I was playing some more last night, and I wanted to know whether other people had had the same experience as me - my computer is quite old (4y) so perhaps I notice this more, but basically my between turn times are pushing 2min during the midgame. I think the set up was 5 civs, small great plains map, epic speed, and it took me around 2 hours to play 55 turns (~210 to ~260) despite not much going on (just a bit of skirmishing against the calabim who were picking on my co-religionists to the south). Regular FfH is slower than vanilla civ too, but I don't think by this much until much later in the game (~500). I'm not complaining, as I assume that better ai requires more calculations, but I was wondering if it was just me or not.

Secondly, I was wondering if you had planned to do a 0.22 version of the better AI - I know it's only just come out, but I'm curious. It would be understandable if you weren't going to bother until the next phase to re-merge the sdk.
The answers are:
1) Yes, I'm interested in improving the game speed. Vanilla is inefficient enough that I wouldn't be surprised if it's quite possible to improve the speed beyond Vanilla. However, unless I get feedback that the game speed is making it unplayable, it isn't going to be a high priority.
2) Yes, I'm interested in doing a 0.22 version. I first want to get something (anything) relatively stable, then I'll look at moving to the latest sources. Note also both that this isn't my only project (I do a lot of the wiki work), and sources tend to trail the releases by a bit, so even if I make a stable 0.21 tomorrow, it will likely be weeks until a 0.22 version.
 
xanaqui42 any news ?
I'm waiting eagerly a stable .22 version as I don't see the point of playing against dumb AI
 
Back
Top Bottom