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

    Battle Calc Question

    Scheduled Pinned Locked Moved Player Help
    38 Posts 9 Posters 14.2k 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.
    • C Offline
      Cernel Moderators @redrum
      last edited by

      @redrum I surely suggest to keep both the Battlecalculator and the Battlesimulator, also considering that this is a volunteer based project, in which anybody can walk away anytime.

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

        @Cernel What benefit would you see in keeping "both" variants?

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

          @cernel Side feature request, a think I sometimes thought is having a button on the simulator that allows you to show everyone the results and the units in the simulation. Like when you messed up something and would want to rerun the battle and edit it, of course at run count 1.

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

            @roiex

            1. There may be things you overlook, like AA shots with special properties against infrastructure units or other things, and at least having a simulator would be more reliable if there is not always a developer around ready to cover all unforseen cases the mapmakers may get creative with.
            2. Maybe a developer would add a feature, but would not be able to rework the battlecalculator; much easier adding features with a simulator; now you are requesting any developers that want to improve or change battle related things to be able to refactor the battlecalculator too; that is a huge additional requirement.
            3. Already the simulator doesn't cover all cases, like you cannot add marine units and decide to take them in some numbers before or after; covering everything would be even more difficult with a calculator.
            4. Maybe something in the future bugs off and there are no developers around to correct the problems readily; a simulator is much more reliable than a calculator, as it is not really another thing but what already happens in battle.
            1 Reply Last reply Reply Quote 0
            • RoiEXR Offline
              RoiEX Admin
              last edited by

              @Cernel Valid concerns, however I'm convinced that if we code it the right way (so it essentially uses the same code as normal battles) the performance improvements will be huge at no cost at all.
              Simply because the code currently simulates battles by copying complete savegames, running the battles there, storing the results and then undoing all the changes.
              I'm sure this will reduce the overhead of TripleA drastically

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

                @roiex I still suggest 1 year time of keeping both before deciding if throwing the simulator overboard.

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

                  @Cernel There's no reason to keep 2 systems doing the same thing around for such a long time. Either the potential new system works as expected and we keep it and dump the current one, or it doesn't work as expected because stuff isn't working as expected and we dump it instead.
                  Simple as that.
                  Nobody wants to introduce a half-broken system just because it's lightweight

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

                    Btw it's easy to forget we can in theory revert all changes that were ever done to the triplea codebase thanks to git.
                    We can even lookup what the first code being written 16 years ago was exactly

                    prastleP 1 Reply Last reply Reply Quote 2
                    • prastleP Offline
                      prastle Moderators Admin @RoiEX
                      last edited by

                      @roiex shush you 🙂

                      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
                      • alkexrA Offline
                        alkexr
                        last edited by

                        I've thought a lot about about calculating actual probabilities, and it looks impossible with aa attacks and support, but I probably could find an approximation that would be fast and fairly accurate in battles with hundreds of units and no support/aa stuff (but inaccurate with fewer units). That doesn't look useful enough for me to try it, though.

                        The tree search looks computationally impossible if battles can last 4-5 turns (if there are only, say, 4 different dice outcomes in each round for each player, that's around 4^10 ~ a million nodes already).

                        On the other hand, a machine learning algorithm should perform quite well here. You would need to train it for each map separately though, which is an issue, because you need a lot of computational capacity to train a neural net. But once trained, it would be fast, reliable and accurate. (Actually, for maps with 10ish units, it might be pretty cheap computationally to train one?)

                        You could also combine the tree method with heuristics. You start building a tree, and if you reach a node where one player is just obviously going to win, or if a node is deep enough down the tree, or it has a very low probability, instead of recursively continuing the tree, you apply a simple heuristics based on hitpoints/power to evaluate the node directly.

                        "For the world is changing: I feel it in the water, I feel it in the earth, and I smell it in the air."

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

                          @alkexr Interesting Ideas.
                          Will think about them and how feasible they are.

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

                            @alkexr I don't think a neural network would need to be trained for individual map.
                            If we think about a unit as a tuple of an attack and defense value, cobine it with an amount count (simply being 0 if this kind of unit doesn't exist) and try to handle any special events with a classical aproach, the only thing we'd need to do is to limit the maximum die value maps can specify (might be very high if needed), and pass in the die amount of a map as an additional input.

                            alkexrA 1 Reply Last reply Reply Quote 0
                            • alkexrA Offline
                              alkexr @RoiEX
                              last edited by

                              @roiex said in Battle Calc Question:

                              If we think about a unit as a tuple of an attack and defense value

                              Except how do you tell the net which support type affects which unit, and which AA attack can target which unit. And units can have multiple rolls. And multiple hitpoints. And we can have coastal bombardment, and capturable combat infrastructure. But if we ignore these, I guess that's possible.

                              No, I think you need to have two inputs per unit type: the number of units of that type on each side. And then you have to let the net learn how combinations of units present affect each other. (Except that triggers, technologies and terrain can change unit stats too. Erm... whatever.)

                              But for some simpler maps with a limited number of unit types this might be viable. You would only have several hundred neurons. Now I never actually tried training a net myself, but I don't think that should take longer than an hour on a PC. And it would massively improve performance if the map tends to have huge stacks of units. As for more complex maps... not sure.

                              "For the world is changing: I feel it in the water, I feel it in the earth, and I smell it in the air."

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

                                @alkexr Yeah, I agree that unless you found a way to aggressively trim the tree that it would expand to quickly for battles that can last 7-8 rounds.

                                @alkexr @RoiEX I kind of doubt that without a lot of data and a lot of effort that machine learning would work here. There again are probably too many different parameters and the variation across them is pretty large. Honestly, I think simulation is the best approach and improving the simulation that we have today is the best use of our efforts.

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

                                alkexrA 1 Reply Last reply Reply Quote 0
                                • alkexrA Offline
                                  alkexr @redrum
                                  last edited by

                                  @redrum said in Battle Calc Question:

                                  I kind of doubt that without a lot of data and a lot of effort that machine learning would work here. There again are probably too many different parameters and the variation across them is pretty large. Honestly, I think simulation is the best approach and improving the simulation that we have today is the best use of our efforts.

                                  This is actually a comparatively simple problem for machine learning. We already know the correct solution to the problem (battle calculator), we have an unlimited amount of training data (battle calculator), the number of parameters is relatively low (hundreds at most with the map specific approach, and that is for the most complex maps) (compare that to hundreds of thousands for image recognition), desired output is a single number (win chance) that changes more or less continously with input.

                                  Although I agree we shouldn't focus too much effort here. Especially since it's probably not going to be me who is going to sit down and do some actual work 🙂

                                  "For the world is changing: I feel it in the water, I feel it in the earth, and I smell it in the air."

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

                                    @alkexr You might want to try it though,we're always looking for new developers 😉

                                    1 Reply Last reply Reply Quote 3

                                    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