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

Fleets

As mentioned in the Towns thread, and the Nation.strength thread, fleets.

Rather than handling encounters as on-demand random generated fleets that sail aimlessly until they disappear and have no connection with anything else in the game, I've been working on a fleet backend. Fleets are generated by port towns (or by mapedges, i.e. Europe or other parts of the Caribbean), sail to destinations (engaging in combat on the way if they sight enemies), do things there (patrol, trade, sack, invade), and then have another destination (or go to a mapedge and disappear), and so forth. Towns would also have harbor fleets that stayed in place (i.e. coast guard, fishing boats, local commerce).

Note that as a side effect of this other ships than yours would no longer be visible on the world map; however, we could tell the player of nearby fleets via text messages and sounds (Sail ho, off the port bow!).
(This is because the worldmap ships are generated on the engine/DLL side, and we can only read their positions, not write to them.)

Fleet strength would be tracked, and strength on generation would depend on national strength and (if from a town) town strength. Strength would be reduced by storms or enemy action, and replenished gradually over time (repairs) or while in port (both more repairs, and crew).
Now, we can track strength in an abstract way, i.e. levels of strength, or specifically (track each ship in the fleet, and its hp/sp/crew). Same with goods, either abstractly (large cargo of this type of good) or specifically (so many of the trade good, so much food, so much rum, so much ammo, repair goods...).

Changes in fleet strength might change national power (i.e. if France loses a squadron of frigates, then her national strength would be decreased somewhat).

We should thus probably implement both true national strength (for use in international relations calcs) and local national strength, i.e. strength that can be applied directly on the 'pelago (and would reflect on--and from!--towns' economies, local fleets, and piracy).

For now I'm just selecting a random encountertype on fleet creation (based on trade/war/pirate), so I don't have to rewrite (well, do more rewriting) the Sea.c group creation and AIFantom ship-creation calls.
----------
Interaction between fleets, and between them and towns and the player, is handled by a grid system. Whenever more than one fleet is in a a grid box (or fleet/town), that box is placed in the update list. When going through and doing fleet updates, we check that update list and handle combat.
In addition, whenever a fleet reaches its destination, new orders are given (disappear if mapedge, or do something there (attack, defend, trade), and/or return home).
For now there is no interaction possible in box updates, and when a fleet reaches a destination they either return home and disappear, or disappear right there.
-----------

And as of 05-04-24 I've reloaded successfully to sea near a fleet and they did show up. The worldmap chugs some, but I can't think of anything further to do (at the moment) to speed it up. (That's for 20 fleets at once).
 
Uploaded as NK_fleets.zip
Note: you must start a new game, and this must be installed on top of a full pre13 release.

If you want status updates in compile.log, open BS.h and set tracelog to 1 instead of 0.
Set it back to 0 via console when you want to turn it off again.

Code for fleets is tagged WM for worldmap.

Other changes:

-WM update in calendar on AddData or AddTime so fleets update when not on wdmap too

Towns changed from attribute array under objTownStateTable to object array Towns[] so we can use Native getindex calls (which are lighting fast).

*fixed exploit where player can escape storms by hitting F3 during reload to sea.
*moved reinit to start before loadlocation
*fixed monks!
 
Yehey the monks are in their stations <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/par-ty.gif" style="vertical-align:middle" emoid=":cheers" border="0" alt="par-ty.gif" />
 
<img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/icon_eek.gif" style="vertical-align:middle" emoid=":shock:" border="0" alt="icon_eek.gif" /> WOW! This is neat! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/keith.gif" style="vertical-align:middle" emoid=":keith" border="0" alt="keith.gif" /> WTG NATHAN! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/me.gif" style="vertical-align:middle" emoid=":onya" border="0" alt="me.gif" />

I AM impressed! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/bow.gif" style="vertical-align:middle" emoid=":bow" border="0" alt="bow.gif" />
 
Great, that will add a lot more depth to sailing between the islands. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/me.gif" style="vertical-align:middle" emoid=":onya" border="0" alt="me.gif" /> <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/sailr.gif" style="vertical-align:middle" emoid=":sail" border="0" alt="sailr.gif" />

Never mind that you can't see the other's toyships, that always felt like playing pacman to me. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/bounce.gif" style="vertical-align:middle" emoid=":b:" border="0" alt="bounce.gif" /> <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/w00t.gif" style="vertical-align:middle" emoid=":woot" border="0" alt="w00t.gif" />
 
Wow !

That is something I have been thinking of for a long time.
Great addition.

As far as I remember you couldn't see the other ships on the pirates! map, back in 1987.
 
<img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/unsure.gif" style="vertical-align:middle" emoid=":?" border="0" alt="unsure.gif" /> Something I've often wondered about sailing on the overhead map view; if your lookout can cry "Sail ho!" when there's a ship in sight, or "Land ho!" if there's land in sight, why the heck can't he call out "Storm ho!" ? I hate getting caught up in a storm when I can avoid it... And sometimes I get caught up in it because I'm too busy looking at too many things to pay attention to whether there's a storm starting up. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/rolleyes.gif" style="vertical-align:middle" emoid=":rolleyes:" border="0" alt="rolleyes.gif" />
 
Cat:
There is an inStorm event, but it seems not to occur until you can't _escape_ from the storm (i.e. the event is what makes you reload to sea, not the event where the icon gets added).

Folks, I'm just writing the backend. The AI of it I've not attempted yet, and I will need _much_ help with.
But thanks. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />

I'd also like to make clear that this was (and perhaps still is, dunno whether they've touched it since) a PMT project--that it to say, I was working on in PMT. And that I've a longstanding commitment to do an implementation of this for them as well.
{PMT'ers, I've not forgotten this. If you still want that, I'm still happy to do it. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/par-ty.gif" style="vertical-align:middle" emoid=":cheers" border="0" alt="par-ty.gif" />}
 
And a plea for help.
Does someone here know about code optimization?
As a self-taught and rather lazy programmer I'm not very good at all at that, and with POTC's lowspeed execution of scripts it's _very_ needed for this (and for other daily updates as well, of course...)

A couple notes. POTC executes things in loops /far/ slower than if something's written out.
I'm trying now an update function without a for loop, and we'll see if that's fast enough. If not....(cue Beatles song) HELP!
 
CCC? <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/huhh.gif" style="vertical-align:middle" emoid=":eek:k" border="0" alt="huhh.gif" /> <i>Somebody?!</i> <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/icon_eek.gif" style="vertical-align:middle" emoid=":shock:" border="0" alt="icon_eek.gif" /> Save us! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/modding.gif" style="vertical-align:middle" emoid=":modding" border="0" alt="modding.gif" />

<Offtopic: I was just listening to that song! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/laugh.gif" style="vertical-align:middle" emoid="xD:" border="0" alt="laugh.gif" />>
 
<!--QuoteBegin-NathanKell+Apr 25 2005, 01:21 PM--><div class='quotetop'>QUOTE(NathanKell @ Apr 25 2005, 01:21 PM)</div><div class='quotemain'><!--QuoteEBegin-->Folks, I'm just writing the backend. The AI of it I've not attempted yet, and I will need _much_ help with.<!--QuoteEnd--></div><!--QuoteEEnd-->Aw everybody needs a hobby! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/icon_wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="icon_wink.gif" /> But remember, Nathan... There is a fine line between "hobby" and "mental illness"... <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/rolleyes.gif" style="vertical-align:middle" emoid=":rolleyes:" border="0" alt="rolleyes.gif" /> <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/laugh.gif" style="vertical-align:middle" emoid="xD:" border="0" alt="laugh.gif" />

I think that's the beauty of the modding going on here; we have a lot of people with various talents that are balancing out quite nicely at the moment. We still need more MODELERS, but it's mostly the coming together in cooperation and in the open that's so attractive to someone interested in modding...

(at least to ME, anyhow!) <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/icon_mrgreen1.gif" style="vertical-align:middle" emoid=":cheeky" border="0" alt="icon_mrgreen1.gif" />
 
<!--QuoteBegin-NathanKell+Apr 25 2005, 08:43 PM--><div class='quotetop'>QUOTE(NathanKell @ Apr 25 2005, 08:43 PM)</div><div class='quotemain'><!--QuoteEBegin-->And a plea for help.
Does someone here know about code optimization?
As a self-taught and rather lazy programmer I'm not very good at all at that, and with POTC's lowspeed execution of scripts it's _very_ needed for this (and for other daily updates as well, of course...)<!--QuoteEnd--></div><!--QuoteEEnd-->

just a thought - have you tried running the game with debug and tracefiles off? i seem to remember the game ran 300x more smoothly when i turned them off. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/happy.gif" style="vertical-align:middle" emoid="^_^" border="0" alt="happy.gif" />
 
Nah, very little difference not tracing. :\
But a good try. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />

OK, here's try 2. Redid it as an event, etc. Works better. Plus I made worldmap run at 0.5x time, and that smooths it out a good deal.
Also added:
(note questbook doesn't work right, but I haven't a chance to fix it ATM...)
<!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec-->*added basetime so we can change a player's basetime (i.e. change mapspeed to simulate wind).
*doh! Cat FBQ characters are already init'd, so my adding them to NK Characters.c made them init twice. Fixed now.
*got rid of //qf" lines, replaced \" with \\"
*fixed lootdead error where blade or item has no *quality attrib.

*adopted some fixes from Akella's patch (via polish version):
-BI\Utils.c process sail repair
-Calendar.c GetMonthDays()
-Ch Ut.c - Fix some goods functions to not check non-removable chars. add int GetNotCaptivePassengersQuantity(ref _refCharacter)
-Itemsbox allow describe window up/down
-itemstrade ditto
-messages.h added MSG_INTERFACE_IS_READY_LOAD but dunno if it works with our DLLs.
-qbook.c add scrollchange
-LAi_fightparams.c - the get attack/block chances at bottom are changed by !bArcadeMode
-Loc\init\Oxbay changed a couple locator labels from Russian to English.
-Loc\init\Redmond ditto
-Quests.c change questbook to add date/time
-AIShip a couple bugfixes, and no accuracy bonus if not in arcmode
-
-cannons.ini, character, controls, endgame, fortcapture, helpscreen, hirecrew, items, itemsbox, itemstrade, option_screen, passengers, perks, playgame, ransack_*, salary, save_load, select_menu, selectCharacter, ship, shiphold, shipyard, store, tradebook, transfer_*,
-defaultnode.ini add bwheeluse = true
-questbook.ini change font, icon size<!--QuoteEnd--></div><!--QuoteEEnd-->

Package is now NK_fleets_plus_050425.zip

I know I said I was going to merge stuff in, but I ran out of time today. :\

Plus, I'll be out for the rest of the week, I'm afraid, trip up to Maine and back. So--don't get into mischief, or at last save it so's I can join. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/icon_mrgreen1.gif" style="vertical-align:middle" emoid=":cheeky" border="0" alt="icon_mrgreen1.gif" />
 
Travel safe, Nathan... <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />
 
This sounds really cool. will it also be able to avoid the wm entirely and sail in sailing mode between islands??

btw.... my work on svanen (schooner) has been stopped because of a harddisk breakdown <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" />
 
It's a pity, the Svanen looked very promising, Sofus. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" />
 
Thanks, Cat. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />
Sofus: Nope, wdmap still required. :\
Sorry to hear of the stoppage, good luck gettin' back up and running!
 
I have two comments:

- If you change player time to simulate wind on the wmap, will you also
simulate wind effect for the fleets ?
I mean, if u are chasing a convoy it would be frustating to lost it just
because there is no wind but only you are affected.

- I allways think this wmap is not just unrealistic, it is also boring.
If I was not so dummy and lazy (and if.., if...) I would have made a map where
you plan your journey with checkpoints and then go back to 3d view at time x30.
Then you would go back to time x1 if there is an encounter or if you reach a
checkpoint.

Just a few thoughts.
 
<!--QuoteBegin-Trebutor+Apr 27 2005, 11:10 AM--><div class='quotetop'>QUOTE(Trebutor @ Apr 27 2005, 11:10 AM)</div><div class='quotemain'><!--QuoteEBegin-->I have two comments:

- If you change player time to simulate wind on the wmap, will you also
  simulate wind effect for the fleets ?
  I mean, if u are chasing a convoy it would be frustating to lost it just
  because there is no wind but only you are affected.

- I allways think this wmap is not just unrealistic, it is also boring.
  If I was not so dummy and lazy (and if.., if...) I would have made a map where
  you plan your journey with checkpoints and then go back to 3d view at time x30.
  Then you would go back to time x1 if there is an encounter or if you reach a   
  checkpoint.

Just a few thoughts.
<div align="right">[snapback]102719[/snapback]</div><!--QuoteEnd--></div><!--QuoteEEnd-->

Simulate wind on the worldmap? Where was that mentioned?

As for the second part. I agree, using the world map for plotting would be nice, but you just can´t sail from one island to another without using the world map. As well, I think it would be a nice feature, but - honestly - not one used all too much. Because tacking against the wind going from one end of the map might be interesting one time, perhaps a second time, but then it becomes annoying (read all the posts in the Pirates! forum concerning the wind). What I would like to have is something like the way Aces of the Deep (a submarine simulator playing in WW II) did it. There you have a world map for long distance travel, allowing up to 1,024x time boost, a tactical map, for engaging convois, allowing 256x time boost and a "deck perspective" allowing all time boosts, depending whether an enemy is near or not. The nice thing about it was, that in deck perspective, weather changed gradually, as did day times. If the sky was clear, one was even able to navigate using the stars (providing you know how to do that - I´m not).
But the engine of PotC does not allow for that.
 
Back
Top