1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Fix for the Barbarians... sort of

Discussion in 'Civ3 - General Discussions' started by watorrey, Sep 25, 2004.

  1. watorrey

    watorrey Deity

    Joined:
    Dec 22, 2001
    Messages:
    2,007
    Gender:
    Male
    Location:
    Rochester, NY, USA
    I know what you mean about the ships but i'm not gonna recommend anyone use that flag anymore. There are several animation preferences and hitting the caps lock twice is alot simpler than holding down the shift key. In the end, it's all up to you. You could always toggle the flag later in a game when it doesn't make much difference.
     
  2. Justus II

    Justus II General Staff

    Joined:
    Dec 14, 2001
    Messages:
    1,572
    Location:
    Peoria, IL, USA
    I posted earlier today some of my results from testing the effect of the NoAIPatrol flag (or lack thereof) on barb movements. After more testing, I've determined that my earlier tests, posted HERE, were done with Patrol turned off! Apparently (and suprisingly), not having the NoAIPatrol flag set at all (the default) means that AI Patrolling is turned off. Using the NoAIPatrol=1 is the same as not having the line in at all, and the barbs WILL behave as described in that post.

    However, if the NoAIPatrol=0, it DOES affect barb movement directly, and causes them to move (somewhat) randomly. I’ve now done some more extensive testing, and can say with confidence that using NoAIPatrol=0 definitely causes the barbs to move, regardless of the presence of any AI or human units. Their movement seems to fit within the following parameters:

    1. Anything along the NW/SE axis that ‘triggers’ a reaction, will override the random moves.
    2. If they are the only unit on a barb camp, they will not move (at least one stays to defend the camp). Note that if another barb moves onto the camp, the first unit will then be free to move (and often does).
    3. If no AI are in range to trigger a reaction, the moves appear to be random, although they will generally prefer better defensive terrain.
    4. Barb units with a move of 1 (warriors in the standard game), seem to move and fortify on alternate turns. Those with a move of 2 (horsemen, and galleys), generally move every turn.

    Note that the NW/SE axis is still significant for triggering long-range reactions, but that the random movement means there is a better chance for them to place themselves on such an axis from your cities/units. Also, they WILL attack off the axis if you are adjacent (or within 2 for units that can move 2), which does not usually happen with Patrol set to off.

    If anyone is interested in testing, run some games in Debug with raging barbs, where you can see the barb reactions. Try starts with multiple AI starts, so some are near barbs, and a few with only 1-2 AI so you can see the reaction of barbs with no AI nearby. There will be a difference depending on the NoAIPatrol flag setting.

    So, in fact, the NoAIPatrol=0 DOES bring back some unpredictability to the barbs, and makes them more dangerous. Not as good as prior barb AI where they would target towns and workers from a distance, but at least they are more menacing with this flag set on. ;)
     
  3. SirPleb

    SirPleb Shaken, not stirred.

    Joined:
    Jan 1, 2002
    Messages:
    1,415
    Location:
    Nanaimo BC Canada
    Interesting, what a discovery! Nice work :goodjob:

    This sounds like there are two separate bugs causing the poor barbarian behaviour - the NW/SE axis bug, and the default patrol setting being backward.

    I guess the next question is whether NoAIPatrol=1 is backwards for AI units. Have you noticed the affect of the flag on AI Civs' patrolling? If the default is backward only for barbarians then we could all start adding NoAIPatrol=0 to our .ini files to get better barbarian behaviour without hurting anything else :)
     
  4. watorrey

    watorrey Deity

    Joined:
    Dec 22, 2001
    Messages:
    2,007
    Gender:
    Male
    Location:
    Rochester, NY, USA
    Justus II:
    Excellent work :)
    First post edited with summary of results.

    Sir Pleb: Someone would have to play a debug game to just before RR's so that the AI is well developed with lots of units then change the flag and repeat turns. Unless someone knows how to turn on debug mode in an existing game ;)
     
  5. Justus II

    Justus II General Staff

    Joined:
    Dec 14, 2001
    Messages:
    1,572
    Location:
    Peoria, IL, USA
    That is a good question, but no, I haven't tested that yet. Most of my tests thus far have been on early games with lots of barbs, but few AI units, to keep the 'trigger' events down to a manageable number. ;) To test AI patrolling, you would need some games with plenty of 'spare' AI units available, who do NOT have barbs to hunt (because I think the AI's need to exterminate barbs overrides just about any other reasonable orders!!), to determine if they fortify them or send them on random patrols. So the opposite situation of what I've been working with.
     
  6. SirPleb

    SirPleb Shaken, not stirred.

    Joined:
    Jan 1, 2002
    Messages:
    1,415
    Location:
    Nanaimo BC Canada
    There's a good chance that the flag is defaulting backward and that overriding with a zero setting will improve the behaviour of AI units a bit as well as barbarians. And if it doesn't improve it, there's a good chance it at least won't hurt :) It is a bit awkward to test because the AI may need to be done exploring before patrolling kicks in, I'm not sure.
     
  7. ainwood

    ainwood Consultant. Administrator

    Joined:
    Oct 5, 2001
    Messages:
    30,083
    I like a challenge. ;)

    The other thing of interest is whether the ini setting can be over-ridden by changing a rule in the game - that would be useful!
     
  8. Justus II

    Justus II General Staff

    Joined:
    Dec 14, 2001
    Messages:
    1,572
    Location:
    Peoria, IL, USA
    I've done some more testing to see if the flag affects the AI's behavior as well, and it does. (Thanks to Ainwood for providing a sufficiently advanced save, with Debug. :) ) With NoAIPatrol=1 (the default), barb galleys remain parked on the coast, and the peaceful AIs had no random movement, just units parked, most in cities, some apparently looking like they were still fortified from their last war! (A stack of Crusaders outside a formerly captured city, for example).

    However, with NoAIPatrol=0, AI cavalries leave the cities to run yon and hither (or however that goes), fortified units on borders wake up and go in various directions, and the barb galleys swim in circles. Of course, that does have the undesired effect of making the peaceful AI's turns take twice as long, but if it weren't in debug, the delay would not be as noticable. Actually, after watching a few runs, I think the AI still spends more time shuffling workers around than units, so the AI Patrol might not have as much an effect on speed, unless you were playing Diety/Sid where they have TONS of excess units not needed for garrisons, etc.

    One other thing from my testing, is that it appears the .INI is read in when loading the .EXE file, not each time a save is loaded. I changed the flag in the .INI while alt-tabbing, keeping Civ running, then reloaded the save, and the flag change did not take effect. I had to actually exit Civ, and then start it back up, for the change to take effect.

    I haven't tried it with PTW yet, I don't have any appropriate PTW saves, but I will try a few debug games and see what I can find out.
    EDIT: Well, I won't be able to do any PTW testing this morning, I can't seem to figure out how to create a PTW Debug game. Was there a seperate editor with PTW? If so, I'll have to reinstall. As it is, the C3C editor won't save as a .BIX, and the vanilla editor doesn't have a Debug setting, so I can't see how to get a debug file to test. If anyone has any suggestions, or can create a debug file, let me know. My idea was to create a tiny archipelgo map, with Diety AIs, so they'd have lots of units and nowhere to go ;), so we could quickly see if they patrol or park them.
     
  9. ainwood

    ainwood Consultant. Administrator

    Joined:
    Oct 5, 2001
    Messages:
    30,083
    I have a debug PTW save as well - but I can't get it to you for about 12 hours. If you have one that you'd like me to covert to debug, e-mail it to me at gotm@civfanatics.net and I'll try to remember how to do it....

    It is a shame that the setting is loaded with the .exe - it tends to imply that the setting is not in the save, and it looks like your testing confirmed that. It would have been nice if it was in the (for example) section of the save that has the governer settings. That way, we could turn it on for barbs and off for everyone else. :(
     
  10. Justus II

    Justus II General Staff

    Joined:
    Dec 14, 2001
    Messages:
    1,572
    Location:
    Peoria, IL, USA
    OK, I've sent an older PTW savegame, if you can set the Debug for it, that would be great, I will then try to test the flag settings for PTW. I don't know about vanilla Civ, I don't think I have any saves still hanging around for that. Did vanilla Civ even have a Debug mode? The standard civ3 editor doesn't have that setting under scenario properties.
     
  11. Justus II

    Justus II General Staff

    Joined:
    Dec 14, 2001
    Messages:
    1,572
    Location:
    Peoria, IL, USA
    Thanks again to Ainwood for sending me a DEBUG version of my save. (Thanks also to AlanH for his links in the GOTM Reference thread, I didn't realize I'd have to reinstall all the GOTM packs from 21, 24, and 25! Been too long ;) ). I can verify that the NoAIPatrol flag has the same effect in PTW as it does in C3C.

    With the NoAIPatrol=0, both the barbs, and the AI's excess units, will conduct random patrolling, moving around the map when not on their way to a specific destination.

    With the NoAIPatrol=1, both the barbs and the AI will fortify their units in place if they don't have a specific target.

    The difference is, if there is no line in the .INI file, PTW defaults to =0, random patrolling is on. C3C, on the other hand, for some reason defauts to =1, random patrolling turned off. Not sure why they would change the default setting, but this seems to be the main cause of the lazy barbs.

    It took a little more effort, but I also tested PTW barbs, with the NoAIPatrol setting on, in a more normal setting. (I created a new game with raging barbs, and using the Mongols, for the scouts). Even at raging, it took a while (2800BC) until I had a barb camp pop up (should have chosen Aztec, still get 2 move and not expansionist, so I’d get some barbs from huts! Still have much to learn in playtesting ;) ). Anyway, the interesting thing is that with the NoAIPatrol flag set =1, the PTW barbs behave EXACTLY like the C3C lazy barbs. They fortify in place, and will only move when a unit triggers a response by ending along the NW/SE axis, or if a defenseless unit (scout) ends adjacent to them. Once triggered, they will move a step toward the triggering unit, choosing the best terrain, and if that takes them off-axis, they fortify again!

    So, based on this, it appears the NoAIPatrol flag IS the culprit behind the lazy C3C barbs. They can be just as lazy in PTW, IF the flag is set. :crazyeye: Conversely, by setting the flag=0 in C3C, you get the barbs to execute random patrolling and restore the unpredictability of PTW barbs! :)
     
  12. watorrey

    watorrey Deity

    Joined:
    Dec 22, 2001
    Messages:
    2,007
    Gender:
    Male
    Location:
    Rochester, NY, USA
    Guess we know what the problem is now!! Good work Justus II :goodjob:

    First post edited to reflect new information.

    So if anyone wants better barbarians in C3C. Add NoAIPatrol=0 to the conquests.ini file. This will increase turn time if it is something you tend to suffer from but can be changed later in the game after barbarians are no longer a major factor.
     
  13. Doc Tsiolkovski

    Doc Tsiolkovski Deity

    Joined:
    May 4, 2003
    Messages:
    5,032
    Location:
    Köln, Cologne, Colonia. Finally.
    Excellent work! Thanks a lot, for the time you spent testing.

    :thanx:
     
  14. Arathorn

    Arathorn Catan player

    Joined:
    Jan 10, 2002
    Messages:
    3,778
    Location:
    Illinois
    Agreed! Excellent work. Thanks for taking the time/effort to test all this out. Barbs can now be restored to their proper role in life...being annoying!

    Arathorn
     
  15. punkbass2000

    punkbass2000 Des An artiste

    Joined:
    Apr 16, 2002
    Messages:
    7,230
    Location:
    A(sia) Minor
    Perhaps the default was changed in order to help people with long wait times, and the bug was inadvertantly created.
     
  16. SirPleb

    SirPleb Shaken, not stirred.

    Joined:
    Jan 1, 2002
    Messages:
    1,415
    Location:
    Nanaimo BC Canada
    Great job! Thanks watorrey, and special thanks Justus II :goodjob:

    So it seems that there are two separate bugs and that the killer for C3C was the nonzero default for NoAIPatrol. The other bug (NW/SE axis) has been around for some time, was in the final PTW. I am curious what would happen if that were also fixed - would that make for super nasty barbarians or would they become too easy to lead around by the nose? It seems unlikely we'll ever find out about that part. Oh well, you've nailed the big part!
     
  17. SirPleb

    SirPleb Shaken, not stirred.

    Joined:
    Jan 1, 2002
    Messages:
    1,415
    Location:
    Nanaimo BC Canada
    More thoughts:

    Remember the original Civ3 barbarians? They were very predictable. They'd all head for the same thing like they were on rails. You could lead them around, taking a whole pack from an uprising to a rival's lands.

    At some point (I think it was one of the late PTW patches) their behaviour improved, they became less predictable. I remember reading something about Soren saying he didn't know why, perhaps a quote from a chat? Anyway, I think we know why now - the NW/SE bug was introduced. Barbarians remained predictable but only on that axis. If there's nothing on it for them to chase they'll wander. (And before anyone suggests it, no, I would not believe that this was a deliberate way of making them smarter! There were better ways to do that which would be less predictable. I feel sure that the NW/SE behaviour is a bug.)

    There might of course have been other changes which affected barbarian behaviour. But the two big ones seem to be the NW/SE axis change and the changed default for NoAIPatrol.

    Barbarian behaviour as we now understand it in the final PTW patch and in C3C is roughly as follows:
    List below edited to add points from watorrey and Justus II further down this thread.
    1. If a barbarian is the last one in a camp he stays there to protect it.
    2. If there's a defenceless unit or unprotected city within immediate reach of the barbarian that's where it goes.
    3. If there's a unit on the NW/SE axis of the barbarian, within a fairly large distance, it will move toward that unit. But it won't necessarily move directly, it may go off the axis on its way to that target. If one move toward the target has better defensive terrain than another it will choose that move. It can even move away from the unit if necessary to reach it by land, e.g. travelling around a lake.
    4. If NoAIPatrol is set to zero (the default in PTW, requires explicit setting in C3C) the barbarian will wander at random.
    5. The above rules are applied from scratch each turn. Barbarians don't remember what they were previously doing and continue doing it.
    6. There are a number of other factors which would need to be studied to determine exactly where they fit in the decision process. Sometimes barbarians will pillage, fortify to heal, and go for colonies.

    With what we know now barbarians will be a bit manipulable even with the NoAIPatrol=0 setting. Have you noticed how exploring units can sometimes get away from barbarians? In the earliest Civ3 I don't think they could. If I had a unit caught beyond a barbarian on a peninsula, I think he was doomed. Nowadays (and I think since the later PTW patches) I can sometimes evade the barbarian. I think the rules now are:
    a. If you want to lead barbarians mindlessly somewhere you must stay on their NW/SE axis while leading.
    b. If you want to avoid confronting a barbarian, leave his NW/SE axis. He'll move at random (relative to that unit - he may move deliberately toward something else.) If he follows or attacks it is just by chance - continue moving off his NW/SE axis and eventually he'll wander off somewhere else.

    MP players should probably not set NoAIPatrol=0. Certainly not without some testing. I suspect that the changed default for this flag helped MP play noticeably. With barbarians and AI units not making random moves there would be a considerable reduction in inter-machine messages and synchronization. The change to this default setting might even have fixed some MP problems as a side effect. Furthermore, if MP players change this default in their .ini files they may find that all players in a game must have the same setting to avoid crashes or bizarre results.
     
  18. watorrey

    watorrey Deity

    Joined:
    Dec 22, 2001
    Messages:
    2,007
    Gender:
    Male
    Location:
    Rochester, NY, USA
    Yes, I'm fairly certain it was in a chat transcript that i read that also.

    One barbarian does always stay behind to 'protect' the camp. If a second barb ends its turn on a camp and the first hasn't moved yet, the first will move off the camp. Wounded barbs will leave your territory to heal. If in neutral territory, they fortify where they are.

    c) When going someplace intentionally and having the choice of 2 or more tiles of differing terrain defensive bonus, they will always choose the higher defensive terrain. (This is actually true for all AI civs but deserves mentioning for the barbarians)

    Good catch on this one :goodjob:
    PBEM players could just agree on a setting to use. The others MP types will need testing by the players that use it.
     
  19. Justus II

    Justus II General Staff

    Joined:
    Dec 14, 2001
    Messages:
    1,572
    Location:
    Peoria, IL, USA
    Thanks for the compliment, and for adding some more insight. :) I have a couple more things to add, based on your thoughts.

    I agree, the nature of the NW/SE direction leads me to believe it's a simple mistake in a formula. Each tile along that axis will have a coordinate that is an equal number of vertical and horizontal tiles from all the others. (i.e. If the barb is at tile 33,27 the next tile to the direct SE is 34,28, then 35,29, etc.). So I'd guess that somewhere, when it looks for activity it goes through some iterations, probably starting at range one and working out (so it will find the closest 'trigger' first). In that process, which I would assume involve looking at all tiles within an absolute difference in the coordinates, it's somehow requiring the difference to be equal. So instead of saying, I'm at 33,27, is there anyone within +/- 2 of 33 OR +/-2 of 27, its saying is there anyone within +/-2 of 33 AND +/-2 of 27. Not sure if I'm explaining what I mean correctly (I'm not a programmer, but I played one in college ;) ), but hopefully you understand what I mean.


    It may even go in a perpendicular direction, if it determines that the closest path to actually reach the target (due to water/impassable terrain) requires it. BUT:

    so that doesn’t do it much good. ;)

    I have seen barbarians drawn to an empty colony, even off axis, but it wasn’t in a DEBUG game, so I’m not sure exactly what range they came from. The point about defending the camp was interesting in practice. The rule appears to require one barb to be in the camp at all times. This overrides the others, I parked a scout adjacent to a camp, and the barb never flinched. HOWEVER, it doesn’t have to be the same barb! I have seen a barb, reacting to movement, move onto a guarded camp. The previous guard, now seeing that the camp was ‘defended’, then moved out (along the same axis) that same turn. (I would assume that it depends on the internal move order, as to which unit was ‘selected’ first, whether that would happen).

    The whole subject of MP games is a tricky one. My first thought was that it would provide players an exploit, if for example one player had patrol on, and one not, they would be facing tougher barbs than their opponent. That’s one of the reasons I was hesitant to publish too much about my findings at first, until I had a chance to PM a couple of Moderators. However, I’m not sure how it would affect MP games. I’ve never really played online (I tried a LAN game once with my 10-year old son, but his attention span wasn’t up to it!), so I don’t know how it handles barbarian movement, but I would think the flag setting of whichever computer is the ‘host’, or processes the movement orders, would take precedence, but I really don’t know. With PBEM games, it appears all ‘end of turn’ processing is done at the end of the last human player’s turn in rotation, prior to creating the save. So I would be more confident it would only be the flag setting of that player that would be in effect, and so everyone would at least be playing under the same set of rules. But I agree, without a lot more testing (not by me ;) ), I wouldn’t recommend MP games mess with the flags.

    Edit: Watorrey replied while I was still working on my response, so sorry that some of this is redundant. Thanks again to Watorrey, he helped point me in the direction to do the testing! :)
     
  20. watorrey

    watorrey Deity

    Joined:
    Dec 22, 2001
    Messages:
    2,007
    Gender:
    Male
    Location:
    Rochester, NY, USA
    I'd like to add that the AI civs KNOW that a single barb won't move off a camp. They will send undefended settlers adjacent to camps if it is defended by only one barbarian.

    That 'how it calculates what to do' section is only usefull if somebody is going to fix it. As it stands, it doesn't look like C3C will ever get any more fixes so we need to find these things and develop workarounds.
     

Share This Page