Roads of Daggerfall

Show off your mod creations or just a work in progress.
Post Reply
meritamas
Posts: 58
Joined: Sun Apr 07, 2019 6:16 am
Location: Slovak Republic

Re: Roads of Daggerfall

Post by meritamas » Sat Jun 08, 2019 5:49 am

Let me join the crowd. I also think a road-system would greatly improve the game and I am rooting for you to succeed with a viable implementation. A few comments by others that I like and few of my own.
alephnaught wrote:
Wed Mar 13, 2019 12:19 am
If roads were implemented, there's the potential for further use of procedural techniques to generate POIs along major routes (say, inns at crossroads, random shacks with bandits and loot, shrines etc) which would add yet more life and realism to the game world, and provide the player with reasons to actually explore. [...]
charlieg wrote:
Wed Apr 17, 2019 10:26 am
That's a good idea. Would also make it easy to e.g. add signs to show where a road leads.

I couldn't agree more. Though most of them are longer than I would like to quote here, I also like jayhova's comments because, if implementable, his suggestions might be the best solution available.
jayhova wrote:
Fri Apr 12, 2019 6:53 pm
I'm not a developer. I'm a guy who has read a bit on ancient roads and how and why they were built.
Skipper wrote:
Tue Apr 16, 2019 6:39 pm
Keep in mind, the game is not real, and it does not have to follow most of real rules.
Also, you want to keep an algorithm as simple as possible, getting somehow believable result at the same time.
Throw away everything, except few rules that make sense for a game and fit into it.
1. Roads connect places. This is good rule. It fits into game concept and allows to explore the world without need to constantly check your map. You just follow a path defined by road and you end up somewhere - a city, or other settlement type, or ruins, or tomb, or camp, whatever point of interest you want.
2. There should be various roads (not many types), e.g. stone roads between big cities, dirt roads leading to smaller settlements, and abandoned variations of both types for ruins and wild, secret or hidden places.
3. Roads cross each other sometimes. Period.
4. Roads are not straight lines, for various reasons. And, human's eye likes when roads are constantly wriggling, it gives more natural look to roads.
I think the rules skipper outlined and jayhova's original suggestions actually do not contradict. I would appreciate jayhova's take on what Jay_H suggested in his 17 April 2019 post.
Jay_H wrote:
Wed Apr 17, 2019 5:24 am
Here's a quick drawing of a hub-and-spokes model for roads.
I am not sure how much the end result would differ. If there is just a little difference and it is a lot easier to implement (or to run the calculations for that matter), I would go the easier route, cause having a bit awkward roads is still better than having no roads at all.

If the problems is mainly that the algorithm yielding acceptable end results would take too long to compute on the map of DF, then perhaps the best way to go would be to make use of the computing power of the human brain first and then use algorithms to work out the details.
I mean there cannot be that many great population centers. As a first step, someone might manually go through these and see which ones should be connected by road independently of their other connections. We should refrain for excessive road-building. Building roads is expensive, so I think there should only be a few long high quality roads. If some two places are connected by water, then no point in adding a road - people would have just shipped their stuff via ships (small pun intended). This might make most of the inter-province roads unneeded.
So you have established which big places should be independently connected by road. Fine. Now, run an algorithm to calculate where these roads would be - one by one. There should be no need for many iterations, so we can afford to have a computationally demanding algorithm for this. This algorithm should make use of jayhova's suggestions, mainly about inclines and declines and computing the route commerce would actually take to reach place B from place A (perhaps even considering going past other settlements in the process - like if a steep decline is penalty than going past an actual settlement is a negative penalty). I wouldn't worry about turns and bends. If there are realistic enough hills on the map, this algorithm will generate the turns and bends pretty much like actual road-builders.
If the algorithms used presently are good approximations of the above, then I don't want to complicate things, go with those that you are using. I just cannot judge if this is the case. But you can, so just disregard my suggestion if it is redundant.
Thus, the backbone of the Daggerfall road network could be formed. Then, go by province to province (or even pick smaller sub-regions) to get every place that we want connected to the network actually connected. The algorithm used here should differ form the former one in that it would be designed to find the cheapest way to connect to the existing road network not to a given point. It takes more computing power to do so, but we'd only need to run it on a much smaller portion of the map. Ports should automatically be considered to be a part of the network so nearby settlements without any nearby roads would try to connect to these. This two step approach should yield results that are realistic enough and take much less computing power in comparison to any one algorithm used on the map as a whole. Perhaps a three step approach could also be considered if two steps are not enough.

Sorry if this suggestion is just a repetition of something that is already common thought, but having read the thread from its beginning, it was not obvious to me if this is the case. Better have it twice than not have it at all.
At this point, I aim to improve DFU by formulating ideas and working out some details of how things could work better.

User avatar
jayhova
Posts: 581
Joined: Wed Jul 19, 2017 7:54 pm
Contact:

Re: Roads of Daggerfall

Post by jayhova » Sat Jun 08, 2019 8:51 pm

It might be helpful to discuss the qualities that make a real road. Bear in mind that roads are constructed like buildings. In fact a road is almost exactly like a building foundation made very long and narrow.

Roads have a distinctive shape. This shape is determined by the terrain the road crosses. I have a piece of software called campaign cartographer. It's used to draw fantasy game maps. It uses fractal geometry to draw roads. You might think oh that's it, just use fractal geometry and poof realistic roads. Nope that won't work. CC draws roads on a flat plain and uses fractal geometry to simulate navigating a 3D environment.

This is the problem. If you have existing geometry you MUST create roads that take that geometry into account the same way as if you were placing rivers. Rivers don't go over hills and neither do roads. So straight roads are unrealistic. Obvious geographic obstacles must be dealt with.

The second thing roads have to contend with is geographic variations in suitability for road construction. You cannot build a road on a muddy plain or through a swamp. Your road must be laid on a surface that both allows for construction. A rocky outcrop would be difficult to construct a road through. Most times it would be simpler to go around. Sometimes not. Non-obvious terrain problems must be dealt with.

This brings us to the third thing. Since roads are constructed like buildings they are governed by economics like buildings. Let's take the outcrop of rock. Would it be cheaper to burrow through 800 ft of rock or build an extra 1.5 miles of road. If the cost is near the same, the engineer will choose the shorter path. One should also bear in mind that if this particular road is a military route, the empire might pay a premium to insure a more expedient path. Related to this is the fact that roads are not built to allow travel. Roads are built to promote commerce and enable to movement of goods, services and in the case of the military establish supply lines and transport equipment. The ability for the common folk to travel on roads is merely a side effect. Every mile of road must justify itself economically.

Forth, roads are constructed on a case by case basis often decades or centuries apart from each other. This is important to remember. Large settlements will tend to have the oldest and best roads. What is the first road a settlement will construct? Most likely to its closest neighbor. But this is only really true if that neighbor is quite close and has the most economic benefit. Roads are always build on an investment/return basis. A road to a settlement a short distance away will start paying for itself quicker, however a road twice as long to a settlement five times as large is likely to be built first. This is because the road will likely be built in the same amount of time as the first as both settlements will contribute to the construction. The construction of very long roads to very distant cities will tend to wait simply because organisations such as the merchants guild are unwilling to invest the large sums of capital to make this happen.

There are two exceptions to the above case. Port cites and cites with exotic goods are willing/able to invest much more capital in constructing roads to locations that provide additional commerce. The silk road is an example of this. The other exception is the establishment of routes of Imperial importance.

Fifth, roads are only useful if they allow the movement of goods. To allow this roads must maintain a relatively even grade. Typically this grade is somewhere around 1 in 30. This means for every 30 units of road the elevation of said road should only change one unit. However, 1 in 30 is not anywhere near ideal. A grade of one fifth of this is considered virtually indistinguishable from level due to any differences being lost in the roll resistance of a wagon across a road. A short grade of 1 in 20 might be allowable if it is for a short distance and it avoids a much longer path.

Over time city states and the larger settlements in their provinces will establish networks of roads that join together.

To summarize.
  1. Roads are only as straight as obvious terrain features allow (hills, valleys ravines, rivers, etc.)
  2. Roads are only as straight as non-obvious terrain features allow (quality of ground to be built on)
  3. Roads have a economic cost and must be paid for with a return on investment. Roads are built to be as short as possible without imposing a substantial economic penalty.
  4. Roads are, often, not planned in a uniform way and are constructed generally, one at a time, decades or centuries apart. New roads join old roads.
  5. The path that a road must follow is limited by the grade. The economic viability of a road is limited by this. Steeper grades limit the use of fewer/heavier wagons carrying more goods. This may eliminate the ability to transport goods like refined iron, etc.
Remember always 'What would Julian Do?'.
Windows 10 Pro 64 bit. DFU Ver. PreAlpha 0.8.6

User avatar
jayhova
Posts: 581
Joined: Wed Jul 19, 2017 7:54 pm
Contact:

Re: Roads of Daggerfall

Post by jayhova » Sat Jun 08, 2019 9:13 pm

The above might look unnecessarily over complicated. Unfortunately, as people we really know what roads look like and faking it just doesn't work.

Let us for a moment assume you needed to create an algorithm for making houses. How would you go about doing that? You could just have a random shape with doors, windows and a roof on top. You would have to take into account things like the inside matching the outside, fireplaces having chimneys, the place having a food prep area, etc. If you did not implement an algorithm that made a house that followed the rules it simply would not look like a house.

Roads are not all that different. We don't think about the rules they follow but they do follow them and it will be obvious when they don't. While I'm not trying to rain on anyone's parade, a road that follows the above rules will look like a real road.

A road that is simply a straight line between settlements will look very odd as it goes up and down at a 45 degree angle or slants sideways. A road with a fractal algorithm to give it a realistic winding appearance will look very odd when applied against completely unrelated terrain. Cities with single roads going out to all surrounding settlements will look like a series of firework busts.

Roads are built for a specific purpose in a specific way.
Remember always 'What would Julian Do?'.
Windows 10 Pro 64 bit. DFU Ver. PreAlpha 0.8.6

meritamas
Posts: 58
Joined: Sun Apr 07, 2019 6:16 am
Location: Slovak Republic

Re: Roads of Daggerfall

Post by meritamas » Sun Jun 09, 2019 6:36 am

As I have said, I like your ideas.
The question now is: do we have a way to make it happen? (preferably without exerting 100x the effort in comparison to an inferior alternative)

If so, it should be done. If not, we'll have to settle for something less good or for no roads at all?

I see this as possible great improvement to DFU and would even be willing to put my magic things aside for a while if I can help. It would be good if we could define what resources we have (like in what format and resolution can we access the height-map) and what kind of output are we aiming for (I mean practically, what format the data should have in the file we are generating).

E.g. for a first step, I was considering printing out a large, detailed map of the Illiac Bay, with color denoting the height and with circles for population centers - the bigger the population the bigger the circle. If we saw a map like that, having the guidelines you just set out in mind, we could look at it for a while (possibly sleep on it a couple of times) and suddenly, some possible solutions would emerge, seemingly out of nothing - this is how our brain works. Or maybe they wouldn't. But I think it would be worth to try. Most likely we can only come up with which cities we want to connect to which other cities and where the road could roughly be built. Then an algorithm could improve on that.
This first manual step would also be good for anybody to judge a particular algorithm. If the algorithm generates something similar to what a human would think of, it's probably good. If it generates something fundamentally different, and once you have seen it, you think: 'why didn't I think of that?', it's probably good. But if it generates something completely different and you see it as a bad solution, it most likely is a bad solution.

And after we have the first, most ancient roads, we could continue to think about how to connect everything else to the network. Ideally with the same algorithm just with different parameters. We could even have more iterations than three.

When it comes to required computing performance. If we want to accommodate mods that can alter some terrain features, we'd need to have an algorithm that can run in a couple of minutes on an average PC. If we settle for generating the roads of the original DF map and supplying it to the users as a datafile, we can have a much more demanding algorithm (like one that runs for a day or even a week on a regular computer) or if anyone has access to a supercomputer, we could go even more hardcore.

UPDATE:
I'm seriously thinking about doing this first step: creating a large, detailed map of the Illiac Bay, with color denoting the height and with circles for population centers - the bigger the population the bigger the circle. Just to see how it would look like.
I've seen some references in Interkarma's post from a long time ago on how to get the data on locations and how to interpret them. I'll be taking a look. Hope works with today's code too.
At this point, I aim to improve DFU by formulating ideas and working out some details of how things could work better.

Tejal579
Posts: 1
Joined: Mon Jun 10, 2019 4:03 am
Location: Pune
Contact:

Re: Roads of Daggerfall

Post by Tejal579 » Mon Jun 10, 2019 4:07 am

That seems like a great update!!!

User avatar
King of Worms
Posts: 2179
Joined: Mon Oct 17, 2016 11:18 pm
Location: Scourg Barrow (CZ)
Contact:

Re: Roads of Daggerfall

Post by King of Worms » Mon Jun 10, 2019 10:16 am

Agreed, way to go Meritamas

User avatar
jayhova
Posts: 581
Joined: Wed Jul 19, 2017 7:54 pm
Contact:

Re: Roads of Daggerfall

Post by jayhova » Mon Jun 10, 2019 12:10 pm

meritamas wrote:
Sun Jun 09, 2019 6:36 am
As I have said, I like your ideas.
The question now is: do we have a way to make it happen? (preferably without exerting 100x the effort in comparison to an inferior alternative)

If so, it should be done. If not, we'll have to settle for something less good or for no roads at all?
I'm sorry if I am belaboring the point. Really I was writing to get the ideas straight in my own mind as much as anything else. My own thinking seemed to myself to be a bit muddled and I wanted to separate concepts out so they could be more clearly defined and understood. I am definitely the wrong guy to ask 'how do we code this?'. What I can tell you is that a hiking trail can't simply be paved and become a road. This is especially true if you will need to drive a load of wrought iron bars down that road.

Height code in DFU does not seem to totally match classic. Perhaps it's just me but I seem to recall seeing classic play-throughs where the PC walked to Gothway Garden from Privateers Hold and the terrain was relatively level. I'm wondering if the original interpreted the terrain differently than DFU. Can anyone confirm this?
Remember always 'What would Julian Do?'.
Windows 10 Pro 64 bit. DFU Ver. PreAlpha 0.8.6

User avatar
pango
Posts: 1404
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: Roads of Daggerfall

Post by pango » Mon Jun 10, 2019 2:05 pm

jayhova wrote:
Mon Jun 10, 2019 12:10 pm
Height code in DFU does not seem to totally match classic. Perhaps it's just me but I seem to recall seeing classic play-throughs where the PC walked to Gothway Garden from Privateers Hold and the terrain was relatively level. I'm wondering if the original interpreted the terrain differently than DFU. Can anyone confirm this?
Yes, quoting @Nystul:
"I managed to get some interesting insights into vanilla daggerfall's handling of height data:
First it seems to use all of the 5x5 pixels of the noise map in a straight forward way (and only the noise map and it seems to ignore the altitude map completely)."
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

meritamas
Posts: 58
Joined: Sun Apr 07, 2019 6:16 am
Location: Slovak Republic

Re: Roads of Daggerfall

Post by meritamas » Mon Jun 10, 2019 3:23 pm

Let's just quickly go through the last summary to learn some of the data we would need in order to take into account your suggestions.
jayhova wrote:
Sat Jun 08, 2019 8:51 pm
  1. Roads are only as straight as obvious terrain features allow (hills, valleys ravines, rivers, etc.)
  2. Roads are only as straight as non-obvious terrain features allow (quality of ground to be built on)
  3. Roads have a economic cost and must be paid for with a return on investment. Roads are built to be as short as possible without imposing a substantial economic penalty.
  4. Roads are, often, not planned in a uniform way and are constructed generally, one at a time, decades or centuries apart. New roads join old roads.
  5. The path that a road must follow is limited by the grade. The economic viability of a road is limited by this. Steeper grades limit the use of fewer/heavier wagons carrying more goods. This may eliminate the ability to transport goods like refined iron, etc.
We would need a somewhat meaningful height-map as mentioned earlier. This should allow us to include hills etc in the calculations. This should be derivable from game data because the game needs a way to determine how high a given point is so we could use the same data and apply the same method. Thank you pango for the information and the link. What is needed is how DFU calculates heights.

I'm not sure what data we could use to account for possible rivers and the non-obvious terrain features. Any suggestions?

The economics could be taken into account much like jayhova already suggested. There should be a cost that is calculable for a given road. There should be some quantity of roads a given settlement would be able to 'finance' based on size and perhaps other factors. So there is a need to access the size or headcount of the settlements.

The algorithm should construct one road at a time and take account of and improve on already existing infrastructure. The 'cost' of connecting place A to place B calculated by the algorithm should be less if some of the road needed was already there. So perhaps the length you need to travel ends up longer but there might be savings on the construction costs that outweigh this. A good formula to weigh these against one another. (No additional game data needed to do this.)

There should be a high cost applied in case of steep grades. The data needed here should already be there. The grade should be calculable from the height data of the neighboring points. I would appreciate it if someone could link some other threads here with relevant information - even distantly related topics could include good hints.

The more I think about this the more I get the feeling that we are talking about algorithms with massive computation costs and quite some time to develop and implement. I don't see that as a reason to quit but rather as a challenge. I'll take a look on some of the algorithms mentioned years ago how they work maybe get some inspiration.

Right now I am struggling to get Unity to work on my computer - I'll look at some of the tutorials and howtos...
I am planning to study the information available and post an update here shortly after 20 June.
At this point, I aim to improve DFU by formulating ideas and working out some details of how things could work better.

hedgelord
Posts: 5
Joined: Fri May 31, 2019 5:50 pm

Re: Roads of Daggerfall

Post by hedgelord » Mon Jun 10, 2019 7:50 pm

@hurleybird thanks a ton for the source code, it's helping a lot! I've already noticed a couple problems (I forgot to sort the roads by length, for one).

There's still some problems but it's getting better. The big issue I have right now is that if we have two clusters of towns next to each other, we end up with a lot of parallel roads next to each other.
Image

It looks like this thread is getting more active again, so that's good to see! As far as making the roads realistic, like jayhova was talking about, I think it's best to look at the connection generation and actual road generation as two separate steps. After we establish which towns/locations should be connected by roads, we can feed each connection into another algorithm that will make a nice/realistic road that takes other features into account, like the heightmap.

Post Reply