How to make "smart" enemies?

jblb2424jblb2424 Member Posts: 65
edited November 2013 in Working with GS (Mac)
Hello :P

My game I am currently making is very simple; a guy with a sword fights other enemies with various weapons(sword, bows, ect.). However, I am having trouble with making my enemies seem intelligent and adding human qualities to them. Does anyone have any tips towards giving my enemies intelligence to seem human? I can give my enemies simple behaviors to react to my character's actions, but it seems robotic and predicable. Any tips? Thanks!

Comments

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    AI is one of the hardest things to code. It requires a lot of experience. I have a video on basic AI and have build several computer controled AI. It took me months to develop the AI for our Air Hockey game puck it.
  • myke66myke66 Member Posts: 74
    basically look at your AI as a set of triggers, and think about what you want to trigger an action. You can use magnitude to do distance related things, collide for collision, invisible actors for enviroment responses,velocity changes, auto-run-walk-target.

    Lots of options, but here's a freebie. On your hero "attack" trigger, whenever he does the attack, have it set a variable to attack=1. Then, on your monster, set an actor attribute integer for BlockChance.

    Then still on the monster actor, have a rule that triggers whenever HeroAttack = 1.

    in the first line of the rule, have it set the chance of blocking. Say you want a 33% chance of block... you have it set the block chance by doing a random roll. so do Change attribute BlockChacne to random(1-3).

    This will set the BlockChance to 1, 2 or 3.

    Then have a nother rule that says

    If BlockChance = 2

    Then

    Do block (come up with a block animation, and dont let them take damage this turn, or have them take reduced dmg

    Else

    Do nothing.

    Then after the rule, change the attribute HeroAttack back to 0 to reset it for the next attack.

    So to recap the logic, what will happen is every time the hero attacks, it turns on the HeroAttack trigger, then monster will do a random 1-3 roll on if to block if the HeroAttack =1, If it gets a 2, then it blocks, if not, it does nothing. Then you turn the HeroAttack back off.

    This concept can be applied to tons of reactive abilities or features. The triggers can be from tons of different sources.

    I just got done with a marathon night of GS so im still in programming mode, i hope this all made sense. Goodluck!!
  • KevinCrossKevinCross London, UKMember Posts: 1,894
    Basically what @myke66 says. Randomness removes robotic behaviours and predictability, how random you make it determines how intelligent/reactive your characters.
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    Those are good places to start.
Sign In or Register to comment.