• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
JDX_John

What do consider with P2P game?

8 posts in this topic

Not a game but for all intensive purposes the same thing, I have a real-time 3D medical simulation environment (C++, multiplatform Windows/iOS). One thing I'd love to do is join a session with a user so I can see what they're doing, and be able to take over to demonstrate to them. 

 

I don't really want to write server-side applications if they're not needed but other than using 3rd-party server middleware (Smartfox) I haven't done real-time multiplayer stuff and have a few questions:

 

  • How hard is it to get a P2P connection between two arbitrary computers anywhere on the web, typically at least one behind a company firewall? Users are quite typically not very technical and while telling their workstation firewall "yes allow access" is OK, getting them to open ports would be a problem... plus every extra step is a barrier to them actually bothering through when I send them a free version and want to demo it.
  • If it is strictly a 2-player scenario, is P2P better or would you tend to write a server application regardless?
  • What about a 'hybrid' setup where sessions are P2P but a simple server is used to facilitate things?
  • What are the main C++ cross-platform libraries these days? It's been 15 years since I was doing this stuff as a hobby :)

Thanks!

0

Share this post


Link to post
Share on other sites

First: it's "for all intents and purposes" :-)

 

Second: P2P requires either port forwarding or a central matchmaking server (and even so, it doesn't always work.) It will be more robust to use a "real" game session server, even if all it does is forward messages between the players.

 

Cross-platform libraries to do what? For networking, and a number of low-level primitives, there's Boost. boost.asio is great.

0

Share this post


Link to post
Share on other sites

Cross platform libraries applicable to C++ networking... when I was a kid doing hobby coding people talked about RakNet but that was a long time back. I was thinking something a step or two above the bare networking stuff, I don't know if boost comes under that category or not, I don't think it was around back then! Has boost made 3rd-party libs redundant? I think a middleware solution (like SmartFox) is perhaps a bit too far but I'm not sure.

 

Can you elaborate why a real game server resolves problems with port forwarding, etc? Whether the client on your PC is talking to a server or directly to the client on my PC, it has to establish a connection to a remote PC so what are the differences, technically?

0

Share this post


Link to post
Share on other sites

With a real game server, each client connects out through the firewall, to a known IP. That is known to work well.

 

RakNet is still a reasonable library if you want higher-level than boost.

0

Share this post


Link to post
Share on other sites

Ouch, pricey though. $8k+ per application (http://www.jenkinssoftware.com/pricing.html). I will have to contact them and ask how they word their hobbyist license e.g. if my company has turnover $101k and I develop 5 demo applications to showcase our technology but don't attract any revenue... clearly RakNet has grown up a lot since 2000 :)

0

Share this post


Link to post
Share on other sites
Okay...

So you've got either your custom servers or your $8000 investment in RakNet going. Your game lobby starts up. Computers join. You have a partial mesh of P2P nodes, with either something acting as a repeater to get to the less-connected P2P nodes or you luckily manage to build a complete mesh...

... Then what?

You have a bunch of computers listening and ready to communicate. That part isn't so hard.

Connectivity has been a solved problem for a half century. Network topology is easy. Your specific game or medical simulation, however, is probably at least partilly a novel problem.

What are you planning on communicating?

How do you actually communicate "the game", or medical simulation, whatever information that is? What is your protocol? Who listens to what? What do they do in response? Who coordinates what happens next? What happens when the mesh changes, either when a node drops out or when a connection drops out yet the player is still partly connected? What happens when someone suffers a bad connection, should they vote to drop? Is a machine selected as a local hosting master, and what happens if they are dropped? How does the processing happen, and what (if anything) do they report back to central coordinators?

Some systems and protocols lend themselves nicely to this kind of environment. Distribution is well-studied, and scatter/gather problem solving across a network is commonplace; the acronym I learned two decades ago was PCAM, Partition, Communication, Agglomeration, Mapping, allowing you to study just about any computable problem and spread it across a network of machines.

The work is not in the networking itself, but it building the individual clients and the protocol that they share.
0

Share this post


Link to post
Share on other sites

Good points although the "gamestate" is probably not going to be very complex compared to a game.

 

When you talk about P2P I think you're talking about a more complete P"P network along the lines of Skype? Dynamically changing how nodes connect? I'm talking about an old fashioned P2P session where each member talks to (all) the others... in reality there would only be 2 players which is something of a special case. If it wasn't 2 players I'd probably go straight to a server-client model, because it is I find myself in a quandary if putting a server in the middle is the right thing to do or not.

0

Share this post


Link to post
Share on other sites
When all clients can directly address any other client, that is called a fully connected mesh. It is perhaps the easiest method of network programming. It is what many programming environments will simulate given the chance, hiding any internal routing that must take place.

Having a server in the middle, where everybody communicates with that central hub and the central hub relays the information is called a star. It is also fairly easy to work on, since as a client you always know who is on the opposite end, and you can route your messages indirectly through the hub node to anybody.

As far as network programming is concerned, those are the easy off-the-shelf parts. No drama or difficulty, they are assumed to be present and debugged.

Network topology has been solved for about 50 years. Go to your favorite used bookstore, buy a network programming college text from the 1970s or 1980s and they'll explain all the details of all the topologies in usually far better terms than a modern book where everything is hidden by the magic of the Internet.


But those are not the interesting bits. Those are not really the things you need to consider, other than the occasional connectivity hiccup and dropped connection.

Once you have your connectivity, what do you plan on transmitting? How do you partition your problems, and why? How do you establish what to communicate, and why? How do you decide what gets placed where, and what gets mapped to what machine, and why? That is where things start to get interesting.
1

Share this post


Link to post
Share on other sites

Some information about how to establish the connection between two hosts behind a firewall : http://en.wikipedia.org/wiki/Hole_punching, especially http://en.wikipedia.org/wiki/TCP_hole_punching ; this might not be an easy trick if you don't have much network knowledge (in which case I suggest you to read http://www.bford.info/pub/net/p2pnat/index.html). An informational RFC has been published on the subject (http://tools.ietf.org/html/rfc5128). http://www.comp.nus.edu.sg/~bleong/publications/netgames09-p2p.pdf provides a state of the market (always interesting). 

 

Some libraries out there might help (summoning google)

 

https://github.com/ckennelly/hole-punch is about UDP hole punching. 

http://cs.nyu.edu/zilin/cplusplus/ provides some source code to do UDB hole punching as well

 

Source code that shows TCP hole punching in C or C++ is harder to find (I found C# examples, Java examples, but I failed to find any C or C++ example). 

 

But then, the first issue is not connection : it's identification. What is the IP/port address of an unknown distant machine? If you're playing on the local network you can setup some broadcast-based discovery protocol (a la upnp). But you can't use that on the internet and thus you need to setup something to help your users to find another player (using what is called a rendezvous protocol : http://en.wikipedia.org/wiki/Rendezvous_protocol).

 

BR

Edited by Emmanuel Deloget
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0