Results 1 to 9 of 9

Thread: AI

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2000
    Location
    Oregon
    Posts
    962
    Can anyone help me by telling me how to make some simple AI? I want to start making more 1 player games but I need some help with AI. So far I have only made 2 games, a pong game (with very dumb AI; moves the wrong way, too fast, too slow, or moves with the ball (never misses)) and a game w/out any need for AI. Basiclly all I want is the comp to make simple discions depending upon given infomation. At this point I don't have a good idea on what I may do with the knowadge, but I will come up with ideas in the future.
    Involved in: Sentience

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    you want to have some ideas for the pong game ai or what?
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3
    Member
    Join Date
    Aug 2000
    Location
    USA
    Posts
    32
    When you make an AI, you need to know what conditions the AI must function in--ie, what's the game? How's the stuff stored? How much information can the AI use?
    -Koralt

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2000
    Location
    Oregon
    Posts
    962
    To make a general AI, would I just use a select case? Do you think that would be the easiest way?
    Involved in: Sentience

  5. #5
    Frenzied Member /\/\isanThr0p's Avatar
    Join Date
    Jul 2000
    Location
    They can't stop us! We're on a misson from God.
    Posts
    1,181
    YOu should really give some information what the AI should do!
    I think if then is the better way, bcause normaly you check much more than one variable to get some 'intelligent' behaviour!
    For a pong game a simple AI is
    if ball.x > player.x then player.x = player.x +1
    so it is following the ball, but could still be slower than the ball!

    CU
    Sanity is a full time job

    Puh das war harter Stoff!

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2000
    Location
    Oregon
    Posts
    962
    That is more of what I wanted to know. Just the best way to write some AI. Just incase this might help some more I will tell you the game I am writting (and yes I know it is copied). What it will do will be a Planet Wars. I don't know the name of the orignal verson. It is where you get X planets each producing ships. The ships are grouped into fleets and then you can move the fleets around play area. In my verson there are 2 types of planets, moon-like and earth-like. You can gain control over the planets. Moon-like produce 5 ships/turn, Earth-likes produce 10 ships/turn. At the start the worlds are randomized and there is a 16/28 chance of a Earth-like and a 12/28 chance of Moon-like worlds. In case you wanna help me with the AI, the computer will need to anailize # of ships, # of Earth-like worlds, # of Moon-like worlds, distance to each fleet, positions of worlds, owners of worlds. There may be more I didn't list.
    Involved in: Sentience

  7. #7
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    AI with no need learn from situations:

    Just think about how you yourself reacts in different situations in the game, sum them up and start making huge if blocks for every possible situation. Yeah I know this sounds hard, but it's they way you can work out a good AI.
    In general these situations comes in second, you put the goals of the AI at first, try to make it prioriate different ways of acting or reacting by using a "points" - system. If a way to react have more points it will choose that one isntead of anoter way with minor points. To calculate these points is another hard one, it can depend of many factors and the result needs to get balanced, one misstake and your AI will be easy to cheat.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  8. #8
    Member
    Join Date
    Aug 2000
    Location
    USA
    Posts
    32
    In my experience, big chukns of If statements, although somewhat easy to implement, do *not* work very well. I am working on a very complex tactical game (not in VB, admittedly, but...) , and I have been developing the AI for some time. It's more like fuzzy logic, not the static logic of "If" statements.

    First, I need to say, it's a turn based, tile based game. Each unit has a number of Time Units with which to act each turn.

    Basically, my AI is able to find routes to every square that a unit can reach. It makes one big routemap, with the time to the tile included... actually, let me just paste in a description of the AI I wrote a while back.

    Code:
    *** A summary of EDF's Tactical AI ***
    
    There are too many components in the EDF's AI for me to list
    them all and give them adequate description.
    
    The central entity in EDF's AI is the pathfinder.  Most
    pathfinders in most games are designed to find the best route
    from point A to point B.  EDF's routefinder finds the best routes
    from point A to every point the unit can possibly reach.
    
    What's the advantage to this?  Does it justify the fact that it
    must be significantly slower than a simpler routefinder?  Well,
    first, it's not much slower than a conventional routefinding
    algorithm, even for finding a way to only one point.  It's
    certainly faster than XCOM's.
    
    The true advantage, though, comes from the fact that routes to
    any number of potential destinations can quickly be tested and
    compared.  If there are 10 squares where the alien can shoot
    an EDF agent, the AI can check all 10 to see which is closest
    without using any more processing time than if it only had to
    check one.
    
    This routefinding technique has more upsides than just that, of
    course.  If a unit, controlled by the AI, is short of energy,
    the routine can easily be made to find the routes which require
    the least energy expenditure.
    
    Further, it will be possible to have "danger modified routemaps"--
    basically, the computer will be able to determine roughly how
    dangerous each square is to step in--based on the possible
    reactions of known enemies--and then avoid overly dangerous zones
    of the map.  This will be even more useful when the AI is
    seriously outmanned and must use extreme caution, and when
    individual AI controlled units are badly wounded.
    
    The AI will be able to create LOF maps just like the routemaps.
    It will be able to, then, find the fastest route to a place where
    it can shoot an enemy by comparing the routemap with the LOF
    map.  This feature will also let it calculate the danger maps for
    routefinding, because it can find the LOF map for an enemy as
    easily as it can for friends.
    
    That alone would make the AI more formiddable than XCOM's by
    a significant amount.  There's more to it, though.  A bunch of
    semi-intelligent aliens fighting you on their own would be
    tougher than XCOM's random aliens fighting you on their own, but
    a coordinating force must be present.  The AI must be able to
    identify goals and know when it's worth taking risks--and making
    sacrifices.
    
    To facilitate this, the AI will be able to set goals.  The basic
    idea of this--and I'll admit, it's still in the planning stages--
    is to let it identify:
    a) Risks to its own soldiers
    b) Overall objectives that must be met (kill civilians, take out
       control center, etc.)
    c) Beneficial, yet unimportant, activities (killing civilians
       while on a research mission)
    
    To use XCOM units and weapons as examples because EDF's aren't
    fully developed, if an alien sees one soldier with a blaster
    launcher and another with a stun rod, it will try to take out the
    blaster equipped soldier first.  Unless, of course, the soldier
    with the stun rod is very close, will likely stun it, and the
    alien has valuable knowledge that the aliens can't afford to let
    the humans learn about ...
    
    The next task, then, is to identify what each unit can do to
    achieve those goals.  Once that is done, units who are most able
    to help achieve the most important goals--but unable to achieve
    less important ones--will go first.  At the point when they cannot
    help in achieving that goal, they will try to identify another
    which they can.  The most important goals will always be dealt
    with first, to ensure that they *are* dealt with, and whenever
    possible the ability to deal with lesser goals is retained.
    
    There are a few more features about which I will write later.
    Hope those concepts help.
    -Koralt

  9. #9

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2000
    Location
    Oregon
    Posts
    962
    I have gotten all the help I need to make my AI. Although it may not be smart, it isn't dumb. I have seen both better and worse AI then mine. If you would like to see my game, I am still fixing bugs in it but I will e-mail you a copy if you e-mail me and tell me that you want it. Thanks for the help. (I will no longer post replys to the thread)
    Involved in: Sentience

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width