#Issue with synchronization PUN2
1 messages · Page 1 of 1 (latest)
Ok i have an idea how to fix this but idk how to implement this: I want all bullets from local player be the same position on other clients ( at least for maybe 0.5s after shooting ). How do do that? Is that even possible?
Looking through your video, it seems your having rotation or scaling issues on the player itself, there are frames where both clients have completely opposite directions/scale and positions on the same player/client (13 seconds for example, you can play your video back at half the speed to catch it easier), maybe that is the source of your issue
In general, projectiles and bullets (AFAIK) could either be sent as a RPC or RaiseEvent, passing relevant info like the position and rotation, or synced with custom serialization or using a Transform View (both have some expense to it in terms of network traffic) - if your projectiles always move at the same speed/arc, then a RPC/RaiseEvent will likely be more efficient, since youd only need to sned it when the player actually "shoots" or whenever the projectile is meant to be created or pulled from your pool
Though I think there are other issues with your player/syncing logic you may want to make sure is correct first before looking at your bullets, as it may solve itself as a result of solving the other issues
ok thank you
I tried doing that and sadly I still get the same issue :c
Here is how I shoot these bullets:
what did I do wrong
The logic seems fine to me in terms of execution, though you should probably be using PhotonNetwork.Instantiate to make sure your bullets are spawned once on the network, you could even pool them so you dont have to constantly spawn and destroy: https://doc.photonengine.com/en-us/pun/current/gameplay/instantiation/
Though if your having the same issue, are you sure that your movement, rotation and scale are synced properly? Since you are instantiating from their Transform information, if that is out of sync, I would imagine your bullets would be too
Photon Unity Networking framework for realtime multiplayer games and applications with no punchthrough issues. Export to all Unity supported platforms, no matter what Unity license you have!
The player rotation is based on cursor position, and if the cursor moves fast, other clients can't synchronize it 1:1 and are making these weird effects. it can stay, but is this possible that it is the issue?
It sounds like it could be
oh...
then i have a problem
but is there a way to tell other clients to spawn bullet not based on the player they see on screen position but on position that shooting player sees? ( sorry for bad english )
i think that would fix everything
You could call PhotonNetwork.Instantiate once on the local client, the link above should help with that, though while that might fix this one problem, I feel the syncing may lead to other problems later (or also be the cause of other problems), I would suggest looking into IPunObservable or "lag compensation" for that: https://doc.photonengine.com/en-us/pun/v2/gameplay/lagcompensation
Photon Unity Networking framework for realtime multiplayer games and applications with no punchthrough issues. Export to all Unity supported platforms, no matter what Unity license you have!
ok ill try that, thanks
Also, Photon does have a Discord which may help for the future as well, albeit not always the most active, there may be others there (as well as the staff) with far more insight than myself: https://www.photonengine.com/en-US/contact
Global cross platform multiplayer game backend as a service (SaaS, Cloud) for synchronous and asynchronous games and applications. SDKs are available for android, iOS, .NET., Mac OS, Unity 3D, Windows, Unreal Engine, HTML5 and others.