how to make a multiplayer game
I am trying to make a multiplayer game but i can't find a good tutorial to learn from it what i want to do is 1- create a random quick match 2- create a match with your friends i want a good tutorial series and how much i have to pay
asked Oct 07 '17 at 02:56 PM in C++ Programming
You can just do quick match and make friend join out of nothing, UE4 alone does not provide such service. Start with basics, make server and try to connect to it with client, i think editor has option for that to
Replication system works quite seamlessly, the game play framework of UE4 is designed for multiplayer local and network from ground up. All you need to do is make code/blueprints that is prepared for existence of two or more player and existence of multiple PlayerControllers (each player has one) and multiple player pawns. The default spawn system should automatically spawn default pawn for all players connecting to the server out of the box. So technically even empty project is already support multiplayer on the get go
Keep in mind that server contains game state, while client tries replicate it state from data they getting fro server, client sending data to server to update the state which eventually will be synced to other clients. All actors that are set to replicate will be synced from server to all clients, so you can pick what si replicated what is not. Note that lot of cospetic things can be figured out by client itself based on actions of replicated actors, for example particle when bullet hit the wall, appearance of effect don't need to be replicated, it;'s just waste of network bandwidth. when so there no need to replicate all actors. Search "replication" and you should find ton of tutorials.
Now creating a match and friend, as i said this is not job of UE4 to provide those services, all UE4 can do is make server and clients can connect to it. You need a service that will connect clients to servers without user needing to know IP of the server. You need 3rd party service to provide those services or make your own, and in case of PC, Steam is best known. UE4 have common API for those servcies and it's called OnlineSubsystem, read about it, there few network supported including console once. Biggest problem of OnlineSubsystem that some advance features are C++ only so you might prepare yourself for that
You also need to figure out who gonna host a server, someone needs to host a server for network multiplayer to work. Do you let users make servers, and you just view lists of them or you gonna host it whole array of them (rocket League does that) but thats expensive, or you gonna have some match making system where client randomly host the game, but then you have higher hacking risks as one of player will be able to manipulate memory of server. Each service might deal with this differently, Steam as i know supports both user hosted servers and client matchmaking.
But think about this, Minecraft never had any master server that lists all server, people hosts server and just share IP addresses, it didn't stop game to be extreamly popular. So not using any service is also option to consider, but if you make game seriously usage of such services is quite mendetory as most people expect game from larger company to support it, it also no go in consoles
for development i recommend you to just use IPs to connect you can worry about service stuff later. Just remeber that if oyu host server behind router you need to setup port forward so people can connect to your PC, inside LAN you should able to connect without any restrictions
Follow this question
Once you sign in you will be able to subscribe for any updates here