Fellow scripters of roblox, i'm having a troublesome logical problem.
Here's the thing :
BASICALLY, to recap the story a bit, I have a game, called Ostfront 1941-1945 that is very laggy when the player shoots. It's normal, simply because I send the instruction to the server to make the bullet and then the server process it itself, so there's this player to server latency which makes the game mostly unplayable for people with bad computer/internet and even in close quarter you have to lead the shots about 1 meter in front of your target if you want to hit it because of the time it takes to the server to recieve the instruction.(I forgot to mention that there is bullet travel time)
So now, it's time to change the way the shots works. And I had 2 ideas to make this happen and play like a normal FPS so here are they :
I can either simulate a shot locally and when the local shot hit a target, it send the instruction to server that the target is killed and it kill the target. And when I shot locally, it also send a sort of "fake shot" in the server so that players can see your shot. HOWEVER, the problem with this is : Some player might see them die while they were just standing behind a building and someone shot them like 1 second before. Also, the guy that shot will have the particle effets and sound simulated both locally and server-side to there will be this kind of duplication.
or I can simulate a shot locally just like I said, but then send the instruction to the server about a shot, then the server send to each players (but the shotter) a sort of fake shot. HOWEVER, the problem is that peoples will not have the same bullet speed depending on the computer, so yeah I could just base it off the time it took for the computer to calculate a frame so this would fix the problem, but the other main issue is about the same as above : some player would see them dying because someone shot them 1 second earlier and has a bad connection so the shot is sent too late server-side.
So please, guys, this is really an important matter. I'd also like to know how real FPS works to make all this working, like Phantom Forces for instance.
(And by the way: My game has 2M visits almost with around 30 players always online so it's not like i'm a noob or anything, this is just a problem that i'd like to solve the best way so i would never have to touch again.)
Forgot to mention some things:
-The shots are raycasts -In the second theory when I say "then the server send to each players (but the shotter) a sort of fake shot." It's a shot that all player will simulate localy -In the second theory, "some player would see them dying because someone shot them 1 second earlier and has a bad connection" It's even worse than that because there will be the latency of sending to the server then the server sending to clients so it basically double the time -I'm french so sorry for the mistakes here and there. -I'm not bragging about being a great developper, someone said that on the forums so sorry if it sounded like. I just need help -Thanks in advance !

1 comment
Um, maybe make it shorter? The length makes me leave this question...