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

    Development Discussion: Speeding up battle calculator (and thus Hard AI)

    Scheduled Pinned Locked Moved Feature Requests & Ideas
    44 Posts 10 Posters 11.7k Views 10 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.
    • LaFayetteL Offline
      LaFayette Admin
      last edited by

      An AI variant IMO would be an excellent step. The idea of computing the actual odds vs the current monte carlo approximation is a very good one.

      The combat/battles code suffers from complexity and is already somewhat time-optimized. It would be very easy to underestimate the level of effort to replace the battle calc (simply having something that mostly works is just not quite enough, it would need to be cleanly coded, not be duplicative, well tested, complete, etc...)

      1 Reply Last reply Reply Quote 0
      • T Offline
        Trevan
        last edited by Trevan

        @RoiEX I'm not aware of the test flag. How do I use it?

        I can make a sibling of FastAI that uses this calculator. I also like the idea of having it automatically compare the actual odds vs the new odds. @Alexei-Svitkine when you say "send error reports", how would I do that? Is there existing classes in the code that I can just use to send the reports?

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

              if(ClientSetting.showBetaFeatures.isSet()) {
                  // add experimental feature
              }
          
          T 1 Reply Last reply Reply Quote 2
          • T Offline
            Trevan @LaFayette
            last edited by

            @LaFayette I tried using that in the PlayerType enum

              BATTLE_TREE_AI("BattleTree (AI)", ClientSetting.showBetaFeatures.isSet()) {
                @Override
                public Player newPlayerWithName(final String name) {
                  return new BattleTreeAi(name);
                }
              },
            

            But the player is still showing up in the list.

            I also tried:

              BATTLE_TREE_AI("BattleTree (AI)") {
                @Override
                public Player newPlayerWithName(final String name) {
                  if (ClientSetting.showBetaFeatures.isSet()) {
                    return new BattleTreeAi(name);
                  }
                }
              },
            
            1 Reply Last reply Reply Quote 0
            • RoiEXR Offline
              RoiEX Admin
              last edited by

              @Trevan
              Looks like @LaFayette trolled you a little bit there.
              Try

              BATTLE_TREE_AI("BattleTree (AI)", ClientSetting.showBetaFeatures.getValue().orElse(false)) {
                @Override
                public Player newPlayerWithName(final String name) {
                  return new BattleTreeAi(name);
                }
              },
              

              instead

              T 1 Reply Last reply Reply Quote 0
              • T Offline
                Trevan @RoiEX
                last edited by

                @RoiEX That worked. I have to restart triplea for it to affect.

                I tried to play a game in the UI since everything I've done has been through the test framework. But when I try to start a game, I get the error

                Failed to start game
                IllegalArgumentExeption: File must exist at path: /.../game-headed/assets/unit_scroller/unit_sleep.png
                

                I've checked and that file definitely doesn't exist. I've also checked out master and tried to run it in case my changes broke it but master also throws that same error.

                Is there something I'm missing?

                And should I create a PR now?

                1 Reply Last reply Reply Quote 0
                • RoiEXR Offline
                  RoiEX Admin
                  last edited by

                  @Trevan are you using a specific IDE?
                  I think you have to run
                  ./gradlew downloadAssets before running the game in order to download all the default assets

                  T 2 Replies Last reply Reply Quote 0
                  • T Offline
                    Trevan @RoiEX
                    last edited by

                    @RoiEX I'm using IntelliJ

                    1 Reply Last reply Reply Quote 0
                    • RoiEXR Offline
                      RoiEX Admin
                      last edited by

                      And yes, you can create a PR whenever you like, it will take us a while to review it though

                      1 Reply Last reply Reply Quote 0
                      • RoiEXR Offline
                        RoiEX Admin
                        last edited by

                        @Trevan If you're using intelliJ then it should automatically download the assets.
                        Try deleting the assets and .assets folder and it should force a re-download

                        T 1 Reply Last reply Reply Quote 0
                        • T Offline
                          Trevan @RoiEX
                          last edited by

                          @RoiEX It looks like IntelliJ is running that command but I ran it manually as well. I'm still getting that error. There are other files in game-headed/assets/unit_scroller so things have been downloaded.

                          1 Reply Last reply Reply Quote 0
                          • T Offline
                            Trevan @RoiEX
                            last edited by

                            @RoiEX deleting the assets and .assets fixed the issue.

                            1 Reply Last reply Reply Quote 0
                            • T Offline
                              Trevan
                              last edited by

                              I've created a PR - https://github.com/triplea-game/triplea/pull/6501

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