TripleA Logo TripleA Forum
    • TripleA Website
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Tags
    • Register
    • Login

    Dyeing/Colorizing Unit Images

    Scheduled Pinned Locked Moved Feature Requests & Ideas
    68 Posts 10 Posters 31.5k Views 9 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • redrumR Offline
      redrum Admin @Black_Elk
      last edited by

      Thanks for all the feedback. I'm going to lay out the high level design and things I'm planning to include along with this feature.

      @Black_Elk I will mostly likely update some existing maps to take advantage of various parts of this feature especially any maps that truly have all monocolored units. I believe it would be possible to grab all sea zones and apply some sort of colorization but would have to think a bit about it and how it works with reliefs.

      @LaFayette I'm sure you'll see the code soon 🙂 I'm mostly doing something similar to what GIMP and other image tools do around a colorize function. It essentially finds the luminance of each pixel of the base image then sets the pixels of the new image based on the specified hue/saturation/brightness and that calculated luminance value.

      @Hepps I believe it should work fine with any base image color that is far from white/black.

      @Cernel This feature will mostly be geared towards map makers that have limited graphical ability or as a shortcut to get started not for complex/advanced map makers that already are comfortable colorizing images. And yes, this will only work well for units that are monocolor so you'll have to live with that or colorize some of the images yourself if you want a perfect map. Generally, you don't want unit images to be the exact same color as territory color so I think its better to have a separate color value for each nation for their units. I think the rest of your comments will be addressed below.

      Overview

      • Add ability for engine to colorize images. This will take a color code (only apply its hue and saturation) or take a HSB value (apply all 3 values, increasing brightness is often not ideal so kind of an advanced use at your own risk). It also ignores any pixels that are close to black (brightness < 10%) as especially if increasing brightness these get faded and make images look less sharp.
      • Add ability to place unit images in unit folder directly which are then shared across all nations (it will first check for an image in the nation folder and if not found then check the unit folder and then check the images included with TripleA). This will allow flexibility if not all units can be shared or aren't monocolored.
      • Add new properties to map.properties:
        • A color or HSB value - apply to unit images for each nation (this will be applied to ALL units of that nation unless exempt). This will allow map makers to potentially use a single set of unit images and specify colors for each nation. Also allow users to override the default unit image color just like they can for territory colors.
        • A list of units exempt from colorization - this could include things like factories that are the same color for all nations or units that were already colorized by hand for each nation like AA radar or damaged battleships

      TripleA Developer with a Passion for AI: https://forums.triplea-game.org/topic/105/ai-development-discussion-and-feedback

      C 1 Reply Last reply Reply Quote 2
      • C Online
        Cernel Moderators @redrum
        last edited by Cernel

        @redrum said in Dyeing/Colorizing Grayscale Unit Images:

        @Black_Elk I will mostly likely update some existing maps to take advantage of various parts of this feature especially any maps that truly have all monocolored units.

        I'm not sure what you intend to do here. Most maps with monocoloured units (if we forget about the hit and aa radar images) have units differing only for colourization and unit that are actually different. For example, in assets, there is the same battleship image, with different colourization, for all players, but each player has its own submarine image. I'm curious what you intend to do and on which maps, as the only map I can think of that have colourization only differentiation of same units ownerships is Feudal Japan (and its variants).

        I actually believe it is lame having the same units for different players, aside from units that don't need to be set apart (factories...), and all units should be actually different beyond colourization, but, of course, someone would need to work on achieving that, and I can see it would be very challenging providing different images for destroyers, cruisers and battleships, one for each player in assets, while keeping them well distinct.

        p.s.: I overlooked the off topic about having a sea zones colour. I agree to that, and I already said so in the past; it's not important, but tiles should not be required for basic display, and indeed they are not required in all cases but for sea zones (as now, otherwise, all the sea will be black like the zones' borders). The two items to add here would be the ability to assign a colour for sea zones and the ability to set any such items has having no colours (fully transparent) (I suggest doing it but having the entry and leaving it empty), the sea zones having no colour if not defined. A third item may be being able to define a colour for unassigned zones (which means mostly the borders), pure black if not defined (this one should be the only item that you cannot set transparent).

        redrumR 1 Reply Last reply Reply Quote 0
        • redrumR Offline
          redrum Admin @Cernel
          last edited by

          @Cernel Yes, Feudal Japan is a good example where units are truly monocolor and the same minus colorization across all players so would be a good candidate for this.

          TripleA Developer with a Passion for AI: https://forums.triplea-game.org/topic/105/ai-development-discussion-and-feedback

          C 1 Reply Last reply Reply Quote 0
          • C Online
            Cernel Moderators @redrum
            last edited by Cernel

            @redrum Was that thing of making the new political notifications different from targets and others ever implemented in Feudal Japan? If not, is it available at the engine level? I'm thinking Feudal Japan may have a number of tweaks on hold, and we could push them all at the same time on a new version. I would also much benefit from upping the starting castles in each capital to 3, for gameplay purposes (I always edit that, when I play the game).

            redrumR 1 Reply Last reply Reply Quote 0
            • redrumR Offline
              redrum Admin @Cernel
              last edited by

              @Cernel Do you mean this change: https://github.com/triplea-game/triplea/issues/3558

              I'm focusing first on just implementing the change in the engine and will document it in POS2. But we can discuss updating Feudal Japan if you want but probably better to create a separate thread if you do.

              TripleA Developer with a Passion for AI: https://forums.triplea-game.org/topic/105/ai-development-discussion-and-feedback

              C 1 Reply Last reply Reply Quote 0
              • C Online
                Cernel Moderators @redrum
                last edited by

                @redrum Yeah. Has that been added to Feudal Japan. If not, is that currently supported by the program (so we can add it to Feudal Japan).

                redrumR 1 Reply Last reply Reply Quote 0
                • redrumR Offline
                  redrum Admin @Cernel
                  last edited by

                  @Cernel It is supported in TripleA and I added an example to POS2: https://github.com/triplea-maps/the_pact_of_steel/pull/20/files. I don't believe Feudal Japan was ever updated to use it.

                  TripleA Developer with a Passion for AI: https://forums.triplea-game.org/topic/105/ai-development-discussion-and-feedback

                  1 Reply Last reply Reply Quote 0
                  • LaFayetteL Offline
                    LaFayette Admin
                    last edited by

                    Just to mention, two more really great uses for this:

                    • help people that are colorblind. If the unit colors look similar, an option to adjust per-country hue so they can be visible would be excellent. Flags would help this, I'm sure using colors that look physically different would be even better.
                    • building on maps that have many nations. If for example someone wanted to mod a map that has many nations, like NWO, or anything with 10 nations+, adding a new unit is a bit of a nightmare. You have to use color-picker very well to match the existing hue and it's hard to say if the new units will still look cohesive. For example, add cavalry and heavy cavalry, that is perhaps 20 units images and for each you need to do a really great match of existing hue for it not to look just hacked on.

                    @Cernel I suspect the usage of this feature would be opt-in per map, or could be used as a fallback when unit images are missing. It wouldn't be the case that we'd go through all existing maps an delete units images to leave just the auto-colorized ones.

                    C Black_ElkB 2 Replies Last reply Reply Quote 3
                    • C Online
                      Cernel Moderators @LaFayette
                      last edited by

                      In the moment a unit that is in a units subfolder (a folder inside "units" having a player's name) can be used only by 1 player, I really feel it is making little sense to colorize it in any ways, as the unit can be, or rather should, be just already made as it is supposed to look. So, on the "fallback" matter, I think it would be better to apply any of this recolourization only on the units directly inside the units folder (shared by all players not having them in their subfolders), but possibly with the ability to define in map.properties units that must not be recolourized, but never on units inside any units subfolders.

                      redrumR 1 Reply Last reply Reply Quote 0
                      • redrumR Offline
                        redrum Admin @Cernel
                        last edited by redrum

                        @Cernel The issue with that is it limits players being able to change unit colors (see color blind example above). So I think its better to colorize all of a nations units unless they are in the exemption list. This makes the feature more useful to existing maps.

                        You can also imagine modding an existing map where you want to create say a new Axis and a new Allies player. Each side has unique images so you want to copy say all germany's units to the new Axis player then colorize them and copy all UK's units to new Allies player and colorize. This would make it so you want the units in the nations folder not in the units folder directly.

                        TripleA Developer with a Passion for AI: https://forums.triplea-game.org/topic/105/ai-development-discussion-and-feedback

                        C 3 Replies Last reply Reply Quote 0
                        • C Online
                          Cernel Moderators @redrum
                          last edited by

                          @redrum Ok, well, if by that you mean that there would be a user option to change units colours while you play, that would give some reasons about recolourizing an already coloured unit used by only one player. I was not considering that, as I assumed that was just a proposal. However, I would not advise giving players the ability to recolourize units colours, at least at the present state. Almost no one plays Feudal Japan, and even if you are playing something like Revised, that is not really good, as it would be unpolished to monocolourize multicolour images, like aa radars and damaged battleships (I know, these are rather small details, but still unpolished).

                          redrumR 1 Reply Last reply Reply Quote 0
                          • C Online
                            Cernel Moderators @redrum
                            last edited by

                            @redrum said in Dyeing/Colorizing Unit Images:

                            You can also imagine modding an existing map where you want to create say a new Axis and a new Allies player. Each side has unique images so you want to copy say all germany's units to the new Axis player then colorize them and copy all UK's units to new Allies player and colorize. This would make it so you want the units in the nations folder not in the units folder directly.

                            It is really not hard to learn to colourize images with a program like GIMP. Also you can find addons for GIMP that allow you to easily recolourize a whole batch of units in a folder. So, in this case, what the mapmaker needs to do is just pasting the folder it wants, then running a batch recolourization of all, or some, of the images inside it.

                            1 Reply Last reply Reply Quote 0
                            • redrumR Offline
                              redrum Admin @Cernel
                              last edited by redrum

                              @Cernel For now, it would probably be just like nation territory ownership colors where users can edit the map.properties to override the defaults but it could potentially be added as an in-game option eventually. While it might look a bit unpolished for people the are color blind or maps with many nations, being able to see the units is probably more important then them being perfect.

                              Given the history of map makers and many of the existing maps we have, people must find it harder than you think to colorize images as we have lots of maps with units that don't match well or appear to be hacked up. Even look at Dom 1914 NML, where I took a recent pass to clean some of it up but before that it was kind of a disaster and that's a relatively popular map. Some of this feature is to help novice map makers, but its also to give players flexibility to override unit color defaults in map.properties.

                              TripleA Developer with a Passion for AI: https://forums.triplea-game.org/topic/105/ai-development-discussion-and-feedback

                              C 1 Reply Last reply Reply Quote 2
                              • C Online
                                Cernel Moderators @redrum
                                last edited by

                                @redrum I dunno. It just feels not sensible to me that you have a bunch of colourized units that are used only by one player and you also have a (mapmaker/powerusers only) setting that recolourize those already colourized units for that one same player, while you could open a graphic program and imput those same settings there, to get the units right. I don't know if maybe it would be feasible and sensible adding a mapmaking utility for recolourizing units, with the ability to select them specifically or a whole folder (I would still use GIMP). That could stay beside the utility for making the smallMap, I guess.

                                1 Reply Last reply Reply Quote 0
                                • C Online
                                  Cernel Moderators @redrum
                                  last edited by

                                  @redrum I'm not really suggesting this, as it might be too much, but it would be also possible to have an alliance subfolder in units. So, for example, the program would look for the unit in "Germans", if not there it will look for the unit in "Axis", if not there it will look for the unit in the units folder, if not there will repeat the above while looking at the program's assets. This would work in a definitive way for the game currently, as there is no way to trigger changes to the alliances during the game (something that it may be good to have).

                                  redrumR 1 Reply Last reply Reply Quote 0
                                  • redrumR Offline
                                    redrum Admin @Cernel
                                    last edited by

                                    @Cernel I considered that as well but didn't think it was worth adding this go around (maybe a phase 2). If lots of people start putting units directly in the units folder to share and there is a lot of interest in having alliance folders to share units just across an alliance then we should be able to add it in later on.

                                    TripleA Developer with a Passion for AI: https://forums.triplea-game.org/topic/105/ai-development-discussion-and-feedback

                                    C 1 Reply Last reply Reply Quote 0
                                    • C Online
                                      Cernel Moderators @redrum
                                      last edited by

                                      @redrum In the TripleA assets, all those units that are the same for all players should probably be moved in main folder. I might eventually post a new zip of the assets remanaged that way, after the stable is out. That should probably be at least 100 units less. It's actually kinda amazing that this possibility has never existed so far, and we instead kept adding the same factory etc. in every single folder.

                                      Another thing I tried in the past, but didn't work, is to have aliases for all those images that are the same for all or a number of players, but I tested TripleA was not seeing them. Not asking for this addition, as I'm not sure how good would it be now, as being able to share for all is probably the main item.

                                      1 Reply Last reply Reply Quote 0
                                      • Black_ElkB Offline
                                        Black_Elk @LaFayette
                                        last edited by Black_Elk

                                        @LaFayette said in Dyeing/Colorizing Unit Images:

                                        Just to mention, two more really great uses for this:

                                        • help people that are colorblind. If the unit colors look similar, an option to adjust per-country hue so they can be visible would be excellent. Flags would help this, I'm sure using colors that look physically different would be even better.
                                        • building on maps that have many nations. If for example someone wanted to mod a map that has many nations, like NWO, or anything with 10 nations+, adding a new unit is a bit of a nightmare. You have to use color-picker very well to match the existing hue and it's hard to say if the new units will still look cohesive. For example, add cavalry and heavy cavalry, that is perhaps 20 units images and for each you need to do a really great match of existing hue for it not to look just hacked on.

                                        @Cernel I suspect the usage of this feature would be opt-in per map, or could be used as a fallback when unit images are missing. It wouldn't be the case that we'd go through all existing maps an delete units images to leave just the auto-colorized ones.

                                        This would I think end up being the primary use of the feature. If it helps map makers in the process that's great, but I saw it as something that the average end user would find useful, either as a visual aid (if they are colorblind or are having difficulty distinguishing units for whatever reason) or just purely based on aesthetic preference. Maybe someone wants to sub out purple units for some other color, using this system you could do it on the fly. Currently its very easy to modify a nation's territory color via hex code in the map properties file, but if you wanted to change the associated units, that is more laborious and requires an outside image editing application like Gimp or PS. This might be easy for a map maker, but rather more involved for the average user.

                                        Instead of trying to arbitrate people's individual tastes by coming up with a default unit set that everyone must adopt, this gives players the freedom to color the map/units in a way that suites their personal preferences, without requiring much legwork or stepping on anyone else's toes while you're at it, since it'd basically be a local setting.

                                        1 Reply Last reply Reply Quote 5
                                        • wc_sumptonW Offline
                                          wc_sumpton
                                          last edited by

                                          @redrum was wondering if it would be possible to flip the colored unit by 180 degrees so that they would face in different directions? ie… Axis would face left and Allies would face right.

                                          Cheers...

                                          prastleP C redrumR 3 Replies Last reply Reply Quote 3
                                          • prastleP Offline
                                            prastle Moderators Admin @wc_sumpton
                                            last edited by

                                            @wc_sumpton gd idea

                                            If we open a quarrel between past and present, we shall find that we have lost the future! Sir Winston Churchill

                                            1 Reply Last reply Reply Quote 0

                                            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                            With your input, this post could be even better 💗

                                            Register Login
                                            • 1
                                            • 2
                                            • 3
                                            • 4
                                            • 1 / 4
                                            • First post
                                              Last post
                                            Copyright © 2016-2018 TripleA-Devs | Powered by NodeBB Forums