As I mentioned a few posts ago, I've decided to use Photon Bolt to handle my multiplayer networking. Being new to it, I figured the best way to learn would be to run through their series of tutorials to quickly get a grasp of the overall workflow and logic behind the system.
To Photon's credit, the tutorials are very thorough and detailed... they were almost intimidating! Nevertheless, I diligently ran through each one, and over time I realised that implementing multiplayer through their software was nowhere near as complicated as I'd feared.
Something that I was subconsciously concerned about was the potential flood of data that my trail solution would create. Having to synchronise thousands of separate gameobjects, whose numbers would only go up over time, was a factor that I was concerned about - just how soon would I hit the data stream limit?
Going through the tutorial helped me solve this issue! Instead of spawning the walls on the server side, I could make the walls a client-side spawn - so each player's instance would handle the spawning. Then, all that would need to be synchronised would be the player positions, from which each client would run the wall-spawning script themselves.
Through testing, however, I ran into a problem - depending on when someone joins the game, walls that are spawned before they connect don't show up for them - so they might crash on someone else's screen, but not their own. It's not something I'm worried about, though. The only time this desync can happen is when someone joins in the middle of a game. The only reason this is even possible is because I've only got one scene in Unity that loads straight into a game instance. Thus, once I implement a lobby system, this will be resolved with no further input on my side.
A less easy-to-explain problem is one that happens when more than two players are in game. For some reason, the with three or more players, not everyone shows up in game. It's not a priority fix for now, but it's definitely something that needs to be addressed for the game to be playable. It might also be an issue that stems from a join-in-the-middle player, so I'll wait until I've implemented a more robust multiplayer sync/lobby system before considering it further.
Something else that I hadn't considered when I first started to implement this was the camera. Having multiple active cameras in a scene is something that I haven't had to deal with before, compounded with the fact that my camera isn't actually parented to the player that's spawned. Although I managed to implement a solution, it's not one I understand in full. As I see it, it makes the camera a singleton instance that is applied each time the scene is loaded - so it should be tied to the player that loaded the scene.
Additionally, something I haven't had the chance to test (nor do I expect to for a long while) is a non-LAN connection - comparing the ping over the internet compared to on a local network. Hopefully that's something I can look at down the line.
コメント