Jump to content
  • Advertisement
Sign in to follow this  
Acharis

Roads (connection between villages/cities)

This topic is 1667 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

mapofprovinces6-roads_zps6e8ddb4d.png

 

The question is partially artistic (very important! it should look reasonably good & clear) and partially design.

 

A small island country, you see villages, some cities and ports. I want to implement roads system (built by the player). Note that the exact placement of villages (nodes) is FIXED (the player only decides what is there (in a "map slot"), not where exactly it's placed on the map), so I (as a designer) can deal with some problems by proper map construction if needed.

 

How to make the road system (both graphical and interface)?

 

The first idea is to make some "build road" option after clicking on any village/city which would show DESTINATION ("neighbour" slots/villages/cites/nodes only) and by clicking you can build/upgrade a road/railroad. Also, my though is that maybe it should not be allowed to join any village with any village because it would look very messy (crossing of roads), so maybe some "distance limit" for the build road feature?

Share this post


Link to post
Share on other sites
Advertisement

I'd make an overlay with a greyed-out or reddish color coding of where you can build roads. For the purpose of keeping it open, some of these roads should not directly connect to other cities, but to "hubs". When creating the first road that connects two cities, make the hubs appear as well, but make sure other roads connect using the same hub (avoids visual clutter).

Should be fairly simple to implement that way.

Share this post


Link to post
Share on other sites

As Orymus3 said, hubs are a valid idea. Let's look at this - several villages are able to connect to one bigger town that will act as a region capital. Each village can have a direct connection to the other and must have a connection to the region capital, be it direct or through another village. From that point, you can connect region to region with the connection points being the corresponding region capitals. A village in one region cannot have a direct connection to another village in another region. The way to get from that one village to the other should be through the region capital.

There are other ways to solve this problem as well. I would strongly suggest you look into some graph theory. With a proper understanding of graphs you should be able to solve a big lot of logistics problems as graphs are the actual thing used for real world road works and logistics.

Share this post


Link to post
Share on other sites


The first idea is to make some "build road" option after clicking on any village/city which would show DESTINATION ("neighbour" slots/villages/cites/nodes only) and by clicking you can build/upgrade a road/railroad. Also, my though is that maybe it should not be allowed to join any village with any village because it would look very messy (crossing of roads), so maybe some "distance limit" for the build road feature?

 

My suggestion to limit nonsensical road construction is relying on the Delaunay triangulation of village locations: allow roads that are an edge of the Delaunay triangulation, and forbid all others.

It seems that you are able to move, add and delete villages during initial map creation to obtain a nice Delaunay graph (with appropriate numbers of neighbours, sufficiently uniform edge length, etc.)

Share this post


Link to post
Share on other sites


There are other ways to solve this problem as well. I would strongly suggest you look into some graph theory. With a proper understanding of graphs you should be able to solve a big lot of logistics problems as graphs are the actual thing used for real world road works and logistics.
One important thing, it is the PLAYER's job to solve these logistic problems :D That's where the fun is (how to lay down the road system properly).

 

That's why I'm not so fond of hubs... It's the player that should "invent" that there should be hubs (or maybe if there should be not in a particular map). The system should allow the player to have fun with laying down these roads, optimizing what route would make most sense and so on.

 

With hubs it's trivial (no decision to make), all neighbouring villages are connected to the nearest city and that's it, all you can do is upgrade these roads.

 

Delaunay triangulation
Interesting... So, are you saying I should limit the connections the player can build so no crossings are allowed? What if the player made a mistake and can't connect one village (easily) due to already existing routes that obstruct it? Does it mean there shoudl be allowed deletion of roads maybe? And above all, do you think the "no crossing rule" would be fun? Or maybe "build as you wish" (with exception to distance limiter - max length of a single road) would be more enjoyable?

Share this post


Link to post
Share on other sites

I think a single crossing per road wouldnt look too bad if you make it so that they always cross relatively perpendicular to each other (you could even make it be a perfect square angle crossing if you did some fancy curve based roads)

 

Or some sort of tunnel where there is a crossing so that the roads wont overlap.

Share this post


Link to post
Share on other sites

 


There are other ways to solve this problem as well. I would strongly suggest you look into some graph theory. With a proper understanding of graphs you should be able to solve a big lot of logistics problems as graphs are the actual thing used for real world road works and logistics.
One important thing, it is the PLAYER's job to solve these logistic problems biggrin.png That's where the fun is (how to lay down the road system properly).

 

That's why I'm not so fond of hubs... It's the player that should "invent" that there should be hubs (or maybe if there should be not in a particular map). The system should allow the player to have fun with laying down these roads, optimizing what route would make most sense and so on.

 

With hubs it's trivial (no decision to make), all neighbouring villages are connected to the nearest city and that's it, all you can do is upgrade these roads.

 

You've got a point. However, if the player is to be free and as creative as he/she wants, then you always have the possibility of having messy logistics. Having the clean roads would imply restriction, at least to some degree. In that sense, you can maybe combine some stuff ? Since you do have the village positions preset, you can, as LorenzoGatti suggested, limit the crossings to a certain ammount. If you have designed the villages to be structured into a closed graph with the sufficient ammount of weight on each village, as a point, you should be able to build a road from any one point A to any one point B in the same graph. That does imply though that these connections are not going to be direct most of the time and that you will most probably need to go through a point C in order to reach point B. In that case, the road might not be as efficient as possible, however it will exist. By doing so and having the ability to cross an N ammount of times (N being the number that suits your needs), you should be ok and have a somewhat not ugly logistics system, without limiting the player too much and without having separate villages isolated.

Edited by ivan.spasov

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!