How does speed determine turn order?

Ask and answer questions about making games and related topics. Unrelated topics go in that other forum.

Moderators: marionline, SDHawk

Post Reply
User avatar
Hedera
Slime Knight
Posts: 175
Joined: Tue May 17, 2011 11:38 am
Location: a dying forest (all forests are dying)

How does speed determine turn order?

Post by Hedera »

How exactly does the speed stat determine the turn order in battle, for both the default battle system and also for turn-based? I know that for the default system, it determines the rate at which the time bar fills, with a starting amount of time that's randomized, but how exactly is it calculated? For that matter, how does it work with the turn-based system?
User avatar
Bird
Slime Knight
Posts: 227
Joined: Thu Jan 26, 2012 2:19 pm
Location: Germany

Post by Bird »

In the Active-Time-Battle (the standard OHR battle system), the speed of the bars isn't randomized. It fills the bars up constantly. There is a bitset however to randomize their starting point at the beginning of the battle. Under "Edit General Game Settings" --> "Battle System" --> "Battle preference bitsets", there is an option "Randomize initial ready meters".

With a stopwatch you will recognise it. Old computers from 1999 are processing the battles slower, but the enemy has to use the slowness too, so it's a fair game.

If more than one ready-meter is full, you can choose between characters by pressing the ESC key quickly.

Wasn't the Turn-Based-Battle similar? If the speed stat is twice as high, you can strike twice before the enemy gets his turn?
User avatar
FnrrfYgmSchnish
Metal Slime
Posts: 741
Joined: Thu Jun 18, 2009 4:37 am
Location: Middle of Nowhere

Post by FnrrfYgmSchnish »

Turn-based mode is pretty much like in the NES Final Fantasy games (before ATB was introduced in FF4) or Pokémon. Every hero and enemy gets one turn each round, no matter how fast they are, because speed just determines who goes first in each round.

In ATB mode you can definitely make a character (or enemy) so fast they act multiple times before slower characters get a chance to do anything, though.
FYS:AHS -- Working on Yagziknian NPC walkabout sprites
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

In active-time battles, the ready meters count up to 1000, and increase by the attack's speed every tick. (18 ticks per second). So Speed 10 means 100 ticks, which is about 5.5 seconds. If "Don't randomize battle ready meters" is off then at the beginning of battle the ready meter starts randomly at 0-500.

In turn-based battles, everyone is sorted by their speed to determine the turn order. Ties between anyone with the same speed are broken randomly. However, after everyone has picked their attacks that order is then modified according to the attack delays ("Delay/Advance Attack") on the selected attacks. Quoting the source code:

Code: Select all

'Delays specify how many places forwards or backwards in the queue an attack should
'be moved, but if two attacks want to move to the same place, the most delayed one
'should happen last, and the most advanced one first. E.g:
'  0,  1,  2,  3   <-- Attacks in initial order &#40;the initiative order&#41;
'  0,  1,  0,  0   <-- Delays&#58; attack 1 should move back one place
'       \->
'There is a tie for the 3rd place, should be broken as&#58;
'  0,  2,  1,  3   <-- Final attack order
'If we add an extra delay to attacks 1 and 2&#58;
'  0,  1,  2,  3   <-- Initial attack order
'  0,  2,  1,  0   <-- Delays
'       \--\==>
'Then, adjusting the previous result, by moving both attacks 1 place, the result should be
'  0,  3,  2,  1
'This shows the most delayed attack should happen last in case of tie
In addition to this are chained attacks, possibly chained from previous rounds.
Last edited by TMC on Sun Sep 27, 2020 11:28 pm, edited 1 time in total.
User avatar
Hedera
Slime Knight
Posts: 175
Joined: Tue May 17, 2011 11:38 am
Location: a dying forest (all forests are dying)

Post by Hedera »

Ah, thanks for the explanation, TMC! This should probably be on the wiki, come to think of it...
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

Yes, though most of it should already be on the wiki and in the help pages, and it was maybe more detail than anyone cares about.

One more detail: in turn-based battles, random tie-breaking of combatants with the same speed happens anew every round.
Last edited by TMC on Tue Sep 29, 2020 2:37 pm, edited 1 time in total.
Post Reply