Topic: Define if strong or werk soldiers should attack first
corsch Topic Opener |
Posted at: 2017-05-29, 21:28
It would be nice if you could decide if the stronger or the weaker soldiers should attack first. Top Quote |
kaputtnik |
Posted at: 2017-05-29, 22:08
As far as i know the strongest soldiers attack first per default. Not sure though... Fight simulator for Widelands: |
WorldSavior |
Posted at: 2017-05-30, 00:09
That would be nice. But I'm sure that they don't do that
Yes, you're right. In fact one is able to manage that only the best soldiers attack, but that requires some micromanagement and the weaker soldiers leave the buildings in this case, so that's a problem. And it doesn't always work. And of course it's hard to figure it out how it works Wanted to save the world, then I got widetracked Top Quote |
GunChleoc |
Posted at: 2017-05-30, 08:27
I dug up the code:
As you can see from the TODO comment, nothing smart is being done here yet. If simply grabs the requested amount of soldiers wherever it can find them. And then the first soldier who gets there is the first to attack. I haven't looked at how it works once a bunch of soldiers are awaiting their turn to attack. I think the algorithm should get all available soldiers, sort them by strength, and then get the strongest ones until the requested amount is sent. We also should take current health into account, so it's not that simple. Busy indexing nil values Top Quote |
Nordfriese |
Posted at: 2017-05-30, 12:27
How about calculating a soldier´s strength by adding his trainining levels and multiplying the sum with his health percentage? For example, a soldier with levels AT3/EV2/DE0/HP0 and a current health status of 80% would get a strength of (3+2+0+0)*80%=4. And when several soldiers are waiting to attack, we could either have First Come First Served or Strongest First. Top Quote |
king_of_nowhere |
Posted at: 2017-05-30, 14:27
to the best of my knowledge, it isn't always so. the soldier who has the higher chance of being sent to attack is the one on the left, followed by the one on the right, with those in the middle coming last.getting to cchoose would be great, but as far as i understnd the code, it does not make any difference among the soldiers. I proposed to sort soldier by skill, turning elite and mook soldiers into different kinds of wares, but that would require some reworking of the code. speaking of soldiers priority, it would also be nice if, when all the soldiers are sent out to meet an invader, one of the stronger was left inside the building. as it is, a castle with 11 fullly promoted soldiers and 1 untrained could be conquered by 2 untrained soldiers with a bit of subterfuge. Top Quote |
WorldSavior |
Posted at: 2017-05-31, 20:26
It seems to me that this is already done somehow. You can watch it if the attacking enemy is right before the military building: I think the "strongest" soldier usually goes outside. But it seems that an badly injured elite-soldier has lower "strength" then a healthy untrained soldier...
Well, if you add just the levels, that's not that accurate. And only multiplying with the health percentage could also be problematic. Why? Because an elite soldier is approximately ten times stronger than an untrained soldier, but if his health is at 10%, he should never go out instead of an untrained soldier, right? So maybe it should be multiplied with the health percentage once more, or something like this. Wanted to save the world, then I got widetracked Top Quote |
WorldSavior |
Posted at: 2017-05-31, 20:27
Yes Wanted to save the world, then I got widetracked Top Quote |
ypopezios |
Posted at: 2018-04-30, 15:29
This sounds like an algorithm I could work with. Any chance of someone pointing me to relevant files? Top Quote |
teppo |
Posted at: 2018-04-30, 16:49
Why do so many soldiers leave the building? While being attacked, I have often hoped that some who are in bad need of healing would stay inside and recover, instead of picnicking outside. Top Quote |