Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Client and server aren't synced together?

Asked by 6 years ago

Alright, I'll explain this once.

I have a custom character, I have removed the original ROBLOX character, that walks around, moves limbs and stuff, and added my own character that slides around on the ground, and shoots stuff.

I'll call the character a Tank.

The tank is moving faster (not much faster) on the client than the server. The problem is, when the client goes to shoot, on the client it looks as if the bullet is going through a pellet. Now, on the server it looks as if the client is in a totally different position than the client, since the client is going faster than the server can.

I CAN delay the client and wait for the server to catch up, but that would defeat the purpose of me going through all the work to create no input lag on the client. I am trying to make the server predict where the tank should be on the client. The problem is, I don't know how.

I have the client's ping, in seconds, but I don't know what kind of algorithm is used to predict where the position of a bodyPosition should be after a time. Any help would be appreciated, I am very stuck!

Please, ask questions, or DM me on Discord @Dalition#3531

The game link is: https://www.roblox.com/games/492336478/Diep-rblx

You'll see what I'm talking about.

2 answers

Log in to vote
3
Answered by
Avigant 2374 Moderation Voter Community Moderator
6 years ago

Doing proper server-authoritative character networking is not an easy challenge. I recommend you check out Fast-Paced Multiplayer, which goes into the details of how to implement something like this. Luanoid, Lua humanoids implemented completely in Lua, may also come in handy for this. As a further resource, Multiplayer Game Programming, Chapter 8, reviews some of the material also described in the Fast-Paced Multiplayer article.

Valve has a helpful resource on latency compensation methods they use for their games, and there was a GDC talk called "I Shot You First: Networking in Halo Reach" that may further assist you.

This is not a beginner's problem, and will likely take a competent programmer.

0
Luanoid in its current state, sadly, is currently client-authoritative. However a lot of the work (implementing humanoids in Lua) is already done for you. You don't need to use Luanoid if you don't intend on using Roblox humanoid-likes, which you seem not to, so it may not be relevant to the direct problem. Avigant 2374 — 6y
Ad
Log in to vote
0
Answered by
mattscy 3725 Moderation Voter Community Moderator
6 years ago

When it comes to BodyMovers, you can just give network ownership to the tank. This will treat the tank the same as how default characters are treated, where its movements are automatically replicated and synced with the server when edited through a LocalScript. As long as the tank is unanchored, alterations to its position/rotation through BodyMovers and such will replicate just like the character, only requiring you to control it through a LocalScript. However, doing this leaves the tank vulnerable to exploiters (in the same way that characters are), thus requiring you to add appropriate server-sided checks.

Hope this helps!

0
I thought of thise, which would be the easiest way, but network Ownership gives the client full access over the servers movement. Internal_1 344 — 6y
0
Repeated server checks on the magnitude between tank movements can counter this, but it can still be a problem. Hope you work it out. mattscy 3725 — 6y

Answer this question