Projectile replication dilemma

I am working on a projectile replication system, and I’m having trouble visualizing how to properly design it.

How it works right now:

A player invokes the firing of a projectile through RMB, the projectile path plays out for the client who invoked the projectile immediately thereafter. Before the projectile path is played out on the client a request is sent to the server, with start position and direction via remote event. The server sends a requests to all other clients with a remote event to display the projectile, then calculates the projectile path and detects any collisions.

Overview:

Obviously everything mentioned above is not time synchronized, and the system has many flaws. I am having trouble thinking of a good system for time synchronization while also maintaining proper collision detection and smooth visual effects.

Should I delay the immediate projectile visualization on the firing client, and start the visualization with the rest of the clients from the server request, or would the following be the wrong thing to do?

I am looking for suggestions from others who have covered this topic before. Help is much appreciated, thanks.

1 Like

I also completed the exact same method for a projectile function today. On the for other client replication part, I multiplied speed of the client rendered projectile by 1.5 (might not be best number), so that it appears to arrive at the target at the same time as the player who shot it. The player being shot at and the one who fired should agree as close as possible with the timing of the hit or miss.

With this I assume you mean raycast right?

@Quenty’s Nevermore Engine has a server/client synchronisation module that you could use.

Every time you’d sync the client and server you would also need to set the projectile’s location to where it should be relative to the synced time it has existed in.

@TheAmazeman Yeah, that’s the best way to do it. But if stuff is synced on the server then the server could handle hit detection.

2 Likes

If I have a delay(timeBeforeHit)

and calculate timeBeforeHit as (target pos - handle pos) magnitude / bulletSpeed then the server could be synced up.

1 Like

Yeah, stuff like that

You can use this project physics to just replicate the start event of the projectile, and the calculate locations. It’s what I do.

4 Likes

Yes, a raycast ballistic arc.

Interesting system, although I am still interested in seeing someone give a basic overview of a system layout. So I can better understand / visualize the process of proper projectile replication.