February 13, 2019

Roads V: Hard to Port

Testing roads is already pretty difficult, since I want to let the population build up organically before placing them. Seaway routes are even more so, because they require a little more infrastructure to generate. They look good, except there are too many and they're not quite long enough.

As pretty as these look, I'd like to add a little intelligence to them. For example, these are really long journeys. Let's say that A, B, and C cities lie along a coast.

Furthermore suppose that an established route already exists between B and C.

Now, if A jumps into the sea-trade game, and wants a route to C, would it be preferable to go straight there, without resupply?

Instead, it's preferable to harbor at B, assuming that B is a friendly city.
So when selecting targets, the code should be able to check if there's already an existing route from B to C (and maybe there are more stops in between?) and reroute through an existing channel. I already kind of do this with the roads, but they're also constrained to a limited number of connections (since roads are physical objects which require maintenance, a trade route is an abstract concept).

This also assumes that a route A>B>C is always preferable to A>C. This might not always be the case. If B fell into enemy hands, then obviously it would no longer satisfy the criteria for a safe harbor. However, I can take this one step at a time and see how things shake out before adding additional constraints and shifting conditions.

2 comments:

  1. Also, for much of history ships sailed mostly within sight of land. So trading routes should have a fairly strong preference for coast-hugging in those eras.

    ReplyDelete
    Replies
    1. They do! I hesitate to make any pathfind cost zero, but the cost to stay near the coast is very very low. Trip might end up taking a little longer, but that's a small price to pay if you lose your mast in a storm 5 days from known land.

      Hopefully I'll have some good routes generated soon that I can show off.

      Delete