Multiple players

Blitz3D Forums/Blitz3D Beginners Area/Multiple players

Buggy(Posted 2006) [#1]
When handling multiple players, either on the same computer or across the internet, do you guys find it easier to use one "player" type or several identical ones?

For example, you could have each player be a "player", and then use For...Each...Next loops for everything, or you could have a "player1" type, a "player2" type, etc.


Steven Noyce(Posted 2006) [#2]
I would say that useing a "player1" type, "player2" type, etc., would defeat the purpose of using types. I would just use one "player" type. If that does not work out, then just have normal variables for each one, because I don't see a purpose in having different types if there is only going to be one object of each type (unless I missunderstood your question).


Sledge(Posted 2006) [#3]
What blitznerd said. If you think that a direct reference to each player might be handy then you can still have that by initialising each instance with a unique handle/name.

There are some fairly concrete differences between the player instances in Ice-Teroids, for example, so I have some hard-coded references in there (playerOne.player, playerTwo.player and playerThree.player, natch) for the setup phase. They're still all the same type, though, and in the actual game code (where you're flying about shooting stuff) everything is done with For...Each loops.


Buggy(Posted 2006) [#4]
Ahh... I guess that makes sense. Thanks then.