Phpwolf arrays are, in its current state, all over the place, so I propose that the arrays be set up into two central array: $players and $roles. $players would contain a nested array, which contains a users' id based on the order that the users joined that game (1, 2, etc...) and the users' roles (also an array) which contains all the roles of that specific user. $roles are all the users based on their roles. A structured example of this is locate here at a GitHub Gist.