Latest Posts

Topic: Few suggestions

suremaker
Avatar
Topic Opener
Joined: 2015-09-21, 18:24
Posts: 5
Ranking
Just found this site
Posted at: 2015-09-23, 00:52

Hello,

Thanks for welcome and replies to my comments face-smile.png

I checked today a dev version of Widelands and noticed that it has many improvements. I tried the same map to see if ships transportation is more efficient. Now I see that AI is building harbours and sailing ships - nice one face-smile.png

Garrison in ports:

Thanks for explanation that port/HQ would be defended by soldiers if they are currently staying there. I like the idea described by wl-zocker for extending the interface for those building to specify minimum garrison. With today's game, I have lost my port again, because all the soldiers decided to go to training camp instead of staying in port face-wink.png It would be very helpful if there would be a control on this minimum garrison size.

Ships:

Regarding colonies, I see that one on remote island has been built quite quickly, so it looks like it has been improved since last version. However I have not managed to build as many harbours as in last game so I cannot confirm it in 100%. It fells like it is better though. Now I took a look at the ship that was sailing to one of more remote port - it unloaded some good and sailed to another one to unload / load other goods as well, but I still noticed that it had some of the originally loaded cargo and there was no further ports around, so probably it had to sail back then to unload it in one of ports it was sailing from.

Basing on that and king_of_nowhere comments, I wondered that maybe a following algorithm would help with transportation: Assuming that ship has cargo from port A to go to port B, it can take an additional cargo for port C if:

  • port C is on the route to port B (so A -> C -> B),
  • port B is on the route to port C (so A -> B -> C)

In addition to that (but optionally), a ship could be redirected to a port C to pick up some cargo to port D if C is on the route between A->B and D is on the route C->B or after, making a final routes as follows:

  • A -> C -> D -> B or
  • A -> C -> B -> D

Now, being 'on route' could be tricky one because normally it could mean that C is on route A->B if distance A->C + C->B is less than distance A->B, multiplied by some margin value (20% ?). It may not work however in scenario where ship has cargo for A->C while there is a need to transport cargo between A->B and B->A, and A-B distance is very short (within this 20% margin) - then original cargo may be never transported to port C.

This could be however solved by storing information about distance that given cargo already travelled. So, if there is a cargo from A->D and ship has travelled to port B and later to C (so now the ship is at C port), then the cargo could have accumulated distance of A->B + B->C. Then to calculate if ship should go to port X before heading to D, a following algorithm could be used: (C->X + X->D) + current cargo distance < (A->D) * margin

I hope that what I wrote is clear...


Top Quote
suremaker
Avatar
Topic Opener
Joined: 2015-09-21, 18:24
Posts: 5
Ranking
Just found this site
Posted at: 2015-09-23, 01:03

Also an alternative to the accumulated distance could be that each cargo could have a list of visited harbours and then ship will not head to the port that has been already visited by carried cargo. With mixing it with the concept of port being on the route could make a trick face-smile.png


Top Quote
einstein13
Avatar
Joined: 2013-07-28, 23:01
Posts: 1118
Ranking
One Elder of Players
Location: Poland
Posted at: 2015-09-23, 02:41

Hey!

Your formulas are quite similar to mine idea:

If you know basics about programming, you can test your own transportation algorithms. If no- just write anything more than it is done now.

There are 3 basics approaches for seafaring/routes:

  • old build-18 where "First In -> First Out". Highest priority is for oldest ware.
  • Tibor's approach where next coordinates are calculated with points. More wares going to port - higher priority. Longer distance- lower priority. This is implemented now in dev build.
  • My (einstein's) approach where the ship remembered the route and try to make it optimized. Your "margin" can be set as constant or a variable (several possibilities now).

Everything can be tested in github project. You can run you own tests too face-wink.png

If you don't have knowledge to run/write your own tests, it is ok. Just explain in math-way how your algorithm can work. Some things are quite clear, but I can see details in different way face-smile.png Then I can write test of your algorithm too.

Edited: 2015-09-23, 02:47

einstein13
calculations & maps packages: http://wuatek.no-ip.org/~rak/widelands/
backup website files: http://kartezjusz.ddns.net/upload/widelands/

Top Quote
suremaker
Avatar
Topic Opener
Joined: 2015-09-21, 18:24
Posts: 5
Ranking
Just found this site
Posted at: 2015-09-24, 22:42

Hey.

Thanks for the links and the description. I'll take a look on it as soon I'll have some more time. Maybe I will be able to get some working example...


Top Quote