Multiplayer in a game. How to design it object wise?

Posted by Ninetou on Game Development See other posts from Game Development or by Ninetou
Published on 2013-07-01T09:05:58Z Indexed on 2013/07/01 10:30 UTC
Read the original article Hit count: 127

Filed under:
|
|

I was suggested on StackOverflow to ask this question here.

I'm working on a simple game and I was thinking of adding multiplayer feature but I'm a bit stuck. I'm not sure what approach should I take, keeping in mind good programming practices.

I have a Player object which is created for each player but then I have many other classes that would have to be able to access them. The thing is, if I initialise them in, let's say my main method, then I can't relate to different instances of player class from other classes. The only solution to my problem that comes to my mind is using some form of global objects but afaik using anything globally in apps is usually not a good practice. Any suggestions/ideas?

© Game Development or respective owner

Related posts about java

Related posts about multiplayer