I am working on making the 2 player net pong game be four player but don't want to have to do it the tedious way of duplicating code for each player (in this case it is not really tedious, but wouldn't be practical for a 20+ person game which is the point of the exercise):
Here is Python function that updates the player position only if the player number is not yourself.
[code:34szvw2l]def Network_move(self, data):
if ((data['player'] == 1) and (System.globalvar("myPlayer") != 1)):
elif ((data['player'] == 2) and (System.globalvar("myPlayer") != 2)):
For example, to make the above support 4 players I would have to double the code. Instead I would like to do something like (with all players in a Family) :
if data['player'] != System.globalvar("myPlayer") :
Pick players by players PV == data['player']
So something like the above where you pick a player based on their Private Variable (or something else) being the correct match. Now the above three or so lines are sufficient to handle 2, 4, 50 players.