Thursday, September 29, 2011

Initiative Revision: Turns Out There Were Problems, Adventures in Amateur Game Design, Part 14

It turns out there was a significant problem with the initiative system that I had devised. I know, I'm disappointed too. The original system had every player with a speed attribute. Every turn their speed would be added to their initiative and the player (or NPC) with the highest initiative takes their turn and their initiative is set to zero.

When I coded up an implementation to work this system, things didn't work out the way I wanted them to. I'll illustrate the problem with an example. Say you have to players with speeds 5 and 9. You would think the player with 9 speed to go almost twice as often as the player with 5, right? Nope.

Player 1: 5. Player 2: 9. Player 2 goes, and is set to zero.
Player 1: 10. Player 2: 9. Player 1 goes, and is set to zero.
Player 1: 5. Player 2: 18. Player 2 goes, and is set to zero.
Player 1: 10. Player 2: 9. Player 1 goes, and is set to zero.
Player 1: 5. Player 2: 18. Player 2 goes, and is set to zero.
Player 1: 10. Player 2: 9. Player 1 goes, and is set to zero.
Player 1: 5. Player 2: 18. Player 2 goes, and is set to zero.
Player 1: 10. Player 2: 9. Player 1 goes, and is set to zero.

So they actually get the same number of turns. In a multiple player situation, the system better approximates the expected number of turns, but there are still some very serious inconsistencies. So I had to revise the system. It is now an old-type Final Fantasy system. Everyone's speed still adds to their initiative, but now a player gets a turn whenever their initiative reaches 100. After they take their turn, 100 is subtracted from their initiative. Naturally, if nobody had an initiative over 100, their speeds are added again.

I modified my code to use this system and the actual results produced were consistent with my expectations and desires for how it should work.