Allow different colours for more than 2 players

Reported by Divided By zer0 on OCTGN · 13/05/2011 15:43:58

Assigned to:
Issue type:

At the moment OCTGN always assigns either a red or a green colour to players joining a game. I think it would be good if the game assigned a different colour to each player as they joined so as to have things more clear in differentiation. The colour assigned to each player could be generated randomly once they’ve joined which would mean it would facilitate an infinite amount of players.

Also, if possible, the player colour should also be available in the player class, so that it can be used to mark the cards for the player for various reasons. For example, in Doomtown, you often want to take “ownership” of a card but that’s impossible normally, so you can simulate by assigning it a special highlight.

So I’ve created a function which assigns each player a random colour during setup and assigns it to the card and given the likelihood of two players getting the same random RGB hex code, it serves as a sort of unique player highlight

def defPlayerColor():
# Provide a random highlight colour for the player which we use to simulate ownership
   global PlayerColor
   if len(PlayerColor) == 7 : return
   RGB = ["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"]
   for i in range(6): PlayerColor += RGB[rnd(0,15)]

If the game assigned a random colout to each player as the joined the game, and I could grab that with player.colour for example, this would allow both tricks like the above, and better differentiation of player targets (i.e. shift-clicks)


No attachment has been uploaded, yet.

Loading comments...