If you join a multiplayer game, each client will have its own game instance since a separate game instance exists for each executable and it is not replicated.
With that if you call Get Game Instance on a client then you will get that client’s game instance.
I just want to make sure if I understand it correctly.
So when I start the game a game instance is created.
If I join in a multiplayer game, each client will have its own game instance?
And the getGameInstance node will get the client’s game Instance when its called ?
Game instance created when game starts and lasts until that game executable closes, persisting across level changes and joining sessions etc.
Game instance is only aware of its own executable. Does not have any connection between server and clients.
When I need to persist something from one level to another for example when a client joins a server’s level then I put it in game instance to save it for after the level switch. Then after Game state starts on the newly joined or opened level I have it grab anything it needs to inform all clients about from the Game Instance and can tell the server via playercontroller RPC to set those vars or multicast a function to everyone about it.
So does that mean when a server launches a dedicated server , that the dedicated server itself would have a game instance?.. that only it has access to?
that you could essentially call on the game mode of your server map using authority to pull say server player saves from and load them from player input of say a name for player save slot
I searched for a proper answer to this eaxct question too - but couldn’t find anything, so after 9000 browser tabs I’ll asume that’s the case, until proven otherwise.
The GameInstance is alive as long as the application is alive, pretty much as its name suggests, it’s an instance of the game. With that said, when a dedicated server is launched, a GameInstance will be created in response (on server). The GameInstance on server has no clue about the GameInstance that exists on clients, which gets instantiated the moment you launch the game, and is destroyed once you exit and close the game instance.
Quick recap: Every server instance has his own GameInstance, and every client instance has his own too.