Ai

This is a discussion on Ai within the Game Programming forums, part of the General Programming Boards category; Hello. I need help with the AI that I am writing for a bomberman-type game I am making. Seeing as ...

  1. #1
    Registered User
    Join Date
    Dec 2001
    Posts
    4

    Ai

    Hello. I need help with the AI that I am writing for a bomberman-type game I am making. Seeing as how I've never done any "real" AI for any of my games, I don't really have a clue what I'm doing. Up until a couple of days ago I thought I was doing okay, but the more code I write, the more weird the AI acts.

    Does anyone know where I could find some tutorials, books, source code, or anything else that could help? I REALLY want to get this to work.

    Basically, this is how my code works:
    Every time something relevant happens (bomb layed, player died, item dropped, etc..) a message gets sent to the player. The ProcessMessage function then generates an importance level for 5 different actions (keep moving, get item, avoid explosions, kill player, destroying blocks), and adds the best choice to a list. About every half a second or so the player's go though there list of actions and insert them into a list of 2 orders based on the importance level, and prepares the neccessary information for completing the order (like a path).

    Is that a good way to go about it? Or is it retarded? Please help!

    Thanks

  2. #2
    monotonously living Dissata's Avatar
    Join Date
    Aug 2001
    Posts
    341
    gamedev.com . . .

    I bought a book on the theories of A.I. Helps a lot with the logic and creativity side.
    if a contradiction was contradicted would that contradition contradict the origional crontradiction?

  3. #3
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200
    Ive never done "real" AI. But one thing ive found is you need to prioritize that AI. Put the most important AI code on top... ect.
    What is C++?

  4. #4
    Rambling Man
    Join Date
    Jan 2002
    Posts
    1,050
    I, too, like Vicious have done a 'real' AI, but I still think I can give you some advice.

    Yes, you have to prioritize of course. However, I think you should prioritize at more than one level; I'll explain.

    The categories you listed for certain actions in the game are "bomb layed", "player died", and "item dropped". The categories you listed for certain actions the AI should take are "keep moving", "get item", "avoid explosions", "kill player", and "destroying blocks". However, I'm sure that there are more, but that is irrelevant.

    For each game action there should have a list of the actions the AI should take. For example the number one response the AI should have to a bomb being layed would be for the AI to avoid an explosion. The AI's second response might be to keep moving (after the AI's action of avoiding explosions should come this). The AI's third response might be to try to kill the player (after the AI has avoided all of the explosions and went is on the 'move'). For each game action you should list the all of the possible reactions the AI should take.

    You'll notice that I added in after a certain AI reaction has been performed. The AI should not only be able to react to the human, yet, act on it's own. What exactly do I mean by this? If you will have your list of (re)actions the AI should take to a game action. While the AI has to be able to react to ingame situations, it needs to be able to create it's own actions for the player to have to react to. Rather than the player constantly acting upon a reaction of the AI, the player will have to ract upon the reaction and action of the AI.

    By using the method I mentioned I believe you will be able to achieve a fairly potent AI. If you are still unclear you can look at this pseudo example I'm going to give you below.

    Code:
    if(bomb laid)
     {
      detect bomb();
        if(area == not safe)
          {
           find safe area to move to();
             if(player == near && player area === safe)
               {
                kill_player();
                }
            }
        if(area == safe && other area == safe)
          {
           find the safe area to move to();
             if(player == near && player area === safe)
               {
                kill_player();
                }
            }
         if(area == safe && other area == not safe)
           {
            wait();
            while( wait() )
              {
              optimize wait();  //e.g. health, items, collect, etc...
               }
            }
      }
    It seems to me that an algorithm would work efficiently, but I may be wrong. Remember that I have only done tic-tac-toe AI, so I could very well be wrong in thinking that an algorithm of that sort will work. However, I think it will work and quite well too.

  5. #5
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200
    Yes, if in doubt ask tech... He will give you an essay for an answer.
    (Even if he has a "real" essay he should be doing for school)

    What is C++?

  6. #6
    Rambling Man
    Join Date
    Jan 2002
    Posts
    1,050
    Well, I figure people are better off I give a thorough post. Would ya agree? But sometimes I actually do post a short, simple answer...but typically not in this forum lol.

    By the way, I started to write my essay the other night, and I got through the introduction part of it, then I decided to give it up. So basically I lost about 10% of my grade right there. The part that I did write, though, was very well written, in my opinion. In fact it was probably my most descriptive writing ever.

    But what do you think of my explanation on how bobtm should do his AI?

  7. #7
    Rambling Man
    Join Date
    Jan 2002
    Posts
    1,050
    BtW, typing that much isn't much for me, because I type fairly fast and the words/thoughts come to my head easily/fast. Not that I'm trying to brag or anything.

  8. #8
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200
    heh... It makes me wanna go and program a bomberman game :P
    I just wish Dev-C++ had some good graphic support
    What is C++?

  9. #9
    Rambling Man
    Join Date
    Jan 2002
    Posts
    1,050
    heh... It makes me wanna go and program a bomberman game
    yeah, i know programming AI is kinda fun. i wish i could spend more time concentrating on programming an AI than anything else.

    I just wish Dev-C++ had some good graphic support
    well, isn't that why you're learning win32 API?

    school is over for me next friday (24th) so i'll be able to spend a lot more time on programming. and other things like getting in touch with my feminine side.

  10. #10
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200
    >> isn't that why you're learning win32 API?

    Umm.. im kinda not any more. I figured i need to atleast make som programs with classes, strings, pointers, ect.

    >>like getting in touch with my feminine side

    Dude, thats like the first almost comedical thing ive ever heard, or read that you made.

    [edit]
    Umm.. you were just jokin tight?
    [/edit]
    What is C++?

  11. #11
    Rambling Man
    Join Date
    Jan 2002
    Posts
    1,050
    Dude, thats like the first almost comedical thing ive ever heard, or read that you made.
    like i said, i typically don't make jokes on this forum. but with that kind of a response that gets me thinkin'...hmmmmmmmmm....

    Umm.. im kinda not any more. I figured i need to atleast make som programs with classes, strings, pointers, ect.
    that's the same exact thing i did...started to learn it then decided i needed more practice with other stuff.

    and yes i was just joking...i'll actually only be doin' a few things over the summer, working, lifting, programming, playing Bill Gates' special little box, and hangin' with my friends when i get the chance...nothing involving getting in touch with my feminine side...but i wouldn't mind getting to touch a feminine side hehe, if you know what i mean. Summer sucks for me because I live in AZ so we are very lucky if we get one day under 100 ..........ing degrees during the whole summer!

  12. #12
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200
    You mean you go... outside?
    Sheesh

    And as for Bill's little.. er.. quite large box. Ill be playing that too. That and programming are the only things on my list.
    What is C++?

  13. #13
    Rambling Man
    Join Date
    Jan 2002
    Posts
    1,050
    You mean you go... outside?
    As long as that big, bright yellow thing outside isn't up.

    And as for Bill's little.. er.. quite large box. Ill be playing that too. That and programming are the only things on my list.
    I'm going to buy World Series Baseball this Tuesday and probably Hunter: TR as well. Those games are gonna rock!

    Gee, we sure do like to spam don't we?

  14. #14
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200
    Nah I hate proscessed meat.
    OH that spam... yep sure do.

    Once i stared at that big yellow thingy for a few mins.
    What is C++?

  15. #15
    monotonously living Dissata's Avatar
    Join Date
    Aug 2001
    Posts
    341
    tha wxplains a lot!
    if a contradiction was contradicted would that contradition contradict the origional crontradiction?

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Simple space combat AI
    By VirtualAce in forum Game Programming
    Replies: 5
    Last Post: 01-06-2009, 12:54 AM
  2. chess ai contest
    By Raven Arkadon in forum Contests Board
    Replies: 7
    Last Post: 07-09-2005, 07:38 AM
  3. AI Contest Proposal
    By MadCow257 in forum Contests Board
    Replies: 4
    Last Post: 03-13-2005, 03:27 PM
  4. Game Design Topic #1 - AI Behavior
    By TechWins in forum Game Programming
    Replies: 13
    Last Post: 10-11-2002, 11:35 AM
  5. Technique of all board-like games?
    By Nutshell in forum Game Programming
    Replies: 28
    Last Post: 04-24-2002, 09:19 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21