Help with Enemy AI

I need some help getting my Enemys to find my player.. more advance AI and Attack my player..

What is the best way to go about finding the player and moving around walls and objects in my RPG style hack and slash?

Comments

  • FajlajpFajlajp Member Posts: 666
    It's hard to make a AI that's good,but it's possible. I can't tell you exactly how it should be made because it's not a specific way,but I could guide you in the right direction.
    First of all you should make a list. This is how my list should look for an Rpg monster Ai.
    1. monster sees player
    2. monster moves towards player
    3. monster attacks player
    This list basicly is the "steps" the monster should be able to do. We could now expandera the list.
    1.How far could the monster see. Had it x-ray vision so it could see through walls. Should the player be able to pick up any item that makes the monster not able to see the player etc
    2.Should the monster keep continue follow the player even if the player is out of the monsters range of what the monster could see etc
    3.Does the monster have the same attack all the time or does it have different(does it only slash or could it also stab) etc.

    You decide all this things and then you try to to complete you. I could help you with this(how the monster see the player and the start moving towards the player) because it's often the same.

    You need two real game attributes that you call PlayerPositionX and the other one you call PlayerPositionY.
    You go into the player actor and make two constrain behaviours.
    Constrain game.PlayerPositionX to self.position.x
    Constrain game.PlayerPositionY to self.position.y
    Now you go into the monster actor and create a new real self attribute that you call DistanceFromPlayer.
    You do a constrain beahaviour that says:
    Constrain DistanceFromPlayer to magnitude(game.PlayerPositionX-self.position.x,game.PlayerPositionY-self.position.y)
    This will calculate the pixels(Distance) from the player.
    Now you could do a rule that says
    If DistanceFromPlayer is less then(<) "the amount of pixels you want the monster to see"
    Move to game.PlayerPositionX and game.PlayerPositionY

    I don't know how to move around walls but there is a template over at gshelper.com. Look at that. It should be perfect for you.

    I don't know if this will work for you but it should be a good start for you:)
Sign In or Register to comment.