Combat system Client to Server communication delay

I’ve been working on making a combat system but I’ve encountered a fatal problem, Client → Server Delay.

This is how my system is managed:

There’s a folder inside the character called “Status” everytime the player does something a status will be made for that action for instance the player blocked a new BoolValue will be created and placed inside tha folder so when the client/server checks if the player is blocking it just checks if a value called “Blocking” exists (I’m using this method as there will be alot of new stuff and I can’t just pre make them when the player joins) since I’m constantly creating values Client to Server Communications will be delayed no matter how much I try.

I’m trying to find a new way to go about this combat system any other methods that do not involve constantly creating values.

Preview:

Gif: (in-game)

Gif: (in-studio)

But the server Client → Server delay does not happen in studio. multiple people reported this delay in-game

If anybody has a better way to manage combat systems like this please reply.
Any help is appreciated

Hmm, maybe instead of creating and removing a new value each time you block/attack/etc, you have a single permanent variable that changes its value each time you do an action.

There’s no way against this as every client (player) has their own connection to the server. This is why we use the term “ping”, the amount of miliseconds it takes to get a reaction from client to server.

2 Likes

@KJry_s is correct. Note that it’s most common for games to play any “feedback effects” despite it not registering in the actual server. Something to do with covering up the “delay”.

For example, in FPS games, it is very good practice to shoot from both the client and in the server. They both wont always sync up because of lag, but they both handle 2 different hit registrations. The client hit registration does the blood spilling, hitmarkers, etc. despite what the server actually hit. Because of this, it eliminates having to wait for the server for each bullet registration but at a cost of “ghost registration.”

I’m saying all of this because there might be a way for you to blanket these time differential with client feedbacks.

Ultimately, there’s nothing you can do to combat this.

3 Likes

Hey, odd question but does this sound normal to you:

Client shoots projectile and does all its visuals and also replicates to server

Server receives data and creates its own projectile (Just a hitbox no visuals and invisible)

Server fires all other clients to make a projectile and they do so and do their own visuals

Other client may hit players or walls and do the visuals that corresponds with those (aka blood, wall effects), but on the actual client who shot it may be a completely different person that it hits and the server may or may not acknowledge it depending on what the server hits.

Does that sound normal or am I just thinking too deep into it?

Sounds like a normal approach, yeah.

1 Like

I guess this is the problem of latency which happens during the communication of client to server and depends on many factors. Many modern games uses client side prediction to counter this but idk if this exists in roblox too