Sonic Speeds in Game Design

I’ve been playing a lot of BioWare‘s latest game, Sonic Chronicles: The Dark Brotherhood, on the Nintendo DS. Some of the gameplay mechanics have really got me thinking. One component of the game’s turn-based battles stands out to me in particular.

Being that this is a Sonic the Hedgehog game, the essence of speed is vital. I got to wondering how a developer might convey the difference in speed between a character like Sonic (really fast) and someone like Big the Cat (who is relatively slow). To suit the purpose of this topic, let’s include Sonic’s sidekick, Tails, as the middle-ground between really fast and really slow.

Let’s recap:

Sonic => fast
Tails => average
Big => slow

But how can we determine that in a certain timeframe Sonic will get to perform many actions while Big’s speed is enough to perform only 1 action in the same timeframe? Let’s assume that each of the characters have an attribute which we will appropriately label “speed” (much like strength, dexterity, etc from any typical RPG). The higher the speed value the faster the character.

Let’s assign a speed rating for each of our characters.

Big->SetSpeed(1)
Tails->SetSpeed(3)
Sonic->SetSpeed(5)

But speed means nothing without time. Time in the game’s battle system is broken down into rounds where each round, I can only guess, has a defined timespan. For this example the timespan will simply be 1 unit.

Timespan => 1

Now the solution begins to present itself. Faster characters make actions more often while slower characters make few actions. Here’s how to represent that mathematically.

Timespan / Sonic->GetSpeed() = 0.20 ## because 1/5 = 0.20
Timespan / Tails->GetSpeed() = 0.33 ## 1/3 = 0.333...
Timespan / Big->GetSpeed() = 1.00   ## 1/1 = 1

With a simple calculation we now know the turn-order of actions within a round. We know it because within a timespan from 0.0 to 1.0 we can see when each character will take action.

Sonic gets an action at 0.20, 0.40, 0.60, 0.80 and 1.00

Tails gets an action at 0.33, 0.66 and 0.99

Big gets an action at 1.0

And when you put it all together the action sequence looks like

Time    Character
0.20    Sonic
0.33    Tails
0.40    Sonic
0.60    Sonic
0.66    Tails
0.80    Sonic
0.99    Tails
1.00    Sonic (because he's faster)
1.00    Big

Throw an enemy or two in there with their own speed value and you’ve got yourself a battle!

It’s worth stating that though I’ve assigned the timespan value as 1, we’re not limited to just that. We could set a minimum value for a character’s speed as 12 then we might define the timespan as that minimum value.

Sonic->SetSpeed(5)

would give Sonic a speed of 5 plus the minimum value. In this case, he’d now have a speed value of 17.

Tails->SetSpeed(3)
Big->SetSpeed(1)

results with Tails’ speed being 15 and Big’s being 13 (12+3 and 12+1 respectively).

The action timeline would play out as

Time    Character
0.71    Sonic
0.80    Tails
0.92    Big

which is very reasonable for the beginning of a roleplaying game where a player has not yet had the opportunity to improve on a character’s stats.

You’ll have noticed that the “Time” column is still within the range of 0.0 to 1.0. The “speed ratio” of a character will always be compared to 1. This identifies when the character gets an action relative to other characters, a method known as normalizing.

Leave a Reply

 

Staypressed theme by Themocracy