can we make first person or third person multiplayer games in UE4 with photon ?

Options
for Unity, there is PUN. but there is not enough documentation for UE4 .. also the demo which they provide is memory game kind of. So i got the doubt whether photon really supports Multiplayer for UE4 if we want to make pubg or fpp kind of games ?

Comments

  • Kaiserludi
    Kaiserludi admin
    edited July 2021
    Options
    Hi @phanipr7.
    also the demo which they provide is memory game kind of
    How did you get that impression? There is nothing memory-like in the UE4 demo at all.
    So i got the doubt whether photon really supports Multiplayer for UE4 if we want to make pubg or fpp kind of games ?
    Of course it does.
    PUN is built on top of Photon Realtime. C++ Client SDKs for Photon Realtime that can be used with Unreal Engine are available for all major platforms.

    So absolutely every type of game that is possible with PUN is possible with Photon in UE4 as well + additionally some types of games that are not possible with PUN are actually possible with Photon Realtime.

    PUN offers a more high level API and makes things easier and less work for you compared to Photon Realtime, but it does so by sacrifying some of the flexibility and control that you have with a lower level API like Photon Realtime.
  • phanipr7
    Options
    thanks for reply. But i am not able to understand the code because for example if we take section of match making .. it has documentation and code but i am confused where to put it in ue4 c++ files.
  • Kaiserludi
    Options
    Hi @phanipr7.
    if we take section of match making .. it has documentation and code but i am confused where to put it in ue4 c++ files
    Are you talking about this page?
    https://doc.photonengine.com/en-us/realtime/current/lobby-and-matchmaking/matchmaking-and-lobby
    Yes, unfortunately the example code there is currently only available in C#, so no, you can't just copy and paste it into your project.
    However just copy-and pasting existing code is rarely a good idea anyway. It's better to write the code yourself and use the example code as what it is: an example, not a template. This way you learn the APIs and understand what your code actually does.
    The C++ and C# Realtime Client APIs are quite similar, so you could look at the the existing C# example code as a rough example when writing your own matchmaking code that uses the C++ APIs.

    For more C++ specific example code please have a look at the demo projects inside the C++ Client SDKs. Those demos are not using Unreal, but they use the same APIs that you would use in an Unreal project, and demonstrate how to use many of the features of Photon Realtime.

    The C++ Client API reference at https://doc-api.photonengine.com/en/cpp/current/index.html can also be quite helpful to understand what certain functions and classes do.

    If you have concrete questions that you can't find the answers to in the forum, then you can always just ask here, of course.
  • phanipr7
    Options
    thank you for response... i will try as suggested
  • phanipr7
    Options
    hi, one doubt. As you said, i was able to create room, take their id's, join in them etc. But they close once i stop ue4 . How can i put 3 or 4 rooms for joining of players when they start the game. Where to set this ? in the dashboard of photon or ?
  • Kaiserludi
    Options
    Hi @phanipr7.

    Please see https://doc.photonengine.com/en-us/realtime/current/tutorials/persistence-guide/ on how to keep rooms persistent.

    Bottom line:
    Entirely empty rooms can't be persisted.
    There needs to be at least one inactive player (a player who has left the room with the flag 'willComeBack' set to true or who has disconnected without leaving the room) left in the room.
    Furthermore for the room to be persisted you need to set up the webhooks accordingly (if the room should stay available for extended periods of time) like explained in the aforementioned link and you need to supply a non-zero value in milliseconds for the player ttl and (if the room should stay in memory for some time (up to 5 minutes) before being stored on disk) the empty room ttl in the RoomOptions on room creation.