local and online Multiplayer in same project
i am working on a coop game and i have set it up as a local multiplayer. The next step for me is creating an online multiplayer by keeping the local multiplayer. I haven´t found fitting documentation for this question. If you guys have a hint how to turn a local mutliplayer into a online multiplayer (by keeping the local), it would be nice if you can give me a link or an explanation. (Yeah i read the unreal documentation to onliine/local multiplayer)
Thanks for the help, Chris
asked Oct 28 '18 at 07:11 PM in Using UE4
I have accomplished multiple players on one machine playing against multiple players on another machine in a local area network. Not exactly online but should work similarly.
Going in you should know a few things: Player controllers only exist on their own client machines and not on the others, except the server. The server has all of them.
Player controller ids are always -1 for remote controllers whether viewed from the server or the client. But have numbers 0,1,2,etc for local controllers.
all player States are replicated to all machines. Player controllers are not.
player States dont exist at level start or even player creation but wait until after one or two replication cycles to start existing.
The only base class that comes with smooth network movement is firstpersoncharacter and firstpersoncharacter. Replicating any other pawn class movement results in choppiness which can only be overcome by creating your own smoothing and prediction code.
RPCs require an owning connection. Without it they may execute but not actually work. Client to server RPCs usually work when done via playercontroller which owns connection. Multicast RPCs usually work when done in GameState class. These can work in other classes but when they don't then I move them to these and then they work.
Expanding to networked multiplayer you may need to move some logic from your pawn and controller to the player state, and some of the logic from your game mode to game state.
Remember that game mode only exists of server.
Game instance does not replicate over network so it can be used to preserve local machine's variables between levels.
answered Oct 28 '18 at 07:40 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here