I have 4 players, I have keyboard inputs for two players and xbox controller inputs for the other two. Alternatively all 4 players can use 4 different xbox controllers.
All my player movements are done with variables; so "when left key is down" - "set 'turn left' to true" - "when left key is not down" - "set 'turn left' to false".
I am really struggling trying to cater for any combination of player control methods, so for example, player 1 can use the Keyboard and Player 2 can use the xbox controller.
If the players only have 1 xbox controller, that means that player 2 will need to use Controller index '0'. What I've done is say 'If player 1 control method = keys and player 2 = controller' - 'use controller 0' - I then write all the controls for this combination.
With 4 players though, say if player 1 and 2 use keyboard and player 3 and 4 use controllers, that means that players 3 and 4 need to use controller index 0 and 1. So that would mean I'd need to write out all that code for that eventuality too.
So what do I do? Do I write code for every possible combination or is there a more efficient way of doing it?