No announcement yet.

What's the proper way to bring custom variables into a new online session? (Deck, Loadout, etc)

  • Filter
  • Time
  • Show
Clear All
new posts

    What's the proper way to bring custom variables into a new online session? (Deck, Loadout, etc)

    Essentially I'm making a TCG, clients can build their decks and bring them into the game. Everything is working and my deck array is being saved to the save slot and passed over to my clients player state before travel. Obviously when I join said p2p session (using steam sdk and appid480 btw) my clients playerstate is reassigned default values and essentially wiped. Same with playercontroller. I've tried passing these custom deck arrays to the gameinstance instead however that proves pointless as it's a p2p listen session not a dedicated server so as my second player joins, he tries to load the deck in deck slot 1 from the game instance which at this point, has only been written by the host, player 1, because only one game instance can exists and joining the session destroys player 2's game instance. So my question is this: how do I go about bringing specifically an Integer Array into a P2P ?listen session in such a way that on post login in my gamemode, I can cast to said way of carrying over the deck, and load the correct deck from the correct client instead of casting to something that is shared and therefore unable to be written as the information is lost on travel before my player 2 controller/state can even set their deck in the game instance. Any help is much appreciated.


    first of all, i am a beginner in multiplayer scripting, too, so there could be a better way of achieving your goal.

    I am not realy sure if i got your setup right. But the behaviour, that you discribes, is networkwise correct.

    I assume, that your player creates their decks offline in their main menu. And as long there is no master server that handles account management and deck saving in the players online profil, you need to save them somewhere else OFFLINE, too. The default way should be a "SaveGame Asset". Then, after joining the mulitplayer session, all of your clients states are whiped. Thats correct, cause as you mentioned yourself, there can only be one session at the time and the client gets the one replicated, that the listen server is useing. But nothing stops you to load the clients "Save Game Asset" on the client machine and passes those information to the server game state or the new player state, to make this information accessable by all other machines. Just include a "load your Deck" Button in the lobby and travel to the game map together with all players. That way: the game session stays the same, even between maps, while the session stays the same.

    1. Build your deck offline and save it
    2. Connect to an online session in a lobby map, where all players meet themself and game options are set up
    3. Let the players load their Decks out of their own save game assets and pass them to the server (for replication)
    4. After finishing up, travel with all the players to the actually game map.

    I hope that helps.

    For detailed information, the following video is a part of epics network tutorial and in this particular video, they set up the save game asset. To view the full concept, you need to view some more videos out of this tutorial series.
    All is related to the "Options Menu" for this example.