Managing Local multiplayer and Online Multiplayer

Options
Hello All,

For a project I'm working on, which already has local (offline) multiplayer, I need to implement networking functionality. For this I'm using PUN. The networking part is not the problem here. After starting to work with the networking I found it difficult as to how to balance my scripts to work for both online and offline. For example, the player instantiation would work differently, but we would have the same basic player components.

I am not sure what would be a good way to keep the networking functionality in my scripts separate from the normal functionality as much as possible. I imagine that I would have to add checks in some scripts like:
photonView.IsMine
Which is not really ideal in my situation.

I was wondering if anyone here has any experience on this subject, or some best practices type of advice.

Thanks!

Comments

  • L3sc
    L3sc
    edited May 2020
    Options
    Hi,
    Basically seperate network related scripts. You could check on start PhotonNetwork.IsConnected. If it is then enable your networked scripts. Other ways you can keep them disabled. If you want to reach network scripts somewhere still you can check if that client connected photon. Btw I never tried before mix online and offline together. I wrote to give you an idea.