Latest Posts

Topic: Restless soldiers in the training camp...

hessenfarmer
Avatar
Joined: 2014-12-11, 23:16
Posts: 2646
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2020-04-01, 23:07

ok I checked the savegame. reason for the behavior is that double edged sword is missing in the economy and almost all soldiers have been trained with all other levels available in the training facilities. So there are mostly only soldiers available which have the same training level. they are exchanged constantly between the warehouse and the saml training camp. this is intended, as we normally want to send untrained soldiers there which are not available in this economy any more. The code to send sodiers is within the warehouse. It is checked whether a soldier fulfils the requirment to be send to a training site ( meaning he has at least one level in an attribute that can be trained in the facility) we can't check whether he really will be trained as the warehouse has no knowledge if wares needed are available in the trainingsite.
I don't see any solution for this without doing a major rework of how information is available in the game. So the recomendation in such cases would be to stop the facility and to reduce the number of soldiers to be trained. If you want you could also increase the economy setting for soldiers so new soldiers get spawned which will be trained in the lower levels until the lower wares are available. Furthermore the eco setting needs to be adjusted to prefer double edged swords to be produced.


Top Quote
blind3rdeye
Avatar
Topic Opener
Joined: 2020-03-26, 08:47
Posts: 74
Ranking
Likes to be here
Posted at: 2020-04-02, 00:18

Ok. Thanks for looking into it. I think the behaviour is a bit weird; but its probably not worth a major overhaul to fix. (I figure that the main bad things about it are that it looks wrong, and that if the warehouse was a long way from the training ground it would be rending the soldiers unavailable for both training and active duty while they walk around pointlessly. I wonder if there are some minor tweaks that could reduce the effect though; for example, when soldiers are kicked out due to not enough resources; get 'kick out' flag could get reset until the next time that resource is needed. That way, newly arriving soldiers would be immediately booted out, and so there would be less churn.

That reminds me, I've noticed that with the Empire tribe, the colosseum is sometimes fully stocked with resources but has no soldiers to train, even though I still have lots of soldiers that could still benefit from the training. It's not directly related, but I guess that's another example of where choice of where soldier go to train could be improved.

hessenfarmer wrote:

If you want you could also increase the economy setting for soldiers so new soldiers get spawned which will be trained in the lower levels until the lower wares are available. Furthermore the eco setting needs to be adjusted to prefer double edged swords to be produced.

Later in the game the effect did go away when I started training new soldiers. (I was holding off on new soldiers because I wanted to get some hero-level soldiers trained up.) So you're right that changing the eco. settings for soldiers would stop the churn. As for eco settings for the double-edged sword, I'm not sure what you mean. I can increase the target number for storage, but my understanding is that that doesn't change how often they get produced. I thought it only meant the economy wouldn't 'skip' making them until I had that many units unused in warehouses. ie. I could make the number 10000 and it still wouldn't mean they get crafted more often. The only thing that would make them get crafted more would be setting the other weapons to zero or something. Have I misunderstood how that works?


Finally, regarding the location of save files - it isn't very important. I think the appdata thing would be better, but it probably isn't worth the bother of changing it now (given that changing it would mess with all current installations). But I do have one more suggestion: I think it would be good to add a shortcut in the game's main folder which points to the save game folder, so that people can find where the saves are in case they want to upload them or back up them up or delete them or whatever. (eg. inside c:\games\widelands, or wherever it is installed, there should be a shortcut called save which points to c:\users\(me)\.widelands\saves; and perhaps one for replays as well.)


Top Quote
hessenfarmer
Avatar
Joined: 2014-12-11, 23:16
Posts: 2646
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2020-04-02, 09:32

blind3rdeye wrote:

Ok. Thanks for looking into it. I think the behaviour is a bit weird; but its probably not worth a major overhaul to fix. (I figure that the main bad things about it are that it looks wrong, and that if the warehouse was a long way from the training ground it would be rending the soldiers unavailable for both training and active duty while they walk around pointlessly. I wonder if there are some minor tweaks that could reduce the effect though; for example, when soldiers are kicked out due to not enough resources; get 'kick out' flag could get reset until the next time that resource is needed. That way, newly arriving soldiers would be immediately booted out, and so there would be less churn.

As far as I know it is not implemented like this. Each trainingsite has a trainer patience defined which is more the less the number of attempts to train a soldier. If a soldier is tried to be trained and this failed due to missing inputs he gets his stalled counter increased. if he has a higher counter then the patience defined he gets a candidate to be kicked out. One thing that might have made the effect more visible is that we changed the failure mechanism to not create some sleep time anymore due to there is no reason to delay other possible training steps. Maybe we should think about increasinng the patience a bit to counter for that.
However the algorithm of kicking out soldiers is what led to the state in the savegame of nearly all soldiers trained to this level, so it has its pros as well.

That reminds me, I've noticed that with the Empire tribe, the colosseum is sometimes fully stocked with resources but has no soldiers to train, even though I still have lots of soldiers that could still benefit from the training. It's not directly related, but I guess that's another example of where choice of where soldier go to train could be improved.

that is a different problem. if you have Military sites that prefer rookies they will never be trained, cause they wont get kicked out of the milsite. Furthermore I believe (but I am not sure) that milsites are preferred over trainingsites.

hessenfarmer wrote:

If you want you could also increase the economy setting for soldiers so new soldiers get spawned which will be trained in the lower levels until the lower wares are available. Furthermore the eco setting needs to be adjusted to prefer double edged swords to be produced.

Later in the game the effect did go away when I started training new soldiers. (I was holding off on new soldiers because I wanted to get some hero-level soldiers trained up.) So you're right that changing the eco. settings for soldiers would stop the churn. As for eco settings for the double-edged sword, I'm not sure what you mean. I can increase the target number for storage, but my understanding is that that doesn't change how often they get produced. I thought it only meant the economy wouldn't 'skip' making them until I had that many units unused in warehouses. ie. I could make the number 10000 and it still wouldn't mean they get crafted more often. The only thing that would make them get crafted more would be setting the other weapons to zero or something. Have I misunderstood how that works?

Your understanding is 100% right. What I meant is to reduce the number of the other weapons to zero so that if the training sites are fully stocked with them only double edged swords would be produced.


Finally, regarding the location of save files - it isn't very important. I think the appdata thing would be better, but it probably isn't worth the bother of changing it now (given that changing it would mess with all current installations). But I do have one more suggestion: I think it would be good to add a shortcut in the game's main folder which points to the save game folder, so that people can find where the saves are in case they want to upload them or back up them up or delete them or whatever. (eg. inside c:\games\widelands, or wherever it is installed, there should be a shortcut called save which points to c:\users\(me)\.widelands\saves; and perhaps one for replays as well.)

I would prefer to let the user define where to save all data. However we have had a lot of problems (and still have) with windows file access rights and stuff, so I won't touch this as it is working.


Top Quote
simplypeachy

Joined: 2009-04-23, 12:42
Posts: 153
Ranking
At home in WL-forums
Location: Hampshire, UK
Posted at: 2020-04-02, 20:58

I guess the solution to training site churn would be to consider each soldier's level to be an attribute which a training site can request, akin to requesting a worker of Master level. The training site could then periodically look at its available wares and request soldier(s) which are able to be trained, given the resources in the site.


WARNING: New-style view packet not found. There may be strange effects regarding unseen areas.
_aD on IRC

Top Quote
hessenfarmer
Avatar
Joined: 2014-12-11, 23:16
Posts: 2646
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2020-04-02, 21:31

this is not possible without major codework I am afraid.


Top Quote
Native
Avatar
Joined: 2020-03-04, 22:11
Posts: 11
Ranking
Pry about Widelands
Location: Bietigheim-Bissingen
Posted at: 2020-04-02, 21:53

Maybe adding some kind of timeout until a soldier can be sent out again after he entered would decrease this behaviour a lot? So that soldiers don't immediatly leave the site, but wait some time to see if the needed wares get delivered. If you want him to leave immediatly you still can click on him.


Top Quote
Nordfriese
Avatar
Joined: 2017-01-17, 18:07
Posts: 1929
OS: Debian Testing
Version: Latest master
Ranking
One Elder of Players
Location: 0x55555d3a34c0
Posted at: 2020-04-02, 23:09

Just a brief explanation what the current soldier exchange algorithm works like internally:

  • Trainingsites train their soldier if possible. If wares are missing, the upgrade attempt fails. If the number of fails exceeds the trainer's site-dependent patience, the soldier is kicked out.

  • Trainingsites with one or more empty soldier slots register a Request with their Economy, like all sites do for missing wares or workers. Special here is that this Request is tagged with the min and max levels a soldier needs to be useful for the site (e.g. barbarian evade arena will have requirements: evade between 0 and 1, health/attack/defence any). This is similar to how military sites tell the economy whether they want heroes or rookies.

  • The worker economy processes those requests like all other worker requests: it looks for nearby soldiers in warehouses, checks if they meet the level requirements, and sends one to the site if applicable.

What could be done fairly easily would be that the trainingsite requests soldiers who have already been partly trained by other sites, and if it doesn't get any for a while then it also accepts rookies

Edited: 2020-04-02, 23:11

Top Quote
WorldSavior
Avatar
Joined: 2016-10-15, 04:10
Posts: 2091
OS: Linux
Version: Recent tournament version
Ranking
One Elder of Players
Location: Germany
Posted at: 2020-04-02, 23:12

Nordfriese wrote:

What could be done fairly easily would be that the trainingsite requests soldiers who have already been partly trained by other sites, and if it doesn't get any for a while then it also accepts rookies

-1 it should still be possible to send rookies immediately into trainingssites


Wanted to save the world, then I got widetracked

Top Quote
hessenfarmer
Avatar
Joined: 2014-12-11, 23:16
Posts: 2646
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2020-04-03, 08:36

Native wrote:

Maybe adding some kind of timeout until a soldier can be sent out again after he entered would decrease this behaviour a lot? So that soldiers don't immediatly leave the site, but wait some time to see if the needed wares get delivered. If you want him to leave immediatly you still can click on him.

that is exactly what is implemented. and it is how it works in the attached savegame as well. It only looks like they are getting send out immediately cause they all have the same level of training. In fact one gets in another one (the one that stayed longest) get's kicked out.


Top Quote
hessenfarmer
Avatar
Joined: 2014-12-11, 23:16
Posts: 2646
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2020-04-03, 08:42

Nordfriese wrote:

Just a brief explanation what the current soldier exchange algorithm works like internally:

  • Trainingsites train their soldier if possible. If wares are missing, the upgrade attempt fails. If the number of fails exceeds the trainer's site-dependent patience, the soldier is kicked out.

  • Trainingsites with one or more empty soldier slots register a Request with their Economy, like all sites do for missing wares or workers. Special here is that this Request is tagged with the min and max levels a soldier needs to be useful for the site (e.g. barbarian evade arena will have requirements: evade between 0 and 1, health/attack/defence any). This is similar to how military sites tell the economy whether they want heroes or rookies.

  • The worker economy processes those requests like all other worker requests: it looks for nearby soldiers in warehouses, checks if they meet the level requirements, and sends one to the site if applicable.

If I am not totally wrong the soldiers are sorted in some way (probably the time of arrival in the warehouse) and they get send out according to this list.

What could be done fairly easily would be that the trainingsite requests soldiers who have already been partly trained by other sites, and if it doesn't get any for a while then it also accepts rookies.

I'd rather thought about the warehouse sending out the highest trained soldier that still fits the requirement, changing somewhat the sorting algorithm.


Top Quote