Download

Help beginning a multiplayer game

Hi!

I want to start a simple multiplayer game just 1vs1 in order to publish it in Steam and it will be my first multiplayer project ever. I’m not asking about online programming tips (not yet :P) just about the architecture needed to start.

As I said the game is very simple but I have no experience in multiplayer programming… Do I need a external server for my game?? or Unreal has all to build the game?? Have I to use Steam servers to online gaming??

Thanks dudes, i’m very lost…

Hey ColibriLive,

Practically nobody can give you architecture tips since every project is unique, but what you need to understand is the UE4’s replication architecture. First of all you would like to research about the client server model and learn how it works (I had to manually make my own client-server architecture app to fully understand the basics). From there you would like to learn how to replicate a simple variables, and then how to do RPC - Remote Procedure Calls.

That will give you the basis to start a simple multiplayer project.

For example, had you wanted to replicate the Health of the player, you would have to mark it as Replicated property (whether it’s C++ or Blueprints).

Making a RPC function is a bit more advanced, but pretty easy if you understand it.

#In Blueprints

Make a custom event, mark it Run On Server, and then do all the functionality you want to be replicated as in singleplayer game. Just note that Run On Server means that a client will ask the server to do something for him.

#C++
You would have to define 3 functions in your class, that is the function name, the _Implementation, and _Validate. Then put inside of the _Implementation part, all the gameplay code.

You don’t have to worry about making your own custom server, UE4 already has it’s own listen/dedicated server system (OnlineSubsystem=NULL) and has Steamworks integration as well. You have to choose it for yourself.

Best regards,
YoungWolf

If you want your game to support “finding other players” somehow (matchmaking) or “storing online state” somehow (scoreboards, persistent inventory, etc) then you will need some kind of servers for that.
Exactly what kind of servers you need depend on which “online subsystem” you’re using. If you use the Steam online subsystem, and you get greenlit and released onto Steam, you can use the Steam servers for that. If you use Google Play, you can use Google Play servers for that; same things for Apple GameCenter, Xbox Live, etc.

Additionally, if you want to run authoritative game servers (to reduce the chance of cheating, say,) then you need to run those servers yourself; no existing infrastructure will host your game servers for free.
The usual way to get around this is to elect one of the players are “the server” (“host”) for the game, and everyone connects to that player when joining the match.

A bit offtopic @jwatte I wonder if you knew how hard it would be to implement custom dedicated server functionality? I mean something like getting input in the console window of the dedicated server, and do stuff based on it? For example if you type list players command it will return a string containg thte total players currently connected?

If you know how to program Unreal games in C++, then doing that is not hard.
If you don’t, then it is :slight_smile:

Read this (:

http://cedric.bnslv.de/unreal-engine-4-network-compendium-released/

That tells you everything about Networking that you need to know at the start.

Hi!!

Thank you all!!

The issue is about the Steam services because I don’t want a dedicated server, just to see other steam player and connect with them to play a match. The problem now is… if my game needs to be greenlited to test with steam servers surely it will dificult to code without testing.

I will read the eXI doc to begin but I think that my main question is resolved… I can use Steam services to find other players and no its not needed know the host ip to play against other player.

Thanks again!!

One thing that is nice is the OnlineSubsystem is an interface that uses all the functions you need and works with Steam, PS, XBox, custom server, etc. Look at the ShooterGame example for an example on how to get friends lists and the such.

Yeah, and you can use Steam’s Spacewar game to test all functionality before it’s greenlit