Topic: main roads becoming normal again
ypopezios |
Posted at: 2018-04-20, 14:11
No need to repeat the almost self-evident over and over, especially since this thread has already been a perfect example of an idea which never reached implementation. And since this time there is improvement in the distance (now shorter) between the new idea and its implementation, we can be optimistic of producing some improved code at last. After all, the same way that a great idea needs actual code to get implemented, actual code needs an idea to justify its writing. Let's not discourage something as cheap as ideas. Having said that, I have more ideas for sharing, so I hope of not getting too discouraged with the treatment of the first one. Top Quote |
Tibor |
Posted at: 2018-04-20, 14:38
We are short of developers so If you deliver reasonable code, chances are high that it will be accepted..... Top Quote |
ypopezios |
Posted at: 2018-04-20, 15:02
If the idea gets accepted, chances are high that I will deliver reasonable code... Top Quote |
teppo |
Posted at: 2018-04-20, 16:37
It is not fun to first implement a change and then learn that is is not wanted or even accepted. Top Quote |
teppo |
Posted at: 2018-04-20, 16:44
No hysteresis? Top Quote |
king_of_nowhere Topic Opener |
Posted at: 2018-04-20, 16:54
No, this is an AWFUL idea, just like all previous ideas for demoting roads. And the reason is always the same: it penalizes a road for working properly. On a 2-steps road, a carrier needs 7.2 seconds to make a full trip. If the road has one ware every 5 second, then you NEED an animal. But with this algorithm, you only see that every ware gets transported immediately, so you demote it. The purpose of the discussion was to AVOID the demoting of roads when the traffic is enough that it can only be sorted with an animal. So no, No, NO demoting roads just on the base that wares do not wait on the flag. Wares not waiting on the flag should be the normal state of business, not a reason to demote roads. it could work with the following change: whenever both carriers on the road are busy, increase the value of the road. That way the algorithm can keep track of the fact that the road actually needs two workers to be effective. And I would also add the clause "if the economy does not need pack animal, do not demote roads ever." Top Quote |
ypopezios |
Posted at: 2018-04-20, 17:46
Could we all get a little less passionate and focus more on the solution than on the problems please? Thanks in advance.
Maybe you thought that the queue is considered after removing the ware. This is not the case. A carrier who takes a ware, always takes a minimum of 1 coin for it, plus some for the length of his road. Let me describe again the basic idea in isolation: As time passes, all carriers lose coins. But carriers who are not idle, get rewarded with coins for their work. Therefore, if the calculations for increasing and decreasing the wallet are chosen fairly, a properly working road will receive plenty of coins to avoid demoting indefinitely. Only underutilized roads will get bankrupt and demoted.
It has already been explained somewhere else that it is a feature of the game to not use animals unless they are really needed. This is the reason they all stay in HQ in the beginning of the game. Top Quote |
ypopezios |
Posted at: 2018-04-20, 17:49
Well, I decided to bite the bullet. For those who want to understand basic C++, here is the form of current implementation:
And here is what should be done:
Missing things (not hard for anyone who understands the codebase):
Edited: 2018-04-21, 03:44
Top Quote |
Tibor |
Posted at: 2018-04-20, 20:21
Ypopezios, good to see something real. I (or anybody) can create new branch, update the road.cc with your changes and have have the binary built so everybody (windows users mainly) can test it. You too of course Can you update directly the function Road::notify_ware() here on forum or elsewhere so that I can just copy&paste it to code? Ignore formatting now, we can have it formatted automatically later on. Also use comments wherever you have some questions or doubts.... As for missing functions - let them undefined, somebody will look at them. Also explain please what you mean with "Handling of congested roads" Endnote: For this kind of work it is very useful to be able to compile yourself and see immediately effect of the changes in code... But unless you are a linux user this can be a problem.. Top Quote |
ypopezios |
Posted at: 2018-04-20, 21:25
Concerning congested roads, probably all that is needed is a statement: last_wallet_check = gametime ...to be placed at the point they finally resume operations, so as to not get bankrupt from all the time of forced idleness. But I cannot know that, since I haven't read the respective code. I'm on windows myself and not willing to install a virtual box for C++, nor to write actual code without debugging it. Therefore I'm afraid that I cannot do much more without seeing any progress. If someone makes the changes and points me to the new file, I can inspect it and detect any errors on the algorithm's implementation. Any other errors should be debugged by someone who has C++ installed. Tweaking the constants to finetune the algorithm needs again access to an easy cycle of compile-test-startover. The ball is no more on my field, sorry. By the way, if such a small change is too much for the active developers of Widelands, we may as well abandon all hope for any changes whatsoever. Top Quote |