Click here to Skip to main content
15,886,067 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am developing a .net based game where several instances of the application needs to communicate with each other effectively and display a common state in all instances irrespective of user input from any of the instances. plz suggest a good way of doing so.

Thanks in advance.
Abhishek
Posted

See my article: Writing a Multiplayer Game (in WPF)[^]

The game flow is:
Clients inform the server of their states.
The server runs the game loop, and informs all the clients about the "actual" game state.
 
Share this answer
 
Comments
BobJanova 25-Nov-11 9:20am    
Some interesting material in this article.
RaviRanjanKr 25-Nov-11 15:57pm    
Nice Link, My 5+
I would make them all clients of a single server instance.
Connect all the clients to the server (Sockets, probably, or WCF) and as each client updates the server, it then broadcasts to all connected clients.
 
Share this answer
 
Comments
Wayne Gaylard 25-Nov-11 4:26am    
Would you use a broadcast system, or would you get the clients to poll the server for updates ?
Sergey Alexandrovich Kryukov 25-Nov-11 4:31am    
I would not make if poll-only client-server -- this is very limited model (a curse in many areas, leading to insufficient responsiveness vs. overuse of resources). Same thing about broadcasting. Right solution is probably permanent sessions with dual pull/push protocol (maybe to channels per client).
--SA
Sergey Alexandrovich Kryukov 25-Nov-11 4:28am    
That was my first though as well. My 5.
--SA
abhitechno 25-Nov-11 4:28am    
how do i reflect my app status across all communicating instances, do i export the entire objects or do i raise the appropriate event across all instances. moreover what would be better for this sockets or WCF???
Sergey Alexandrovich Kryukov 25-Nov-11 4:35am    
If clients interact (otherwise it's too trivial), it would be the best to keep status on service part. Sockets or WCF (by the way, self-host WCF on service) -- depends on complexity of messages are requirements for performance. I would prefer sockets via TcpListener/TcpClient, and data object sent using binary serialization.
--SA
Try creating a web service or WCF and run it on IIS. Use that service to interconnect your applications.

Best regards,
Eduard
 
Share this answer
 
Comments
abhitechno 25-Nov-11 4:30am    
that way my application won't be install anywhere and run type.
I would require to setup a server first and then install the client app.
[no name] 25-Nov-11 4:36am    
that's the way it should be. run it on a server and call that service on your client apps.
hi check this link about WCF

http://msdn.microsoft.com/en-us/library/aa480210.aspx[^]


hope it helps!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900