• 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!

Regarding Surrender.

CaptainOfRohan

Landlubber
Hey, has anybody else ever encountered a problem where the game running in windowed mode opens with the top left corner of the window at about the centre of the screen, and most of the game off screen? Only option I have left to me is to switch it to fullscreen, but I know from experience that in fullscreen mode alt-tabbing stops the game working. (EDIT - fixed, I was just being an eejit, this was caused by having Chrome already open)

Also, while I'm asking questions - Kingston Naval HQ? I'm a naval officer, currently acting lieutenant - am I supposed to be able to access the HQ, will it become open to me later, or is it purely for storyline purposes?

EDIT
A further question, since I have this thread open now. I have been encountering great frustration with the duelling mechanic with surrendered captains. Does anyone know which files I'd want to look in to alter this behaviour?

So, just to talk through how I see the mechanics as they exist (I'd love to hear counter arguments of course)
- This is presumably implemented to make capturing overpowered ships difficult?

- Surely the answer there is to either make leadership/sailing requirements tougher for big ships, or to make opposing ships surrender less easily.

- Or perhaps the system is in place to provide high end one-on-one sword fights? I actually quite enjoy the fencing, but feel it should mostly be a choice. I'd argue that New Horizons has found a niche not so much as a game, but as an age of sail simulation, and I know that it has attracted players who have no gaming experience or interest in traditional gaming, who I predict will be put off by forced high difficulty one-on-one fights. Also, from a historical perspective I'm not sure the game is right to force every great military captain to be an excellent fencer, with my current character I'm prioritising Leadership and have no interest in the dungeons or land-based quests, and personally feel that should be a valid path in the game - it so nearly is. The captain duels are the only time in free play that I feel forced to use the fencing mechanics.

- Proper boarding and the ensuing, difficult crew-to-crew battle fulfils it's purpose and deters me from boarding in the early game or against bigger ships - but I don't feel like the duel system has a similar effect. All I end up doing is winning the ship battle, feeling victorious, quick saving, then using a brute force solution by repeatedly reloading and retrying the duel. That feels like what the mechanics encourage, to me.

(Regardless, if this is a system that the community is generally happy with, I'm only really looking to alter this for personal use)

So onto how I'd want to make this work (obviously some of this will be feasible and some will not, such is modding.)
- Merchant and Naval captains should never duel you after surrendering. Is there any less honourable behaviour for a navy man, than surrendering then attacking? And merchants should be more pragmatic than that, they aren't fighters. You only fight then if you choose to kill the captain, but if you choose to free or imprison them, they won't resist.

- If/when I had greater modding talent I'd love to one day look into the prisoner system, or at least the dialog - as a naval captain I feel I don't have any options that allow me to honourably imprison my enemy - giving him back his sword and/or giving him freedom to wander the ship, for example, or just generally speaking to him like gentlemen.

- Pirate ships MAY fake a surrender, but when you board the surrendered ship you would get a proper boarding fight - your entire crew boards and is ambushed by their entire crew. If I'm boarding a surrendered pirate ship the last thing that I'm going to do is walk over alone, and no decent crew is going to stand back and watch their captain having a one on one fight after being dishonourably ambushed by a false surrender. The opponent has just committed a war crime, he has no right to be allowed to duel me one on one, my crew (even if they didn't come over with me at first) would immediately jump over and join the fight.

- So on pressing 'Board' you maybe have a 50/50 chance (maybe based on the pirate captains reputation?) of getting a genuine surrender and a non violent conversation with the captain, or a full boarding fight.

Anyway, a lot of that was me thinking out loud. I'd be very interested in what others think of the current surrender/duel mechanics, what files I'd be looking in to make any such alterations (or if this is well above my level and something best left well enough alone), and any arguments that may convince me that I'm wrong about how this all works?

As always, I mean this as absolutely no slight on the mod. The game works fabulously as-is, I will give honest feedback as I go and if I can make tweaks for personal use I shall, but I would never ask for more work from the existing modding team. You should all be very proud of yourselves.
 
Last edited:
Hey, has anybody else ever encountered a problem where the game running in windowed mode opens with the top left corner of the window at about the centre of the screen, and most of the game off screen?
Yep, set the game to "Windows Vista (Service Pack 2)" compatibility mode.
That should solve it.

Also, while I'm asking questions - Kingston Naval HQ? I'm a naval officer, currently acting lieutenant - am I supposed to be able to access the HQ, will it become open to me later, or is it purely for storyline purposes?
Mainly for Hornblower storyline purposes.

This is presumably implemented to make capturing overpowered ships difficult?
It works the way it does because nobody bothered to change it.
So it's purely historical reasons and could do with some sensing up.

Actually, we've had plenty of ideas to improve on this.
What we haven't had is anyone with the time and ability to actually do something about it.
And therefore it remains as it is.
 
Well, I've had a good look through the files and I might as well try! What's the worst that can happen (so long as I backup my game properly haha!) I shall make no promises and not hold my breath but I will have a good go. It seems that cabinfight_dialog.c is the place to start? I'll give updates if I start to make progress - this code seems complex but perfectly graspable and I really would enjoy being able to tweak some of this stuff.
 
Well, I've had a good look through the files and I might as well try! What's the worst that can happen (so long as I backup my game properly haha!)
That's the way to missing world goes round! :yes

It seems that cabinfight_dialog.c is the place to start?
Most definitely. :onya

There might be somewhere a forum thread detailing our ideas for improving on this, but you can think of your own ideas as well.
My own preferences rely on changes too the Fame system that I've wanted to implement forever and likely never will due to permanent lack of time and continuously changing priorities.

I'll give updates if I start to make progress - this code seems complex but perfectly graspable and I really would enjoy being able to tweak some of this stuff.
You'll be very welcome to! :cheers
 
Well, I've brainstormed what I intend to do and have read through most of the relevant code. Most of it I can grasp after a little thought - I have minor experience with some coding language and my algebra isn't bad, the basic logic of it all makes sense to me and a lot of what I don't understand can be googled. The wiki and documentation have some good stuff. But there are some things that are just throwing me and I can't get my head around, so I was wondering if there are resources anywhere that can help me with the following functions, or if anyone would care to explain what exactly the following lines of code do (none of these are code I'm planning to touch, understanding what they do and how they work is purely an educational thing so that I can get my head around the whole function.)

surch *= Bring2Range(6.0 * (1.0 + makefloat(fdist+200 < enemydistance)), 1.25 * (0.5 + makefloat(fdist+200 < enemydistance)/2.0), 0.1, sqrt(20), sqrt(HPr));

So I understand that we're multiplying surch by a value. Bring2Range baffles me, google has entirely failed me and I can't make head or tails of what it's doing, sorry. I keep seeing it used and I just don't understand what it does. Finally, MakeFloat. It's creating a float variable, right? Which seems like an odd thing to be happening in the middle of another calculation. It doesn't seem to ever give a name for that float which seems weird. And I assume that the formula in the following brackets (fdist+200 < enemydistance) is the value to assign that float... But what's that less-than symbol doing there? What purpose can it have in calculating a value? Terribly confused. It may be that C is beyond me, but I'd like to learn to understand this if possible, POTC just seems to use some code that google can't help me with which implies it's unique to this game I guess? So yeah... Bring2Range and MakeFloat. Can anybody give an idiot's guide to those?
 
Well, I started to make some headway in phase 1, adding reputation and profession effects to the chances of surrender/fleeing and potentially adding an alternate to surrender (for truly evil players) - abandoning ship. Not really onto any of what I was originally inspired to do but figured I may as well look at the whole process from morale checks through to enemy captain dialog, and be thorough about things. Before I hit the hay I thought I'd just leave a few questions that might spare me rummaging through existing code tomorrow (although to be fair that is the best way to learn!).
- What variable would I check to see if the player is pirate, merchant, naval officer etc?
- Is there any easy way to do a check on a variable for another ship's captain? Ie - calling GetCharacterReputation() for the nearest enemy vessel's captain? Currently the reputation checks in my tweaks to the surrender code just check the player's rep, which is fine (if clumsy) for enemy surrenders, but it is daft for the player's rep to have the same effect on allied surrender.
 
Bring2Range
Converts a ratio between, say, 1 to 10 to, for example, 1 to 100.
It's a PotC specific function and you can probably find its definition using the tricks described here:
Tutorial - Modding Tips & Tricks

MakeFloat
Ensures that numbers are floats (instead of, for example, integer, string or boolean).
That's sometimes required in the middle of a calculation to ensure it does what you think it does.
I once spent a whole afternoon figuring out a crazy big only to find out it needed a MakeFloat in there to make sense. :facepalm

In this case, because of the < and > being used, that bit returns a true/false Boolean.
But you cannot calculate with that, so it is being converted to a floating point number that is either 0.0 or 1.0 instead.

What variable would I check to see if the player is pirate, merchant, naval officer etc?
I think it was the CaptainType function. Search for that in NK.c to be sure.

Is there any easy way to do a check on a variable for another ship's captain? Ie - calling GetCharacterReputation() for the nearest enemy vessel's captain?
You can call that on any character you want, but you need to get that character's ID or reference.
Is that already being used in the function you are tweaking? If so, it is not too difficult.
 
Things are coming along. Will hopefully have some working progress to share soon, if this is stuff the wider build is interested in implementing. I've noticed in the code the following couple of lines and wondered if somebody could explain why one has been commented out:

//float fdist = DIST_NOSHIP; fdist = FindClosestShipofRel(chridx, &fdist, RELATION_FRIEND);
float fdist; if (FindClosestShipofRel(chridx, &fdist, RELATION_FRIEND) == -1) fdist = DIST_NOSHIP; // LDH 07Mar09

fdist isn't mentioned any time previously in the function I'm looking at. It is then used a couple lines later in some calculations related to surrender likelihood depending on friend proximity. But as far as I can tell, the value of fdist isn't being properly calculated. The first line looks promising but is commented out, and the second line only sets fdist to a value of 100000.0 (from internalsettings.h) if there is no nearby ally. This is all in AISHIP, from line 1202, if anybody more qualified needs to look at it. Does anybody remember a reason for that being commented out. Tomorrow I might try uncommenting it and running some tests I suppose.

My current plan since I'm really feeling like I understand most of this now and have the bit between my teeth, is to:
- Adjust relative surrender likelihood and sail away thresholds, using the current values as a baseline then adjusting up or down based on:
* Player Reputation
* Player Type
* Their Type
Some examples - Heroic characters will get lots of surrenders but reduced fleeing. Horrors of the High Seas will see more enemies flee or fight to the death since they don't expect to survive surrendering. Naval ships will generally flee and surrender slightly less than average, merchants will flee and surrender quicker than average (possibly horribly unbalanced due to the money to be made by capturing merchants, any thoughts on how to balance that? Maybe they might throw cargo overboard?) Pirates will surrender about on average to other pirates or privateers, be unlikely to surrender or flee from merchants and almost never surrender to naval characters due to fear of the noose.

- Different types of surrender
* Surrender
* False Surrender
* Abandon Ship
Surrender will operate basically as is, with some tweaks
False surrender will only be done by pirates, and you won't know until you board and find yourself in a proper boarding fight.
Abandon ship means no captain dialog and no crew to capture, and if the ship isn't taken it will remain in place and re-boardable. Don't know if scuttling is at all historically accurate or reasonable to implement in game as a 4th type of giving up but I think 3 is more than enough.

-Different captain options based on player type and foe type
* Enemy Navy captains can't be captured and turned into officers, nor can Player Naval Officers capture any officers. All other player types can capture enemy merchants and pirates as before.
* Enemy Captains can be imprisoned respectfully or not. Respectfully treated captains will be found on deck instead of the cargo hold, giving a reputation boost but coming with risks...
* Enemy Crew can be imprisoned, thrown overboard, or recruited. Naval Officers may not recruit foreign crew, and will suffer severe penalties for throwing men overboard. If you choose to recruit, you get the traditional "transfer crew" option. If you throw them overboard, the captured ship will have zero crew and will have an "assign prize crew" option instead - this will perhaps trigger a boarding style fight if the crew resist. If you imprison them, the enemy crew will be reduced to zero, you will have an "assign prize crew" option, and the enemy crew number will be converted into a cargo good - prisoners. (the details of what can be done with them would need careful discussion, obviously they would be contraband everywhere and smugglers would have to refuse to take them. Tossing the cargo overboard might get you whacked with rep penalties, we would need a way to set them free somehow, maybe a way to ransom them to a governor of their own nation, or to hand them in to one of your nations dungeons or governors. And the big question is would any islands have individuals interested in buying human cargo, or is that an area of history best left well enough alone by the mod.) Of course, keeping large numbers of prisoners without a large enough crew to contain them may lead to riots, giving players a reason to not capture every ship they can if they aren't willing to slaughter the crew.
- Perhaps an option to offer the enemy captain a chance for freedom or an honourable death in a duel, but at the player's discretion.

There's more on my mind but it's 1am and I'm knackered. I'll continue posting updates and hope to receive honest feedback - both on what sounds good and what people disagree with, and also on what might sound unfeasible given engine limitations, or extremely hard to code in.
 
That's a lot of good thoughts! I wished I had time to give them the attention they deserve, but that is going to have to wait.
Hopefully @Grey Roger will drop by to have a look at this as well though. :diff

I've noticed in the code the following couple of lines and wondered if somebody could explain why one has been commented out:

//float fdist = DIST_NOSHIP; fdist = FindClosestShipofRel(chridx, &fdist, RELATION_FRIEND);
float fdist; if (FindClosestShipofRel(chridx, &fdist, RELATION_FRIEND) == -1) fdist = DIST_NOSHIP; // LDH 07Mar09
Looks like there used to be an original line which was changed by @LarryHookins.
Maybe he remembers?
 
The first line has been commented out because I changed it to the second. The reason for the change is in the comment right above the lines you quoted. Check out the function FindClosestShipofRel() (it's in the same file, AIShip.c) to find out what it actually returns and why I changed those lines.

// LDH was using ship's character index as distance - 07Mar09

The code was originally setting fdist to a character index, not a distance.

Hook
 
A lot of my code is like that. I'll comment out the original line that I changed so people can see what was there before. Sometimes that's useful, especially if I mess up. :) Also, it reminds me 8 years later why I changed the line. :D

Document everything. You never know when it will save you.

Hook
 
My current plan since I'm really feeling like I understand most of this now and have the bit between my teeth, is to:
- Adjust relative surrender likelihood and sail away thresholds, using the current values as a baseline then adjusting up or down based on:
* Player Reputation
* Player Type
* Their Type
Some examples - Heroic characters will get lots of surrenders but reduced fleeing. Horrors of the High Seas will see more enemies flee or fight to the death since they don't expect to survive surrendering. Naval ships will generally flee and surrender slightly less than average, merchants will flee and surrender quicker than average (possibly horribly unbalanced due to the money to be made by capturing merchants, any thoughts on how to balance that? Maybe they might throw cargo overboard?) Pirates will surrender about on average to other pirates or privateers, be unlikely to surrender or flee from merchants and almost never surrender to naval characters due to fear of the noose.
Naval ships should indeed be less likely to surrender than merchant ships, but it should certainly still be possible. Warships were captured - some of them changed hands several times. Merchants should not throw cargo overboard for at least two reasons. One is that if they have time to do that then they aren't in a desperate enough situation to consider surrender in the first place. The other, especially if it's a pirate or privateer doing the attacking, is that throwing the cargo overboard is a really good way to invite the pirate/privateer to send the crew after it. Pirates should be the least likely to surrender of all - no quarter given or expected!

- Different types of surrender
* Surrender
* False Surrender
* Abandon Ship
Surrender will operate basically as is, with some tweaks
False surrender will only be done by pirates, and you won't know until you board and find yourself in a proper boarding fight.
Abandon ship means no captain dialog and no crew to capture, and if the ship isn't taken it will remain in place and re-boardable. Don't know if scuttling is at all historically accurate or reasonable to implement in game as a 4th type of giving up but I think 3 is more than enough.
False surrender already happens, to some extent. It's when the ship has apparently surrendered but you then need to duel the captain.
Abandon ship is unlikely to be accurate. Speaking as a crewman, if I jump overboard then I'm likely to drown unless someone is nice enough to pick me up. If I stay on board then hopefully I'll be taken prisoner, especially if I wasn't stupid enough to throw the cargo overboard. Scuttling is also unlikely to be accurate - in reality, Sir Richard Grenville of the Revenge ordered the ship to be scuttled. ("Sink me the ship, master gunner! Split her in twain! Fall into the hands of God, not into the hands of Spain!") The crew did not obey and the ship was indeed captured, though it sank anyway in a storm while being towed as a prize. As previously stated, naval ships were often captured.

-Different captain options based on player type and foe type
* Enemy Navy captains can't be captured and turned into officers, nor can Player Naval Officers capture any officers. All other player types can capture enemy merchants and pirates as before.
This is wrong. Navy captains certainly ought to be able to be captured, and by other naval officers at that. Admiral Villeneuve, French commander at Trafalgar, was captured. However...
* Enemy Captains can be imprisoned respectfully or not. Respectfully treated captains will be found on deck instead of the cargo hold, giving a reputation boost but coming with risks...
... this is the most likely fate of a naval officer captured by an enemy naval ship. He gives his parole not to try anything, and is treated more as a guest than a prisoner. You should be able to ransom him.
* Enemy Crew can be imprisoned, thrown overboard, or recruited. Naval Officers may not recruit foreign crew, and will suffer severe penalties for throwing men overboard. If you choose to recruit, you get the traditional "transfer crew" option. If you throw them overboard, the captured ship will have zero crew and will have an "assign prize crew" option instead - this will perhaps trigger a boarding style fight if the crew resist. If you imprison them, the enemy crew will be reduced to zero, you will have an "assign prize crew" option, and the enemy crew number will be converted into a cargo good - prisoners.
Additionally, at the moment, if you run over a survivor in the water while you have free crew space available then you pick him up, he's added to your crew and you get +1 reputation. If you have a free crew then you can't pick up survivors. I suggest that if you have no free crew space then you can pick up crew which then go into the prisoner pool as well.

You should be able to recruit the crew, or at least to use them as crew for their own ship, now captured and your prize. Naval ships certainly did this. Privateers and pirates probably did it too.

The game has steered clear of slavery. I suggest continuing to do so. Therefore you can not sell prisoners. You can release them at the next port or you can throw them overboard. Prisoners will consume food until they are released. Naval officers should not have the option of throwing them overboard. Neither should privateers - the whole idea of a LoM was that you were effectively an auxiliary naval officer, bound by the code of conduct of a naval officer, and likewise expecting to be treated as a naval officer rather than a pirate if you were captured. Throwing prisoners overboard is a gquick way to lose your LoM.

Perhaps an option to offer the enemy captain a chance for freedom or an honourable death in a duel, but at the player's discretion.
I believe the option to offer the captain a duel already exists. If you talk to him and tell him you're going to execute him, doesn't he then ask to fight rather than simply be slaughtered?

Overall, some good ideas, but beware of penalising pirates and privateers. We do not want this game to change from "Pirates of the Caribbean" to "Shoppers of the Caribbean"!
 
Back
Top