Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Local and Online Multiplayer?

How would I go about implementing both local and online multiplayer? I have a game that has up until this point been local multiplayer, and I have been looking into adding online multiplayer, but I'm stumped as to how to implement online multiplayer while keeping local multiplayer as an option. The best I can see is that I essentially may have to build two separate games, because when using a build with Networking, half my events are split between server/client, but when running local, I need all my events to be running on the single instance of the game.

TL:DR. How do I implement a game to have both local and online multiplayer? Do I build two separate games, or is there a setting that "disables" networking?

Product Version: UE 4.13
more ▼

asked Nov 30 '16 at 03:29 AM in Using UE4

avatar image

21 4 8 12

avatar image KyleRasmusson Nov 30 '16 at 06:20 AM

It depends how you have the functionality set up as to how easy it is. You totally can set up so that you use a multiplayer connection. There's steam integration built into UE4. If you go to Edit > Plugings > Online Platform > Scroll down to Steam and enable it. Then go to your DefaultEngine.INI and get the steam integration set up with code from there.

Question though, when you talk about "Local Multiplayer" Are you talking LAN Connection? Or literally 2+ players on the same machine using controllers for inputs or something like so? If its local machine connections then yeah, you'll have to do a lot of work, but I'm sure its possible, just set up some checks for that in the way you set up the matches.


I'm fairly new to Networking myself, I've been working through this as much as I can to get networking set up, and there are definitely ways of switching between a LAN connection and an Internet connection.

I'd need to know more information before actually giving any answers. However the tutorial I linked should hold some answers for you.

avatar image thecomediclife Nov 30 '16 at 06:35 AM

Thanks for the response. As for local multiplayer, yes I meant 2+ controllers on a single machine. The game I am working on at the moment is essentially a couch party game with a shared camera. So far it's been purely local, running off of one machine, but I want to add online multiplayer while keeping local multiplayer as an option.

As for networking, so far I have been able to successfully create a dedicated server and tested it both in LAN and online, using a friend's computer. However, I notice that if I try to run a local game on a build that is meant to be a client, I cant run any of the server functions and events that are neccessary for game flow and game events. I'm pretty sure this is intentional, so I'm wondering if there's any way I should be handling this, or if the only way to do this is to build a local version and an online version seperately.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

You do not need to build two separate modes, if you do not want to. Implementing local multiplayer generally comes down to using the function "Create Player". See https://www.youtube.com/watch?v=ZOc9fV6Sap4 for an introduction. https://docs.unrealengine.com/latest/INT/BlueprintAPI/Game/CreatePlayer/index.html

As far as I know, you can run CreatePlayer on the server without problems, it will have the same behaviour as when run in a "local" game. So you can simply run a server (without any client) as a local game and allow additional local players. This will make testing a lot easier, because you do not need to test two different modes.

more ▼

answered Dec 03 '16 at 06:18 PM

avatar image

216 9 16 22

avatar image Mewbits Sep 08 '17 at 02:02 PM

Can the client also add new new local players? I want my game to be able to be two player split screen on two machines all playing together or four players on one machine. 3 on 1 and 1 on the other. Etc. Any configuration people want to do so there's both online and local going on on each instance with up to 4 players on one machine or up to four players across four machines.

avatar image lotodore Sep 09 '17 at 08:35 PM

Yes the client can add additional players. But this is not intuitive: If you need to run CreatePlayer on a Client (which is connected to a server), you cannot use the return value. Instead, you need to use some kind of player activation based on the local player id in BeginPlay of the Controller. This is very tricky, I'm afraid.

avatar image Imagine-Games Dec 10 '17 at 04:23 PM

im wondering if you got this working, im having some trouble spawning 2 players from another machine, so pretty much what you said 4 players, but 2 on one machine(host) and 2 on the other(client).. getting any number of players on the host is easy, but getting more than 1 on a client is where my trouble is...

avatar image Mewbits Dec 11 '17 at 02:22 AM

Unfortunately I did not. I created a forum and didn't get any answers there too. Lotodore's answer was also not specific enough to really help me.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question