Group and Sort Units onto Placements Logically
-
Currently, units are pretty arbitrarily grouped/placed across the list of placements for a territory (there is some ordering but it doesn't make much sense). It would be much easier to quickly see what units are in a territory and have static units (factories, etc) not shift around a lot if they were ordered more logically.
Here is the proposed grouping/sorting:
- Unit owner: territory owner, not at war with territory owner, player order in XML
- Unit type: 0 movement, can't combat move, sea, air if sea territory, land, air if land territory
- Within each of those groups sort the units by XML order in UnitList
Before:
After:
-
@redrum Looks good. I'm wondering does this order affect the order in the territory tab or unit selections order when left clicked on the owned territory by the active nation.
-
@general_zod Not at the moment. I only changed the ordering of unit placements on the map.
Though we could consider changing the ordering of other areas as well.
-
@redrum Denmark has never seen so much love!
Great work. the groupings will make so much more sense when you are looking at the map between phases.
-
Added to unit overflow PR: https://github.com/triplea-game/triplea/pull/3309
-
@redrum said in Group and Sort Units onto Placements Logically:
Here is the proposed grouping/sorting:
- Unit owner with territory owner units first (all units owned by each player appear grouped together)
- Infrastructure then land then sea then air units
- Within each of those groups sort the units by XML order in UnitList
It was needed to define some standards on this regard, but I surely suggest to, instead, just sort by ownership, then xml order (meaning not forcing a predetermined order for unit types). I get that this has a big downside in adding confusions to all those unsupported maps without a logically ordered xml, but it will give the greatest flexibility to new and still supported maps. As long as a map is still supported, point 2 is wholly redundant (also because you never have land and sea in the same territory), as the mapmaker wanting it can assure it via point 3. So, also for simplifying the behaviour, I suggest going this way:
- Unit owner with territory owner units first (all units owned by each player appear grouped together)
- Unit owner relationship = enemy with territory owner units last (all units owned by each player appear grouped together) (this is mostly, but not only, relevant for maps with limited combat rounds)
- Within each of those groups sort the units by XML order in UnitList
Then, add in PoS2 this behaviour, documenting it as being fairly definitive as default, and encouraging the mapmakers to pay attention at their XML order, with maybe the general suggestion of having infrastructures first (but this should be left to the mapmakers, especially on the account that the current behaviour is to have infrastructures always last, instead of first, and most xml have them listed last, as well).
-
@cernel If you agree to update every existing map then sure. The main reason to have some general grouping is that most maps will never be updated so we need to have some groupings to help them.
-
@redrum As I said:
I get that this has a big downside in adding confusions to all those unsupported maps without a logically ordered xml, but it will give the greatest flexibility to new and still supported maps.
and as I said:
the current behaviour is to have infrastructures always last, instead of first, and most xml have them listed last, as well
I believe most maps are currently consistently coded in having things as industry and AAguns listed last; so, all those maps, will have such units last, that it is the way the system works now (currently, infrastructures are always listed last, instead of first).
I agree that infrastructures first is probably preferable, and I'm not sure if you would consider either a switch (as an option in map.properties) for that first or last or a switch for having the predetermined unity type ordering or not (thus xml list only).
I would go for a map.properties option for having the listing by xml only, default being false.
-
@cernel I think most maps (even new maps) would probably benefit from those groupings. If we get to a point where there are a number of maps that would prefer to have ordering that don't use those grouping then we can consider adding an option or updating how the sorting works.
-
@redrum Maybe some prefer having infrastructures last, instead of first, since they have been last until not?
-
@cernel Generally, you want isInfra first so that they don't move around.
-
@redrum I agree. Seems very logical for your infrastructure being first... then the units that don't move EVER stay stationary inside a territory. The system you have devised seems a great step forward in making the appearance of the map more consistent since your stationary units will be stationary turn over turn.
The rest of your organizational system seems logical and well planned out as well.
-
@redrum I think it depends mostly on the kind of map. In maps with a complex, infrastructure based, production system, think about Civil War, you definitely prefer having them first. The preference might go the other way round for maps with only a few industry and AAguns somewhere, and mostly both in the same places, as you don't really care to even look at them, as you would have already pretty much memorized them, and, of course, whatever is first allows cleaner view, so you get a faster glance at what the not infrastructure composition is, which is especially relevant in the moment you are checking for the defensive safety of your positioning, as infrastructures (factories and aaGuns) don't normally attack you.
Mostly, I think this should be well defined in PoS2, and be fairly stabilised, once you decide how it works, as I can see mapmakers wanting to have a stable behaviour, in the moment they define their maps.
As I said, I tend to agree that infrastructures first may be better than infrastructures last, so don't think I'm at the opposition here, but, especially since this would turn the current actual behaviour around, I'm wondering if most would be happy or not (I've no doubt that players of Civil War will).
-
@hepps On the matter of things not moving around, the Fortress of Napoleonic Empires don't, either. How about relating it to having movement 0 or having the property that disallow movement during combat move, instead of being an infrastructure.
I actually think I would rather relate it to the inability of moving during combat move, rather than the infrastructure attribute (that, by the way, just means that you can't take hits and are captured: you could have a map in which infrastructures are combat units only, all moving, and not production related at all), also because, this way, AAguns won't go different ways moving from v3 to v5, but I'm not actually sure, because, for a number of reasons, I don't like that option (I would prefer being unable to move to hostile, rather than totally unable of moving during combat move).
I think I would have a preference for having just movement 0 units first (which would also be consistent with the current behaviour of having them not selectable), so my suggestion would be to go for checking movement 0, instead of being an infrastructure (you can also have infrastructures like the Horses of Feudal Japan), even tho that would imply a different treatment of AAguns for v3 and v5, which I'm not really bothered myself.So, summing all up, my suggestion would be:
not relating it to the "isInfrastructure" attribute, but to the movement being equal to 0. However, when the property "Selectable Zero Movement Units" is set to true, then this priority is absent.How about this?
-
@cernel Or the rule could be that you get priority only if you can't move during combat move, no matter why; thus either having movement 0 or the specific inability to move during combat move, or both, would get you priority all the same.
-
@redrum said in Group and Sort Units onto Placements Logically:
@cernel If you agree to update every existing map then sure. The main reason to have some general grouping is that most maps will never be updated so we need to have some groupings to help them.
While this is a reasonable concern, and one that I anticipated, already, it might be less dramatically so that you might thing. Basically, aside rare cases of units you have but cannot buy, what I was saying is that the order you would see on the actual board would be the same order you have when you open the purchase window. Most maps are reasonably defined, already, on this regard, and, since in most maps you see aaGuns and factories last in your purchase window, most map will retain the current behaviour of listing infrastructures last, while allowing full customisation for new and supported games. Adding to this, the order being exactly the same both for purchase and placement I believe has a value in itself.
Maps having the units in the purchase windows listed randomly or, anyways, all over the place, would be damaged, but I'm not feeling much concened about that. Of course, my concerns don't matter.
Also, an xml only listing would solve the problem of deciding what is going to be what since, as I've pointed out, "isInfrastructure" is not necessarily that meaningful (and you can have maps in which all infrastructures are just supporting combat units or transporting ones).I wouldn't mind updating Civil War so to have all infrastructure units first.
-
@redrum Even at the risk of going off topic, I would add that I would have the units order in the purchase window AND the placement order AND the support order (units able to give bonus to some of multiple) being all the same. Of course, this would raise the concerns about existing maps, but the support order should matter very little for most. Of course, support ordering is a highly arguable matter, as well.
-
@cernel Actually, when not specified in the screen, the purchase order you get in the purchase screen is the one of the frontier; so that would be the order I'm proposing, instead of the general xml one (unless the unit is not specified in the frontier).
Anyways, it doesn't matter to what I was saying; what I'm saying is having the same order as that player would have when you open the purchase window, however that is defined.
The matter, then, would be what about is not listed in the frontier (purchase window). In that case (that doesn't matter for most maps), I would actually show all such units before those in the purchase window, and by their xml general order, as I guess they may be often like utility units having roles similar to the territory options; tho there are a few cases, like Age of Tribes, in which those units are the ones that got out of the frontier for obsolescence. Still, even in this case, I think it makes sense having them listed before the current purchasable ones.
A problem may be a game like WAW, in which you have Bunker at start game, but can produce them only from round 4, so they are not in the frontier for the first 3 rounds, while being on the field, but I can't really have an opinion on that thing at all, as it makes just no sense that everyone has bunker, yet nobody remembers how the hell to build them until 3 rounds after the start of the game. That's obviously just a gameplay thing, I guess because the mapmaker considered the game would flow better without early bunker placement. -
@cernel Just to be clear, in case anybody doesn't know it, taking the xml dependant production window would not be a constraint for main games of new / supported maps, as you can customise it in the skin, anyways (look at War of the Relics), while I'm assuming it should be reasonable safe for existing games, as you would assume some order was put into it, as it showing in the purchase window, already.
Another related matter would be armonising the Unit Help listing, if feasible, as there the xml general order is not used at all, but anything goes with the purchase order (I agree), then random (if I'm not missing some order I don't see). -
@cernel It may make sense that the order on the board and the order you have in Unit Help are exactly the same, but I'm not sure if maybe Unit Help should rather go with the purchase frontier, in case those are differently ordered. Also maybe you (or some) have the preference of seeing factories first on board and last in Unit Help?