Networking Client Sending Character Selection

I am just starting with networking in blueprints for UE4, but I have plenty of experience doing sockets coding in java, python, and websockets in javascript.

I’m so used to having to send exact messages between client and server and exact functions when those messages are received, and having completely separate code for the client and the server, that not having to do that is very much confusing me and frustrating me. I have gone through the tutorials on YouTube for networking ([here][1]), but everything is from the point of view of the server. There is never anything shown where the client does something, that information is sent to the server, and then replicated to all connected clients.

What I have so far is pretty simple.

  1. When you launch the game you are taken to an initial home screen with a menu to host, join, change settings, or quit. But I also have the character select here. When a character icon is clicked a variable in my game instance called “SelectedCharacter” with type Skeletal Mesh Reference is updated.

  1. The person who will be the server/host clicks “Host” and an execute console command to “open game_map?listen” is performed.

  2. When the character actor is created in the game_map level it makes a call to get the game instance data and update the skeletal mesh.

89708-character_change_skeletal_mesh.jpg

I know at this point this would be fine for a single-player game, but I am doing a networked game, so this will have to change. But I have so many questions that I can’t find the answers for.

  1. Should my SelectedCharacter variable in my game instance be replicated? I imagine it shouldn’t because each client is modifying it for it’s own purposes before joining the host and if it were replicated then wouldn’t it be overwritten upon joining a host?
  2. How do I keep a hash/associative array of the clients and their actors? I know there is an event in the GamePlay blueprints for OnPostLogin, but is this enough to keep track of the client and manipulate their actor? Or is this even necessary with how replication is supposed to work?
  3. How do I have the client send it’s game instance variable to the server once connected so that the server has that information? in my character blueprint event graph would I add a “Switch Has Authority” and on “Remote” call a custom event set to “executes on server”? And how do I pass the local game instance variable to this custom event?
  4. Once the custom event is called on the server to receive the client’s “SelectedCharacter” variable how do I then replication the skeletal mesh change to all the connected clients? Should I have a variable on the character instead that indicates which mesh it should be using and then use a RepNotify on it so that when the variable is changed it calls a function to change the mesh to the new mesh?

I’m pretty frustrated because I feel like this should be such a simple task, but I have spent days on it. If I had to manually send data from the client to the server or server to the client then I think I would have this done already, but this automatic replication and unspecific data source thing is killing me. And I have no idea how the server is keeping track of the data and no idea how to view the data as I run the game to see what it’s doing.

Any help would be greatly appreciated.