Author Topic: Action RPG AI help!  (Read 5654 times)

0 Members and 1 Guest are viewing this topic.

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Action RPG AI help!
« on: April 19, 2011, 03:43:52 pm »
Can anyone explain how to create an Action-RPG AI?
Including enemy moving, attacking, etc.
Also, checking your own attacks would be nice to be explained too.

Thanks a lot in advance!

--aeTIos
« Last Edit: April 22, 2011, 09:27:03 am by aeTIos »
I'm not a nerd but I pretend:

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: [REQUEST] Zelda-ish enemies tutorial
« Reply #1 on: April 22, 2011, 09:26:01 am »
*bump* Is there no one who knows anything about this subject?
I'm not a nerd but I pretend:

Offline JustCause

  • CoT Emeritus
  • LV8 Addict (Next: 1000)
  • *
  • Posts: 810
  • Rating: +115/-5
    • View Profile
Re: Action RPG AI help!
« Reply #2 on: April 26, 2011, 03:44:30 pm »
Well, you've left the question awfully general. What kind of AI do you need? What's the game like? How complex do behaviors have to be?

Generally speaking, moving towards a player is accomplished by a simple "if playerx > enemyx then enemyx + 1 -> enemyx", with matching conditions for the opposite direction and for the Y vars. Naturally, before actually updating the position, you'd have to check whether it's possible for the enemy to go there, but without info on your code I can't really go into that.

Attacks can be triggered via the distance formula, SQRT( (playerx - enemyx) ^2 + (playery - enemyy) ^ 2 ): compare that to a fixed number and have an attack routine fire at that point.

Sorry if this was waaaay more basic than you were looking for. Good luck!
« Last Edit: April 26, 2011, 03:44:47 pm by JustCause »
See you, space cowboy...

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55941
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Action RPG AI help!
« Reply #3 on: April 26, 2011, 03:49:40 pm »
If it's just for enemies moving around, what I did in Zelda Dark link quest is something like this:

While 1
<other code goes here>
0->F
If F=0:Then
1->F:Move enemy in your direction
Else
0->F:Move enemy in a random direction
End
End

That ensures the enemy won't move towards you too fast, but will still somewhat tries to touch you.

For bosses, if for example hitting the boss causes him to act differently, I just change a variable when hitting him and the code launched every loop depends of the variable value.

Offline JustCause

  • CoT Emeritus
  • LV8 Addict (Next: 1000)
  • *
  • Posts: 810
  • Rating: +115/-5
    • View Profile
Re: Action RPG AI help!
« Reply #4 on: April 27, 2011, 09:54:29 am »
If it's just for enemies moving around, what I did in Zelda Dark link quest is something like this:

While 1
<other code goes here>
0->F
If F=0:Then
1->F:Move enemy in your direction
Else
0->F:Move enemy in a random direction
End
End

That ensures the enemy won't move towards you too fast, but will still somewhat tries to touch you.

For bosses, if for example hitting the boss causes him to act differently, I just change a variable when hitting him and the code launched every loop depends of the variable value.
Though if you're using coordinates multiplied by 16 / 32 / 64 or whatever, this obviously isn't necessary.
See you, space cowboy...