Improve Battle Calc Unit Ordering


  • Admin

    For some complex maps, the unit ordering doesn't seem to make much sense as can be seen for TWW where AA gun, AT gun, and Fighter seem out of place:
    0_1517596442489_7a39d641-c586-46aa-a31d-d652f45f48ad-image.png

    The reason for this is that the engine currently doesn't keep the ordering from the Production Frontier in the XML and then applies the following sorting for land battles:

    1. Land Units
    2. Air Units
    3. AA Units (any unit with any type of AA attack)
    4. Naval Bombard Units

    This works well for simple unit sets but any map that uses AA to have units target specific other units then ends up with those units sorted at the bottom after air units as can be seen above (AA gun, AT gun, Fighter) which all have an AA type attack.

    I'm proposing to have it respect production frontier ordering and change to the following sorting:

    1. Land Units
    2. Air Units
    3. Non-attacking Land Units (have 0 movement or can't move during combat move)
    4. Naval Bombard Units

    This helps in a few ways:

    1. Keeps the current functionality of true AA guns in v2, v3, and global sorted at the end
    2. Allows units like fighter and AT guns (AA attack units that can combat move) to fit with their normal groups
    3. Helps align the battle calc window for attackers and defenders (puts defend only units towards the bottom)
    4. Allows map makers to specify order in production frontier which is respected within the above groups

    After changes:
    0_1517604580250_8d296806-7cc5-4d8f-b5d2-d14201efb8c3-image.png

    PR: https://github.com/triplea-game/triplea/pull/2941


  • Admin

    @redrum The other question is would having a better setup/ordering in the production frontier address this as well?


  • Admin

    @hepps In theory, we could remove the sorting all together and take what is in the production frontier as the order. The problem with that would be if you add units to the production frontier then they would appear at the end with no sorting.


  • Admin

    @redrum No what I meant was... can the entire system (with your proposed changes) also be improved by detailing in the POS2 XML that during the design phase.... BC display results can be improved with a standardized set up/unit ordering.


  • Admin

    @hepps Ah, yes. In general, map makers should order units in the production frontier in the order they would like them displayed. A note should probably be added to POS2 XML to that point.


  • Admin


  • Admin

    @redrum I find that if we did some work on being very clear in POS2 (since it is already such a great tool for map-makers) the quality of new submissions would be greatly improved.


  • Admin

    After the changes here is the result for TWW:
    0_1517601130873_c7c62c00-df22-4f3b-8fd6-92302e0e1fdc-image.png

    Definitely better though I'd argue that @Hepps should re-order the production frontier to have AT gun right after artillery and naval fighters right after fighter 🙂


  • Admin

    @redrum I down voted your post. 🙂

    But truth be told the new ordering seems to be a nice improvement.


  • Admin

    @hepps Now my forum reputation is ruined... Only thing to do is down vote your down vote response 🙂


  • Admin

    @redrum LMAO!!!! This is going to get ugly.

    We are both going to go from respected members to horribly disdained people.

    To quote a beautiful mind... "Vengeance is the most assured path to mutual destruction. "


  • Admin

    @hepps @redrum Gigglez


  • Admin


  • Admin

    @Frostion This change for example improves the ordering for Iron War as well. Probably affects a few of your other maps too (most likely for the better).

    Before (weird seemingly random order):
    0_1517606337428_76db9a53-e596-4d52-8291-e62b3ad84e77-image.png

    After (much smoother/logical ordering):
    0_1517606374427_7f0bda04-49e9-4b55-9d2b-df5088b32ffd-image.png


  • Admin

    @redrum

    If the productionFrontier is triggered to remove once available units from a nations production.

    And there is still some of that unit type on the map. Will it still be listed in the BC?


  • Admin

    @general_zod Yeah. The way it works is it takes all the units from the production frontier first then checks all your owned units that are on the map and adds in any that aren't in the production frontier at the end.


  • Admin

    @redrum
    This change looks great! The difference between something good and something great is attention to detail 🙂


  • Moderators

    @redrum 0 movement doesn't imply that the unit is non-attacking, as you can have it movement boosted or transported or, anyways, movement 0 units can attack in contested territories (for example, the Fortress of Napoleonic Empires FFA, when downgrading to war, that have also attack 4, but would attack if having attack 0 too). Of course, in the basic rules games there are no ways a movement 0 unit can attack. But in the moment more games are made in which there are limited combat rounds and you can place units in hostile territory, this occurrence becomes less marginal (for Napoleonic Empires FFA, attacking movement 0 units were specifically wanted, of course).


  • Moderators

    @redrum I'm also not convinced that either movement 0 or cannot combat move units at end is always preferable.
    For example, if I make a "static infantry" unit that it is 0/1, movement 1 and cannot move during combat move, I think that would be better displayed before the "infantry".
    The same in case territories have movement 0 units already in it, maybe defence 1 simple ones, to represent territorial militia, or something the like (would make more sense being first, as being the foremost fodder).
    I believe the ordering would be better if by the same order in which defender casualties are preselected in the battlecalculator. This would also help, especially in PBEM games, in knowing in advance what the order will be, for the defender (of course, this should be documented, to let people know). In this case, a bunker would be still last, if it would be the unit that the battlecalculator would kill last.
    The main reason I can see for not having a "bunker", or anyways defence only unit, at the start is that would push down all other defending units, losing the alignment with the attacking ones, so I'm making a feature request specifically for overcoming that issue, another way.


  • Moderators

    @redrum I think it woud be just better letting the mapmakers able to define if a movement 0 or cannot combat move unit should stay at the start or at the end or somewhere else in the list, by their order in the production frontier. Alternatively, I would go with the battlecalculator order (so, a 0/1 immobile unit would be first, and a 0/4 immobile unit would be last). For the problem of defence only units pushing the defence listing only down (like in the case of your first image, in which the alpine infantry is pushed down from 1st to 3rd position by the two immobile units), deteriorating simmetry, I've opened this f.r., that would cover that (the solution would be pushing down the attacking alpine infantry too, leaving empty spaces):
    https://forums.triplea-game.org/topic/695/always-align-the-same-named-units-in-the-battlecalculator-if-any