Generating Random Default Colors When Default Color List is Exhausted


  • Admin

    I've a PR up for this already, but wanted to open a thread for discussion.

    https://github.com/triplea-game/triplea/pull/7637

    To describe what the engine does today, default players are defined today in map.properties. If a game has a player that does not have a color defined in map.propertiers, then that player gets a default color. There were about 8 default colors. When all default colors are used up, the game would crash on launch with a java.util.NoSuchElementException.

    The update in PR#7637 essentially avoids this crash and instead when all of the default colors are used up, the engine will start generating random colors. Any given player name will always generate the same random color, so the colors will be consistent for any map even if randomly generated.


Log in to reply