Guide for Enemy A.I?!

mmmodelmmmodel Member Posts: 46
edited May 2013 in Working with GS (Mac)
Hello guys, somebody know where i can found some guides for enemy a.i?!
I tried to found something about but without success.
I know the basics like movement 'go' and 'back' and the follow rule(follow the player) but i really need to found how i make the point of collision to decrease the health of the player (like some punch in the face of the player or sword attack )
i have some idea how to start but i need some tips or some nice guide to study.

Sorry about the question but i really don't no what to do :/

Thanks :))

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Someone else may be able to point you toward some resources but generally AI is just something you have to figure out how to do depending on what you want the enemies to do. If you want the player's health to decrease when the enemy collides with the player, that's not really AI... it's just a simple When actor collides with [enemy actor] --> Change Attribute self.health to self.health-1 rule.

    What exactly are you wanting to have your enemy do?

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • mmmodelmmmodel Member Posts: 46
    Hello, how are you? @tatiang
    so, i want when the enemy punch ( he has the animation sprite) the player health will decrease, i did the basic collision for one monster but i have the boss in the end of the scene and he has this attack but i need that he decrease the health of the player when the punch collides in the player.

    Thanks for the answer :D
  • mmmodelmmmodel Member Posts: 46
    And i tried to make one rule for when the enemy see the player he runs after him, but seems not working, you can tell me what i really need to do?
    sorry for ask another thing
    8-}
  • ironDanironDan Member Posts: 148
    edited May 2013
    Hey @mmmodel you can make a Boolean Global Attribute called Boss Hit and in the animation rule for your bosses punch you can add a timer set to the time in the frame when the bosses fist is extended and add a rule that states at that time the if boss collides with actor player to change that rule to true. And then in the player set a rule that states if Game.BossHit is True change player health to -whatever value.

    Dan
  • mmmodelmmmodel Member Posts: 46
    @ironDan amazing solution!! i will try this, but i think that will work great for the boss, thanks for the help :)
  • ironDanironDan Member Posts: 148
    edited May 2013
    No problem, just remember to set a rule in your boss actor that say when not colliding with the actor to change Game.BossHit to False or he will only register his first punch.
  • mmmodelmmmodel Member Posts: 46
    okay, thanks for the tip :D
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    Here is a video I did a long time ago. It should get you pointed in the right direction. When I have some time which could be a few weeks, I may do some stuff on AI as I've built several, especially the AI I built for Puck It.



  • mmmodelmmmodel Member Posts: 46
    Hello @FryingBaconStudios i will watch the video now, thanks for the help :D
  • JGary321JGary321 Member Posts: 1,246
    http://www.indiedb.com/games/tinykeep/news/tinykeep-ais-system-part-1-of-5

    http://www.indiedb.com/games/tinykeep/news/tinykeeps-ai-system-part-2-of-5

    These videos are great to bring ideas on the backend of how AI is done. You could take these ideas and implement them into GS. Obviously it's not a direct how-to, more to just get the creative juices flowing.
  • mmmodelmmmodel Member Posts: 46
    @JGary321 lovely tip, thanks so much!
  • mmmodelmmmodel Member Posts: 46
    edited May 2013
    I have a little problem, i made some 'constrain att' to make my self position and i created some int for my player for the position y and x so i created for my enemy one 'move to' rule to follow the player in the scene but the enemy just face the player and when i run away he don't chase me like i wanted, what i'm doing wrong? maybe i need some bool to reset the position when he face's me?! or something like that?! thanks and sorry about the question =T
  • mmmodelmmmodel Member Posts: 46
    But if the enemy don't touch the player he continues to follows, but when he collides the problem happens =P
  • mmmodelmmmodel Member Posts: 46
    edited May 2013
    and i tried to make the rule
    that says att self.distance < some number..
    move to
    position x, position y
    and worked great, i think hahahaha
    but i still don't know what to do when the enemy touches the player and he is stopping.
    :-/
  • aspiringgamemakeraspiringgamemaker Member Posts: 20

    Try putting the 'move to' in a timer and set it for .001. That way it will keep following every after it reaches you.

Sign In or Register to comment.