Download

Host/Join Multiplayer.

So i had a idea on how to do hosting and joining with UMG but i’m still kind of new to UE4 and i have a question. So i have a Button that when clicked Executes a console command “open Level1?listen” and that works just fine. Then i have a Join button that when click takes you to a editable text where you type a ip and that textbox is set as a variable. What i’m trying to do is send the numbers typed in the editable text to a execute console command to join that ip. But when i tried it out it did not work. can you guys check and see if i did something wrong or if this even will work at all.

9f591d9e9d26dcc936eff54f27aefe256cd7b69b.png

c9345f40620389e06408df9907f55378489a44ca.png

Here is the error i get.

Does anyone know how to fix this?

That is a strange error, I don’t think it’s related to your blueprints. Are you compiling from source or using plugins?

I’m not sure what you mean. I’m packaging the project to test this out on my desktop and that is when the error appears. So my blueprint looks fine the way it is?

Does anyone know why it gives me this error instead of connecting to the ip?.

when loading new map make sure you don’t have any widgets on the screen - remove this widget from the viewport before loading new map. I’ve done the same thing yestarday, and here’s my blueprint which is working - make sure you are playing on standalone game or cooked game.

intoxicat what does your Create Server and Connect to Server event do?

I cannot set click event or anything for mine. How did you do that for yours.:open_mouth:

Ok i found out where i messed up in this. First i did not have it open the map it should of (facepalm) second i forgot to add a space after “open” in the append. Here is what it looks like working.

0a629fb449c4b2f6414494bbe0ff4deac5a2077e.png

The way i have this setup is. There is a host and a join button. When one player clicks host it runs a Console command “open Level1?listen”. That runs the game as a listen server on that players ip. Then for other players to connect they click join and they see the “Ip Address” text box. They enter the players ip that host the server and click enter. Upon clicking enter that code in the blueprint above activates. Sending the player to the map then opening the Ip Address that they typed into the box. This is a basic system for now and hopefully it helped someone out.

Now i want to try to take this further and i have been working on it since my last post but i need some help. I want some way for this system to detect if the ip typed is hosting a game or not. Will i be able to do this with Booleans. For example, I type in a ip that is not hosting a game and a message pops up telling me so. I have most of this setup but i cannot figure out how to cast between widgets. I tried putting a bool in the “host” button event and having it set to true that changes a branch in the join blueprint to allow to play to join. But that doesn’t seem to work. How can i make the bool change from False to True when a game is being hosted on that ip?.

Firezown is your picture Form within the widget blueprint or where have You did it?

10 bucks straight on the hand for the guy who makes this simple system work for me im struggling since weeks i dont know what i do different than whats shown here

1: Make a Widget Blueprint and name it Multiplayer.

Host_join.png

2: Make a Host and Join Button inside that widget blueprint.

3: Rename both buttons and make a bind for both.

4: Make another new widget blueprint and name it Join.

5: Inside the Join Widget Blueprint make a Editable Text and a button.

9f591d9e9d26dcc936eff54f27aefe256cd7b69b.png

6: Rename the editable text and at the top right make it a variable.

7: Set a bind for the button under the editable text.

8: Open the graph in the Join widget blueprint and copy the picture below.

Join Widget Blueprint: (The “Ip” variable is the editable textbox") Make sure you add a space after open in the append.

0a629fb449c4b2f6414494bbe0ff4deac5a2077e.png

9: go back to the Multiplayer widget blueprint and open the graph.

10: on the Host button follow below.

Host Button:

HostBtn.png

11: on the Join Button.

And that should be all you need to do. It will not work in the editor you will need to Package your project and open two versions of it on your desktop. Let me know if you have any further trouble.

Did you get it to work Majek?

it still doesnt work this **** drives me nuts i dont understand. do i have to set some option on or what ever?

remember that you need to be in standalone game to make it working.

i did a development package and startet it. this is standalone isnt it? i open the widget with event begin to play in mycharacter. still doesnt work.

yes, it’s standalone. What exactly isn’t working? Did you started the game two times? Post your blueprints.

i think it worked now. have to try it later on my real game and via internet to be sure.

There has to be a game hosted on the Ip you are trying to join. and since you are running both instances of the game on your internet you need to use 127.0.0.1 to connect. Also make sure you put a space after open in the append that is what messed me up for a little while. :stuck_out_tongue: