Here’s a bit of insight into the networking part of our game. We didn’t want to reinvent the bicycle, so to speak, when it came to an optimal networking solution for Football Story. To save time and a lot of headaches, we went with a great ready-to-use system that was also conveniently compatible with Unity3D.
We identified some major requirements for the network before deciding anything:
- Maintaining a fluid, synchronous connection
- Excellent 6v6 (12 player) support
- Immediate reactions to changes in physics (the ball, etc)
- Comfortable and smooth gameplay over longer distances (e.g. EU vs USA matches)
- Crossplay between platforms
- High scalability and maintainability to allow for fast code changes/updates
After doing some research on various network engines, we decided to use the Photon suite of products from Exit Games. Their products were already compatible with Unity, they had dedicated servers in numerous countries around the world, and their support for rapid prototype development and testing was excellent. Our initial prototype consisted of 12 players and a physics-based ball.
The prototype was built on the foundation that PUN (Photon Unity Network) laid out for us. It was very convenient, as it did not require deep networking knowledge, solved the floating point issue, and already included network optimization algorithms and support for implementing our own down the line. As a result of this, PUN proved to be the prime candidate for our network architecture. Playing on an EU server, the ping hovered around 60, while connecting to the USA caused it to rise to around 130. It wasn’t as smooth as we’d prefer, but it was tolerable at the time. The big issue with the latency was how it affected the physics of the ball. It felt a bit off. Once we discovered this, we began looking into a technology called TrueSync (no longer available) because of how it handles physics.
TrueSync works alongside PUN and is a bit more proficient at working with physics, using its own special components and a lockstep mechanism. Testing proved fruitful, as the ball movement issue was solved, but we ran into other issues. The biggest of which was the player limit. For a game without lag, we were limited to a maximum of 4 players. That’s when we started looking at Photon Bolt.
Photon Bolt was quite a unique tool to work with, as it allows you to implement a networked game almost without touching a line of code. It mostly just uses a GUI. It also comes with its own optimizations and gave us access to the Photon Cloud, but it unfortunately has the same disadvantages as our initial PUN testing. Therefore, we chose TrueSync over Bolt.
We shifted all of our development into TrueSync, which included writing to the Photon developers asking for help with the shortcomings of the system. They replied quite quickly, giving us more info about their products and agreed that TrueSync was best suited for real-time physics in sports games. After explaining our problem with TrueSync, the developers were kind enough to present us with an upgraded, in-development build of TrueSync 2.0. However, they also mentioned that we should take a look at their future platform, Quantum.
Quantum seemed too large and too new for us to consider at the time, so we stuck to building another prototype using TrueSync 2.0. It provided us with a smoother experience (no laggy behavior) during testing and allowed us to up the player count to 8 (4v4), but that was still not enough. Once Exit Games dropped support for TrueSync 2.0, we decided to move everything over to Quantum, which also promised to handle physics well across RPGs, sports games, fighting games, and so on.
Quantum has proven itself to be a powerful, high-performance deterministic ECS tool (Entity Component System, the latest and greatest thing in optimization). It implements modern modeling, forecasting, and rollback APIs without lockstep based on existing Photon products. Before we made the big transition, we received an introductory course from the developers, as a result of the software being quite new and lacking documentation. Once we were more comfortable with how it worked, we started work on what would be our best prototype yet.
Photon Quantum - Europe Server, Player connected from Russia. Ping 70
Photon Quantum - US Server, Player connected from Russia. Ping 140
As seen above no lags on Europe and on US servers, despite different latencies
Once the prototype was up and running, we ran an initial 6v6 test on an American server, connecting players from the US, Russia, and Europe together, followed by a European server test. The results were very promising! All players had almost no issues with the network and latency. Everything worked well, from the ball physics to movement. Players from Russia played quite comfortably on the US server, even with ~130 ping. This showed us that latency doesn’t hinder Quantum much. It does a great job of handling that aspect. Even better, US and Russian players both had around 60 ping to European servers, offering smooth and enjoyable matches.
We are very happy with how the networking aspect of the game is working now. It was quite a ride testing out all of these different solutions, but we’ve finally settled on a great one. You have to experience it for yourself. Thanks for reading! Be sure to catch up with us again soon for another update on the game.