Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Direct-Sail Optimization

A topic by Klatu created Apr 02, 2023 Views: 201 Replies: 4
Viewing posts 1 to 2

Is there any way or any chance of improving the Direct-Sail functionality so that the game doesn't chunk so hard on the thresholds of cells/grids? 

I was a little disappointed that despite using the 64bit engine, the game still has a lot of problems synchronizing cells/grids. It works pretty well on short trips, but on long trips when you and your fleet exist in two different grids, the game starts stuttering like mad until the game forces a world map refresh. 

I don't understand why the game struggles so hard to load just two grids/cells when there really isn't a lot going on inside them. I'm guessing this has more to do with the code than it does the engines ability to process more concurrent assets/resources. 

The upshot is that I have found the culprit of the camera-snapping issue mentioned in the previous thread. Unfortunate that this sometimes happens in static locations.   

(+2)

Modern games probably use asset streaming, background threads and level-of-detail for more efficiency.  However, the way this game was designed, prevents most of that.  First, they made their own custom texture and model formats, that must be processed in engine code, before handing off to the renderer.  Then, the program scripts that allow for easier modding and customization of behaviors also are notified at various points during asset loads so that the scripts can respond and add certain data to its variables that must be done in order of load, so that prevents doing anything in parallel threads and must be handled consecutively in the main thread. 

The main culprit is the design of the program script handler and I am not going to try redesigning the entire game engine.  The point was to take the original code design, but at least rid the prominent crashes and bugs that existed in the original.  Also keep in mind that the "direct sail" was a modification to allow more interactive direct-sail, with encounters and such, but was also never part of the original game either, but was added by script modders.

I also saw your other question about camera movement, and that is also inherent to the original engine's timestep; their original timestep approach does not do well once frames get high.  I had once contemplated using a better timestep resolution and delta approach, but a first pass broke much of the other physics and turned out to require much more work than anticipated, so I let it go.

Thanks for the insight. I think there are slight problems outside of that. Something I had not experienced, at least in GOF 1.0 is that in some instances you can be right next to an island direct from a world map cycle and the island won't render or register. I exited world map from Shores of Somana roughly half way between Hispaniola and the tip of Puerto rico and Puerto rico would not load. I sailed right under the island until I collided with it's invisible mesh. Normally this only happens in vanilla and GOF 1.0 when you don't cycle the map for long periods. But in that scenario I was well within range. I had to actually sail around the north face of the island to get it to cycle/refresh.   

Is there perhaps anything I could set in Globals or another file that would alleviate both behaviours? 

(+2)

There is a big, long explanation for this sort of problem in direct sail...

First, some of the "island locations" are a single island model, and some are the main location model, with several distant islands visible in the distance, but are technically not really valid locations, but just for scenery on the horizon.  In original COAS, if you sailed directly to those distance islands, you could reach them, and even keep sailing beyond them.  But if you reached that island and sailed around the circumference of it, you would never actually see the ports, or any detail, even though it was defined as a real location, until you exit sea, enter world map, then reload back to sea.  Then, you would then get the valid location to load of that once distant island to load it's real model, not the fake distant one you saw from afar.  For those islands that are just a single model, with no distance islands visible, you can sail forever in a direction where you know another location exists, and you will never reach it in COAS, because there is no such thing as "direct sail" ability in the original game.

The modders for GOF added the "direct sail" feature to calculate the distance you sailed from your original location, compare it to the distance from every other island, and if at some point during your sailing, if the distance from any other worldmap location was less than the distance you had sailed from your original location, their modded scripts would force that location's model to load and you would get a loading screen as you transition from that portion of the map to the other.  This usually works except for transitions from certain locations on the western and southern parts of the map.

The reason those western and southern parts of the map are a problem, is that it turns out the original design of COAS is that the worldmap for Cuba and the South American continent on the worldmap, and their respective port locations are actually a different distance scale than all the other portions of the map, so comparing the distances doesn't work well, because if you started sailing at any of the eastern island, then approached Cuba or South America (both west and south on the world map), at some point in the journey, the distance scaling prevents the calculation, because there is no way to account for when the distance scaling needs to change, because that dividing line of distance scaling change is unknown.  In GOF, if you sailed from Hispaniola, toward Cuba, you could reach Cuba shores and nothing would happen, unless you turned north for a ways and eventually you could get the transition.

For ERAS, which is based on the GOF mod, a change was made to help alleviate this problem by using the direction your ship is heading at any given time, and if any of the "problem" ports are forward of your position, it will use a different scaling for calculating your distance to those ports, and the regular distance calculation for ports not on that last of problems, to help eliminate the problem.  It's still imperfect, but it works better for most locations that GOF did.  I have tested that sail from Hispaniola to Cuba in GOF, and you can reach the island without a load, but in ERAS, you get fairly close and can see the low-res fake island, but the transition happens sooner than GOF, before you reach the shore.

This has been a known issue since the early days of COAS and GOF and also a problem in the New Horizons mod when they lifted the South American portion of the worldmap from COAS and put it into POTC.  There are discussions on PiratesAhoy about this very issue, and the attempts to compensate for the scaling differences in the modded scripts.

You're right, that system is quite convoluted, but I guess not uncommon for these older games. 

To be honest I was a little sad that ERAS doesn't have real direct sail, it's more or less the same thing as in GOF 1.0, the only difference is that it auto-cycles your location in very much the same way a world map cycle would. The most disappointing aspect of that is it doesn't fully retain weather conditions when it does cycle/sync, which I thought would be the main point of it. So mechanically you could say the only real difference is that it just saves you from cycling the map manually. It does seem to do a better job of syncing your orientation relative to other entities. At least you don't get rubberbanded back half the distance you travelled like in GOF 1.0 lol.