• New Horizons on Maelstrom
    Maelstrom New Horizons


    Visit our website www.piratehorizons.com to quickly find download links for the newest versions of our New Horizons mods Beyond New Horizons and Maelstrom New Horizons!

AI Agressiveness

Doober

Buccaneer
Storm Modder
Does anyone have any idea on what causes AI ships to flee rather than attack during battle? I end up chasing alot of ships down and they won't engage me in battle, even if they are stronger ships.
 
this answer seems to be a bit late, but i think it's all based on the odds. i mean, each ship [IIRC] compares itself to you. how many crew, how many guns, speed, manouverability...etc. they don't count the fact that they may have other ships with them, in a fleet, and simply scatter.....
 
I was just in that code recently. Actually, they do consider if they have friendly ships around. Morale seems to play a big part in whether they decide to flee or not.

Hook
 
ahh....it seems i am behind the times as well as lost.....another bad mark to my name! <img src="style_emoticons/<#EMO_DIR#>/jackhat.gif" style="vertical-align:middle" emoid=":j2" border="0" alt="jackhat.gif" /> lol...
must be the fact i haven't played in a while...
 
I just went through the code. It doesn't seem to care about friendly ships around except under one special circumstance having to do with being around 5% HP, if I undertsand the code correctly. But at that level they're already sinking, really.

A ship will attempt to run away once the morale gets to a low level. Merchants are twice as likely to run as warships, and pirates are less likely to run than warships by 25%.

There used to be a line of code that would keep a ship from surrendering if any friendly ship was closer than any enemy ships. But it's been commented out for some reason.

Hope this helps.

Hook
 
so...im not as lost as i think? <img src="style_emoticons/<#EMO_DIR#>/jackhat.gif" style="vertical-align:middle" emoid=":j2" border="0" alt="jackhat.gif" />
 
<!--quoteo(post=163468:date=Sep 24 2006, 09:17 PM:name=Hook)--><div class='quotetop'>QUOTE(Hook @ Sep 24 2006, 09:17 PM) [snapback]163468[/snapback]</div><div class='quotemain'><!--quotec-->
There used to be a line of code that would keep a ship from surrendering if any friendly ship was closer than any enemy ships. But it's been commented out for some reason.
<!--QuoteEnd--></div><!--QuoteEEnd-->
Could we re-enable that line? What would happen if we did that?
 
I'd like to reenable it, actually. The main effect would be to have fewer surrenders. But I have the global surrender scale at 0.05 in my system now, and it's working nicely. As far as I know, it wouldn't break anything else.

Hook
 
I'd be interested to see this re-enabled, and see how it effects surrenders. Hopefully a good balance will be achieved. <img src="style_emoticons/<#EMO_DIR#>/keith.gif" style="vertical-align:middle" emoid=":keith" border="0" alt="keith.gif" /> <img src="style_emoticons/<#EMO_DIR#>/poet.gif" style="vertical-align:middle" emoid=":hmm" border="0" alt="poet.gif" />
 
Here's the line line in AIShip.c, somewhere around line number 700 to 800:

//if(HPr > 20 && fdist <= enemydistance) return; // if friend closer than enemy, no surrender.

Just take out the "//" at the beginning of the line to uncomment it. It doesn't seem like it would hurt anything.

Hook
 
I'll have that line re-enabled in the next modpack version. See if it works. <img src="style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />
 
Maybe I would try it too for curiosity. <img src="style_emoticons/<#EMO_DIR#>/mybad.gif" style="vertical-align:middle" emoid=":facepalm" border="0" alt="mybad.gif" />
 
Thanks for checking that out, Hook.

You mentioned that a ship will attempt to run away once the morale gets to a low level. Merchants are twice as likely to run as warships, and pirates are less likely to run than warships by 25%.

(Sorry, I haven't figured out how to quote yet)

Do you know where in the code this is? Just for myself, I would rather engage in cannon dueling as opposed to chasing down fleeing ships.
 
You might get a good effect by changing the values of the following variables in InternalSettings.h:

SURR_MAX_MORALE (default 40, ship will not surrender if morale is above this)
SURR_MRL_SCL_MAX (defalut 1.0)
SURR_MRL_SCL_MIN (default 0.2)

SURR_MAX_MORALE is used to determine if a ship will run away as well. If you set it lower you'll have fewer surrenders and fewer ships fleeing. Perhaps 20 or 15 would work, experiment.

Hook
 
Back
Top