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

    Game notes max width

    Scheduled Pinned Locked Moved Map Making
    36 Posts 4 Posters 4.7k Views 4 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.
    • C Offline
      Cernel Moderators @redrum
      last edited by

      @redrum said in Game notes max width:

      Well my screen is 1920 wide and this fits across it 4 times and a little left over:
      f15f74a1-f610-4124-a2e1-ec12feb3293b-image.png

      This image is 489 pixels wide. Also you may notice that those things are more to the right than the actual centre, I guess because some space is left before the big dots. If you take that into account, it becomes exactly 520 pixels wide.

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

        @Cernel I've obtained the 520 because it extends of up to 260 pixels rightwards from the centre, thus I've extended of the same amount leftwards. It extends less than so to the left, instead. Anyways, those quadrangles are centred and, for sure, it doesn't fit in the 400 pixels wide one, anyways.

        520 pixels would be exactly 30% more pixels than 400, that is what I'm getting in all cases.

        So, it seems clear to me that TripleA has this major problem of setting any pixel dimensions to 30% more than you set. I guess, so far, mapmakers just set it and, then, look if it is good enough, instead of assuring it being of the wanted dimensions. It would be good if you can actually give a wanted layout to your rulebook, without having to go the TWW way and have it as all images. I can assure that if you call an image, instead, the image is not increased by 30% (of course, overwise the notes of TWW would be all blurred, for example, as well as whatever image).

        Practically, if you have a centred image that is 400 pixels wide and, under it, a division that is centred and supposed to be 400 pixels wide too, the image will be 400 pixels wide, while the division will be 520 pixels wide, screwing up the relative layout, other than the absolute one.

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

          @Cernel Hmm. Honestly I have no idea. I don't think TripleA does anything beyond using the standard Java HTML rendering so if its displaying 30% wider I don't have a clue to why that would be.

          @RoiEX @LaFayette Any thoughts here?

          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 Offline
            Cernel Moderators @redrum
            last edited by

            @redrum The only way I can explain this is that there must be something somewhere in the program that increases all "px" values given in notes by 30%. It would be good to get rid of it. Hardly any idea why any developers decided to have this, if I'm right.

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

              A bit of topic, but .... can notes have background picture instead of background color? If so, what would the code look like?

              BTW, and if it is of any use, I use text max width in some map notifications instead of a <br> at every line to keep a long sentence to not make the notification window very wide. Notification code looks like this like this:
              HumansIntro=<body><p style="width: 260px"><img src="IntroLogo.png"/><br><b>Humans:</b><br>Bla bla bla.<br><img src="GreatBattleArthur.png"/><br><br></p></body>
              But strangely the text field is much wider than 260px, more like 300px. But I just adjust the number to fit the purpose.

              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

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

                @Frostion said in Game notes max width:

                But strangely the text field is much wider than 260px, more like 300px. But I just adjust the number to fit the purpose.

                Yes, and I would say that is bad. Then, if someone would (finally) fix this problem (if it is a problem), your layout would be messed up. Probably other mapmakers do the same, and maybe don't even realize it.

                My guess is that some developer in the past felt that some notes were too small and added to the program a +30% on any dimensional values, but, of course, I'm merely surmising. If so, better getting rid of this as soon as possible.

                As far as background pictures go, I think that would be another topic.

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

                  @Cernel said in Game notes max width:

                  My guess is that some developer in the past felt that some notes were too small and added to the program a +30% on any dimensional values, but, of course, I'm merely surmising. If so, better getting rid of this as soon as possible.

                  Quite positive no. AFAIK the HTML of game notes is plopped into the Swing UI for rendering. I'd conclude it's more a problem with the dimensions calculations the HTML rendering is using. Inline styles of some elements can be overridden to stretch/fill space. You may need to include a 'filler' element that can occupy the extra space that is being used so that the 'filler' is expanded rather than the HTML engine stretching your component. For example, consider this:

                  <p style="width:500px">
                     <p style="width:250px">
                    </p>
                  </p>
                  

                  you might think that nested element is going to be 250px wide, but the engine sees that the component needs to be made 500px, so you the child styling might lose or might win, it totally depends on the HTML rendering engine.

                  Some things you can try:

                  • try a table, the width of tables is usually respected
                  • avoid nesting elements with width specifications
                  • see if you can get the HTML to render well in a web browser, if you can't get it to render well there, then there is not much hope in a swing HTML renderer.
                  C 1 Reply Last reply Reply Quote 0
                  • C Offline
                    Cernel Moderators @LaFayette
                    last edited by

                    @LaFayette I've tried in several other cases, also on otherwise completely blank or next to blank notes, as per screenshots at this thread, and it still gives 30% more pixels. Look at this:
                    https://forums.triplea-game.org/topic/1784/game-notes-max-width/6?page=1

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

                      @Cernel Give it a try as a web-page. The swing rendering should not be too different, if you can't get it to work there, it's pretty guaranteed swing won't do any better.

                      C 2 Replies Last reply Reply Quote 0
                      • C Offline
                        Cernel Moderators @LaFayette
                        last edited by

                        @LaFayette said in Game notes max width:

                        @Cernel Give it a try as a web-page.

                        What do you mean?

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

                          Save the HTML content as a ".html" file and open it in a web browser.

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

                            @LaFayette said in Game notes max width:

                            @Cernel Give it a try as a web-page. The swing rendering should not be too different, if you can't get it to work there, it's pretty guaranteed swing won't do any better.

                            Ok here it is what I get on a html file with this code:

                            <html>
                            <body>
                            <table width="1000px" border="1px">
                              <tr>
                                <th>AAA</th>
                                <th>BBB</th> 
                              </tr>
                              <tr>
                                <td>aaa</td>
                                <td>bbb</td> 
                              </tr>
                            </table>
                            </body>
                            </html>
                            

                            Screenshot:
                            508791ff-bc01-40f8-b30b-b55e5523b907-image.png

                            It's fully correct. So, does this prove the problem (getting 130% the pixels you ask for) is not with my system, but with TripleA?

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

                              We're using Swing HTML rendering, we literally can't fix it and have not coded anything to alter or manage it. The fix needs to be in crafting the HTML that renders properly in that HTML rendering engine.

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

                                Correct rendering in a webpage is necessary but not sufficient criteria for having it render well in the Swing HTML renderer. Said another way, if it does not work on a vanilla webpage, it certainly won't work in Swing. But even if it renders well on a modern browser, the Swing HTML renderer does not guarantee to be compliant, is old, and has no guarantee it'll do anything really correctly.

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

                                  Well, in my opinion this is a pretty major issue TripleA is going to go along with, as mapmakers will keep formatting notes likely inherently wrong, with respect to their intentions (like @Frostion), over the years, and new mapmakers will have to find out that they are getting 30% more pixel than they wanted, so I suggest at least tracking this somewhere.

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

                                    Tracking is for things we can fix and do something about. The problem is in the HTML and the HTML renderer, neither of which is controlled by the game engine proper.

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

                                      Ok, anyway, if anybody is curious about this problem that, apparently, will never be possibly fixed, you can install this map:
                                      0.zip

                                      Then, starting it, if you see what I see, you should see a table of 130 pixels wideness, while, opening the xml, you can see this is the code of the notes property:

                                          <property name="notes">
                                            <string/>
                                            <value><![CDATA[
                                      <html>
                                      <body>
                                      <table style="width:100px;background-color:FFFFFF">
                                        <tr>
                                          <th>a</th>
                                          <th>b</th> 
                                        </tr>
                                        <tr>
                                          <td>c</td>
                                          <td>d</td> 
                                        </tr>
                                      </table>
                                      </body>
                                      </html>
                                      				]]></value>
                                          </property>
                                      

                                      The map works both on 1.9 and 2.0.

                                      If you believe the wideness of the table in notes is given as 100 pixels (as it should), please upload a screenshot of it.

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

                                        Issue tracked in:
                                        https://github.com/triplea-game/triplea/issues/6157

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

                                          @Cernel the HTML needs to be fixed within the constraints of the HTML rendering. There is no code fix for us to apply here. We're not modifying the HTML, we're not rendering it ourselves. There is no way we're going to change anything (short of rebuilding an HTML renderer, IE; a web-browser) that makes this exact HTML render how you want.

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