[Suggestion/Add-on] Road Generation
firemaster1294 opened this issue ยท 1 comments
As highways and subways are currently implemented, they follow logical, simple stepwise pathing that is highly predictable. I personally find this to be a little too predictable. I'm thus suggesting an addition (possibly as an add-on) that would generate pathing between cities at predefined intervals. The biggest catch here would be knowing where the next city was going to be and thus generating the road appropriately. Here's how I imagine this could work:
- Player discovers a city
- Mod immediately determines if the city should have a road (or not) based on RNG/predetermined (such as based on coords)
- If location has a road, begin searching for the next closest city. This search format could be specified in a config to be linear (along an X/Z axis), in a circular search of every chunk (computationally expensive), or through a simplified search where it doesn't check every chunk but assumes a minimum city size.
- When the city is found, the mod then determines an approximate path and stores that info for generation of those chunks
- When a chunk is loaded, the mod will "paint" the road onto the surface of the world to try and connect as best it can along the path that was predetermined, ensuring gradual elevation change.
- However, this is where things get interesting: if the surface doesn't connect in a gradual fashion (ie. a massive hill), the mod will look further down the path to find one of two things. Either it will find a point that it can generate a gradual slope upwards to via small amounts of terrain modification (possibly as a tunnel or by forming a small valley), or it will tunnel completely through the obstacle to reach the other side, again at a reasonable change in elevation.
- To make things more interesting, the mod could look for pathing around any terrain within a couple chunks that would allow it to reach the desired elevation and location - thus allowing the road to "go around" hills.
I don't know how computationally expensive this add-on would be, nor do I know if road generation would need to look at general height mapping when plotting the route. I suppose you could run road generation all at once and have it all ready to go when the non-surface portion of the chunk is generated later on, thus resulting in one initial lag spike but then not much afterwards. I guess this would also mean the discovery of a new city might need to load "pseudo-chunks" of surface level information. I don't know if this is possible, but Distant Horizons seems to have figured it out. I suppose you might also need to treat the surface as whichever blocks are stone/grass/snow to avoid any sky-island conundrums with Tinkers' or other mods that generate sky structures.
To further customize this add-on, this feature could allow for roads to be completely generated out of grass paths, concrete, or any form of pre-defined pieces per the current modification system. You could even have specifications of minimum blocks needed per 1 block height change. This would create much more gradual slopes. Roads could also have set heights, allowing them to go underneath trees. In theory you could try to have it automatically avoid removing trunks if possible, but that seems excessive. And yes you could also have a fancy archway at the entrance to each city or possibly have guardrails down the side of these roads.
All in all, this is just a crazy suggestion I thought of and I thank you for reading to this point if you've reached here. I look forward to hearing any insight/comments about just how absurd and impossible this idea would be!