Invisible units



  • It would be really cool to have an algorithm, probalby a neural net, that calculates sensible and artistic-looking placements runtime, taking into account the number of units present on the territory as well as any visual features like territory names or PU placements.

    It would be cool, but it has nothing to do with this feature request aside from me being bored to death by placement picking at the moment.

    On the other hand, it would be cool if there would be a way to prevent units that are transparent anyway from taking up precious placement space.

    To emphasize the point, this
    0_1535063816678_invisible.png
    instead of this
    0_1535063830618_visible.png

    Anyway... back to placement picking...


    Here is the PR: https://github.com/triplea-game/triplea/pull/3917. Essentially you can now specify units that won't be drawn on the map, territory panel, or unit help (also won't throw an error if you don't include images for them in the unit folders as long as you aren't using them anywhere else like production/etc).

    Here is an example of what I added to Red Sun Over China:
    dont_draw_units=ruralproduction,station

    Before
    image

    After
    image


  • Moderators

    @alkexr The problem with invisible units, that is practically a hack to overcome engine limits (typical example is Domination), is also that when you click on the territory to select the units you want, you may easily clicking upon the invisible unit, instead, achieving nothing (and it's a bit frustrating). I tend to prefer the Global War 2 way to rather use them to represent the ownership roundels, but I think it would be cool if the program would support hiding units from both the board and the territory tab (of course to be used only in the case of those units you don't need to see).


  • Moderators

    @alkexr Another case is that I'm making a map in which all territories have a number of 0/1 defenders equal to their production (and triggers put them back if any killed), to represent local defences, so those would be cool to be hidden too, as you just need to look at the production of the territory to know how many 0/1 "freemen" units you would be attacking.



  • @cernel said in Invisible units:

    units you don't need to see

    Yeah, actually, if you don't need to see a unit, why is it even a unit? The option to add "isFactory" to a territory would do it too (and would in fact be much cleaner).


  • Moderators

    @alkexr Probably the most consistent way would be expanding the Chinese production v3 rules to cover at least the basic need of the case of all territories having factories (both games of the Domination map).


  • Admin

    Why couldn't we just add an suffix to the name of any particular unit that is invisible or has no "real" image....

    eg. chinesehypotheticalFactory_Null_Image

    Then the engine could simply be directed to place all "_Null_Image" units last on the rendering priority list or not be rendered at all.


  • Moderators

    @hepps Well, in that case you would still have the issue that if you have no overflow lines the invisible unit will be clicked on when you want to click on the territory and if you have overflow lines you see the overlflow with no units (of course this could be addressed by stopping the overlflow before that).

    But having a skin property to set the placement order would be cool also for other reasons; so any mapmaker could define it as he thinks it's best for the map, and safeguard the map from future changes in the default placement order.


  • Moderators

    @alkexr Not actually suggesting it, but if you make sure the invisible unit is always first in placement (having 0 movement and being first in list of those) and always present in those territories, you could hack what you want by having the first placement spot outside view (like setting it at a X and Y value greater than the map dimensions).


  • Admin

    So I'd like to add an option to not need/display unit images for certain units. General thought is just a unit attachment property like "invisible" or "noImage". Not sure what you mean by "in the skin". The other 2 suggestions are very hacky and really don't address the problem for large maps with potentially multiple invisible units: https://forums.triplea-game.org/topic/986/red-sun-over-china-rsoc-official-thread/17


  • Moderators

    @redrum Ah, I mean I would not flag the unit as to not be displayed (in the territory and the territory tab) in the xml. I would add such an option somewhere in the map folder outside the xml, maybe inside map.properties.

    For example, an entry in map.properties like:

    dont_draw_units=ruralproduction,station

    To be clear, the skin of a map, more correctly called original skin, is everything relevant inside the map folder but the xml in the games folder.
    Since it is a purely display feature, I definitely believe it should belong to the skin, not to the game itself (so, you could also have a mapskin showing ruralproduction with a village and station with a station, for example).

    I personally definitely think that for games having a factory in each territory, representing it with a flag roundel is preferable and less hacky than using an invisible image. No doubt setting units outside view it's a dirty hack, obviously.


  • Moderators

    @redrum Another possible use of this feature is for making mapskins that don't display units you would not hide by default. For example, one could do a "battle" mapskin for a map (like Civil War) where you have a lot of economic units. That mapskin could have all the non-battle units hidden, and one could switch to that when he doesn't care to see them. In this case a quick key for jumping through the available map skins would help.


  • Admin

    @cernel Ah ok. I see what you mean. Yeah map.properties is probably a better place for it since it really a display only issue.


  • Admin

    Here is the PR: https://github.com/triplea-game/triplea/pull/3917. Essentially you can now specify units that won't be drawn on the map, territory panel, or unit help (also won't throw an error if you don't include images for them in the unit folders as long as you aren't using them anywhere else like production/etc).

    Here is an example of what I added to Red Sun Over China:
    dont_draw_units=ruralproduction,station

    Before
    image

    After
    image


  • Moderators

    @redrum Cool, but, on a second thought, I'm not so sure anymore my suggestion of not having it displayed in the territory tab too was the right way to go. I was thinking in term of the unit to be represented by an invisible image and, in this case, of course better not having it in territory tab. On the other hand, now that the image doesn't display on the board anymore, that is the main item, maybe we should assume that invisible images should not be used (they were always a hack anyways), thus, for example, the "station" unit could be shown by the image @Hepps posted (the image of a station) that would be seen in the territory tab but not on board, this being consistent with the fact that the board is making the presence clear by other graphic means. Also I'm thinking about spotting bugs in that, say, you miss to add a "station" somewhere, and that would be easier to spot if is still displayed in the territory tab. So, I'm not definitive on this, but thinking about it again, especially on the account of games imperfections or for an easy way to be sure of what it is when you play a new game, maybe it would be better not to draw it in the board but still displaying it in the territory tab? Of course, this assumes that mapmakers would use actual images, to display in territory tab. What does @alkexr would think would be best for his map as well between:

    1. Having the factory unit never displayed on board and territory tab.

    2. Providing an actual visible image for the factory unit, and having it displayed in territory tab but not on board.

    ?

    Anyways, I don't feel strong one way or the other. Just having some doubts on the utility of hiding the image from the territory tab too.

    I didn't think about the unit help, and yeah that can easily become a mess with many utility units (just look at Age of Tribes), even without considering invisible ones, and I don't have a clear idea about it. I think a good game should just provide a good table in notes for giving the info, but, as we know, it is not rare that most games don't and not few of those that do say different stuff in notes than what it is the game, so the unit help is really a useful feature. I'm oriented to think that unit help should go the same way as territory tab.


  • Admin

    @cernel I think not showing them at all is probably better. Don't want players to get confused on seeing a unit in one place then not seeing it display on the map. At least for ROSC, I definitely feel ruralproduction not displaying anywhere is best and think stations probably better not to show anywhere but could argue that one a bit.


  • Admin

    PR is merged and this can be tested out by downloading the latest RSOC and using the latest pre-release: https://github.com/triplea-game/triplea/releases/tag/1.9.0.0.11665. Rock on!


  • Admin

    @redrum I think that makes sense. If the unit does not interact with the game, meaning it can't be attacked and simply provides a solution to the map maker for functionality, then it really doesn't need to be in the map or tab.

    The mapmaker should really be describing the impacted behavior in his notes, since often times the unit itself is purely a means to an end and not really intended to be a unit at all.


  • Admin

    @redrum Your current version is great but I think it would be nice to allow map maker to decide where exactly it needs to be displayed. That being said maybe build in an additional option into this by adding one more letter to the code as follows.

    dont_draw_units=ruralproduction,station (wont draw anywhere)

    dont_draw_units_m=ruralproduction,station (wont draw on map only)

    dont_draw_units_h=ruralproduction,station (wont draw on help page only)

    dont_draw_units_t=ruralproduction,station (wont draw on territory tab only)

    dont_draw_units_m_t=ruralproduction,station (wont draw on map and territory tab or any mix in one line of code.)

    @cernel makes some good points for might wanting to see it in territory tab or help page while still in the mapmaking phases. This may help a mapmaker identify or pinpoint issues early. As the help page goes it also shows the true values for each unit at the point of opening help page (updates itself). This helps if using triggers that manipulate values. Also it will simply by flexible enough to accommodate unmentioned scenarios.

    Additionally it might be helpful to have a feature that can disable the selection of invisible units on map. So it doesn't even show up in a selection list on any movement phases (cm, ncm). I guess can just give 0 movement too.


  • Admin

    @general_zod Yeah, I'd probably spell it out but that was my thought as well. For now, I think I'll leave my initial feature and see how people want to use it. If a mapmaker has a strong case to want it shown some places and not others then I'm glad to expand this to have more fine grain control.


  • Moderators

    @general_zod If going finer, I'd rather go this way:

    For the Unit Help, having a specific property for it, to fully customize what's in it and its order, on the same model as the "production_tabs.properties". This is probably needed anyways, since the way the Unit Help tabs currently work is very raw, and it doesn't really work well even for very basic games like World At War (or any games having units that may get added by triggers during the course of it).

    In this case, you should get an error if at any point during the game you are able to purchase a unit not present in Unit Help.

    For the showing / not showing in territory tab (while always not on board), I'm thinking that this probably needs to remain standard, as I doubt that mapmakers may go consistently one way or the other, and would just end up like some sort of random personal preference.

    In this case you should get an error if you have in purchase screen a unit meant not to be drawn, as I think that would not make sense.

    EDITED as on a second thought better not relate to image presence.

    I want also to point out that combat units (you would see in the battle window and in the battlecalculator) may be a good candidate for not being drawn in the territory tab. For example, you can have a game in which in each territory there is always 1 capturable combat unit, providing some additional defence or whatever, that would be better not being drawn (everywhere) in the map. Or you could have a game where everywhere there is a river you have a "river" combat unit, that (as long as it is always there) can be not drawn, if it is already shown by the graphic.