Soldiers leave training sites too early

Bug #1251918 reported by fk
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
widelands
Won't Fix
Wishlist
Unassigned

Bug Description

The 'error' happens most often when there are few resources. For example, two breweries are needed for one battle arena or the soldiers walk out before their training has been finished. Otherwise, soldiers walk out of the trainingscamp after they have been equipped with the first weapon, leaving more advanced weapons behind unused. Then new soldiers walk in and cannot be upgraded with the more advanced weapons.

Revision history for this message
Teppo Mäenpää (kxq) wrote :

Please read the entire discussion thread in https://wl.widelands.org/forum/topic/978/
Then return to this site and update the bug description!

Teppo Mäenpää (kxq)
Changed in widelands:
importance: Undecided → Wishlist
Revision history for this message
fk (fredkuijper) wrote :

#1 Teppo,

It was a good idea to make soldiers leave the training sites automatically, but it has gone so far that they walk away while they are still in training.

I would like to stress out that the new soldier handling works quite well for large games with hundreds of soldiers, where the advantages weight out the disadvantages, but it becomes fully uncontrollable in smaller scale wars where the disadvantages effectively block the training proces. After a while I had 20 broad axes and no sharp axes. The soldier that left the training site will not survive it's next battle. The soldiers that replaced him in the training site will not be upgraded. The training is in a deadlock and the player looses its soldiers, and nothing can be done against it.

The problem is not caused by low resources, but only worsened, or made more visible.

I broke off many games because they had become unplayable. The game makes me feel like a fool. Instead of fighting with the enemy, the player finds itself in a battle with the game logic, and will be predestined to loose.

My suggestion is to lengthen the waiting time for soldiers, or even better, not to leave while there are still weapons available.

Revision history for this message
Teppo Mäenpää (kxq) wrote :

fk: Soldiers do not walk away if they can be trained. However, when you lack something, be it bread, beer or so, they go away. Feeding enough food to military sites has became more important than what it was before: fail to do that, and half-trained soldiers evict, go to military sites preferring heroes, and die there too soon.

I have made the logic a bit more complicated, which might solve your problems, too. Please try downloading the branch "feature-978-partial-training" and see if that works as you like.

I still do not see a bug. Be patient, try it and explain more. Thanks!

Revision history for this message
fk (fredkuijper) wrote :

"Please try downloading the branch "feature-978-partial-training" and see if that works as you like."

I have not yet done so, and I am not familiar with the trunks.

Should I issue: "bzr feature-978-partial-trainin lp:widelands" and will it overwrite the current version?

"Soldiers do not walk away if they can be trained."

I have to refute this argument, several obvious cases were spotted during my latest game. I don't think that is it needed, but I can provide the screenshots here.

Secondly, it should not be considered as an invalid situation if a player has to deal with few resources.

btw. Patience is not the problem; the scenario I'm working on has already been postponed beyond rc18.

Revision history for this message
Teppo Mäenpää (kxq) wrote :

It might have been

bzr branch lp:~widelands-dev/widelands/feature-978-partial-training

or something like that.

I take my words back a bit. I have never seen bugs resembling something you describe. Of course, there could be bugs nevertheless. A replay, with buggy trainingsite coordinates (if there are many) would be helpful.

Revision history for this message
fuchur (fuchur77) wrote :

I also observed that I only got partially trainied soldiers. But I think that's due to the new feature. I didn't have a closer look at the trainingscamp if soldiers really leave even if they could be trained.

For the new feature of soldiers leaving training sites if they cannot be trained I have some comments. I recently played the barbarian campaing 3 with build 18. I had one axefactory, one warmill and one helmsmithy. I guess my main problem was that I didn't build enough smelting works. So I lacked iron in each of the weapon production sites. But now I was curious and had a closer look at the config files.

If I understand them correctly one soldier gets fully trained in the trainingscamp in 245 seconds (I guess the values in the config file are miliseconds). Each training step takes 30 s, preceded by a sleep of 5 s. The full production cycle of a helmsmithy is 251 s. Therefore on the long run one helmsmithy is not enough. The full production cycle of a warmill is 342 s which is much longer than the training duration. The axefactory of course helps with the simple axes. I understood the conf files in a way that the production of each weapon starts with a sleep cycle of 32 s followed by the working animation of respective duration. Attached is a table where I wrote down the values of the config files.

Btw. I don't know how the value trainier_patience influences the ejection of soldiers. And I don't know the details of the training programm. I reduced the site to only one soldier slot. Maybe it's better to have more of them. But I assumed that then it would be even more complicated to get all the neede axes produced.

Conclusion: for the mentioned campaign it didn't matter as the enemy was not very strong. But I realized that I need much more ressources and production sites to get fully trained soldiers than before. And I assume it was simply how the new feature works, not a bug.

Revision history for this message
Teppo Mäenpää (kxq) wrote :

About the table: Warmill and Helsmithy both need many pieces of iron and gold in a work-cycle. The table did not address that.

Soldiers are ejected, if training has failed >= trainer_patience times in a row. With a trainer_patience of 5, a ~20% supply of wares is enough to keep soldiers in. This bookkeeping is done separately for each training level. In trainingscamp which trains both attack and defense, a soldier is ejected only if neither of these cannot be trained.

Revision history for this message
fuchur (fuchur77) wrote :

@ Teppo #7
You are right, the table lists only iron and not gold. That's just because in my game gold wasn't the problem.

I'm not sure if I understand the bookkeeping correctly.
1. The trainer (program) checks for each training level if there is a matching soldier available.
2a. If yes -> do training cycle
2b. If not increase a variable by one for that level.
3. Sleep for 5 s.
4. If variable reached the value trainer_patience (5) then eject soldier
5. Start over at 1.

So if none of the soldiers can be trained (always step 2b.) the cycle repeats 5 times with 5s sleep each cycle -> after 25 s one or more soldiers are ejected if no wares were delivered in the meantime.

In my case I had the available soldier slots reduced to 1. Now I have the feeling that this maybe worsened the situation.

Are we getting off-topic here? The original bug report by fk mentioned soldiers leaving even if advanced weapons were available. But maybe that was because of missing food.

Revision history for this message
Teppo Mäenpää (kxq) wrote :

#8: about right. I would add: "2a: .. and reset variable to zero"
Also, a soldier must be at a no-patience level at _all_ arts taught at that school. For example, if attack-training-patience has exhausted but defense-training is still OK, then that soldier is safe. Also, if there are no soldiers at all at some level, then the trainer slowly regains patience.

The feature works as I planned. However, this does not guarantee that it works in the best possible way. Actually, I think that the current system could be tuned a bit. Relevant code is in feature-978-partial-training branch at launchpad. That code is ready for merging and now would be a good moment to merge it.

Yes, this discussion is off-topic. I suppose that missing food (or beer or meat or whatever) explains what fk saw. In case there are problems with food supplies, reducing the number of soldiers at the training helps a lot. At least, if heroes are the target.

Revision history for this message
fk (fredkuijper) wrote :

#8 This screenshot (taken some time ago) might clear up things. The soldiers walks away from the training site while enough weapons/food are available. It seems that the training site does not perform all necessary checks.

Revision history for this message
Teppo Mäenpää (kxq) wrote :

You could tell some details.

* The attack 1, evade 2 guy is the one who just departed the trainingscamp?

* How long have the level-2 weapons and foodstuff been on the site?

If the weapons arrived to the site after the trainingsite attempted to train that guy to attack2 and the end of a work-cycle, then the kickout was expected.

However, if the level-2 weapons (and foodstuff) were there for long (read: were there already when a soldier was trained from lvl-0 attack to level-1) , then something is not right.

Revision history for this message
SirVer (sirver) wrote :

Setting to incomplete for bug sweeping.

Changed in widelands:
status: New → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for widelands because there has been no activity for 60 days.]

Changed in widelands:
status: Incomplete → Expired
SirVer (sirver)
Changed in widelands:
status: Expired → Confirmed
Revision history for this message
GunChleoc (gunchleoc) wrote :
Revision history for this message
Teppo Mäenpää (kxq) wrote :

maybe-related is probably-fixed ;-)

Revision history for this message
GunChleoc (gunchleoc) wrote :
Changed in widelands:
status: Confirmed → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.