Hello. I’m creating multiplayer football game with unity. I have already finished basic gameplay, you can see it here:
I have a big problem with the multiplayer implementation. I tried PUN2, but from what I understand, in order to synchronize the ball physics there I have to transfer the ball owner of the ball between players, which prevents smooth gameplay. In general, I can’t let two players influence the ball at the same time.
In summary, I need a physics synchronization (so that players can influence objects at the same time), animation synchronization, position and rotation synchronization. All this in some compromise and acceptable lag, so that you can play and react relatively quickly, after all, it’s a sports game. Speaking of the multiplayer tool, I even include paid options, as long as they are one-time amounts and are not unbelievably large, I make the game myself and have to finance myself.
I would be very grateful for the suggestion and hints in which direction I could go with it, what multiplayer platform to use. Thanks.
This is going to be more difficult than you think.
Generally for real-time games multiplayer is very difficult.
You will need Interpolation, Prediction and Lag Compensation.
It’s old no unity3d but still relevant read this: https://developer.valvesoftware.com/wiki/Source_Multiplayer_Networking
Thanks for the post. I know it’s gonna be hard, but I think I have time, patience and motivation so there is no reason why it should go wrong. Unfortunately, I don’t know how to start, where to go, after fail with PUN2.
Also I know it’s possible to made it on unity. There is similar game already on steam made by one guy(hmm, maybe I should ask that guy…) This is the game btw https://store.steampowered.com/app/485610/Ball_3D/
In order to succeed you need client-side prediction with physics rollback.
You’re in luck, Fish-Networking FREE has this built-in. It’s the only free solution with this feature
Thanks for chiming in but you are actually linking to the older version of PUN. Please don’t use that.
PUN 2 is not a great fit for games like this, as all connections are relayed and not a single player is the authority of the simulation. It gives you a hard time synchronizing objects when each player’s physics simulation attempts to be “right” while also getting various low-frequency position updates via the network…
For a physics based games, it makes a lot of sense to put authority of the simulation into one place. Our state of the art networking solution Fusion does this. In Host/Client mode, it sends only input from the clients. The Host will send the resulting state. The tick based simulation gets corrected and your code can continue to predict the current state, based on the latest snapshot, almost seamlessly.
This feels really snappy. There are several samples for Fusion already. It can be a bit tricky to begin with but unlike PUN 2, it won’t become more and more complex towards the end of a project.
An alternative to that would be Quantum, which has a deterministic physics engine (yes, across platforms as it works with fixed point math). Using that is a slightly different approach and might be best, if you want more players to join. It’s a bit more costly and it’s own game engine, essentially. A nice benefit is that working with it feels as if you create a single player game, there is a bot framework and more. We’ve got a prototype soccer game…