Integrating Photon Multiplayer while using UE4 Netcode

Hi, so currently our team are looking at integrating Photon into our Unreal game for cross platform play. Our biggest worry right now is that since we have already developed plenty of Netcode that is offered by Unreal, we don't really want to have to be forced into using Photon's version of multiplaye netcode into our game.

We are looking to integrate Photon Realtime and Photon Chat into our game. Would it be possible to integrate them for cross platform play without the need to modify our networking code and still use Unreal's version?

Comments

  • Hi @mantracker.


    looking at integrating Photon into our Unreal game for cross platform play

    I am not sure about what usage scenario you have in mind
    You say that you want to use Photon for cross-platform play in Unreal. Does that mean cross-platform between platforms that all run UE or rather between UE and non-UE clients?
    If it is the former, then what restrictions of UE prevent you from doing it with UEs built-in networking? Are there platforms, which are supported by Unreal, but not by Unreals networking features?
    If it is the latter, then I don't see how continuing to use existing UE network code would offer any benefit, as there is no way in which you could use it to communicate with non-UE applications (except for ripping the UE netcode from Unreals source and porting it over to non-UE platforms, which might be a lot of work). If you would use UEs networking to communicate with some clients, but something else, like for example Photon, to communicate with other clients, you would end up in having to write and maintain all the related code twice.
    So it would make more sense to just port the existing code to Photon and use the Photon code for all network communication, even there where you could also use UEs networking. That way, you would only need to maintain and enhance one networking codebase. Initially porting the code would have to be done in both cases anyway.

    Maybe I just don't understand you use case yet. So which part of networking would you like to continue to use UE for and which part you would want to use Photon for?

  • I am not sure about what usage scenario you have in mind

    Sorry I didn't quite explain our usage scenario clearly. All our clients will be launching our UE4 game through an executable we package. However, they might all be using different platforms. We can have Steam users using Steam, Oculus users using Oculus, and perhaps PlayStation users using PSN. However, everybody will be using UE.

    It sounds like we can continue to using UE Netcode. The only thing is I was reading a lot of people talking about using Photon Netcode when they were integrating Photon Realtime. Were people who were using Photon Netcode only doing so because their game engine didn't provide Netcode? Or was it because people were connecting between different clients?
  • Hi @mantracker.

    I have listed typical reasons for using Photon with an UE4 game at:
    https://forums.unrealengine.com/development-discussion/content-creation/22518-photon-unreal-networking.
    https://www.photonengine.com/en-US/Realtime also provides an overview of key features.


    The only thing is I was reading a lot of people talking about using Photon Netcode when they were integrating Photon Realtime. Were people who were using Photon Netcode only doing so because their game engine didn't provide Netcode? Or was it because people were connecting between different clients?

    Well, you simply can't use Photon without using Photon. If you want your app to communicate with a self-hosted Photon server or with Photon Cloud, then you must do so by using a Photon Client.

    All Photon Cloud features can only be used through Photon Clients.
  • Hey @Kaiserludi

    I notcied that in the UE4 post you linked, you said this:

    Theoretically you could use both in parallel, but that doesn't make much sense in practice. So normally you would use Photon instead of UE4s built-in networking system.

    That is exactly what I am afraid of. Because for our game, we have already extensively used UE4 built-in networking system and do not want to switch to Photon's version.

    Also, I've been checking out the PhotonDemoParticle project for Unreal. I noticed that for networking in the demo, the demo is using Photon RPCs. Is it possible to implement those using UE4 built networking instead?

  • On a closer look, it seems like it is possible to use Photon networking for matchmaking and Unreal networking for in game networking. I don't think that is being demoed in PhotonDemoParticle. Are there any examples that shows this?
  • Kaiserludi
    Kaiserludi admin
    edited November 2017
    Hi @mantracker.


    I noticed that for networking in the demo, the demo is using Photon RPCs.

    No, it isn't!
    There is nothing like Photon RPCs. What you are referring to are PUN RPCs. Those are a concept of PUN (Photon Unity Networking) and closely coupled with the functionalities of the Unity Engine. For this reason they are not available in other Photon Clients than PUN.
    The demo uses opRaiseEvent() to send messages to other clients.


    Is it possible to implement those using UE4 built networking instead?

    No, it's neither possible to make PUN RPCs nor to make Photons opRaiseEvent() use UE4s networking.

    I still don't understand what you want to achieve and I think that you have a major misconception about Photon or maybe even about networking code in general.
    It's simply not technically possible to use UE4s networking functionalities to communicate with Photon Cloud or with a Photon server.
    Maybe it helps if you have a phone call with us to explain things. Feel free to contact us about setting up a call by email to [email protected]


    On a closer look, it seems like it is possible to use Photon networking for matchmaking and Unreal networking for in game networking. I don't think that is being demoed in PhotonDemoParticle. Are there any examples that shows this?

    No. We don't have any examples available to show this.
    However this is quite simple. Just let every client connect to Photon Cloud and let it either join a room that matches the specified requirements by a call to opJoinRandomRoom() or let it create a room if no matching room exists. When enough players have arrived inside a room to start playing, just make one of them the host and let it sends its IP to the other Clients inside that room via opRaiseEvent(), then let all clients connect to that IP with UEs networking and send actual ingame data with that.
  • Hey @Kaiserludi

    Thanks for your detailed explanation. I am starting to understand how Photon is going to work with UE4.

    One final question though, what does Photon offer in terms of cross platform voice chat? I don't think Photon Chat is used for Voice chat, and it seems Photon Voice is only available for Unity. Are there any solutions for Unreal?
  • Kaiserludi
    Kaiserludi admin
    edited November 2017
    Hi @mantracker.

    Yes, you are right, Photon Chat is used for text chat, not for voice chat, and Photon Voice is currently only available for Unity.

    We are working on a C++ port of Photon Voice that can be used with Unreal Engine 4, but this is a relatively low priority project in quite an early state of development for us right now and we don't have any idea yet, when this will become available to customers.

    If you are seriously interested in Photon Voice support for Unreal Engine, then please email us at [email protected] and ask for it. Also please mention it in your email, if you should be a somewhat bigger or well-known studio.

    The more requests we receive by email about Photon Voice support for Unreal, the more likely it is that we raise its priority.