How to set up simple online multiplayer?
I've been sifting through all the documentation on multiplayer all day and I'm rather confused on what I should be doing to implement multiplayer. I've been reading about online subsystems and client/server models and sessions and I'm not sure if these should all be used in conjuncture with each other or if each one is used for a different purpose.
Anyway, what I'm asking is for someone who knows how servers and UE4 works to help me understand what I should be doing here.
I want to be able to host a server on my computer and let my friend hundreds of miles away be able to connect to it.
I was also going to implement a server list for easy server lookup but if I have to do something like setup my own online subsystem to do that then I won't; this is primarily a project for my friends and I to use so it's okay if it's rough around the edges.
asked Jun 18 '16 at 04:35 AM in C++ Programming
To anyone following this: I fixed it (in a way). I was able to get session-based multiplayer working by using Steam's subsystem. Rama made a cool guide on how to do this here. For session setup, I used eXI's guide here.
I'm still not entirely sure how to run a listen server through the console or through code, but I did solve my original problem.
answered Jul 04 '16 at 07:06 PM
Your question is quite general. Replication should work out of the box, you don't need ot deal with OnlineSubsystems, first make your game work just by connecting client to server
First thing you need ot understand is that there not much difference from local and multiplayer player, they are added and playercontroller for them is created and you game should handle that, so start with that. To add a player you use either CreatePlayer() function (in viewport or gameplaystatics which also work in blueprints), or input "debugcreateplayer 1" (if this still works) to console.
Now UE4 online multiplayer is based on state replication, host holds master copy of state and clients tries to sync that state and input there own data so all clients (and host) are synced, this system is good for shooters and any other games that have real time action (not just action games) but it's overkill for turn base or games that don't need much information to be synced (but you can do function call replication for that using system that UE4 have) or fighting games which require more controller input based replication. I never played with replication but i think as long you use dafault movment system and oyu game can handle more then 1 player it should work out of the box, so start up the server and try to connect client (remeber about port forwording):
Now setting up replication is all about deciding what should be replicated and what server should listent to, make everything sync in correct way. You need to remember that computer memory can be easily altered locally, it's main method of hack injections, so don't allow client to control anything then related to player, client should only do what player is allowed to do, host is ultimate authority which should be on guard of that and it should check if it's not getting some ridicules data from client, like player teleporting somewhere.
You should conceptrate on replication, things like OnlineSubsystem are just support social services like Steam works, PSN or XBox Live you can add that later if that confuse you, but you need to create a session in order for you game to be discoverable in LAN.
If oyu want more tip say what kind of game you making
answered Jun 22 '16 at 12:38 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here