I’m not very familiar with sessions but I’m attempting to create a lobby with sessions and I have a few questions about them.
- When a session is created, is the gamemode among other things cloned for that specific session?
- If so, how can you pass variables between maps? Game Instance? (Which I’m not sure if Game Instance is cloned for that session or not, not really sure)
Basically I’m creating a lobby with UMG and in order to sync the lobby with connecting clients I would store the players in an array and have it replicated to connected clients so that their lobby matches everyone else’s and is updated when a new player connects. (not sure of a better way) The host would be able to change rules such as lives/time/etc that would be needed to be passed to the level’s GameMode once they begun loading the map they chose.
Any help will be appreciated.
Do you plan to any online service like SteamWorks? Because if you do you gonna have support for that out of the box, not sure in blueprint (as not all OnlineSubsystem features are exposed) but definitly in C++
Yes, I do plan on moving to steam eventually. I’ve been learning BPs before switching over to C++ but it seems like I might as well do it now than later. If I’m thinking correctly, moving to Steam (like using LAN) and doing sessions that way would still work effectively the same way right?
Sessions don’t really change replication or game modes any differently than singleplayer.
But from my understanding a “session” is when a client becomes a host to more people, while still being connected to the main server.
For “rooms”/“games” (think of League of Legends style).
Let’s call this client “PlayerA”
Other clients first connect to the main server, then can be given the ability to connect to a “session”. We’ll call this “PlayerB”
PlayerA and PlayerB are both connected to YOUR server, but PlayerB is also connected to PlayerA.
PlayerA is a “host” and all replication is done on that end and sent to PlayerB.
PlayerA can change maps/levels and game modes etc just like normal, and PlayerB will tag along.
A “GameInstance” would be one way to keep track of things such as player name, level, ammo, etc. And if it’s persistent it will not change between different maps/reconnections etc (assuming you had a save/load for it)