I have a game with 2 main places: Lobby and Round.
They both have building plot. But:
Lobby: Plot is local, exists on client only, but actions should be performed on server and replicated back. The lobby plot is placed at the same spot for everyone and not replicated between 2 diffirent players.
(And all 16 player’s plots are placed here)
Round: Plot is on server, actions performed on server. Each plot is placed individually.
(Assume that all 6 plots here are just from noob players, they can be diffirent)
The problem I face is that I have almost identical systems, yet which have major diffirence in such replication. It’s really big barrier for using single module script for both. (I mean I can’t just use 1 same module script to handle both places without any modifications)
Just for example:
Smelter - thing which can accept ores and fuel. They are storen inside internally, with script values, like self.Fuel
, self.MeltingOres
, self.Melted
. Also it can output physical object - ingot, which later can be picked up.
On Round everything is simple - ores and fuel added from server values, and server outputs ingot.
But Lobby must use diffirent approach. Ores and fuel will be still hosted on server, because they are internal script values, but ingot is physical object - it must be created on client, because it will glitch otherwise - non-existant smelter for server, while ingot is serversided, and some other issues, which I won’t describe cuz too many.
So, I came into conclusion that I need somehow separate 2 systems, or at least try to branch them. Like if IsServer then Load123, else Load 245 end
But this system is really hard to maintain, so, maybe there’s any better approach possible?