I want to handle all the mobs on the local clients because with standard network replication (and set network owner) I risk a skidder ruining the mobs for everyone, and if the servers always owns control then this happens (server lags):
The problem arises though, just as with set network owner, when a player first joins, how can the server tell that client securely each mob’s position, velocity, and other data? Simulating everything on the server seems hacky and I’m worried it will lag again… the only thing I can think of is each client periodically sending the server his mob data and the server sanity checks+averages them
When the server is control, what type of logic are you running on each mob? Are you just updating position/velocity data which is replicated over? Are you simply just updating each mobs state, with the local client handling all the other logic? Does the server have actual mob instances in workspace that is being replicated over by ROBLOX Net code?
If you are running to the problem where having the server control each mob’s logic code is impacting performance, then you are going to have to find the balance between server-client authority. A permissive client structure where full mob logic is supported on the client with server simply logic-checking is what you seem to be looking for.
In my prototype which is shown in the video I was doing all the physics stepping on the server (raycasts and setting Roblox constraint forces etc)
That’s what I’m doing now, and all the mobs are created locally on each client–I don’t see a reason to use Roblox replication because I can just run the simulation locally per client at close ranges; at far ranges I will probably do hermite interpolation like Roblox
I think it’s necessary too, what kinds of sanity checks should I perform and how should I consolidate all the different clients’ states for each mob?
how are you implementing server control? The game vesteria seems to handle mobs pretty well, and I believe they use the same method (server controls position+damage, client controls visuals and effects).
Could you give us a basic example of how your doing it right now?
if server controls positioning then it lags like op shows
I want to use Roblox physics because it makes it all much more realistic and smooth, and it might even be more efficient than what I could do to reach a similar level
I raycast 3-8x per frame for each character to determine a smooth ground surface (I can try to cut down on this, but my implementation is similar to luanoid which does 32)
I want to collide with other characters because they can attack each other (and players)
I wouldn’t use that method I suggested for mobs. How I handle mobs is entirely different from how I handle normal NPCs as they need to be a lot more accurate in terms of physics, rendering, and replication.
Here’s a small breakdown of how I go about doing my hostile NPCs:
Server creates a collider
Server sets physics owner to closest player (if no player is close by or that player is handling too many NPCs at once, this NPC will go into an “inactive” state where physics isn’t calculated at all
If the NPC is over X amount of studs away from the camera, skip the above client steps and un-render the NPC
This way, physics is almost as perfect as having the model on the server, the server doesn’t stress with any NPC stuff besides basic logic, and players get a smooth locally rendered NPC on their screen.
There’s not really a noticeable performance gain when just hiding the NPC as opposed to just leaving it but hiding it allows me to stop performing calculations for it, no rays, no physics, nothing complex needed if it’s not on the screen.
There’s ways to combat mobs being frozen client sided by server checking their position every so on however I really don’t 'think it’s necessary. Either way, even if physics was left on the server to decided without forced network ownership, once a client gets close enough to the mob, they’ll own the physics anyway. Unless you force the server to constantly own mob physics (which I really don’t recommend).
I’m not an expert, I’m just talking from experience so I could be wrong in doing some methods but I’m happy to answer any questions you might have with what I know