So I spawn all cars on the host, I have an object that handles all input from clients to the host.
If I open 2 different games and host with others and connect with other the input works flawlessly. I can instantly see the car moving on host when I press gas on the client for example but on client car lags a lot even in moving.
Even if I press gas on host it lags on the client, makes the gameplay HORRIBLE.
Anyone got any improvements for my interpolation code?
Yes I made this too yesterday, but then I read Photon Cloud documentations. 100ms per data send⌠100MS??? that is worst design ever, maybe works for some Civilization 5 type of game but for Car game, just no.
I hope the self hosted version letâs me tinker these settings but 100ms is just too much. Think about it, 100 ms I send I pressed Gas to server, server sends me back car moving forward after 100ms. So that is 200ms right there, it needs to be like 20ms not 200ms jesus christ.
@Jackalus : If your âgasâ is a button, then you could possibly send RPCs on keypress. To send input asap, you can call an RPC âi pressed gasâ and then call PhotonNetwork.SendOutgoingCommands(). This will almost immediately send the input on itâs way.
Keep in mind that network lag and loss will then affect your game a bit more and in a less predictable manner. In that setup you have low latency for sending input but if something gets dropped, the times will be tripled or worse.
You can gain a few milliseconds by sending input immediately but executing it ~50ms later locally. The slight delay is almost imperceptible. Best of all: If itâs constant, players will adjust their play style without noticing.
Test well and hide the lag as good as you can. Some of which canât be avoided.
Okay I will test RPC on the input, I recoded the project a lot and using my own server as âcloudâ. I read valve docs tho, they use all sort of strange interpolation, extrapolation and lag reduction techniques. these are hard to find for Unity. Simple Lerping is not enough.
Im using the same methods as Valve does, for L4D, for my game. This will not make time between player âsmallerâ as you create a buffer before you pick a package to update with.
BFgames, please explain? Also I got my game running very nicely now, I recoded almost all handling. I no longer serialize useless data or send location of item boxes on every sync Now they are once sent with RPC (on beginning), same with mines etc.