Any reason Player.GetNext() returns null on playercount = 1?

I've got a game where players can potentially control multiple pawns. So the single player case is they can control all pawns until a new player joins. I'm curious why in the GetNext() method the single player case returns a null as opposed to looping back and returning itself, like in any other case where n > 1? Am I missing some condition where this could potentially be a problem?

Comments

  • This is by design, to have a different result when there's no one else. There is no next player. It's you.
    If we returned the single player, some might have to check if it's "me" and do something else in that case.

    Is it a problem?
  • Ah ok! Ya the use case I typically found myself using Next() for in turn-based games was simply "who's turn is it next?" So the method would typically 'loop around' after the last player. The only odd case in that scenario is having 0 players. Having 1 player isn't seen as special case in that use case as it's simply 'your turn again'.

    But upon further reading I think I saw that the player list order isn't guaranteed so trying to leverage that as turn order mechanism wouldn't work.

    So no, not a problem, as I've been able to work around it.