im just starting learning online multiplayer, i found out i need to use RPCs, this made me change my code.
it seems convenient to treat the whole game as just multiplayer, and when a player wants to play offline/singleplayer, he can just play as the server host, locally no internet connection needed.
the question is, is this a good practice? or i should make another mode as singleplayer that doesnt have create session and RPCs?
the most direct Answer is that “there is no Correct answer” and instead; these are hypothetical questions to you about your design, and it will vary based on what you want your game to be:
will this single player (character/file/save) once created ever be able to play multiplayer?
how will players connect to each other? Peer2Peer, Client-Server, shared-Ownership (Unreal does not natively support shared-Ownership)
how will the transition between Single Player and multiplayer work?
if the game is Single Player and shall never have multiplayer you will just end up complicating your design to add RPC stuff.
if the game is meant to be Client-Server (in the engine referred to as “Authoritative Server”) where the player does not actually do anything, but sends requests to the server waiting for feedback (so they player hits to swing sword, where they send the action to the server which replies with if the sword swung and what happened)
out of the box unless you set up Server-Authoritative logic you are working in effectively Peer-to-Peer mode, and if you are doing work in the Game-Mode that is by default Server-Only, and you would need some intermediary object for the client systems to get at the Game-Mode.