Syncing new clients with on-going client-sided effects

I want to make it so when a player joins the game, all the on-going client-sided effects (and scripts) are started for them. All the methods of client-replication I’ve managed to find don’t solve this issue.

An example: a player has a magic forcefield around them summoned by holding a key. The forcefield is only seen on the client-side as it is an effect while the rest of the forcefield’s mechanics (e.g. granting immunity, deflecting shots, etc.) is server-side. If another player joins while this forcefield is up, they won’t see any of the visual effects but, if they try to attack, they will be met with the forcefield blocking their attack.

The only solution I’ve found is to summon the effects on the server first, then when the client receives the message to replicate the effects it deletes the server copy on the client. This would solve the issue of having to make any new players create the effects, but if they joined during a fight, for example, there’d be a large number of server-sided effects for them to load. Also, to me this doesn’t work as the effect will actually remain on the server and weigh it down?

If anyone has any ideas of how to go about this, I’d appreciate it.

Have you figured out a solution? I’m having the same problem myself.

I mean the best I can think of is storing all ongoing moves/client sided events in a table on the server and have any new players loop through that and run everything. The problem is that it’ll start the events from the beginning so any animations and effects will be off. So idk what to do

Actually I think in the server table you can store every player and what move/skill each player is using and when they started using it. Then when a new player joins they cycle through everything and receive the info on what move and when it started. Then in the actual move, to sync animations and particles effects and whatnot, you can set the animation track time to the difference between when the move originally started and the current tick(). For stuff like particles I guess you can say

--pass args and it can have a property of time only if it is coming from this table
if args.time then
    if tick - args.time > particleTime then --[[particleTime is just how long it takes for particles
to spawn but it can also be an animation event for more precise timing]]
        particles:Emit()
    end
end

Ideally, you’d have all your visual effects work on a timeline that allows them to be started, skipped, or paused like a video. Unfortunately this is generally not worth the time to develop (most big games don’t do this). The thing is, if you already have a loading/start screen that plays when you enter the game, most visual effects will already be over by the time the player loads in, and longer ones can be split into multiple events.

1 Like

Do it on the server

fsdhfsigbsrffhb

Yeah that’s smart, but, as you said, maybe not worth the effort. Splitting into multiple events might work with animation events too. If the action has an animation, just set the animation time and it will automatically skip over the events not played

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.