Topic: main roads becoming normal again
king_of_nowhere Topic Opener |
Posted at: 2015-04-24, 19: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 |
Posted at: 2015-04-24, 20: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:
See: http://bazaar.launchpad.net/~widelands-dev/widelands/trunk/view/head:/src/economy/road.cc#L620 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, 21:05
Fight simulator for Widelands: |
wl-zocker |
Posted at: 2015-04-25, 08: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, "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 Topic Opener |
Posted at: 2015-04-25, 10: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 |
Posted at: 2015-04-25, 12:59
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. einstein13 |
king_of_nowhere Topic Opener |
Posted at: 2015-04-25, 15: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 |
Posted at: 2015-04-25, 16:19
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...
You say it: eventually.
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?
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:
This could be done i think. Fight simulator for Widelands: |
king_of_nowhere Topic Opener |
Posted at: 2015-04-25, 19: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 |
Posted at: 2015-04-25, 19: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 |
Posted at: 2015-04-26, 11:06
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:
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. Fight simulator for Widelands: |