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

    Rules for engine rendering of unit images (Feature Request)

    Scheduled Pinned Locked Moved Feature Requests & Ideas
    11 Posts 5 Posters 1.6k Views 5 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 @Frostion
      last edited by

      @Frostion I agree with the idea. Essentially unit images that are lower on the screen appear on top. I guess secondarily then units further to the right appear on top in case of horizontal overlap. I'm not sure how its determined at the moment. Do you think its random or maybe based on placement ordering? I haven't tested this much or looked at the code.

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

      HeppsH FrostionF 2 Replies Last reply Reply Quote 1
      • HeppsH Offline
        Hepps Moderators @redrum
        last edited by

        @redrum and @Frostion Would be a very welcome graphical improvement.
        !

        "A joyous heart sours with the burden of expectation"
        Hepster

        1 Reply Last reply Reply Quote 1
        • C Offline
          Cernel Moderators @Frostion
          last edited by

          @Frostion I think it should be map settable if to prioritize higher or lower Y. If not set, then I guess keep it random like now. Same for X.

          And, yes, this would be cool to support maps made in projection, likely axonometric.
          https://en.wikipedia.org/wiki/Axonometric_projection

          However, if making a map based on simulating objects resting on a surface underneath them, then also drawing them from the top left corner would come into question, but they should be rather drawn from centre bottom, if prioritizing higher Y and not prioritizing any X, for example.

          1 Reply Last reply Reply Quote 0
          • FrostionF Offline
            Frostion Admin @redrum
            last edited by

            @redrum said in Rules for engine rendering of unit images (Feature Request):

            Do you think its random or maybe based on placement ordering?

            I have tried to investigate the behavior. To me it seems pretty random, but with some tendencies in regards to when the position is affected. I have tried to start up a map several times and look at the the same territory with units that sometimes end up in the foreground and sometimes in the background, even though it is clear what position has the higher XY coordinates.

            The three units are placed at Thunder Bluff from game start. A "Horde-Capital", "Flag" and "Footmen". This is just after map loading (here with the Footmen ending up in the back ... tip of sword is behind Horde-Capital.
            1GameLoadUp.png

            I removed Flag. Still ends up behind Horde-Capital.
            2RemovedFlag.png

            Placed Flag again and Footmen ends up in front.
            3AddedFlagAgain.png

            Then I try to reload the map. This time the Footmen are starting in front:
            4GameLoadUp.png

            I remove the flag ... like before it ends in the back:
            5RemovedFlag.png

            During the placement it goes to front:
            6DuringPlaceFlag.png

            But after placement it is in back:
            7AddedFlagAgain.png

            So it seems pretty random. But the most notable find is, that when units are placed, even outside territory during game loading ("setupRandomStartDelegate") it can (sometimes) affect units to go front to back or back to front, sometimes several times. When altering units in territory, it also affects the position.

            Note that during my test it might not be the Footman only that changes position. I guess that it might instead be the Horde-Capital or maybe both (all units)?

            Question: Du we have a dev who is into these graphics and mechanics of the visuals? I have the impression that this aspect of TripleA is seldom addressed. I hope we do 😉

            Map maker of: Star Wars: Galactic War + Star Wars: Tatooine War + Caribbean Trade War + Dragon War + Age of Tribes + Star Trek: Dilithium War + Iron War + Iron War: Europe + Warcraft: War Heroes

            HeppsH redrumR 2 Replies Last reply Reply Quote 0
            • HeppsH Offline
              Hepps Moderators @Frostion
              last edited by

              @Frostion It does seem totally random. I have run some of the same tests and found no discernible pattern. It also changes when you toy around with the zoom function.

              "A joyous heart sours with the burden of expectation"
              Hepster

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

                @Frostion To answer your question, not really. Most of the tile and unit drawing code hasn't been changed much in a very long time. The only somewhat related updates have been to add the unit flags and unit icons for technologies used in TWW. I would need to spend some time reading through the unit drawing code to figure out exactly how it works and if a change like this is possible to make.

                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 1
                • redrumR Offline
                  redrum Admin
                  last edited by

                  So I glanced at this and the simplest answer is to try and draw unit images in the order you want them to appear back to front. The 2 challenges are as follows:

                  1. The map screen rendering is divided into tiles which are essentially 256 x 256 pixel squares that as a grid represent the entire map. A territory can span multiple tiles so in order to have the units drawn in a certain order, you'd have to consider the order in which the tiles are drawn. And if you redraw the bottom tile for say territory A last then it could create a cascading effect where then it overlaps the top of Territory B which now needs another tile under it to be redrawn, etc.
                  2. Need to ensure units in a territory within a tile are rendered in a certain order. Right now there doesn't appear to be any ordering and its essentially random. It may sometimes follow the placement ordering but this doesn't appear to be guaranteed. This could be addressed.

                  So with that approach the short answer is they could be drawn a certain order within a tile but a territory could span multiple tiles which without redrawing some/all tiles below and to the right of the territory, I don't think it would be possible to guarantee order.

                  Another I think related problem is unit overflow drawing which I again believe is essentially random. Sometimes the overflow bar/units are on top and other times they are on the bottom.

                  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
                  • FrostionF Offline
                    Frostion Admin
                    last edited by

                    @redrum Drawing the units within the 256x256 areas in an orderly fashion would probably guarantee like that most (75%?) of the units look good.

                    From what you say I imagine that, for example, when one 256x256 area is drawing its units as a result of an updated situation (or just when the player interacts with a territory, like when I clicked a territory to add a flag and the units rearranged themselves), then often other adjacent 256x256 areas, to the top, buttom, left of right, simultaneously do their own updates of unit pictures in their own speed. An therefore even if the single areas are ordered nicely, we may still see strange overlaping where the "border" units meet and overlap each other.

                    I think it would be a good start to have orderly drawing within just areas. @Hepps don't you think so?

                    Map maker of: Star Wars: Galactic War + Star Wars: Tatooine War + Caribbean Trade War + Dragon War + Age of Tribes + Star Trek: Dilithium War + Iron War + Iron War: Europe + Warcraft: War Heroes

                    redrumR 1 Reply Last reply Reply Quote 2
                    • redrumR Offline
                      redrum Admin @Frostion
                      last edited by

                      @Frostion Exactly. And so if say those adjacent areas redraw after the initial one then if they have overlapping unit images they would appear on top. Plus those adjacent redrawn areas then could impact other territories.

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

                      HeppsH 1 Reply Last reply Reply Quote 0
                      • HeppsH Offline
                        Hepps Moderators @redrum
                        last edited by

                        @redrum Seems like a good place to start. Very interesting... I had always wondered what impact the 256 x 256 had other than when the map itself was being rendered. I hadn't realized it affected unit placement as well.

                        "A joyous heart sours with the burden of expectation"
                        Hepster

                        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 / 1
                        • First post
                          Last post
                        Copyright © 2016-2018 TripleA-Devs | Powered by NodeBB Forums