March 4, 2019

Roads VII: Row, Boys, Row

What I did with the roads, I now do with the seaways (I'm calling them seaways because its a convenient one-word descriptor).

I toyed a long time with the idea of reducing the number of these trade routes between harbors. If there are two routes between two harbors, over time, one will emerge as the dominant one. For my purposes, I can just say that the "shortest" route will be the best. Therefore, why generate all possible routes?

Eventually, though, I decided to take the extra time to generate everything. Well, not everything. Only harbors with a certain infrastructure (50, for now) are eligible, and I only look at harbors within a 50-hex distance. Longer journeys are certainly possible, but not all at once. Certainly not for trade, which will find the quickest and easiest route to transport goods (as mentioned before).


As a result, there are only a few places where you can travel between continents. However, it is theoretically possible to travel to every single continent.

There are also a couple of issues where some of the seaways are drawn as straight lines (a few can be seen in the figure above). Ideally, the lines follow the currents. It's kind of neat to show a straight line diagram, but if I want that, I'll make that. I think this error happens because of the route-splitter.

Let me back up. I'm generating routes between harbors of sufficient size, A to B. But let's say that this route passes just off-shore of a town too small to have its own harbor. Well, it's reasonable to assume that this would be an ideal place (politics aside) to resupply your merchant vessel. So the algorithm will find places such as this (C) and split A>B into A>C and C>B. All three are now connected rather than just the two. This allows a more robust network and lets smaller cities benefit from the commercial activity of larger ones. However, I have a bug in the code that when no C is found, it looks like the algorithm abandons the original path entirely. Should be trivial to fix (the programmers famous last words).

And if a party is interested in a much longer journey, it is trivial to generate it.

At this point, I'm starting to be interesting in taking all this data and condensing it into a trade network. I've already written a bit about this here, but so far all my testing has been done with manual inputs. Now, I can simply run an algorithm over my map data and generate nodes, edges, and weights from the cities, roads, seaways, and river routes. Things are finally coming up Milhouse.

No comments:

Post a Comment