2 Replies Latest reply on Dec 9, 2006 8:22 AM by r1chard..w3lch

    Artificial Inteligence

      I've been working on a 3D shockwave game recently and I've got to the point where I can explore a 3d environment relatively well, it’s just a case of giving players something to do. I was wondering if anybody can help me out, or give me a link to a tutorial of how to get ‘basic’ artificial intelligence? When I say basic I do realize I may be greatly contradicting myself, but what I mean is to get an enemy that fires its gun at you within a certain range. At the moment I could just place different enemies at different points in the game like around the corner, so there is no complicated moving involved. It would be a case of the player seeing an enemy by surprise and having to act immediately…

        • 1. Re: Artificial Inteligence
          duckets Level 1
          You could occasionally cast a ray from the enemy's position, along the vector from the enemy to the player (you'll want to only include your basic scenery in this test, not player or enemy models). If the first object intersected is further away than the distance between the enemy and the player, then the enemy can see the player. and should take action.

          You can also easily check the distance between the enemy and the player like so:

          dist = (player.transform.position - enemy.transform.position).length

          Of course none of this touches on getting enemies to move intelligently around your scene, which is a whole other kettle of fish!

          hope this helps!

          - Ben

          • 2. Re: Artificial Inteligence
            r1chard..w3lch Level 1
            Thanks i will look into that ben