# Topic: main roads becoming normal again

 king_of_nowhere Joined: 2014-09-15, 18:35 Posts: 1527 One Elder of Players Posted at: 2015-04-24, 20:52 I've noticed that sometimes a main road (one with a donkey or ok or horse) will randomly become a secondary road again.I say "randomly" because I supose that is dependent on the traffic, but in a straight road with no junctions (so every piece of the road has exactly the same traffic) there willl be some roads becoming main roads and some not, without much apparent meaning. If necessary, I can send a replay, but I forgot how to do a bugreport. Top Quote kaputtnik Joined: 2013-02-18, 20:48 Posts: 1810 One Elder of Players Location: Germany Posted at: 2015-04-24, 21:57 Which road becomes a busy road depends on the wares that lies on the flags and could not be carried because the carriers are busy with carrying other things. So a short road, where the wares are carried fast from flag to flag, becomes not as soon a busy road as a little longer road (where wares lies a bit longer on the flags). If you have a road splitted into 2 sections with flags, and one section of this road has f.e. a slope, or is a bit longer, the wares lies longer on a flag and this road becomes earlier busy as the other section. The number of carried wares are for both sections the same, but on one section the wares lying a bit longer on the flags (this section becomes busy, the other section of the same road will be still a normal road). A turn from busy road to normal road is difficult to reach. The comment of the code says: ``````If m_busyness drops below a limit, release the donkey. remember that every time a ware is waiting at the flag m_busyness increase by 10 but every time a ware is immediatly acked by a carrier m_busyness is decreased by 1 only. so the limit is not so easy to reach `````` Edit: This is a typical difference between a logical and an optical view. Logical it is absolute ok, but optical it is disturbing Edited: 2015-04-24, 22:05 Top Quote wl-zocker Joined: 2011-12-30, 17:37 Posts: 494 Tribe Member Location: Germany Posted at: 2015-04-25, 09:56 I want to add that not only the slope influences whether a road stays busy or not, but also if wares are transported in both directions: Imagine a west-east road. On a road segment (i.e. the part between two flags), a ware from east may arrive, but both carriers are carrying wares from the west to the east, so this ware has to wait. When it is transported further, on the next road segment, there is a carrier that has nothing to do (because therer are currently not so many wares that need to be transported from west to east), so he can pick up that ware immediately. Thus, `m_busyness` changes in a different way for both segments. "Only few people know how much one has to know in order to know how little one knows." - Werner Heisenberg Top Quote king_of_nowhere Joined: 2014-09-15, 18:35 Posts: 1527 One Elder of Players Posted at: 2015-04-25, 11:37 I am not sure demoting a road is a good thing. some roads hhave only occasional traffic with longer periods of inactivity otherwise, but on those occasions you need the donkey. Top Quote einstein13 Joined: 2013-07-29, 00:01 Posts: 1107 One Elder of Players Location: Poland Posted at: 2015-04-25, 13:59 king_of_nowhere wrote: I am not sure demoting a road is a good thing. some roads hhave only occasional traffic with longer periods of inactivity otherwise, but on those occasions you need the donkey. That is definatelly true. For example where you have map with ships But the good thing abuout demoting is that if you conquere lots of territory, you don't have to think about old roads- they will demote automaticly and your economy (donkey eco) will not be overloaded. einstein13calculations & maps packages: http://wuatek.no-ip.org/~rak/widelands/backup website files: http://kartezjusz.ddns.net/upload/widelands/ Top Quote king_of_nowhere Joined: 2014-09-15, 18:35 Posts: 1527 One Elder of Players Posted at: 2015-04-25, 16:36 well, then I think the current algorithm is failing at its intended purpose. First, I never saw anything like a lack of donkeys. they are cheap and they last forever. demoting roads can save you at most a dozen wheats in a small map, some more in a large map. absolutely trivial. Second, most important: the algorthm as described by kaputtnik is actually encouraging inefficient roads: let's suppose that a road has enough traffic to require 1 and a half carriers: it will be slow, and accumulate m-business points. when it gets a donkey, it becomes fast; and then every ware that passes through it is lowering its value. eventually, it will again go back to being a secondary road, and it will be slow again. That's not how it should be. A road where the wares don't have to wait at the flag is an efficient road. You want to keep it that way, not demote it. Third: a road carrying moderate traffic will be demoted faster than a road carrying no traffic. because if absolutely no ware is going through that road, the m-business is never decreased. So the algorithm you actually have is encouraging roads to be inefficient. I understand if you want to keep some way that main roads could become secondary ones again, but I definitely suggest changing mechanism. Possible suggestions are: 1) for decreasing m-business value, don't use wares on flags. use instead time and wares transported. Say, for example, that for every minute a road is not using the donkey, it gets a -1. And for every minute in which the donkey is actualy used it gets a +1. that is a way to count whether the secondary carrier is actually needed or not. That second part is important, because it counts whether the wares would have had to wait if there had been no donkey. Either that, or run some kind of carrier inactivity count, which would mostly be the same thing. 2) Do not demote any road if: economy does not need donkey. Top Quote kaputtnik Joined: 2013-02-18, 20:48 Posts: 1810 One Elder of Players Location: Germany Posted at: 2015-04-25, 17:19 king_of_nowhere wrote: well, then I think the current algorithm is failing at its intended purpose. I don't think so. It's not failing it's just behave different than a player (including me) thought of. In General the code do his work... Second, most important: the algorthm as described by kaputtnik is actually encouraging inefficient roads: let's suppose that a road has enough traffic to require 1 and a half carriers: it will be slow, and accumulate m-business points. when it gets a donkey, it becomes fast; and then every ware that passes through it is lowering its value. eventually, it will again go back to being a secondary road, and it will be slow again. You say it: eventually. That's not how it should be. A road where the wares don't have to wait at the flag is an efficient road. You want to keep it that way, not demote it. Many roads get heavy traffic only for a relative short time. f.e. if you want to get a ware from one warehouse to another. After this transportation is done, the busy roads gets "only" normal traffic. Why should they stay as a busy road? Third: a road carrying moderate traffic will be demoted faster than a road carrying no traffic. because if absolutely no ware is going through that road, the m-business is never decreased. Yes, i stumbled over this once and was wondering why the hell the road don't demote... Earlier i thought that the changing of roads is time/wares related, just as you suggest. I think a time related change of roads isn't possible, or result in huge processor usage: Maybe i am wrong, but i think you then need a timer for each section (the piece between two flags) of a road. If you think about how many sections of roads are in a map, you could imagine how many timers you will need. A developer should correct me if i am wrong. Possible suggestions are: 2) Do not demote any road if: economy does not need donkey. This could be done i think. Top Quote king_of_nowhere Joined: 2014-09-15, 18:35 Posts: 1527 One Elder of Players Posted at: 2015-04-25, 20:13 I agree that a road that only got traffic for a short time could be demoted (from a gaming perspective it makes almost no difference cause the cost of the donkeys is minimal, but it looks good, and if I understand the creators, making a nice setting is as important as anything else). I am merely stating that the criterion to decide the demotion should not be that the road is working efficiently, but that the donkey is not employed. I realize that making a counter for every road could be processor-consuming. Maybe the programmers could find a better solution. I can propose that maye an alternate algorithm would be that whenever a ware is carried on the road, if the carrier (or donkey) finish the transport before another ware has been placed on the flag, then the roadd gets -1. not perfect, still has the paradox that a road without traffic never gets demoted, but still better than actual algorithm, as it measures the fact that the secondary carrier is redundant. Top Quote GunChleoc Joined: 2013-10-07, 15:56 Posts: 3159 One Elder of Players Location: RenderedRect Posted at: 2015-04-25, 20:14 Maybe we could have a global timer that goes through all the donkeys once in a while? This would be less work than checking all the roads. Busy indexing nil values Top Quote kaputtnik Joined: 2013-02-18, 20:48 Posts: 1810 One Elder of Players Location: Germany Posted at: 2015-04-26, 12:06 Maybe we could have a global timer that goes through all the donkeys once in a while? This would be less work than checking all the roads. Busy roads mustn't have a donkey. So only checking the donkeys isn't enough. But maybe a carrier can get a timestamp, if he is out of work. A function could go over all carriers and compare the carriertimestamp with current time and all roads depending on currentTime - carrierTimestamp > 500 (or so) should be turned into a normal road. For me there is another thing which i am not satisfied of: Currently the code to change the roadtype acts only on sections of roads. As a result we have roads where one section is busy and the other one is till normal. As mentioned above from a logical way it is absolute ok, but not from an optical view. While playing i saw often straight roads (without crossings) where one section is busy, the next section is normal and the following section is busy again. So i would suggest to make a road busy from crossing to crossing, if one of the section between the crossings gets busy. Turning back to a normal road should then also act between crossings: if no section between crossings needs to be a busy road, turn all sections to normal roads. But currently two things act together: Change the roadtype Ask/release a second carrier So everey time a road becomes a busy road, the code also asks for a donkey/second carrier. If the traffic decrease, the road becomes a normal road and the donkey/second carrier is released. In regard to my suggestion, this behavior should be separated. The code for asking a donkey/second carrier would be still the same for each section of a road, but the graphics to the whole sections of a road between crossings depends on if one section becomes busy. In the end there is a road between crossings which is displayed as a busy road, but one section of this road has a donkey/second carrier, the other sections have not. Top Quote