No code today boys!! (and girls :P) I do have a question. For those familiar with my project, I'm making a framework for a J-RPG game. So far its working great but at this moment, its got a major flaw. Each combatant has a speed function that determines initiative order (think D&D or Pathfinder) but right now, the functions just figure out which combatant has the highest speed and lets him go first . . . and its always that combatants turn. I need to create a function that evaluates each combatants speed in a fight, and arranges them in an order from highest speed to lowest speed and has them take actions in that order. I'm drawing a blank on anywhere to start though.
What do you guys think? What's a way I can make my program evaluate and reorder something?
In the scenario you describe, where it will never be the case that an exceptionally fast character goes twice before an exceptionally slow one, I would just take all of the combatants that are fighting and sort them into an array*. You can then loop through that array until combat is resolved.
*: Probably pointers to the combatants since I would imagine that you need to track things like inventory and hitpoints between fights as well.