Hi,
lets say you want to create a game with two players - to make it easy.
You could create two entity pointers playerA and playerB
And to make it even more simple: two actions acPlayerA and acPlayerB
action acPlayerA() {
playerA = me;
...
same for the other action...
In your main program is a kind of main loop which checks the current game mode like
- intro running
- menu running
- game running
- game pause
in case of "game running" you check another game state: player mode
- 1 player
- 2 player (two players with joystick sitting in front of the same screen)
- network mode
Your game loop calls different functions depending on your player mode (if the game mode is "game running")
it calls ai_function( playerB) if it is a single player game and the opponent is controlled by the AI
it calls input_playerB() in order to check the buttons pressed by the second player
If it is a network game, you have to change skills on playerB depending on network input.
In all cases playerA is controlled by a function input_playerA() which sends network commands only in case of "network game" ( the entity actions control all animations locally.)
This is just a raw sketch about how you could do it and it is not easy if it is your first try.
But the idea is to decouple input from Player A + B, AI or network from the action which animates the entities.
let 4 functions change skills of playerA and playerB and let 2 actions control its entity depending on my.health, my.move_mode, my.anim_mode,...
Our game was more complex when it came to game modes, because you could choose between
- single player ( against AI and return to menu after level complete)
- arcade (play against all possible enemies and maintain a highscore list)
- dual player (local)
- network (2 player)
We had to write the game only once - which was your question

-- slacer