I am sorry, I have just seen this.
a). I totally understand how you feel about starting a whole new project!
b). I hope you didnât!
c). I eventually got it all figured out. More on that below.
d). Note on dedicated servers. I am using a marketplace plugin called âMultiplayer Server Browser - Master Server - Server Listingâ ⌠it took me probably 2-3 days to get it all set up and working, but using this I have 2 digital ocean instances (one for session listing and one for actually hosting games) and my monthly bill is ~ $15. Its a cost, but not breaking the bank. I have no idea what it will look like when I need to start scaling it. It is cool and easy to implement, and cost effective compared to some other setups. Just FYI.
Notes on this particular problem:
I canât tell you exactly how I got this solved, but I DID get it solved. Here is my setup:
Multiplayer FPS and TPS. I donât like True TPS (camera attached to 3rd person mesh head) for FPS games, it makes it feel like the character is floating around. So in my project, similar to like COD, the FPS mode has its own dedicated Arms mesh and camera setup etc. You can change between FPS and TPS anytime (PITA!).
So, that setup is complicated for replication it turns out lol! For instance, the players TPS mesh needs to be visible to all other players, all the time. But when the player changes their view from TPS to FPS, and the TPS mesh hides, it STILL needs to show for the other players but NOT for the controlling player. The way unreal handles visibility replication is confusing and complicated. Also, testing inside the editor in different modes with different amounts of players changes how your code will act. Sometimes player 1 (host) and player 2 all see everything correctly, and player 3 (client 2) doesnât. Or sometimes dedicated hosting some players see the right things some dont.
Then there are weapons. Each weapon pickup has 2 meshes, 1 for TPS and one for FPS. All of the visibility issues that are there with the character meshes are there for the weapons. etc etc.
What eventually got me through it was an immense amount of trial and error. I posted this probably a month into my struggles, and it was probably another month before I got it all sorted. Then another 2 weeks straight on weapon attachments (another PITA!). Spawning, attaching, and changing visibility for different players in different circumstances is a pain! And the way the server acts also matters. I have found that I had to use delays here and there to make sure that the server had time to spawn the item before I was trying to attach it, etc. That really helped. when I realized that sometimes my problems were not code related but they were simply not working because the server needed a quarter second to finish its task before running further logic. Then a healthy use of client, server, and multi casting! And a healthy use of âisDedicatedâ and âisServerâ and âisLocallyControlledâ etc.
Sorry this is kind of a book, but this is a BIG topic that will take a lot of your time, but it is TOTALLY worth it. I am really glad I stuck to it and pushed through. I learned a lot and I have reused some of the things I have learned in other replication issues, like flash lights. Getting the right light to show for the right scenario will make you pull your hair out!