Announcement

Collapse
No announcement yet.

c++ ability

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #31
    Uh, no. A good AI doesn't care about the Carrier Flag, because the only unit with it is the Aircraft Carrier. A good AI doesn't care about any of the flags, because it knows the specific strategy to use for each unit.
    Considering there are promotions which allow units to gain abilities, I think the kind of hard-coding you're suggesting would just weaken the ai. I agree with Solver. A good ai shouldn't know about units, but about the underlying abstractions.
    As for a carrier flag, it's exactly the same for the ai to care about a carrier flag or about being an aircraft carrier, since, in your example, they are the same thing. But the one which knows about the flag is easier to adapt to modding.
    Also, it's usually safer to build the ai on math rather than on believes. For instance you know that your units (of type A) can beat enemy units (of type B) with a given ratio of success. How many do you send to attack 3 kind B units? You are NOT going to compute the proportions for each possible pair of unit types as it's a huge table, and using such huge tables everywhere bloats and slows down the program needlessly. You're going to simulate the fights or compare the strengths. Abstraction is better because it is more accurate (less chance of an error slipping in the code), smaller and faster.
    Also, Kuci, the kind of ai you're talking about is unable to handle modding. People who start modding the ai will start modding other aspects of the game, and the ai you're wishing for will be unable to handle these. Thus it will be useless for most people who would use it. Everyone who makes a mod or scenario would have to rewrite the whole ai for it to work, which is not practical.
    Clash of Civilization team member
    (a civ-like game whose goal is low micromanagement and good AI)
    web site http://clash.apolyton.net/frame/index.shtml and forum here on apolyton)

    Comment


    • #32
      Considering there are promotions which allow units to gain abilities, I think the kind of hard-coding you're suggesting would just weaken the ai. I agree with Solver. A good ai shouldn't know about units, but about the underlying abstractions.


      A good AI in which the underlying units aren't fixed, yes. When they are, it doesn't have to.

      Also, Kuci, the kind of ai you're talking about is unable to handle modding. People who start modding the ai will start modding other aspects of the game, and the ai you're wishing for will be unable to handle these. Thus it will be useless for most people who would use it. Everyone who makes a mod or scenario would have to rewrite the whole ai for it to work, which is not practical.


      WHICH IS MY POINT.

      Firaxis has to make an AI that can handle mods. Apolyton doesn't.

      The AI that Apolyton would make, I'd think, is one that would be specifically customized to the default ruleset, or a slight modification thereof ala Apolyton University. It would be programmed with the strategies that players discover over time for that specific ruleset, and would fail when used in a mod. This AI would be superior to the Firaxis AI, in those stock games, and could even prove a formidable opponent.

      Comment


      • #33
        Uhh, you are, simply put, wrong. The AI will always take in account several factors when taking decisions. That's how it works. The factors will be numerous. To pick a promotion, you have to look at the overall situation, not always pick the same promotion. Thus, several factors. If you want the AI to choose the best promotion, you have it look at those factors. When it does, it simply doesn't matter anymore whether the unit is fixed or not. You don't tell the AI that for Swordsmen, it needs promotion X. You tell it what to consider when picking a promotion, and the AI will do it.

        I really doubt Firaxis are specifically adding code that makes the AI adapt to mods. It's too complex. However, adaptation is simply emergent behaviour. A well designed AI is adaptive, to a degree.
        Solver, WePlayCiv Co-Administrator
        Contact: solver-at-weplayciv-dot-com
        I can kill you whenever I please... but not today. - The Cigarette Smoking Man

        Comment


        • #34
          Uhh, you are, simply put, wrong.


          Great rebuttal

          The AI will always take in account several factors when taking decisions. That's how it works.


          Where did I say it wouldn't?

          To pick a promotion, you have to look at the overall situation, not always pick the same promotion.


          Where did I say it would?

          However, the AI can be programmed with a sort of understanding of the uses of the various promotions, if they're constant, and to which units they should be applied, in what proportions, in what situations.


          I really doubt Firaxis are specifically adding code that makes the AI adapt to mods. It's too complex. However, adaptation is simply emergent behaviour. A well designed AI is adaptive, to a degree.


          No no no. Even the Civ3 AI adapted to mods. There were the flags, and it looked at move points and such. It built defense units in certain situations, offense units in others. But it never knew to do a Palace jump, or beeline for Cavs, or build a settler factory.

          Comment


          • #35
            I hate to but in when I don't know the subject all that well but it sounds to me like you are saying the same thing.

            Kuci is saying that the stock AI will be good and adaptive to mods overall by using the flags. However, when the community mods the game they will take specific things that players do or exploits and train the AI to do the same.

            For instance, if the tech tree isn't as good as expected and players find a way where one research path is always used, then in order to aid the AI the mods will code the AI to use the same method.

            I don't know it sounded to me like you were all argueing the same point and just misunderstood each other. I'll but out for now.
            GC Magazine|Gamecatcher

            Comment


            • #36
              Firaxis has to make an AI that can handle mods. Apolyton doesn't.
              You can certainly make ai's that will be able to better handle specific mods. But the more fine-tuning you do, the less generic they become, the less useul they become. Kuciwalker, you seem to believe there will be one standard game and the ai will be able to better cope with that standard thanks to modding. It's possible, but I don't believe that. I think there will be mods, that these will be different, and an ai devised for the standard game would behave worse than the standard ai for them.
              In my opinion, the way to make the ai better is not to teach it units (CtP2 has a simple way of teaching which unit to build: It's got a list and picks the best unit of the given type in the list), but to teach it things the rules allow.
              For instance, if the special ability XXX is overpowerful, it's intersting to teach the ai: "Try to get units with ability XXX". It will have several ways of doing that: Promoting them, or building such units. Building such units may require techs or resources. So you have to keep it general so an ai which is unable to get a resource is still able to get the XXX units through promotions. Maybe even declare a war just for the sake of promoting its units. This would require players to find out that XXX is important, that the ai doesn't have a clue about that, and it's better to handle it that way than by saying try to build unit Z which has that special ability, because it will also perform well when used with a mod where unit Z requires a resource that the ai can't find.
              You do not need to hard-code things based on a certain set of moddable figures. Things like palace jumping aren't really moddable in civ2 or 3 (unless you prevent them by removing the palace from buildable things), they are part of the rules. Apolyton can adress such points if Firaxis failed somewhere, but this won't be attached to a specific ruleset, just to experience of how the game works. For instance, the real question with palace jumping is: When and where to do it. You may decide of an arbitrary number of cities, but that depends on map size or you may decide of a proportion of wasted resources, which will work as well and be able to adapt to other situations.
              My point is a generic ai is not necessary weaker than a hard-wired one, and you don't have to rewrite it every time you tune the game.
              Clash of Civilization team member
              (a civ-like game whose goal is low micromanagement and good AI)
              web site http://clash.apolyton.net/frame/index.shtml and forum here on apolyton)

              Comment


              • #37
                Originally posted by Locutus
                The reason for not using Python more is quite obvious: C++ give much better performance.
                Only if you consider algorithms within the same big O measurement. It is often said that a quicksort written in Basic is faster than a bubble sort written in C for lists of arbitrary length.

                That's why us CS types study algorithms and generally ignore individual programming languages

                Besides, pointers in C (and C++ by extension) are horrible for a compiler to optimize. Fortran and Pascal, for example, are better in this aspect.
                (\__/) 07/07/1937 - Never forget
                (='.'=) "Claims demand evidence; extraordinary claims demand extraordinary evidence." -- Carl Sagan
                (")_(") "Starting the fire from within."

                Comment


                • #38
                  Originally posted by Urban Ranger
                  It is often said that a quicksort written in Basic is faster than a bubble sort written in C for lists of arbitrary length.
                  Well, duh. Bubble sort is one of the worst sort algorithms in the world for large, unordered lists. That's apples and oranges (it's not like quicksort is impossible on C).

                  But obviously the algorithms for calculating city growth or the outcome of a battle aren't going to be horribly different in C than in Python. And using the same algorithm, C typically outperforms Python by a large margin.

                  That's why us CS types study algorithms and generally ignore individual programming languages
                  Uhm, I'm a CS type myself. The choice of language is one of the most important choices for any project, and it's not a trivial one. But in case of games programming, which relies very heavily on performance and in practice often involves low-level platform- or even hardware-specific code (for the purpose of increasing performance), you pretty much can't avoid C for at least major sections of your code.

                  Besides, pointers in C (and C++ by extension) are horrible for a compiler to optimize. Fortran and Pascal, for example, are better in this aspect.
                  Yeah, but we're not comparing C with Delphi or Fortran, we're comparing it with Python, an interpreted language. And although Python is one of the fastest of all major interpreted languages, it overall still performs much worse than C.
                  Last edited by Locutus; September 12, 2005, 05:28.
                  Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

                  Comment


                  • #39
                    Originally posted by Locutus

                    But in case of games programming, which relies very heavily on performance and in practice often involves low-level platform- or even hardware-specific code (for the purpose of increasing performance), you pretty much can't avoid C for at least major sections of your code.
                    Performance is important, but not all parts of the code contribute equally. The 80/20 rule fits pretty well. Write your code in a high-level language for development speed, then profile your bottlenecks and rewrite the heavily-used parts in C. Some things obviously must be in C or assembly from the beginning, either because it will obviously be a performance bottleneck or because the high-level language doesn't support it. Nevertheless, I don't see that a game like Civilization needs the majority of its code (measured in lines, I guess) to be in C, especially since the graphics engine is third party.

                    Comment


                    • #40
                      Originally posted by Locutus
                      But obviously the algorithms for calculating city growth or the outcome of a battle aren't going to be horribly different in C than in Python. And using the same algorithm, C typically outperforms Python by a large margin.
                      If you use two different languages to code the same algorithm, sure, a compiled language is going to have a speed advantage over an interpreted language. What I was saying was it would be better to spend the time on improving the algorithms themselves first.

                      Originally posted by Locutus
                      Uhm, I'm a CS type myself. The choice of language is one of the most important choices for any project, and it's not a trivial one.
                      Strange, since an algorithm can be implemented in virtually any programming language. Afterall, they all end up as machine code sooner or later.

                      Originally posted by Locutus
                      But in case of games programming, which relies very heavily on performance and in practice often involves low-level platform- or even hardware-specific code (for the purpose of increasing performance), you pretty much can't avoid C for at least major sections of your code.
                      Just capsulate the low level parts. C is nice for system programming, being essentially a preprocessor for an assembler I thought most people would have migrated to a nicer language (i.e. one that resembles natural language mre) by now.

                      Originally posted by Locutus
                      Yeah, but we're not comparing C with Delphi or Fortran, we're comparing it with Python, an interpreted language. And although Python is one of the fastest of all major interpreted languages, it overall still performs much worse than C.
                      Sure. I don't think it makes such a big difference here, though. The computer is waiting for the human player to think most of the time.

                      It appears multiple threads can be used to take advantage of this.
                      (\__/) 07/07/1937 - Never forget
                      (='.'=) "Claims demand evidence; extraordinary claims demand extraordinary evidence." -- Carl Sagan
                      (")_(") "Starting the fire from within."

                      Comment


                      • #41
                        Originally posted by Kuciwalker
                        Also, there are tons of units for which there are specific strategies in C3. It would be even more true with all these promotions. An AI designed around a specific ruleset will always beat an AI designed around a more general ruleset.
                        Complete BS.

                        A well designed general AI will be just as good, if not better, then a specifically designed AI for 1 specific ruleset.

                        The reason why the well designed general AI will be just as good, is that it would understand the strategies just as well as the dedicated 1 set AI. However, as a general AI, it may play better because it may have a larger set of strategies then just a 1 set AI.

                        Think about it. You are arguing that a Civil War buff who specializes in the Gettysburg battle would be a better strategist then a Sun Tzu. That isn't true. But in code, it would be easier to translate the particulars of that one battle, or indeed, of all the civil war era, then it would be to build a well rounded code version of Sun Tzu.

                        Now, what that means is that Apolyton will be able to more quickly roll out a good AI for WW2 era scenarios, etc then it will be able to create that master of all things war AI.
                        Last edited by Darkstar; September 13, 2005, 16:11.
                        -Darkstar
                        (Knight Errant Of Spam)

                        Comment


                        • #42
                          Originally posted by Darkstar
                          Think about it. You are arguing that a Civil War buff who specializes in the Gettysburg battle would be a better strategist then a Sun Tzu. That isn't true. But in code, it would be easier to translate the particulars of that one battle, or indeed, of all the civil war era, then it would be to build a well rounded code version of Sun Tzu.
                          You are right of course, though the Civil War buff isn't really a strategist - he is more of a tactician. Strategy decides which battles to fight. Tactics decides how to fight them.

                          As it was pointed out, Robert E Lee was a brilliant tactician but a rotten strategist.
                          (\__/) 07/07/1937 - Never forget
                          (='.'=) "Claims demand evidence; extraordinary claims demand extraordinary evidence." -- Carl Sagan
                          (")_(") "Starting the fire from within."

                          Comment

                          Working...
                          X