• 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 Sailing into the wind

When you're talking about VERY quickly turning ships, are you considering that in Realistic Game Mode,
big ships CAN turn very quickly BUT it takes a lot of time for them to start turning AND for them to stop turning.
But once they're turning, they could theoretically out-turn smaller ships.
 
I'm now sailing the Dolphin Xebec (xebecAS)instead of a fluyt in order to see how a more maneuverable ship compares to the AI. I'm still getting out turned. First it was an English bark, then a light frigate, but the killer was when an English Galleon with its two main masts down evaded my attempts to board it. It ended up getting sunk.

Are you getting 'out turned' while the AI is tacking or at other times? The best way to check for this is - does the AI have its sails furled and is crossing the wind? Their sails will appear to 'flicker' as they try to put them up but my script forces them not to. If you are getting out turned at any other point when the AI has its sails up, it is almost certainly not due to this script.

I say 'almost certainly' because just like storms there is a possibility that ships may 'bug out' and do a crazy spin (like in storms), although i havent seen that in my game with the version i released. If thats happening often to you, its a bug

They seem to generally be avoiding cliffs better now. In one battle early on when I was in a class 5 pinnace with a caravel escort we got into it with a light frigate in a cove with the wind coming in the throat. Several times we were up against the cliff with sails furled turning. Once the caravel came barreling in at full sail and rammed the frigate. :shock That is rare but I have seen it before. Fred Bob once sunk a frigate with a fluyt doing that many months ago. :onya

That is interesting because all I really do is force the AI to furl sails when facing the wind, nothing else. In the version im working on I also force their sails UP, and I expect THAT to create problems, but if you are seeing fewer collisions in the versions i released thats good to hear, but its really just incidental

At Guadaloupe they had trouble getting out of port one time out of three so far. They ended up just going around in circles and I had to go to the world map to get them out. They will sometimes spin in other ports as well.

I will try Guadeloupe to see how ships tack there but ports are a tough thing for the AI to get out of at the best of times, let alone tacking! Im a bit concerned that you say they were 'spinning' however. There is a subtle difference between the AI 'sailing in circles' and 'spinning' and the latter can be caused by 'bugging out' when trying to rotate a ship through a script. Was the AI spinning on the spot with its sails down (or even with its sails up), ie no real 'turning circle' or was the AI sailing in a circle with sails up except when facing the wind and with a good diameter to its turning circle?

Ive not had time to play but a few times I did see the AI tack in a port then come up against a cliff and have to turn around in a wide circle and try again. They ussually get out .. eventually. Alas wed need proper AI to make ships know the 'right way' to tack out of a port.

EDIT: You know, the best thing to do might be to post a screenshot or two of the issue. Picture is worth a thousand words!
 
The AI are very good at positioning themselves for a tacking duel. That is where I lose. On a downwind run I can hang in there with them. But upwind they can pivot so fast that by the time I get turned around they might be out of gun range.


They are much better at getting away from cliffs now. I have always had trouble with them plowing into the cliffs at Philipsburg. In fact there have been times when I swapped ships and sailed them into clear water myself rather than watch them sink themselves. Today both ship went into the cliffs, turned, and then sailed away on their own. :onya


They don't spin, but sail in circles. Bad choice of words on my part.
 
NEW VERSIONS - SIMPLE VERSION AND EXPERIMENTAL VERSION

After much delay here are two versions for people to try. Rename to Aiship.c and paste into Program/Sea_Ai as usual.

Both versions result in much improved headway that the AI can make against the wind and both in my opinion may result in more risk of collisions, but differ very significantly otherwise.


The simple version uses the same method i have already released almost to the letter and applies equally to all ships (no matter their sail skill or any other attribute), with two changes:
1) The rotation force exerted upon ships has been reduced from 0.0015 to 0.0010 in response to miklkit's observations.
2) When sailing close to the wind the script forces the AI to raise its sails to 100%, because the AI normally tends to reduce sail to 50% once it is forced significantly off course. The AI is still able to reduce sail when it meets obstacles but not as well as might otherwise and this change produces the gains in effectiveness and the increased risk of collisions of this version.

Nonetheless, my own personal opinion is that this simple version is the best mix between simplicity, effectiveness and increased risk of collisions and should have very little impact on framerates. I would recommend it to those who just want ships that tack reliably upwind.


The experimental version uses three seperate methods modified for ten seperate levels of effectiveness - one for each point of Sailing skill from 1-10. This includes variations of the method above and two additional methods that force the AI to sail on one side of the wind for longer. Each skill level in Sailing has its own tacking formula and ships increase greatly in tacking proficiency from 0-5 (5 being equivalent to the simple version above) and somewhat from 6-10.

There are some benefits to the higher levels in tacking, and the way the ships stay on one side of the wind may seem more correct, but the ships generally do not improve all that much on the simple method above. The code is, however, FAR longer and more complex, and could have a number of drawbacks, although I hope these have been solved;
1) Regular pauses every second or so for a fraction of a second or other performance effects - I had this issue before, but believe I have improved it by rewriting some of the code. Nonetheless, this code is at least 15 times longer than the simple version - it has far more potential for an impact on framerates than the simple version.
2) High rotation forces (when crossing the wind these range from 0.006-0.0016 similar to the simple version, but go as high as 0.0055 when trying to keep AI from entering the wind) needed to keep the AI out of the wind can introduce immersion jarring, but temporary 'spins' on AI ships when the wind changes.
3) With sailing skills 6-10, the improved methods come with higher risks of the AI doing something dumb like crashing into things or not taking logical paths.
4) Sail skills 1-3 are very poor tackers (but improve very rapidly between 1 and 3), but that is intended :)
5) Other bugs i am not aware of.

This version represents all of my latest progress but frankly, i feel it may simply have been wasted given how well the simple version works (and how much simpler it is) just by forcing sails up. It produces some gains, but in my opinion not enough to warrant the hugely more complex code. It is put here for the benefit of the adventurous and for others to judge which version is best.


Ultimately I think the original, simple method just plain works most reliably and yet gives something like 80% of the tacking performance. Im interested to hear what you all think. I should note though that I could use any method from the experimental version and apply it universally, which would make the code much shorter and simpler (maybe 3-4x longer than the simple version for the most advanced method) if people feel that any particular method works best.

Cheers!
 

Attachments

  • Simple Version AIShip.c
    195.5 KB · Views: 144
  • Experimental AIShip.c
    229.7 KB · Views: 163
Good timing! :onya I just happened to be in Guadaloupe again. Installed the Simple version. There was a wind coming right down the throat of the bay. I had to tack to get out in my XebecAS. The other 2 ships, the Wicked Wench and a Trade Brig, sailed to one side of the harbor and then tacked smoothly out. :2up Once out of the harbor we encountered a battle between two French ships and four Pirate ships. That turned into a nice free for all with all ships behaving very well. Impressive. :))

Now would be a good time to say I probably play this game differently than you. I'm on Swashbuckler level and only use the compass, clock, and doctors tool kit. No lucky charms or other enhancements. I find the game to be completely different and much more enjoyable, but advancement and making money is much harder. In order to test the Experimental version I will have to start a new game in another install and use all of the lucky charms to get my stats high enough to test it properly. It may take a while. :whipa

So far, so good.
 
Good timing! :onya I just happened to be in Guadaloupe again. Installed the Simple version. There was a wind coming right down the throat of the bay. I had to tack to get out in my XebecAS. The other 2 ships, the Wicked Wench and a Trade Brig, sailed to one side of the harbor and then tacked smoothly out. :2up Once out of the harbor we encountered a battle between two French ships and four Pirate ships. That turned into a nice free for all with all ships behaving very well. Impressive. :))

Now would be a good time to say I probably play this game differently than you. I'm on Swashbuckler level and only use the compass, clock, and doctors tool kit. No lucky charms or other enhancements. I find the game to be completely different and much more enjoyable, but advancement and making money is much harder. In order to test the Experimental version I will have to start a new game in another install and use all of the lucky charms to get my stats high enough to test it properly. It may take a while. :whipa

So far, so good.

I should clarify that the experimental version's tacking is based on the Sailing skill of the AI ship itself (ie, THEIR captain), not the players! That wouldnt make much sense :p

The idea is that if you want to make someone captain, you should assign someone or assign them officers to make sure their sail skill is at least 3 or so. If you encounter other AI ships, the quality of the captain and their sailing skill should also be reflected in their skill in tacking.

The player is not taken into account at all in this script


Having said that, id say the simple version is the better of the two anyway, just for its sheer simplicity :)
 
I have not installed it yet. I've just been playing the simple version. :eek:ops2 Real life has reared its ugly head and I will be gone for a few days. I will install and play it next week. :facepalm


Belay that. I got a reprieve and will leave tomorrow, so installed the experimental aiship file and started a new game.

First off I have noticed no stuttering. It is smooth and fps is normal. I left Speightstown in the stock Lugger and followed the French fleet north where they engaged two pirate xebecs, sinking one. Six ships total and still smooth. The french ships pivoted into the wind and tacked around back with the wind smoothly. The only odd thing was that they stayed at battle sails all the way around with the big 3rd rate moving backwards. I was at skill level 1 and I presume all other ships were also. My Lugger seemed to turn just fine for that part of the game. IE, very slowly because of my low skills.
 
A quick update.

I have three ships now, a class 6 light fluyt, a jackass bark, and an English bark. I haven't really noticed any difference in sailing qualities yet, but one of the officers is having trouble. His skill is Leadership-5 and sailing-1. He gets caught by the wind and just starts sailing in circles. He improved to S-2, but still goes in circles. I switched him to the jackass bark and he started doing better and was even able to enter a harbor safely. The other officer is a L-2, S-5 and he is keeping the other guy alive. I have observed other ships behaving oddly too. Right now I'm a firm believer in the KISS Principle. Keep It Simple Stupid. :cheeky
 
A quick update.

I have three ships now, a class 6 light fluyt, a jackass bark, and an English bark. I haven't really noticed any difference in sailing qualities yet, but one of the officers is having trouble. His skill is Leadership-5 and sailing-1. He gets caught by the wind and just starts sailing in circles. He improved to S-2, but still goes in circles. I switched him to the jackass bark and he started doing better and was even able to enter a harbor safely. The other officer is a L-2, S-5 and he is keeping the other guy alive. I have observed other ships behaving oddly too. Right now I'm a firm believer in the KISS Principle. Keep It Simple Stupid. :cheeky

Well, to be fair, its entirely intended that captains with sail skill of 1 or 2 are really no good at sailing :) Having said that, does it add to gameplay, especially when these same captains are mysteriously fine when it comes to complex maneuvers and combat outside the wind?

Id have to agree that this just may not be so. It just might not be all that good an idea to make ships tack better with sail skill. The simple version probably is the better of the two

I should add, however, that I could just take the most powerful tacking version out the experimental version (when sail skill equals 10) and apply that to all ships, and see if that produces better overall results than the simple version.
 
I am still traveling and have not been here or played PotC since my last post, so I am relying on my alleged memory. :eek:ops

The officer with low sailing skills can only sail with the wind. If he attempts a tack he just goes in circles and with every circle he goes farther downwind until he is off the map. :8q Getting him to follow me in or out of a harbor without wrecking his ship is a major achievement. :j3 In other words, he is useless. When I get home next week I intend to keep him in the jackass bark until he becomes competent. That ship can sail far enough into the wind that he doesn't go backwards so much. In a square sail ship he is hopeless. :rumgone
 
ADVANCED VERSION - More advanced method that aims to keep ships out of the wind for 2.2 times how long it took them to last cross the wind. Most likely will introduce some issues with collisions until i figure out how to find out when the ship is about to hit something.

I am still traveling and have not been here or played PotC since my last post, so I am relying on my alleged memory. :eek:ops

The officer with low sailing skills can only sail with the wind. If he attempts a tack he just goes in circles and with every circle he goes farther downwind until he is off the map. :8q Getting him to follow me in or out of a harbor without wrecking his ship is a major achievement. :j3 In other words, he is useless. When I get home next week I intend to keep him in the jackass bark until he becomes competent. That ship can sail far enough into the wind that he doesn't go backwards so much. In a square sail ship he is hopeless. :rumgone

I think i may have overdone the 'poor' tacking in that case on the experimental version. Perhaps it is better to have all ships tack equally rather than introduce distinctions. Ive taken the best method out of that experimental method and made an 'advanced' version where it applies to all ships equally.
 

Attachments

  • Advanced AIShip.c
    201.4 KB · Views: 133
Ok, I will play this advanced version soon. Right now I'm curious as to when that one officer will become competent and will continue playing that version.


8 hours later: The experimental version is just too buggy. It got deep sixed and I will try the advanced version next.


AARRGGHH!! Heavy stuttering! Not playable and never made it out of the harbor.
 
It got quiet here. :? I've been playing the simple version for a while now and am comfortable with it. The ship to ship collision detection isn't the greatest, but the ship to shore collision detection is pretty good with ships only very rarely crashing into a cliff. Even then they turn and sail away instead of just sitting there until they sink. :2up

The experimental version is just too buggy and the advanced one has heavy stuttering for me. :2dn

Has anyone else tried these?
 
For the sake of making the next Patch, any idea which edition of this code I should include?
 
I much prefer the "simple" version to the "experimental" version. I was unable to test the "advanced" version due to heavy stuttering. I only play at the lower skill levels, and so do my AI, so the AI in the "experimental" version were totally useless. In the "simple" version they maneuver and tack pretty realistically instead of just charging off downwind and out of the battle. Their collision detection is still off and they will run into things, but now they will turn and sail away instead of just trying to batter their way through until they sink.

Legendary_Spider is hopefully still play testing this and I am looking forward to hearing his opinion.
 
Just so you know, I did kind of sneak the 'Simple' version into the ship pack. :wp
I figured it works well enough to make an appreciable difference.
 
We'll probably stick to the "simple" version then until we decide we want to use one of the others. :doff
 
This is an interesting thread, thanks irR4tiOn4L and others for the work and progress on this. I haven't tried any version yet(unless it is in beta 5 patch?), but thinking on some of the things Hylie Pistoff was talking about in relation to <3 Sailing skill navigators having problems on 'certain' ships, it got me to thinking.

Do all the AI ships get assigned crew? a full compliment like the player character has access to? So if they do, would it be possible to set a minimum Sailing skill to these AI ships, all of them? That way we can avoid the situation of AI ships behaving too badly.

Now in terms of the player characters and their ships/crew etc. Well i kind of like the story of Hylie Pistoff, when he was talking about having to put the low skill navigator on another ship they could sail. That to me sounds like it is full of rpg+realism flavour :sail:

What about this, with this AI mod in place; ensure the player is made fully aware that having low Sailing skill on certain ships will be a recipe for disaster. We already have the Ships Class structure, and the limited access dependant on players ability mod(part of the Realism mod?). Is there a way to add this 'bug' on this improved sailing into wind ai script become a further refinement of that same kind of thing? It certainly would make good Navigators worth their weight in gold?

The main issue would be in gathering the data on what ships in particular sailed badly when assigned low Sailing skill navigators. I'm not sure how many ships PotC Build mod currently has, but that would require a fair amount of testing to get all that info, this then could be given to the player in the ships info(somewhere?), i guess in a simple form('requires Sailing skill +4' etc) - not as a complete barrier to entry(as in the Ships Class thing), but as a guideline for a player thinking of setting up their own fleet. I figure those situations where you have no choice but to assign a Navigator with too low sailing skill, would just be a learning experience that Sailing skill is important, a good Navigator is a prized member of the crew(...hmm... and maybe their wages should increase to reflect this...just a thought for now, as i'm running very low on funds as is!!).

And any more news on this particular mod? Is irR4tiOn4L still around etc?
 
Number of ships in the upcoming Patch 6: over 240.

The simple version of the code is in the Easter Naval Supplies WIP pack by Armada, but not yet in any of the patches.

irR4tiOn4L Last Active: Apr 12 2011 03:17 PM
 
Back
Top