P2P network programming
P2P network programming
Hey
Im making a 3 players cooperative game (only a demo tho), and im at the part where i have to integrate the networking.
So before starting the basic server-client networking, i was wondering if i could use p2p networking, like in borderlands.
In borderlands, one person "hosts" the game, but e.g. that host leaves, the game still working, and one other person will become the game master.
So i believe its P2P connection, and it just selects one person to control the game (mobs, the world). And if that person disconnects, other computer takes the control role.
As for network, every user should connect to every user (thats why p2p), sending player specific informations to every connection, also the control role computer sends the basic control informations (mobs, map).
But there comes the problems. Routers doesnt let connections come in, unless they are port forwarded. But i know games (s4 league, and also borderlands), what connects to my pc even if not port forwarded the router. How they do it?
So please point me in the right direction ^^
Im making a 3 players cooperative game (only a demo tho), and im at the part where i have to integrate the networking.
So before starting the basic server-client networking, i was wondering if i could use p2p networking, like in borderlands.
In borderlands, one person "hosts" the game, but e.g. that host leaves, the game still working, and one other person will become the game master.
So i believe its P2P connection, and it just selects one person to control the game (mobs, the world). And if that person disconnects, other computer takes the control role.
As for network, every user should connect to every user (thats why p2p), sending player specific informations to every connection, also the control role computer sends the basic control informations (mobs, map).
But there comes the problems. Routers doesnt let connections come in, unless they are port forwarded. But i know games (s4 league, and also borderlands), what connects to my pc even if not port forwarded the router. How they do it?
So please point me in the right direction ^^
-
- Competition winner
- Posts: 1123
- Joined: Sun Jun 10, 2007 11:14 pm
i will write down a few of my recent thoughts about this topic:
i think the most modern approach would be a system combining most of the basic principles which exist today and using different channels for different data depending on the datas priority.
these are 4 different systems used today:
- option 1: the basic system is 1 server for a limited amount of players (like in FPS game servers).
- option 2: a bit more advanced, have a big game world with lots of players, divided in adjacent maps and/or channels, and when moving from one to the other, players can be potentially handed over to another server. this would massively increase possible count of players per game world.
- option 3: this is basically option 2, but with servers which are in the same location and have high speed networking for internal communication (fibre optics), this would make handovers smoother, or even unnecessary sometimes.
option 4: use option 2 (or 3 if possible) and add real P2P networking for data which does not require very low latency or does not need to be known by the game server (e.g. voice, text, file transfers, individual textures and similar). this would require a stable UDP hole punching implementation.
while these ideas are most effective in MMO games and similar, having a simple multiplayer (lets say up to 8 users) CoOp game would also benefit from using P2P connections provided by UDP hole punching in a way which would require the central game server to only mediate connections, thus no heavy server load is created.
i think the most modern approach would be a system combining most of the basic principles which exist today and using different channels for different data depending on the datas priority.
these are 4 different systems used today:
- option 1: the basic system is 1 server for a limited amount of players (like in FPS game servers).
- option 2: a bit more advanced, have a big game world with lots of players, divided in adjacent maps and/or channels, and when moving from one to the other, players can be potentially handed over to another server. this would massively increase possible count of players per game world.
- option 3: this is basically option 2, but with servers which are in the same location and have high speed networking for internal communication (fibre optics), this would make handovers smoother, or even unnecessary sometimes.
option 4: use option 2 (or 3 if possible) and add real P2P networking for data which does not require very low latency or does not need to be known by the game server (e.g. voice, text, file transfers, individual textures and similar). this would require a stable UDP hole punching implementation.
while these ideas are most effective in MMO games and similar, having a simple multiplayer (lets say up to 8 users) CoOp game would also benefit from using P2P connections provided by UDP hole punching in a way which would require the central game server to only mediate connections, thus no heavy server load is created.