Navigation

    Fuze Arena Logo
    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Help
    • Discord

    DEMO - High Scores: supports now unicode

    Work In Progress
    high score saving
    2
    14
    812
    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.
    • joyrider3774
      joyrider3774 @spikey last edited by

      @spikey @Gothon provided me with an alternative strLen function which improves speed a lot but the righttrim function still calls it a lot but unsure how the function can be made so it does not need to keep calling strLen everytime but atm with this function from gothon it's usable for me

      Function strLen(S)
      Return Int(TextWidth(S) / TextWidth(" ") + .5)
      
      1 Reply Last reply Reply Quote 0
      • spikey
        spikey F @joyrider3774 last edited by

        @joyrider3774 Thanks for the feedback. Later I will have a look at the code. On a scrolling 3D background like in 'Da Bean' it worked well. If its the function you mentioned, the CPU (dark blue line in the debugger) would go up, please confirm.
        In general I will check if i can just do this length calculations, once the scores change and afterwards just print the content from an array.

        joyrider3774 1 Reply Last reply Reply Quote 2
        • joyrider3774
          joyrider3774 @spikey last edited by joyrider3774

          @spikey yes cpu time went from 10 ms (from my own 3d background in main menu) to 60 ms when using the printhighscores function. And given frames start to drop when you go over 16.66667... ms it was noticeable a lot. I have now replaced the strlen function with gothon's version and that seems to help a great deal.if i commented out the righttrim part in the printhighscores function fps remained normal. Do note i changed Field_SIZE_SCORE to 10 as i have a max score of 9999999999 (just made sure it was high enough) and i only display 10 scores at a time

          spikey 1 Reply Last reply Reply Quote 2
          • spikey
            spikey F @joyrider3774 last edited by spikey

            @joyrider3774 Hey, decent testing, cool. And by the way thanks @Gothon for helping out. With that details, I will review if additional changes can bring further improvement.

            1 Reply Last reply Reply Quote 3
            • spikey
              spikey F last edited by spikey

              Just submitted v3.0. It seperates display operations from trim operations. Means 'printHighscores()' only iterates through 10 strings instead of trimming 3x10 entries. So, inserting a rank, resetting the highscores or loading new highscores takes 3 seconds because it updates 10 formatted lines of text for every highscore table. But printing them later should be done in no time. I will check when its live and update the post.
              Happy if you could test this. Thank you.
              Download code: EMT73MNDN8 pending

              joyrider3774 1 Reply Last reply Reply Quote 4
              • spikey
                spikey F last edited by

                Its live now.

                1 Reply Last reply Reply Quote 0
                • joyrider3774
                  joyrider3774 @spikey last edited by

                  @spikey thanks man, just tested it in my game, and all fine now. Initially i was affraid of the 3 seconds thing you mentioned but i only have 3 highscore tables and it does not even take 1 second to do the actions you mentioned. Everything speed wise behaves normal as well now when viewing the highscores.

                  I guess if people still have problems if they have many many highscore tables they could still use gothon's function. But in my game with your new code the delay is hardly noticeable (i only see a small spike in the graphs but nothing else).

                  It also makes me wonder is there any reason we can not use gothon's functions or better why you did not use it ?

                  Thanks again :)

                  1 Reply Last reply Reply Quote 0
                  • spikey
                    spikey F last edited by

                    This post is deleted!
                    1 Reply Last reply Reply Quote 1
                    • joyrider3774
                      joyrider3774 last edited by

                      ok no problem out of safety i'm using your function again then until we can confirm it works somehow. Thanks again

                      1 Reply Last reply Reply Quote 0
                      • spikey
                        spikey F last edited by

                        Ok, after a first round of tests I was not able to find any case where it was not working. The + .5 is the cool thing that rounds to the right value. Basically use it, if there is a bug you can go back to the original. I mean its from @Gothon, my guts cannot compete 😂 with a single line of code.

                        1 Reply Last reply Reply Quote 2
                        • spikey
                          spikey F last edited by spikey

                          I removed my guessing comment about textWidth(), it works 100% according to my tests in the current FUZE version 3.0.0. For all unicode.chars. textWidth(chr(x)) for all x is the same for the same text size; or 0 for some characters, which do not draw anyhting at all.
                          So, good to go, I will adjust the code and resubmit.
                          Just a side note: the width returned, is the width, the character will obtain, including space before and after the character. TextWidth() does not return the distance between the left most to the right most pixel. E.g. "W" has almost no unused pixels to the left and right, where "i" has a lot of unused pixels to the left and right. But textWidth() returns the same value, which is perfect for aligning texts. But if you want to center a word, starting or ending with lower case, above a word in upper case, you will have to adjust the position a bit (if you use a big font size).
                          submission status: pending

                          joyrider3774 1 Reply Last reply Reply Quote 3
                          • joyrider3774
                            joyrider3774 @spikey last edited by

                            @spikey thanks for verifying / testing it out :) now it's all perfect :)

                            1 Reply Last reply Reply Quote 1
                            • First post
                              Last post