Andrea Sisti
2008-Jan-21 09:05 UTC
[Eventmachine-talk] Help understanding Eventmachine concepts
Hello, I want to develop a multiplayer online game (just a board game). every group of players (4) will play at a table. I want to use eventmachine because of course i''m using ruby to develop. Is eventmachine a correct model for this scenario? I have a question. How I can identify from what player the packets arrive? I mean how can i identify the session of the player? Sorry for bad english. Andrew -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/eventmachine-talk/attachments/20080121/dd45a6ed/attachment.html
Francis Cianfrocca
2008-Jan-21 10:17 UTC
[Eventmachine-talk] Help understanding Eventmachine concepts
On Jan 21, 2008 12:05 PM, Andrea Sisti <yakuman77 at gmail.com> wrote:> Hello, > > I want to develop a multiplayer online game (just a board game). > every group of players (4) will play at a table. > > > I want to use eventmachine because of course i''m using ruby to develop. > Is eventmachine a correct model for this scenario? > > I have a question. How I can identify from what player the packets arrive? > > I mean how can i identify the session of the player? > > Sorry for bad english. > >If you use TCP, then obviously you can tell who the players are because each one will have a distinct connection object associated with him. If you use UDP, then you can distinguish them either from the source IP address, or you can add a player ID to the packets that they send. Many people ask about multiplayer games. In general, EM is a good platform to use. But I''m always curious about the network protocols that people use for these applications. Are there standard protocols (like Jabber, perhaps?) that are suitable for multiplayer games? Or do people tend to invent their own protocols? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/eventmachine-talk/attachments/20080121/1e8648b2/attachment-0001.html
Dave Skidmore
2008-Jan-22 06:16 UTC
[Eventmachine-talk] Help understanding Eventmachine concepts
As a bit of a game programmer myself, most use custom protocols. No one has really built a good protocol that is fully generic, and yet fast enough for most games. the FPS client/servers use custom protocols intended for that style of play, but it''s really overkill for a boardgame or Internet Hearts. To answer the OP, the general design pattern is to have a mirror of the player object on the server machine, and associate the name and ID of the player with one of those objects, along with their connection information. That way when you get a packet from a132.network.com, you know it''s Fred, who is player 2. Alternatively, you can build the protocol to pass that information in the packets sent back and forth, in the case that you want to allow for more than one player per IP (for people playing via home routers, etc) In that case, the player connects, and you say ''okay, you are player 42314145'' and then store that in the player object on both client and server; the server uses it to know who to associate data with. For a 4 player game, TCP is acceptable. Only the larger games(hundreds of users), those that needs very high communication rates, or those that want to use some of those fancy firewall tricks we discussed, need UDP. Dave S On 1/21/08, Francis Cianfrocca <garbagecat10 at gmail.com> wrote:> > On Jan 21, 2008 12:05 PM, Andrea Sisti <yakuman77 at gmail.com> wrote: > > > Hello, > > > > I want to develop a multiplayer online game (just a board game). > > every group of players (4) will play at a table. > > > > > > I want to use eventmachine because of course i''m using ruby to develop. > > Is eventmachine a correct model for this scenario? > > > > I have a question. How I can identify from what player the packets > > arrive? > > > > I mean how can i identify the session of the player? > > > > Sorry for bad english. > > > > > > > > If you use TCP, then obviously you can tell who the players are because > each one will have a distinct connection object associated with him. > > If you use UDP, then you can distinguish them either from the source IP > address, or you can add a player ID to the packets that they send. > > Many people ask about multiplayer games. In general, EM is a good platform > to use. But I''m always curious about the network protocols that people use > for these applications. Are there standard protocols (like Jabber, perhaps?) > that are suitable for multiplayer games? Or do people tend to invent their > own protocols? > > > _______________________________________________ > Eventmachine-talk mailing list > Eventmachine-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/eventmachine-talk >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/eventmachine-talk/attachments/20080122/4a1b3227/attachment.html
Francis Cianfrocca
2008-Jan-22 17:28 UTC
[Eventmachine-talk] Help understanding Eventmachine concepts
On Jan 22, 2008 9:16 AM, Dave Skidmore <dave.skidmore at gmail.com> wrote:> As a bit of a game programmer myself, most use custom protocols. No one > has really built a good protocol that is fully generic, and yet fast enough > for most games. the FPS client/servers use custom protocols intended for > that style of play, but it''s really overkill for a boardgame or Internet > Hearts. > > To answer the OP, the general design pattern is to have a mirror of the > player object on the server machine, and associate the name and ID of the > player with one of those objects, along with their connection information. > That way when you get a packet from a132.network.com, you know it''s Fred, > who is player 2. Alternatively, you can build the protocol to pass that > information in the packets sent back and forth, in the case that you want to > allow for more than one player per IP (for people playing via home routers, > etc) In that case, the player connects, and you say ''okay, you are player > 42314145'' and then store that in the player object on both client and > server; the server uses it to know who to associate data with. > > For a 4 player game, TCP is acceptable. Only the larger games(hundreds of > users), those that needs very high communication rates, or those that want > to use some of those fancy firewall tricks we discussed, need UDP. > > Dave S > >Insightful. Thanks, Dave. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/eventmachine-talk/attachments/20080122/43441b1d/attachment.html
Andrea Sisti
2008-Jan-23 02:10 UTC
[Eventmachine-talk] Help understanding Eventmachine concepts
Thanks all for the answers. I thought using TCP for the reasons Dave said and because i need to use SSL encryption. Any code snippets of how to setup SSL server? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/eventmachine-talk/attachments/20080123/23ebc754/attachment.html
Daniel Aquino
2008-Feb-03 07:08 UTC
[Eventmachine-talk] Help understanding Eventmachine concepts
EventMachine supports TLS On Jan 23, 2008 5:10 AM, Andrea Sisti <yakuman77 at gmail.com> wrote:> Thanks all for the answers. > I thought using TCP for the reasons Dave said and because i need to use > SSL encryption. > Any code snippets of how to setup SSL server? > > > > _______________________________________________ > Eventmachine-talk mailing list > Eventmachine-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/eventmachine-talk >
Francis Cianfrocca
2008-Feb-03 09:27 UTC
[Eventmachine-talk] Help understanding Eventmachine concepts
On Jan 23, 2008 5:10 AM, Andrea Sisti <yakuman77 at gmail.com> wrote:> Thanks all for the answers. > I thought using TCP for the reasons Dave said and because i need to use > SSL encryption. > Any code snippets of how to setup SSL server? >Here''s the easiest way: EM.run { EM.start_server "0.0.0.0", your_port, your_handler do |conn| conn.start_tls end } You can test it with a browser (https:// etc). This uses a built-in self-signed server certificate. There are additional functions to deal with third-party certs. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/eventmachine-talk/attachments/20080203/2cac479b/attachment.html