Latest Posts

Topic: main roads becoming normal again

WorldSavior
Avatar
Joined: 2016-10-15, 03:10
Posts: 2094
OS: Linux
Version: Recent tournament version
Ranking
One Elder of Players
Location: Germany
Posted at: 2018-04-26, 13:31

It's difficult to watch this discussion...

How will the new concept work if you link two flags with several street-segments at once? (In most cases two segments.) And what about street-segments at buildings? There the carriers don't only walk between the flags, but also beyond, into the buildings.


Wanted to save the world, then I got widetracked

Top Quote
ypopezios
Avatar
Joined: 2018-04-19, 23:22
Posts: 220
Ranking
Widelands-Forum-Junkie
Posted at: 2018-04-26, 14:46

WorldSavior wrote:

It's difficult to watch this discussion...

It is difficult as well for everyone involved in it. Such threads need regular updating on their first post with the relevant information. But this is a task for either the first poster or a moderator.

WorldSavior wrote:

How will the new concept work if you link two flags with several street-segments at once? (In most cases two segments.) And what about street-segments at buildings? There the carriers don't only walk between the flags, but also beyond, into the buildings.

The short answer for your scenarios and every other scenario is this: The new concept will work better than the old concept.

A longer answer is that the algorithm makes the most of what information is available to it. If someone could provide me with code to bring more information, I could certainly incorporate it into the algorithm, thus improving it. The same is if someone could provide me with line numbers in the code of other files where special events take place. As long as we have the wallet, we can add/remove coins from it whenever we want to affect the things it controls (in this case the promotion/demotion of the road).

A detailed answer could also be given, if a question gets more detailed.


Top Quote
Tibor

Joined: 2009-03-23, 22:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2018-04-26, 19:42

Finaly it works - I am able to see promoted roads:

road_promotions.png

I had to divide by 1000 as discussed above

Edited: 2018-04-26, 19:44

Top Quote
hessenfarmer
Avatar
Joined: 2014-12-11, 22:16
Posts: 2654
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2018-04-26, 19:50

ypopezios wrote:

~~~~ wallet_ -= carriers_count * (gametime - last_wallet_check_) / 1000; ~~~~

wouldn't that skip the concept of integer Math?


Top Quote
hessenfarmer
Avatar
Joined: 2014-12-11, 22:16
Posts: 2654
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2018-04-26, 19:53

ypopezios wrote:

The short answer for your scenarios and every other scenario is this: The new concept will work better than the old concept.

that should be the basic requirment of every change. But as with all requirments it has to be verified that it does.


Top Quote
ypopezios
Avatar
Joined: 2018-04-19, 23:22
Posts: 220
Ranking
Widelands-Forum-Junkie
Posted at: 2018-04-26, 20:58

Tibor wrote:

Finaly it works

In the log, gametime and last_wallet_check are always identical. If you placed the printf after last_wallet_check_ = gametime , move it higher. If it's already higher, something is going on.

Inform us when and how we can test the debug build ourselves.

hessenfarmer wrote:

wouldn't that skip the concept of integer Math?

The property wallet_ is defined as an integer, so any decimal digits get probably truncated. In any case, coins are whole numbers.

hessenfarmer wrote:

ypopezios wrote:

The short answer for your scenarios and every other scenario is this: The new concept will work better than the old concept.

that should be the basic requirment of every change.

That's not the basic requirement, but the ideal one. Still I'm confident that we'll meet it.

hessenfarmer wrote:

But as with all requirments it has to be verified that it does.

We are getting there, one step at a time. And there is plenty of room for further improvements.


Top Quote
Tibor

Joined: 2009-03-23, 22:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2018-04-26, 21:17

OK, modified printf:

wallet_:     0, carriers: 1, gametime: 7637978, last_wallet_check_: 7584284, current_wares: 1, nsteps: 2
wallet_:    16, carriers: 1, gametime: 7638041, last_wallet_check_: 7629871, current_wares: 1, nsteps: 2
wallet_:     0, carriers: 1, gametime: 7638103, last_wallet_check_: 7618097, current_wares: 1, nsteps: 2
wallet_:     0, carriers: 1, gametime: 7638134, last_wallet_check_: 7619091, current_wares: 1, nsteps: 2
wallet_:     0, carriers: 1, gametime: 7638156, last_wallet_check_: 7592178, current_wares: 1, nsteps: 2
wallet_:   742, carriers: 1, gametime: 7638177, last_wallet_check_: 7633001, current_wares: 1, nsteps: 2
wallet_:  1471, carriers: 2, gametime: 7638197, last_wallet_check_: 7634186, current_wares: 1, nsteps: 3

the revision is pushed to launchpad, feel free to pull and compile. Also the merge request should compile windows binary I believe...


Top Quote
ypopezios
Avatar
Joined: 2018-04-19, 23:22
Posts: 220
Ranking
Widelands-Forum-Junkie
Posted at: 2018-04-27, 07:01

Tibor wrote:

Also the merge request should compile windows binary I believe...

One build timed out, but the rest work.

Promoting happens very rarely, for no obvious reason. So it's not ready for testing by users.

Tibor wrote:

OK, modified printf:

Is there a way to get similar prints in Windows?

Also, could you find me the files which contain notify_ware, as well as the file where class Carrier is defined?

We are close to show-time, but not there yet.


Top Quote
Tibor

Joined: 2009-03-23, 22:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2018-04-27, 07:32

ypopezios wrote:

Promoting happens very rarely, for no obvious reason. So it's not ready for testing by users.

On my test map there was simply not much reason (too low traffic) for roads to be promoted

Tibor wrote:

OK, modified printf:

Is there a way to get similar prints in Windows?

Ou, printf() should be changed to log()...

Also, could you find me the files which contain notify_ware, as well as the file where class Carrier is defined?

grep is your friend:

$ grep -Rilw notify_ware  .
./economy/flag.cc
./economy/road.h
./economy/road.cc
./logic/map_objects/tribes/carrier.h
./logic/map_objects/tribes/carrier.cc

$ grep Carrier . -r | grep class
./logic/map_objects/tribes/carrier.h:class CarrierDescr : public WorkerDescr {
./scripting/lua_map.cc:           * :class:`carrier <CarrierDescription>`, a specialized

oops, not found, but this will find it:

$ grep -w Carrier . -r | grep struct
./economy/road.h:struct Carrier;
./logic/map_objects/tribes/carrier.h:struct Carrier : public Worker {
Edited: 2018-04-27, 15:27

Top Quote
king_of_nowhere
Avatar
Topic Opener
Joined: 2014-09-15, 17:35
Posts: 1668
Ranking
One Elder of Players
Posted at: 2018-04-27, 13:06

ypopezios wrote:

king_of_nowhere wrote:

So, we are talking about fuzzy improvements beyond perception.

Would you consider a fuzzy improvement the fact that the new algorithm would promote road B much faster than road A?

Depends. If the old algorithm promotes both roads in two minutes, and the new algorithm promotes the busyest road in one minute, then yes, I'd call it a small improvement, because one minute does not matter too much.

Do not take it personally. I am not saying it to bash your work. I would not turn down improvements. But as long as roads that needs promoting are promoted in reasonable time, and are not demoted if they keep enough traffic that they need the second carrier, if just occasionally, then there are no large problems and only small improvements are possible.


Top Quote