Turn mechanics in an RPG

So I’m working on an online multiplayer RPG game where people can set up matches and battle each other, so far people can set up the match however they want, but for simplicity sake, lets say 9 players have setup a 3v3v3 match, I wonder what would be the best way to sort the turns.

So far I been thinking of these

  • Arrange all players in a list from fastest character to slowest.
  • Randomize the team in a list, and then at all character in that team attack, before go to the next team.
  • Take the first character in each team, for the first three turns, then the second character in each team, then the third.

Any advice or suggestions.

EDIT: I don’t need help with the coding, just the advice or suggestions for the turn mechanics.

Everyone commits to a course of action, then the actions are resolved in order of character initiative.

How about the arena is an enneagon with a player on each point. Each player chooses their attack and when their all ready they attack whichever player they choose in order of the speed stat. If you want teams, I suggest coloring one part of the enneagon red (for the red team) , another part blue (for the blue team) , and the last part green (the green team). I drew a small diagram for it:

That is an idea I like, I could let the players choose and then lock their moves. When everyone is ready they execute. I’m not so sure about the enneagon arena. But it sounds more like an interface option, and not a part of the mechanics.