AI coding overview

Discussion in 'General Discussion' started by Sithuk, Oct 15, 2016.

  1. Konstantine

    Konstantine Grand Admiral

    Posts:
    2,200
    Joined:
    Oct 19, 2016
    The problem is that "true" AI does not exist yet, what we refer to as Ai is nothing more than a very long list of programmed responses to situations as they arise. Obviously it is quite difficult to envision every possible contingency that can arise in a 4x game and program a response that would be similar to a human. Humans are un-predictable whereas the "AI" is programmed to respond/act in the same manner every time a particular situation arises.

    For me, this is the hardest part for a developer to deal with and one of the most crucial aspects that will determine if the game is good or not.
    We take for granted when we play how many decisions we make and a good AI needs to have so many responses programmed into it that just creating a coherent structure of eventualities to responses is a task by itself.

    I personally would not initiate serious work on this until after the scope and mechanics of the game are clearly defined.
     
  2. Neil

    Neil Ensign

    Posts:
    30
    Joined:
    Oct 20, 2016
    You description of AI is sadly how it seems to exist in the majority of computer games. However, most AI research outside of this (for which there has been some significant progress in recent years), utilises some form of machine learning. There was some fascinating work on the google deep mind project, where deep learning was used to allow a computer to learn to play old Atari games. No prior knowledge of the games was programmed into the system. The only thing the system was provided with was a video feed from the game and the score. It figured out how to play these games, in some cases better than a human could, using only machine learning. Now, obviously 4X games are more complicated than old Atari games, but the point I am making is that progress is being made in this field. It's just that game developers are still in the dark ages.
     
  3. Neil

    Neil Ensign

    Posts:
    30
    Joined:
    Oct 20, 2016
    Check this video out..



    Incredible, given that it is based entirely on machine learning!

    Watch the video to the end. It is a great demonstration that modern machine learning is not just for fine-tuning of parameters, but can also figure out novel solutions to problems.
     
  4. IvanK

    IvanK Lieutenant

    Posts:
    138
    Joined:
    Oct 17, 2016
    Too bad they have trained it on only one level. Probably the original game had only that level but missed opportunity nonetheless because the strength of learning algorithm is measured on control set, not input set. That is you let the AI learn the game on levels A, B, C and D, turn learning capability off and let it play level E. This video only demonstrates the power of overlearning which is actually a bad thing.

    On the brighter side there is this: https://www.arago.co/hiro-freeciv a company which uses it's IT support automation AI to play FreeCiv. They are a vague about how exactly does it work but the AI is capable of handling surprises.
     
  5. Neil

    Neil Ensign

    Posts:
    30
    Joined:
    Oct 20, 2016
    I think the phrase you are looking for is 'overfitting', however it is not reasonable to say that this is occurring here. It only makes sense to even talk about overfitting when you are training a system with data samples from a larger population, with the intention of modeling that larger population. So, for example, using 1000 images of cats to train a system to recognise all possible images of cats. In this case, however, the task is to play the basic breakout level and the 'dataset' is the basic breakout level. Your sample is your population, you are not trying to generalise beyond this, so discussion of overfitting makes no sense. Now, the question one should ask is :- is a machine learning system figuring out how to play the basic level of breakout without any prior knowledge an impressive achievement. I would say that it most definitely is. Sure it would be even more impressive if the system played different levels, but the fact that they have not trained it to in this example does not mean they are overfitting, nor does it alter the fact it is an impressive achievement.
     
  6. IvanK

    IvanK Lieutenant

    Posts:
    138
    Joined:
    Oct 17, 2016
    Yes, overfitting that's the word (I forgot English term so I went by literal translation from my language).
     
  7. rxnnxs

    rxnnxs Ensign

    Posts:
    120
    Joined:
    Oct 15, 2016
    Here are two interesting "tags" I want to throw in.
    I am sorry I cannot find the documentation i recently watched and have forgotten who made it, so I do not know if I have seen it on TV, youtube or somewhere else, but you should look for

    -> "Graphene Transistor" to get started.
    or maybe it was silicene transistor? I do not even know that for sure, but i know for sure it was a really interesting article/watch!!

    The Documentary went further, and said that when they built a transistor foil with millions of these 1 atomic layered transistors, they stacked themselfes up to do a "shortcut" so to speak. <- it was for sure working a bit different and I would be glad if I could watch it a second time!
    Has anyone seen this Documentary? It was maybe broadcasted in Germany about September October 2016.

    They found out, that it "remembered" where the shortcut happened and was then doing the "switching" faster than before.
    The resistance also went down and therefore the voltage went up.
    This brought another person to the idea, to make this way a neuronal working AI.
    They are working on it and will for the next decades, but it was VERY interesting!

    So I think they Scientists were from Japan or Germany?, and the Inventor was from Australia/USA?



    The other thing that could be possible to come in handy ( ;-) ) is this:
    -> neural-network
    https://de.mathworks.com/products/neural-network/features.html#key-features

    Surely you could code it for yourself and before you found out how matlab works, maybe with an self written "try and error" AI you will finf the 10 best strategies the "AI" could use to give the player a hard time.


    So to begin with, and we all would love it too, would be a sandbox where we could test our designs in a "simulated" battle.
    An this could be the point, where the "AI" could also start to learn as well as the programmers right from the beginning:

    To find out where to tweak the weapons and how to balance it throughout the technological advancement levels.


    The second step would be to let compete different strategies against each other or to look, how fast one strategy leads to a given goal.
    Lets say how fast 100 planets are populated and that without any other circumstances (from revolts up to pirates and wars).
    What race is the fastest?
    Where is the one race in advantage against the other? Is teching better than fertility? and so on..

    P.S.: It does not matter what happens under the hood, and for sure the AI used in this and other games will not be self aware of itself :)
     
    Last edited: Oct 26, 2016
  8. Neil

    Neil Ensign

    Posts:
    30
    Joined:
    Oct 20, 2016
    1. I really cannot see how experimental work on a new type of transistor is relevant to game AI programming. It could be decades before we see any commercial application of this technology, if it ever works out at all.
    2. There are plenty of free resources for machine learning with neural networks (e.g. caffe), not sure why one would want to pay for mathworks hugely expensive software, unless they are dead set on using Matlab (which seems unlikely).
     
  9. rxnnxs

    rxnnxs Ensign

    Posts:
    120
    Joined:
    Oct 15, 2016
    1. Neil, you talk about stuff that is in the past, I talk about stuff that is in the future, so i also really can not see how "modern machine learning" that you describe above ("There was some fascinating work on the google deep mind project") will help this game either.. so why are you so rude?
    BTW, Higher CPU frequency is always good

    2. you did not mention caffe before, now maybe this is something useful?
     
  10. Neil

    Neil Ensign

    Posts:
    30
    Joined:
    Oct 20, 2016
    How was I rude to you, exactly?

    Anyway, modern machine learning techniques, even deep learning networks, can be deployed on a modern desktop. It may or may not be beyond the scope of this project, but it is relevant to current game AI programming in general. On the otherhand, experimental transistors, likely decades from any commercial implementation, are not.

    It is certainly better to use Caffe, or one of the many other freely available resources, than paying a small fortune for Mathworks. Probably, deep learning is beyond the scope of this project. However, there are cheaper and easier techniques, that are likely more applicable. For example, bayesian inference can be used to guide decision making and has many advantages over using sets of nested if statements with hand crafted thresholds.
     
    • Agree Agree x 1
  11. IvanK

    IvanK Lieutenant

    Posts:
    138
    Joined:
    Oct 17, 2016
    Calm down boys! :)

    Rxnnxs, Neil knows what he is talking about but doesn't articulate it in a most layman friendly way. Thing is faster processing doesn't help much because small changes in problem size result in steep jump in how much stuff needs to be processed. For example let's say you have checkers playing AI and it takes 1 millisecond to decide a move on normal 8x8 board. If you increase the board size the processing time doesn't increase by 12.5% but by factor of 10. This means that 11x11 board takes whole second to process while 15x15 takes half a day. Using twice as fast processor and making AI multithreaded to use all available cores might reduce 15x15 board to less then an hour but 16x16 will still be unplayable. So it's more practical to use processing power smarter. In your post you assume that plugging neural network is trivial while in fact it's the crux of the problem. As Neil said there are multiple ANN (artificial neural network) implementations around, in my experience for every popular programming language there is at least one free ANN library.
     
    • Agree Agree x 1
  12. rxnnxs

    rxnnxs Ensign

    Posts:
    120
    Joined:
    Oct 15, 2016
    That sounds interesting.

    Besides that, I really would like to know, how the AI was designed for the older MoO Series and, to a greater extend, other X4 Games.
    Pathfinding is not a problem :)
    But, what makes the differenc ebetween lets say MoO and Space Empires?
    SEV needs soo long to calculate, MoO is done in no time.
     
  13. IvanK

    IvanK Lieutenant

    Posts:
    138
    Joined:
    Oct 17, 2016
    Probably bunch of if-then-elses :D
     
  14. Neil

    Neil Ensign

    Posts:
    30
    Joined:
    Oct 20, 2016
    I think there is a very good chance you are right!

    As I alluded to before, this is something where simpler AI techniques could be applied without the need for huge processing power or expertise. Bayesian based approaches are easy to implement and have many advantages over bunches of it-then-elses :-
    • All information is combined under a probabilistic framework.
    • It won't become unwieldy as the number of features you are basing you decisions on increases.
    • New decision features can be added easily.
    • Prior information can be added to bias decisions easily.
     
  15. Konstantine

    Konstantine Grand Admiral

    Posts:
    2,200
    Joined:
    Oct 19, 2016
    Greetings Neil
    Yes, I have heard of these developments and it is quite exciting. I am no expert on AI but it seems that this is akin to what hot air balloons were to early flight. In other words a beginning that is still quite a long way from being adequate for the subject at hand. In either case I have faith that a great game can be made with todays technology as long as the work is put in, Another option that would help the game overall is to program AI factions in an aggressive manner so that the player would be forced to respond to the AI to a greater degree. This would need to be carefully balanced however so that the player still feels like he/she is playing the game rather than the other way around.
     
  16. Neil

    Neil Ensign

    Posts:
    30
    Joined:
    Oct 20, 2016
    For sure, we are a long way from an AI than can match a human at a complex game, such as a 4X. Your analogy with hot air balloons may be fair, but if that is the current state of AI, then I would counter that most game developers are still attaching feathers to their arms and flapping them up and down.

    I am all for having some aggressive factions (although not all factions as that would spoil the immersion for me). Too many 4X games are way too easy because you can just fast expand early and the AI just lets you get away with it.
     
  17. gja102

    gja102 Cadet

    Posts:
    26
    Joined:
    Oct 27, 2016
    This approach is clever, but it wouldn't feel very "MOO2". Of course there were the Antatans, which did act as a challenge in the way you describe, but the 'main' game was very much about broadly equivalent spacefaring races in the style of Star Trek etc.

    Higher difficulty MOO2 did in fact give the AI aliens bonuses to growth, production, etc. The amusing thing was that these bonuses were tied to their populations, so when playing at high level, you could enslave a bunch of AI-enhanced Silicoid workers, and end up with a more productive worker base than you could ever have on standard difficulty. Which took the sting out of the 'cheating AI' feeling.

    My two cents is that the AI should 'feel' like a competing player - with as many subtle cheats as it takes to get it to that point. When people complain about AI cheating, it is usually triggered by things that make it OBVIOUS that it is playing by different rules. For example, many 4X games decide that higher difficulty should mean the AI automatically hates the player more, which makes a diplomatic playstyle impossible. Or they give the AI dramatic production bonuses, which in theory would be fine, but they don't scale well with the early game, which means it is physically impossible for the player not to get outproduced at the start.

    If you're clever about AI cheating, using it to boost the AI to player level rather than giving it a different ruleset entirely, and giving it mid-game boosts rather than early-game ones, it should work fine.
     
    • Agree Agree x 1
  18. Neil

    Neil Ensign

    Posts:
    30
    Joined:
    Oct 20, 2016
    MOO2 was a great game, but it was simply too easy, even on hardest skill level, for a competent human player in single player mode. Since this game will be single player only, MOO2 is not a great model to follow for the level of challenge.

    Subtle cheats just won't cut it. Without some major improvements in the quality of the AI (compared with every other 4X I've ever played), the AI needs massive cheats to provide a challenge.

    There is a point at which the magnitude of the cheats you need to give the AI to compete becomes so great, that you may be better off designing separate mechanics for the AI, which can then be balanced to provide a interesting challenge to the player.

    Improving the AI is, of course, the better solution. And, as I have posted in this thread, there are techniques that could be applied, even by non-experts without huge resources, to work towards this aim. However, if the AI cannot be improved beyond what is seen in the typical 4X, then another approach is needed to provide a long term challenge. The AI playing by different mechanics is just a suggestion. I fully accept it may not work out in practice.

    I don't know about other posters here, but for me, the typical 4X experience is enjoyable whilst I am learning the systems, then becomes boring beating up the AI once I understand them. Thus, with the exception of a period where I played MOO2 multiplayer, every 4X gets abandoned. Beating up on an AI that can't challenge me is simply not fun.
     
  19. Adam Solo

    Adam Solo Developer Administrator Grand Admiral

    Posts:
    4,846
    Joined:
    Sep 9, 2016
    Hi @gja102, welcome to the forums.

    I agree with a lot of what you said. I also think the big problem we have with the AI sometimes is not so much with the AI cheating per se (although it would be nice if didn't had to), but when we see it do obvious things that are either: very weird, obviously hardwired (e.g. gang up on the human) or simply absurd (e.g. when the AI asks you to stop doing something, that you obviously aren't doing).

    So, it should feel like it's competing, I agree. And, if the AIs cheat, there should be only slight bonuses given to them (or through other more sophisticated means), and not simply insane bonuses that will distort the experience at the higher difficulty levels. That's why I never found playing Deity in Civ games an interesting challenge, given the ridiculous amounts of bonuses the AI gets.

    Your idea for giving boosts to the AIs not in the early game, but only at mid game is also interesting.
     
  20. Neil

    Neil Ensign

    Posts:
    30
    Joined:
    Oct 20, 2016
    The trouble is that slight bonuses aren't enough and massive bonuses distort the gameplay.

    One way you could stagger the bonuses to different times in the game, is having the AI have access to certain technologies not available to the player. These could be scattered across the tech tree. Different species can have different special technologies, increasing the diversity of the challenge. This probably fits in more cleanly with NPC species, since human player will be peeved if he/she doesn't get same technologies when picking that species.
     

Share This Page