I’m using the online session blueprint nodes to create my game session (LAN). Everything is working fine but i want to stop people from joining after the game has started (I determine at what point to stop people from connecting). Is there anyway to do this with the session nodes? I tried to use DestroySession on the server but it kicks the clients out. According to the docs
When you no longer want other players to be able to discover and join your game, you can call the Destroy Session node. This will effectively cause you to leave the session, and if you are the host, shut down the session so that it is no longer discoverable.
Also how do i have players reconnect (game crashed or computer restarted) if i do stop connecting after the game has started.
You could have a Counter Int Variable on the GameMode. The “PostLogin” function that is called there could add 1 to that counter. When someone connects and the Counter is already equal to the max amount of players and the Game is already running, you just let him disconnect again. That could be done by calling a RunOwningClient RPC on the PlayerController that is passed with the PostLogin function. This RPC could then call a simple ConsoleCommand that does “open MainMenu”.
It bit dirty but that would work i guess.
When someone leaves you would just need to lower the counter again.
Only thing you can’t make sure is that the same player connects, because that would need a unique ID that you can compare. And that only ships with OnlineSubsystems like Steam and i don’t know if the SteamID is exposed to Blueprints.
Well, if you work a bit with UE4 you will find it pretty normal that Blueprints lack a lot of stuff. You can always say “You can create a Blueprint Only Game”, but there is a lot of stuff that you might find very quickly that does not work without C++. In the end you are forced to work with the stuff Epic exposes to you. So if something is not exposed, you are already seeing yourself using C++.