Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: aeTIos on April 19, 2011, 03:43:52 pm

Title: Action RPG AI help!
Post by: aeTIos 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
Title: Re: [REQUEST] Zelda-ish enemies tutorial
Post by: aeTIos on April 22, 2011, 09:26:01 am
*bump* Is there no one who knows anything about this subject?
Title: Re: Action RPG AI help!
Post by: JustCause 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!
Title: Re: Action RPG AI help!
Post by: DJ Omnimaga 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.
Title: Re: Action RPG AI help!
Post by: JustCause 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.