Agility Algorithm to determine turn?

Started by
5 comments, last by BreathOfLife 15 years, 6 months ago
Hey guys, i'm developing a rpg custom battle system and was wondering if you could give me a good agility formula to determine whose turn is next based on everyone's agility. I don't need actual syntax or coding, i just need a general formula in psuedo code. Ex: lets say i have the following characters and enemies in a battle. Mage Bob: Agility = 20 Warrior Chester: Agility = 25 Priest Helen: Agility = 20 Boss Slime: Agility = 45 Reg. Slime 1: Agility = 15 Reg. Slime 2: Agility = 15 Reg. Slime 3: Agility = 15 Given those stats, what would be a good formula to determine turn order. Thanks
n/a
Advertisement
what kind of results are you looking for? Turn based?

If turn based just sort based on agility highest will always hit first. Maybe say if you have double the fastest enemies agility he gets two moves a turn.

If it is a more real time/points based thing, have each tick give some percent of their points back so more agile people move more often.
yeah, im actually doing a final fantasy tactics/shining force style battle engine and wanted to do the turn determination similar to the way shining force did it. You know usually the giant bosses get 2 or 3 turns in a row =D. Someone told me there was a way to do it by seeing who had the highest agility and then subtracting something. Not sure.
n/a
Don't complicate it, it's pretty simple. Just loop through the guys, and every time you encounter an agility higher then the previous, notate what person that is. Then just give that guy his turn, set a flag that says he went, and do it again (excluding anyone who went already).
Well there are a lot of ways of doing this. For example, one way would be to give everyone a Tick Count. Every turn add everyones' Agility to their Tick Count. Anyone who's Tick Count goes above a certain number, say 100, gets to perform an action that turn. If they perform an action, then their number gets reset down to 0.

You can mix it up by changing any of these steps in different ways. Maybe instead of adding everyone's Agility, you add a random number from 1 to their Agility. Or instead of reseting down to 0 when they do an action, subtract 100. Or maybe a number based on what action they did.

What method you eventually end up doing is up to you: it's your game, you decide how it works.
Thank you all for your great replies. Here's an idea i came up with for this. Let me know if you like it and think it will work.

I was thinking of dividing a character or enemies agility in half after they perform an action. Then re-compare to see who has the highest agility. If the character who just performed the action still has the highest agility, he gets to go again, and his agility will once again be divided in half and it will compare again. If his agility is no longer the highest anymore compared to any of his enemies, his turn is done. Once everyone's turns are done it resets everyone agility and starts over again.
n/a
OK, each unit has and AGI score, like you've listed. Now pick a time unit, either a turn for a turn based game, or some reletively short time for real time (~2 seconds). Each tick, each character gets its agi added to some variable, then checks if that variable is over 100. If it is, the variable is reduced by 100, and that character gets a turn.

That is either how final fantasy tactics did it, or fairly close.

This topic is closed to new replies.

Advertisement