team index -1 is random team/start place team index 0,1,2,.... makes that players home planet a starting Planet for Team 1,2,3 and so on.
Thus if you have 3 players with team index 0, those 3 will be in team 1 and starting on those planets. Which player will start on which of these planets is random, but this way you can ensure that the players in the same team start next to each other.
The teams determines the home planet, no matter where the players are when joining a game (e.g.: The Player join the game and player 1 and 2 are team 1, 3 and 4 are team 2, 5 is team 1, 6 is team 2 - still the players in team 1 will spawn on the home planets with team index 0, and those of team 2 on the home planets with team index 1)
Not that sure if teamindex 0 = team 1 , teamindex 1 = team 2 and so on, maybe the teams are shuffled random to either teamindex. But still if the players and their homeplanets have the same teamindex != -1, they are spawned together if they are in one team.
You notice this when opening a new game. If you set 3 players on teamindex 0 and 3 on teamindex 2, those players automatically are in one team, instead of each player being in a unique team when joining the game.