Download

Peer to Peer networking support in UE4 ( online games with no server )

Hi. Currently, UE4 built-in networking is client-server. It would be cool for UE4 to support peer to peer networking in blueprints. The advantage of Peer to Peer networking is that that a server is not required.

  For a better performance, things could be instanced. For example, let's think of an online Hack n' Slash. You are in a map, and other player is in another map. That player streams to you minimal information, that he is in that map. When you get in the same map with him, you get more information, such as its coordonates. When you get more closer, you get even more information, like his equipment, level etc. In this way, the data streaming is minimal.

P2P system is currently used in various console games.

I have found a webpage in which people discuss various aspects on P2P networking:

http://gamedev.stackexchange.com/questions/3887/how-can-i-make-a-peer-to-peer-multiplayer-game

   Could P2P be implemented in Unreal Engine 4 ?

Well, of course it can be done. But think about the security problems, the cheating.

There are some solutions for these http://cswww.essex.ac.uk/cig/2005/papers/p1037.pdf

Got another idea. To prevent cheating, a hybrid P2P/client-server system could be implemented. So actually, the clients send info to other peers, (and have security measures mentioned in above link) ,and the server acts like a checking system. So…from time to time, the server checks the clients if they are modified or not. The checking server could also be used for log-ins. In this way, the costs of hosting an online game could be highly reduced. In this way, you retain controll over your game. So…your network game runs on its own. When you turn on your PC/server, you gain full controll over its state. When you turn it off, the game continues to work, with cheating clients remooved.

Sorry, but looking at it realistically:

  1. Changing from server mode to p2p mode, will cause huge lag.
  2. The real cheater will get around this in more or less one day. Max one week.

His question was can it be done in UE4 - not everyone’s opinion about it. Truth is there will always be hackers and ways to cheat even in a client server model. Also maybe the OP doesn’t even care people cheat and wants a peer to peer for friends to play together.

Finally I’m no expert on peer to peer but if I was concerned about cheating I would have the clients verify each other by running tests. If both get the same result allow a match otherwise match them with someone else. A cheater could cheat by some memory hacking but most of the time if your trying to prevent cheating making it difficult for the average person is good enough.

P2P is good for a closed environment. ( like playing with your friends ) . It also works for an open environment, but, like Awdogsgo said, having each client to check the others to prevent cheating.

 For an indie project, P2P seems ok for networking without a server. It has its issues, but they can be prevented.

  Found a tutorial about creating a p2p game: http://gamedevelopment.tutsplus.com/tutorials/building-a-peer-to-peer-multiplayer-networked-game--gamedev-10074

  I think p2p networking could be implemented in UE4 by introducing some custom blueprints nodes. 
  
  It would be cool to have that, even as an experimental plug-in.

Actually, if one player checks the other,we.come to a bad situation where one player knows the variables of the other. Now think of an RTS…

Then a hybrid solution seems the best. I have found a detalied study on how to implement a hybrid p2p/server network solution. The main advantage is that it would reduce the costs a lot for indie developpers.
http://www.google.ro/url?sa=t&source=web&cd=1&ved=0CBkQFjAA&url=http%3A%2F%2Fwww.diva-portal.org%2Fsmash%2Fget%2Fdiva2%3A347749%2FFULLTEXT01.pdf&ei=tf3RU9TKOMjNygP7qoCgBQ&usg=AFQjCNEvVTE41JbnqiB11OWV0Eu4xzySIw&sig2=1OXiJQm_bW48RPMST6D0EQ

The security is maintained.

How do we implement the most basic of client to client communication. Can I get some code? I want to simply be able to send a message from one client to another without the sever. Think that would be a good start.

Hey Quizalot! In regards to your PM, I believe the only way to set this up would be with the TCP Socket stuff that Unreal Provides. I’ve personally never used it but Rama has a nice tutorial on transferring data with it here: A new, community-hosted Unreal Engine Wiki - Announcements and Releases - Unreal Engine Forums,Receive_Binary_Data_From_an_IP/Port_Into_UE4,%28Full_Code_Sample%29

Unreal isn’t really designed to work this way though, in a typical UE4 game the Clients have absolutely no connection to each other whatsoever, they are all connected through the server who oversees and transmits everything. There is no way to directly communicate between two clients, and I’m not sure if the Unreal Online Subsystem supports that either. One way or the other, expect to have to dive into Engine code at one point or another…

Cheating / Opinions and all that aside, the Engine was never designed to work this way from the offset, so it’ll probably be an uphill struggle for the most part.

Perhaps a compromise would be to host a lobby system with a web server and the clients host their own lobbies/servers for others to join. The web server would distribute what’s available to others looking to join. Peer to Peer is really horrible to work with or play using.

We need better support don’t we? Let’s vote for this- Trello
Authoritative client

I also think P2P is an interesting model

I know P2P has its problems but it opens up opportunities that the Server-Client model is very limited at.
the most obvious example is that of games with multiple players being removed out from the game as they lose. most of the time the losing player will want to leave and join a new match, but if that player is the server he has to wait for others (annoying for him) or the game needs to be migrated to a new host (annoying for everyone).
but there’s more to that I think, like ‘always on’ multiplayer

While it might not seem intuitive, I do feel that P2P networking is a very good thing to look in to. For anti-cheat, integrity checks between clients would work, however I feel that P2P is more useful for alternative use cases outside of traditional gaming instead, such as VR.

Everyone who wants an “authoritative client option” is voting right? I found this and thought it might be interesting to those developing their own solutions in the meantime. NAT Punch-through

On the topic of cheating.

The OP asked about setting up P2P, and while the subject is a good thing to study, it is not a one sized solution to just say “No, because people cheat.” there are a variety of very good reasons that games want to P2P.

Many games actually start a server in the background. When you get ready to connect P2P, one person is often “the host” while the others are just clients. The game client for the host actually starts the server software as a silent process. IE: Vanilla Minecraft is a perfect (modern) example. Clients would connect in much the same way, and players would probably have no idea what is going on in the background.

To simply slag off P2P because people can cheat, would totally annihilate many, many games that friends hook up to play for a weekend. Even our little indie game will be P2P simply because it’s a free game, and we want to provide multiplayer support without extra cost.

A P2P is generally a bad idea. The commonly selected option is to allow users to host their own servers in the client itself, and the host acts as an authoritative server for all other players.

I do like the idea of having all peers validating actions, sort of similar to the Bitcoin protocol, but it’s overkill. Just assume that the host isn’t going to cheat and use the aforementioned model.

P2P is good idea, if you don’t like it, just don’t use it… But for some projects it might help a lot.

Still waiting till i can implement my own multiplayer like this