Currently Online

Latest Posts

Topic: maning military buildings

Tibor

Joined: 2009-03-23, 22:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2016-05-10, 07:56

Well than these seems to be two separate issues.

Somebody should look at the code


Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 14:56
Posts: 3324
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2016-05-10, 08:30

Maybe the solution is to keep the soldiers sorted in the warehouse, maybe in a 2-dimensional data structure. So, we'd have a slot for each summed up soldier level and a list of soldiers in each slot. Then, depending on whether heroes or rookies are preferred, start searching the slots from the front or back for the first non-empty solder list.

Basically, the same type of data structure that you would use for https://en.wikipedia.org/wiki/Bucket_sort


Busy indexing nil values

Top Quote
No0815
Avatar
Topic Opener
Joined: 2016-05-01, 13:52
Posts: 49
Ranking
Pry about Widelands
Posted at: 2016-05-10, 09:15

Well, I guess the details for this are above my head.

kaputtnik wrote:

If you build a Castle (which prefers heroes by default) nearby the frontier to get some resistance to the enemy, it is somehow bad if it get filled with rookies first even if there are some heroes in a warehouse. Of course, currently one couldn't see how many heroes are in a warehouse...

Thanks! It's actually nice to see that someone explicitly agrees that the current behavior is suboptimal, to say the least.


Top Quote
king_of_nowhere
Avatar
Joined: 2014-09-15, 17:35
Posts: 1668
Ranking
One Elder of Players
Posted at: 2016-05-10, 13:09

kaputtnik wrote:

I couldn't say something to the code, but for a player i would say that if a military building is set to prefer Heroes, the code should send Heroes if Heroes are available (in a warehouse). And i think this was the behavior sometime (but i am not sure).

If you build a Castle (which prefers heroes by default) nearby the frontier to get some resistance to the enemy, it is somehow bad if it get filled with rookies first even if there are some heroes in a warehouse. Of course, currently one couldn't see how many heroes are in a warehouse...

I proposed that soldiers are sorted in warehouses depending on level, at least roughly (recruits, level 0 - roookies, level 1 to 3 - veterans, level 4 to 6 - elite, level 6 to 9 - heroes, level 10, except for atlanteans that only have 9 levels, so for themm it would go level 6 to 8 - level 9). But that would require a lot of rewriting, because as of now, all soldiers are considered as a single ware, with a string attached to show their stats.

However, I thought of something that may allow that kind of change easily: it ccould be easy enough to make separate categories of soldiers in the same way that there are miners and master miners. Both kind of miners can fit into a normal mine, so coding soldiers like that would ensure that there would be different wares named "soldiers" and they all could fit into military buildings. then all those soldiers would still have theur string of attached stats values, just like now. Simply, when one soldier accumulated enough promotions, it get automatically upgraded to veteran soldier, or however we want to call them. A newly built fortress would look for heroes first, then for elites, and so on. it may still exchange a few soldiers afterwards, because all the various categories would still be stored according to the current algorithm, so after it got all the elites, there may still be some elites left in the warehouse with better stats. but it would ensure that the fortress would get at least the highest tier of soldiers available.

No0815 wrote:

Thanks! It's actually nice to see that someone explicitly agrees that the current behavior is suboptimal, to say the least.

Oh, I also agree that the system is suboptimal, but the programmers have limited time, so it is best to spend that time on more important things. Furthermore, we must make sure to not swap a suboptimal algorithm for one equally subotpimal, only with different problems. And third, I see that virtuallly every game I've ever seen - indeed, every piece of sofrtware - is suboptimal in many aspects. It's just that in those cases, we know it's going t stay that way, so we treat the suboptimality as a feature. while in widelands we know stuff can be improved all the time, so we as of it to be improved. It's the same reason the quality of the leaders has much improved in going from monarchy to democracy, yet the citizens of democracies complain about their government much more. People tend to complain on what they can change, and to adapt to what they cannot.


Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 14:56
Posts: 3324
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2016-05-10, 15:30

Complaining is good, as long as it leads to constructive discussions like this one. I am interested in improving this. How or when we can improve this is another matter entirely - one of the bugs that I closed last week was almost 6 years old face-wink.png


Busy indexing nil values

Top Quote
DragonAtma
Avatar
Joined: 2014-09-14, 00:54
Posts: 351
Ranking
Tribe Member
Posted at: 2016-05-11, 04:00

If we're complaining about soldiers, then we should at least consider rebalancing them. Barbarian 0 -> 2 attack, for example, is vastly cheaper than Barbarian 2 -> 5 attack, yet it also provides a bigger increase (0 -> 2 is +100% attack, while 2 -> 5 is only +75% attack). If you want, I can do the math to get better stats (I really am a math person, but it depends on some questions for the staff:

* Do you want higher levels to give the same total increase? (so if 0 -> 1 is +20% attack, should 3 -> 4 also be +20% attack?)
* Do you want higher levels to give a same increase per ware? ((so if 0 -> 1 is +20% attack and 3 -> 4 costs twice as many wares as 0 -> 1, should 3 -> 4 be +40% attack?)
* Do you want all four categories to be roughly equal? (so a 2/0/0/0 soldier and a 0/0/2/0 soldiers are equally matched)
* Should evade training also increase accuracy a bit? (I'm thinking bases of 100% for level 0, 110% for level 1, and 120% for level 2, so 0/0/2/0 vs 0/0/2/0 doesn't take forever).
* Attack levels vary a lot at lower levels (12-16 for barbarians and atlanteans, 13-15 for empire), but very little at high levels (47-51 for barbarians, 45-47 for empire, 44-48 for atlanteans). Should the higher levels have larger ranges?
* Level 0 defense is near-worthless (Barbarian level 5 attack always does 45-49 to barbarians and 44-48 to empire). Should it be changed (either 0 or somewhat respectable values)?

And, of course, it also depends on the staff wanting the numbers changed -- if they're fine with the current numbers, then we can continue to use them. ;)

I should add that the stats in my examples were taken from https://wl.widelands.org/wiki/SoldierLevels/ -- those stats are probably still current, but if they have changed, I apologize.


Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 14:56
Posts: 3324
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2016-05-11, 06:58

Did you take the recent changes into account?

https://wl.widelands.org/forum/topic/1937/

Also, this is off-topic for this thread. We will never find this discussion again later. Please reuse the other thread or make a new one face-smile.png


Busy indexing nil values

Top Quote
king_of_nowhere
Avatar
Joined: 2014-09-15, 17:35
Posts: 1668
Ranking
One Elder of Players
Posted at: 2016-05-11, 10:15

DragonAtma wrote:

If we're complaining about soldiers, then we should at least consider rebalancing them. Barbarian 0 -> 2 attack, for example, is vastly cheaper than Barbarian 2 -> 5 attack, yet it also provides a bigger increase (0 -> 2 is +100% attack, while 2 -> 5 is only +75% attack). If you want, I can do the math to get better stats (I really am a math person, but it depends on some questions for the staff:

someone already mentioned that in the past (maybe it was you tht time too?), and i replied that while it's true, a stronger soldier can kill a weaker soldier, then go heal, therefore it's still more effective to promote soldiers all the way. there had been a general consensus to leave things as they were. on the other hand, attack promotions are much more useful than defence promotions, and looking at my calculations, i see that in a fight agins fully promoted soldiers, it would probably be better in some cases for the empire to not build armor at all, or to only build level 1 armor - takes 4 hits to kill instead of 5, 16% more chances to lose for that, but some 30% cheaper.

anyway, you should open another topic if you want to try and change those values.

I should add that the stats in my examples were taken from https://wl.widelands.org/wiki/SoldierLevels/ -- those stats are probably still current, but if they have changed, I apologize.

those stats are outdated. a few months ago we agreed to give the barbarians an extra +1.5 damage per level, since a fully promoted barbarian soldier only had a 36% chance to win against an atlantean, while being more expensive; barbarians pay their stronger early game with a weaker late game, but they should not become completey useless. They already have the most expensive soldiers to train and the most expensive mines to operate. So, someone should update that page.

Edited: 2016-05-11, 10:15

Top Quote
No0815
Avatar
Topic Opener
Joined: 2016-05-01, 13:52
Posts: 49
Ranking
Pry about Widelands
Posted at: 2016-05-11, 15:18

I'll ignore the balance discussion here since it's OT. Regarding the suggestions of GunChleoc and king_of_nowhere:

I don't know, this sounds rather complex. Even if my code isn't usable in this form (what a surprise), wouldn't it still be easier (and even more effective) to just iterate through the array that stores the soldiers to pick the best (or weakest, if rookies are requested)? These functions could even be reusable for other situations.

king_of_nowhere wrote:

No0815 wrote:

Thanks! It's actually nice to see that someone explicitly agrees that the current behavior is suboptimal, to say the least.

Oh, I also agree that the system is suboptimal, but the programmers have limited time, so it is best to spend that time on more important things.

Well, rating importance can sometimes be a delicate issue. But if a problem can affect the game in such a deep and potentially game-changing way, as the example of kaputtnik should illustrate, I would hardly consider it as unimportant.

Furthermore, we must make sure to not swap a suboptimal algorithm for one equally subotpimal, only with different problems.

Now that's definitely fair enough, as long as it doesn't implicitly means "Nah, changing would require effort, do not want." Though I can hardly imagine that this change could have unwanted side effects, unless the changed code itself is defective. Though I still could be wrong, I don't know the source code, so if someone has substantiated arguments ...

And third, I see that virtuallly every game I've ever seen - indeed, every piece of sofrtware - is suboptimal in many aspects. It's just that in those cases, we know it's going t stay that way, so we treat the suboptimality as a feature. while in widelands we know stuff can be improved all the time, so we as of it to be improved. It's the same reason the quality of the leaders has much improved in going from monarchy to democracy, yet the citizens of democracies complain about their government much more. People tend to complain on what they can change, and to adapt to what they cannot.

That's a pretty feeble argument. What should I conclude from that, that Widelands doesn't care about improving at all, or at least doesn't want to be bothered with reports about things that could be improved from outside the core team? (To be honest, it looks like that, somehow) I'd rather want to believe it's like GunChleoc said, albeit I rather wouldn't use "complain". It still makes a difference if one says "Hey, I stumbled over this problem/behavior, wouldn't it be better to change it (in this way) for this and that reason?" or "OH MY GOD!!! I FOUND THIS PROBLEM, FIX IT!1!! NOW!!1!11!!!"

Ironically I already had decided that I'd like to contribute, I started by giving feedback on the campaign, as a newbie, to find problems an experienced player might not see or regard the solution as self-evident/obvious ... and I stumbled over more of these than I could have imagined. It felt like crashing against a wall when I discovered that knowing about the buildings and how they work together is scarcely a first step towards creating a successful economy and the game doesn't give you even a hint about it, leaving you with no idea where to even start. These things got me frustrated enough that I seriously consider to pack the whole game in, before I even really had started. So please forgive me if I let shine through some of my chagrin. I had plenty of ideas how to extend the campaign but I'm still not sure, if it's worth the effort anymore, to get into the game deep enough. If it takes me dozens and dozens of hours of try and error till the game starts to be fun again I won't bother to wast my time.


Top Quote
king_of_nowhere
Avatar
Joined: 2014-09-15, 17:35
Posts: 1668
Ranking
One Elder of Players
Posted at: 2016-05-11, 17:46

No0815 wrote:

Well, rating importance can sometimes be a delicate issue. But if a problem can affect the game in such a deep and potentially game-changing way, as the example of kaputtnik should illustrate, I would hardly consider it as unimportant.

Furthermore, we must make sure to not swap a suboptimal algorithm for one equally subotpimal, only with different problems.

Now that's definitely fair enough, as long as it doesn't implicitly means "Nah, changing would require effort, do not want." Though I can hardly imagine that this change could have unwanted side effects, unless the changed code itself is defective. Though I still could be wrong, I don't know the source code, so if someone has substantiated arguments ...

Actually, changing that algorithm has rather profund game-changing effects, which will affect balance, so we must be very careful to consider them. For see, you consider the fact that strong soldiers will take time to man a new building at the border to be a flaw, and it certainly is such when your soldiers are doing it. But what when you are on the defensive?

In my first game in the torunament, I was the only one who knew the micromanaging to create level 10 soldiers without a strong economy. I had only a handful of them, but they killed weaker soldiers and then retreated to get healed. I could slaughter the enemy army without taking a single casualty. But human opponents can adapt. They dismantled their border buildings, retreating. Now I had to build forward military sites to get to them. and when i did, those sites got filled with weak soldiers, and got overrun by the enemy. I found myself unable to advance. Eventually I found a way, but I needed one or two hours and several more level 10 soldiers. By the time I managed to break through, my opponents also had level 10 of their own, though not enough to change the outcome.

You see, if the algorithm had worked as you wish, that game would have ended immediately, with no contest whatsoever. Do one deserves to win only because he can micromanage a couple of level 10 soldiers in the first two hours of the game? It turned out, what you considered simply a bug or an unoptimized algorithm actually turned out to be an important factor in attack/defence balance.

So, do we want to give that advantage to the attacker? Letting the stronger soldiers occupy a new building will remove one of the very few viable defensive strategies one has when facing down stronger soldiers. I'm not sure it is wise to alter that mechanic. In fact, the only reason I'm not vehemently opposed to changing it is that one can, again by careful micromanaging, ensure that his new building will be filled with strong soldiers from the start.

(If you are curious: step 1: fill anoter building away from the front with good soldiers. Step 2: empty it, so that all the good soldiers will enter the warehouse and be placed consecutively in the array of soldiers. Make sure to count the soldiers in the warehouse first. Step 3: finish your border building, or connect a road to it if you completed it but cut road to avoid it being manned. Step 4: now the weaker soldiers will leave the warehouse. Let them come out, then cut the road. those soldiers will go back to the warehouse, but will be in the end of the array now. If you had X soldiers in the warehouse before you sent your best soldiers in, then you need to send out X soldiers. Every time weak soldiers try to go into the building, cut the road. Eventually, the good ones will come. You may need to cut roads to your other military buildings, if soldiers keep going in or out of the warehouse they may mess with that)

Widelands is a game of unstable equilibrium. The defender has no bonus for fighting in his land, so maybe we should leave every possible little advantage aa defender can get, unless we want all the games to be decided in the first couple of hours. As I write this, I am less convinced that we should change the mechanism.

People tend to complain on what they can change, and to adapt to what they cannot.

That's a pretty feeble argument.

That wasn't an argument against changing stuff. That was a bit of philosophical though on being more appreciative for something can be improved, instead of scoffing it for its failings; and they often are misled at perceiving something good as something bad because of that, so I preach about it when I can. Yeah, of course it would be a dumb argument for not fixing problems.

Edited: 2016-05-11, 17:47

Top Quote