Hello guys.
I need help setting my multiplayer session.
I followed this tutorial by @eXi
After setting up everything as described and without any compilation error, now I’d like to know how to use this functions/delegates.
I have a widget blueprint for the MainMenu with two buttons:
But when I run the game with 2 players and I click the HostGame button:
What does it mean?
I think the error is in the HostSession function:
SessionSettings->Set(SETTING_MAPNAME, FString("NewMap"), EOnlineDataAdvertisementType::ViaOnlineService);
[/quote]
Looks like I have to change the name for my map. But I tried and that's not the problem.
Also, always in the HostSession() i set this parameters:
Hey, my setup was very basic. Because i didn’t want people to have a full packed function that they don’t want or which looked too complicated to understand.
You can always check what things i pass to the Host functions and extend it to let the Player fill these settings.
You would just need to add more parameters to the HostSession(…) function and then also add these to the BlueprintCallable function, so you
can actually pass information from the Menu Widget.
Also keep in mind that launching a game in PIE with 2+ Players will always come with an already existing connection between them.
If you want to test it with 2+ players without the initial connection, make sure to compile everything and go to your *.UPROJECT file in
your Project folder. Right click the file an hit “Launch Game”. Once for each copy of the game you want to start.
Searching a Session needs time. It’s not a direct action.
You need to split “Find Online Games” from “Join Online Game”.
Make sure you wait a few seconds before trying to join.
You should also try to add some Log Information to the whole Find Online Games thing inside of C++, so you can see
if you actually found something.
The C++ code gives you an array of Session Results back, so you should be able to print the length of this Array.
I just wrote that down from memory, so make sure to check the spelling. For adding a variable to it, you can try doing this:
GEngine->AddOnScreenDebugMessage(-1, 10.f, FColor::Red, FString("Number of Found Sessions") + FString::FromInt(NumberOfSessions));
Where NumberOfSessions is a variable or the direct length of the Array. Again, double check my spelling on these code stuff. I don’t have my VS open atm.
You can only use “LAN” as long as you don’t have a Subsystem like Steam.
It can’t find online Sessions without a MasterServer.
For online, you either need a Subsystem or Connect Via IP.
I don’t know why you find 2. Maybe you started the Game in PIE and created a second Server with the Client.
Or you did not destroy the first Session :X
What I don’t understand is this: it finds the session but it doesn’t join
I have a NULL OnlineSubSystem.
I’d like to be able to host a match, and want my friends to connect to that match using my public/static IP address.
I already opened the port 7777
NULL Subsystem is a dummy one. That doesn’t count. To connect over the Internet with this, you need to have a TextField for your Friends to type in
your IP Address and then fill it into a “Execute Console Command” Node with “open IPADDRESS”.
If I HostSession() from my PC, how does my friend find my session using FindSession() and JoinSession()?
Am I forced to have an OnlineSubSystem like Steam?
If yes, since it’s too early to think about Steam, should I use the commands open MapName to host (me) and open ip.ip.ip.ip to join (my friend from the other side of the world)?
If yes, this doesn’t work! (Widget Blueprint of the Main Menu)
Yes, to find a Session via Internet, you are forced to have Steam or any other Subsystem/MasterServer. The NULL Subsystem does NOT support online matchmaking.
For opening a level, try the normal “OpenLevel” node and add “listen” as an option.
Try this first with your Local PC. Start the game twice with “Rightclick->LaunchGame” on the *.UProject file in your Project folder.
Then use one Instance to host via OpenLevel and connect with the other via the IP “127.0.0.1”. If that works, you can try connecting
over the internet. If that doesn’t work, then i’m a bit out of question, because this needs to work on a local setup.
If it works but connecting over the Internet does not work, then you have Port Forwarding issues.
I think there are multiple Ports you need to forward, but i don’t know which right now. But you will find them with a bit of google.
And yes you can test Steam. Steam has a Test AppID 480, but it can be that Searching Sessions gives you more sessions than you
want, because everyone is using that ID.
I’ve been off all these time because I have been set up a Dedicated Server for my test project and I finally got it work.
Also, my friend can now connect to my session succeffully.
One thing that I don’t like is that once we’re in a session (both my friend and me) it looks like we have a huge FPS drop.
When I’m in no session it doesn’t happen, but as long as I host the session it’s like our FPS get dropped.
Is that about ping or FPS?