Photon Networking Fast Paced Car Game

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?

http://pastie.org/private/hybpdo4hsuiaqpc71oxauq

Probably need to some how sync rotation.

you can sync the rotation in the very same way you sync the position.

I have the same “choppy” feel to the car movement, so would also like to see an answer on this one :slight_smile:

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.:hushed:

Today I will try to change rate and such. Maybe will be better, I have my own dedicated hardware on 100/100 line, I will test this too.

@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 :smile: Now they are once sent with RPC (on beginning), same with mines etc.

https://developer.valvesoftware.com/wiki/Source_Multiplayer_Networking

@Jackalus how did you solve this problem? My network cars have unexpected behaviors, shaking non-stop

1 Like