I have written a small peer to peer internet game in bgt that is a spin off of time fcrest. It is a nice little game and it can be a blast. However the way I have coded it is an absolute pain in the ass. It supports 4 players, and for each player I have to write the same exact thing. So I have 4 sets of everything. Menus, music selection, and 4 wheels. But that's not the part that is a pain in the ass. The part that is: having to write 12 blocks of the same code to make sure each player receives each player's online action. For example, player 1 receives 2, 3, and 4. Player 2 receives 1, 3, and 4. You get the idea. That's 12 blocks of the same code!
I would like to make a player class containing all of the variables so I only have to write everything once and not 4 or 12 times. However I am not very good with working with classes, and adding online to it makes it even more frightening. What is the best way to go about rewriting this? I may have lots of trouble at the start. The thing I have the most trouble with is assigning the player to that specific player when they connect to the server, but that's a step ahead of what I need to do. If anyone can help me start rewriting this, that would be fantastic!