WIP: Basic Roads

Show off your mod creations or just a work in progress.
Post Reply
User avatar
Hazelnut
Posts: 3014
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

WIP: Basic Roads

Post by Hazelnut »

So having observed the large Roads of Daggerfall thread for 3 years, it seems like a good roads system for DFU is a way off still. It's a hard problem to solve certainly, and not one I intend to tackle. I tend to take a different approach to stuff which is working out what is the simplest thing that will work. I had this idea when I was migrating the terrain generation code to the Unity Jobs system a year and a half back and decided to try it out last week to see how well it worked.

The idea is to have a single byte for each map pixel of the Daggerfall world indicating which of 8 directions a road leads out of the terrain, then modify the terrain texture code to paint roads in each marked direction from the centre. This has a negligible performance hit as it simply runs during the normal tile assignment, so should make no appreciable difference to terrain generation speed so still allowing time accelerated travel at the same rate etc. There's a new road flattening code module in the generation path to smooth the roads a bit, and that will have a minor performance impact.

I've implemented this, and while very simple, it actually works really well in-game. The biggest issue with this method is that where the roads intersect locations, they don't always line up with the city gates etc. I've taken a very simple approach to solving this issue by encircling any location a road goes to with road - 2 wide for cities and 1 wide for smaller towns etc. This is not ideal, but is a compromise so that this simple scheme works.

Eventually I expect that a more refined roads implementation will be created, but for now we can use these simple basic roads. I considered seeding the path data from some of the work done by Meritamas on procedural generation, and then refine by hand using an editor. However, after creating the editor and trying it out I've now done 4 regions already... it's taken a few hours but was actually quite fun to do. For this reason I don't plan to seed path data, but will simply create all the paths using the editor by hand. To allow for crowd-sourcing this effort the editor creates a text file of the binary path data so others can make changes and send a PR to me and git should be able to merge in the changes. I hope anyway, since the lines in this text file are 2000 characters long it may not work.. we will have to see how it goes.

Here are some pictures of roads in game and the editor.
RoadCity.JPG
RoadCity.JPG (302.05 KiB) Viewed 10215 times
.
RoadIntersection.JPG
RoadIntersection.JPG (301.75 KiB) Viewed 10215 times
.
RoadEditorDF.JPG
RoadEditorDF.JPG (279.68 KiB) Viewed 10215 times
.
RoadEditorZoom.JPG
RoadEditorZoom.JPG (247.97 KiB) Viewed 10215 times
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
Hazelnut
Posts: 3014
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

WIP: Basic Roads - ready for community pathing!

Post by Hazelnut »

So, calling anyone who wants to path out roads for this mod - it's now time for you to have a go. You can now use the released v0.5 build with DFU 0.10.26. Regarding the roads I've already pathed - they need looking at in game, with focus on travelling to different locations and seeing if the road layout works well with the ground tiles / gate placement. If you find a small correction you can make to improve the paths, then please use the editor to make the changes and post here with before and after screenshots. I cannot merge the data files and will need to make the edits by hand from the screenshots.

Regions still remaining to be pathed:

Code: Select all

NONE! All done... at last. Phew.
You must follow these rules to path new regions:
  • Take great care and ensure you follow the instructions below by reading them very carefully!!
  • Be prepared that your work may not be used if I don't think it's good enough.
  • Don't path any regions not listed above, as I will not be able to merge it even if I wanted to.
  • Post the region you are going to path in this thread so others know and can avoid duplicating work. It's fine to path a region someone else is already doing if you want, I will merge the best work regardless of who posted first.
  • Take some time to study the existing roads and see how they're laid out and join up the cities etc. The more you do this, the less likely your work will be rejected.
Editor instructions:
  • Enable editing in the mod settings.
  • Load the game and open the console to type 'patheditor'.
  • When first loaded the editor will start with a copy of the binary road path data from the dfmod package. Changes you make will be written to a text file roadData.txt in StreamingAssets/WorldData folder. Note that it doesn't write the file until you make a change and say yes to saving when exiting.
  • The editor window is a modified extension of the DFU travel map, you can select regions and zoom with right click. (1600x1000 minimal resolution recommended)
  • There are buttons top left for roads and tracks - they will toggle the display on/off and if on when clicked will highlight to show you're now editing that type of path. (helps to not edit by accident)
  • Left click on map pixels to mark it as having a path of the type selected, and click again to unmark. An unconnected pixel with show as having all 8 directions until connected.
  • Paths connect to adjacent roads, and sometimes you will need to click different combos to get the layout you want. Cardinal directions are preferred over diagonals by the connecting logic.
  • Cities and Towns are shown as large squares, and these should generally be connected by roads. Bright large squares are cities which should generally have 3-4 roads leading away, dull large squares are towns that should have 1-3 roads leading away but usually 2.
  • Smaller villages and hamlets can be connected if a road is going close by and it looks okay in game. (depends on the blocks used) Generally prefer tracks for these.
  • Taverns can be connected by a road if the road is going that way.
  • Remember these are roads and have been constructed, don't go mad putting them all over, instead base the density on the city/town density of the region.
  • Try to avoid connecting any tombs, dungeons, homes, plantations or farms etc - but placing roads nearby is fine.
  • Tracks should be added once the main roads are in and connect all villages and towns. Okay to connect to temples, taverns and the odd fancy home, farm etc where it makes sense. No dungeons except for the tombs that are discovered by default when you start the game. (use the normal travel map with a new-ish character to check if you want to)
  • When you exit, you can save your changes or discard them.
  • If you can be diligent and check the roads coming into a city/town match the gates/ground tiles well that would be fantastic. For instance if changing an outgoing road from E to NE makes it closer to the gate and makes sense for the road layout please do it. (I haven't done this much myself, and am relying on people submitting corrections)
  • When you're done, post here or send me the StreamingAssets/WorldData/roadData.txt (and trackData.txt if you did tracks) along with a screenshot of the road layout from the editor. Then move the file somewhere else before pathing another region, as I may reject one but not the other.
  • Lastly, be creative and try to make the paths interesting - having different styles in different regions is a good thing, especially when it takes the population and climate etc into account.
Have fun!
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
WhiskeyTangoWoodElf
Posts: 14
Joined: Thu Jul 16, 2020 3:16 pm

Re: WIP: Basic Roads

Post by WhiskeyTangoWoodElf »

VERY COOL! I was hoping a project like this would pop up eventually. My only input would be to leave some kind of breadcrumb trail that 'slow-travel' modes like Tedious Travel can follow. Also, the markers can allow for changes in random encounters (less dangerous events) compared to the open wilds.

imsobadatnicknames
Posts: 371
Joined: Sun Jun 02, 2019 4:28 pm
Location: Colombia

Re: WIP: Basic Roads

Post by imsobadatnicknames »

Looks amazing! Can't wait until it's done.

Quick question, would it be possible to do this with several "layers" of different types of tile? Because if you could have a layer that adds road tiles and one that adds water tiles, I'm thinking this could be useful for the creation of rivers too!
Released mods: https://www.nexusmods.com/users/5141135 ... files&BH=0
Daggerfall isn't the only ridiculously intrincate fantasy world simulator with the initials DF that I make mods for: http://www.bay12forums.com/smf/index.php?topic=177071.0

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

Re: WIP: Basic Roads

Post by King of Worms »

This is epic :)

l3lessed
Posts: 1398
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Re: WIP: Basic Roads

Post by l3lessed »

I love the idea of using this for rivers. Could you use altitude data to figure out start points for the rivers? Aka, vast majority of rivers a formed from high elevation drops.
My Daggerfall Mod Github: l3lessed DFU Mod Github

My Beth Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

User avatar
Jay_H
Posts: 4059
Joined: Tue Aug 25, 2015 1:54 am
Contact:

Re: WIP: Basic Roads

Post by Jay_H »

I loaded up the editor and gave this a shot.

Image

Perfect? No.

Totally lifelike? No.

A huge improvement? Absolutely yes.

Trees utterly fail to spawn in the way, which makes these roads look very well-maintained. They look like they matter -- like Gothway Garden and Burgtry actually depend on commerce from one another. The placement is occasionally a little glitchy like in the third screenshot, but this is a huge step for realism in DFU.

User avatar
Hazelnut
Posts: 3014
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: WIP: Basic Roads

Post by Hazelnut »

Nice to have some feedback, thanks Jay. Did you try the editor?

Regarding the last screenshot, this occurs on diagonals where it crosses over from one map pixel to the next. I could prevent it with some more code I think, but wanted to see how it felt to people in game first. Someone mentioned that roads may be damaged in places and this could represent that. The worst part is that trees etc can spawn at these points, so I probably will see what i can do to fix it.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
Ralzar
Posts: 2211
Joined: Mon Oct 07, 2019 4:11 pm
Location: Norway

Re: WIP: Basic Roads

Post by Ralzar »

Hm, one thing that strucvk me: Would it be possible to have different road types for different climates? The grey stone roads look fine in daggerfall, but would look odd running through the desert...
I'd almost say the desert climates generally shouldn't have roads?

User avatar
DigitalMonk
Posts: 111
Joined: Sun Nov 10, 2019 8:01 pm

Re: WIP: Basic Roads

Post by DigitalMonk »

WhiskeyTangoWoodElf wrote: Sun Aug 09, 2020 11:56 pm My only input would be to leave some kind of breadcrumb trail that 'slow-travel' modes like Tedious Travel can follow.
Cheesy thought for anyone wanting to mod Tedious Travel:
  • If the pixel you're in doesn't have roads, use existing "straight towards the marker" logic.
  • If you are in the pixel with the target destination, just head straight towards it (otherwise you might endlessly circle it on the "moat road" ;) )
  • If the pixel you're in has roads, and at least one road direction is < 130 degrees of the direct path, follow it. (That's tight enough to accept 5 out of 8 possible paths for any exit direction, allowing detours but not total backtracking. Probably require tuning and/or user setting. )
  • If the pixel you're in has roads but only going the wrong way (ie, prior step didn't accept them) then leave the road and head cross country using existing logic.
That sounds reasonable in my head, but there is the question of actually travelling ON the roads as opposed to just "in the same direction" as the roads. That requires finer location logic than the above, obviously. I assume that the current position's texture type can be queried... If so, maybe just change all of the above "if the pixel has roads" conditions to "if the pixel has roads AND your current ground texture is road".

(Sorry if I'm rambling... Been travelling, and I'm currently in Monday morning mode. But I think what Hazelnut has already provided should be enough information for Tedious Travel to make a reasonable stab at road usage without additional markers.)

I look forward to a second byte that works the same way, but denotes "worn paths", which could be used to branch off to villages and farms and such... Would complicate the editor a bit.

Post Reply