Announcement

Collapse
No announcement yet.

Player Index on MultiPlayer

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Player Index on MultiPlayer

    Hi, how does the Player Index work on MultiPlayer? I ask this because I set a variable on a Class BluePrint and I passed its value to the HUD BluePrint with a BluePrint Interface. The problem is that if I go on the MultiPlayer, this variable is set to everyone.
    Unreal Engine 4 C++ Programmer

    My projects:
    Ultimate Arena FPS

    Our Discord Server:
    Ultimate Arena FPS Discord

    #2
    Player Index is for local multiplayer only.

    If you want to keep track of players joining using blueprints, you can "listen" for them connecting in your GameState blueprint. When a new player connects to your game, they are given a player controller. If OnTick you GetAllObjectOfClass Player controller and the player controllers you get are not in your "connected players array", you can give them a unique number, and add them to the array.

    This has worked well for us so far, although we end up with one extra player controller object which we do not know where it comes from. Still, doesnt turn out to be a problem for us.

    Update: An Epic person might want to chime in on performance here, when our match starts we short circuit this tick with a branch that bails immediately. I would hope this doesnt kill performance .

    Also: This is a very round about way to do this. In C++ you can deal with connected players directly. But for blueprints this is as good a solution as we have been able to come up with.
    Last edited by joessu; 07-07-2014, 04:22 PM.

    Comment


      #3
      Originally posted by joessu View Post
      Player Index is for local multiplayer only.

      If you want to keep track of players joining using blueprints, you can "listen" for them connecting in your GameState blueprint. When a new player connects to your game, they are given a player controller. If OnTick you GetAllObjectOfClass Player controller and the player controllers you get are not in your "connected players array", you can give them a unique number, and add them to the array.

      This has worked well for us so far, although we end up with one extra player controller object which we do not know where it comes from. Still, doesnt turn out to be a problem for us.

      Update: An Epic person might want to chime in on performance here, when our match starts we short circuit this tick with a branch that bails immediately. I would hope this doesnt kill performance .

      Also: This is a very round about way to do this. In C++ you can deal with connected players directly. But for blueprints this is as good a solution as we have been able to come up with.
      Yes, but for example, how can I see which player is overlapping an actor?
      I need to get the player controller of the player who overlapped a Box, and then I need to get its HUD.

      Unreal Engine 4 C++ Programmer

      My projects:
      Ultimate Arena FPS

      Our Discord Server:
      Ultimate Arena FPS Discord

      Comment


        #4
        Originally posted by Scienziatogm View Post
        Yes, but for example, how can I see which player is overlapping an actor?
        I need to get the player controller of the player who overlapped a Box, and then I need to get its HUD.

        Shouldn't you be doing that somewhat locally if you're doing HUD related stuff with that information?

        Comment


          #5
          Originally posted by S0T0 View Post
          Shouldn't you be doing that somewhat locally if you're doing HUD related stuff with that information?
          Yes, but how? That is the class blueprint of my pickup.
          Unreal Engine 4 C++ Programmer

          My projects:
          Ultimate Arena FPS

          Our Discord Server:
          Ultimate Arena FPS Discord

          Comment


            #6
            Originally posted by joessu View Post
            Player Index is for local multiplayer only.

            If you want to keep track of players joining using blueprints, you can "listen" for them connecting in your GameState blueprint. When a new player connects to your game, they are given a player controller. If OnTick you GetAllObjectOfClass Player controller and the player controllers you get are not in your "connected players array", you can give them a unique number, and add them to the array.

            This has worked well for us so far, although we end up with one extra player controller object which we do not know where it comes from. Still, doesnt turn out to be a problem for us.

            Update: An Epic person might want to chime in on performance here, when our match starts we short circuit this tick with a branch that bails immediately. I would hope this doesnt kill performance .

            Also: This is a very round about way to do this. In C++ you can deal with connected players directly. But for blueprints this is as good a solution as we have been able to come up with.
            Sorry to interfere with this thread but would you be willing to share a picture of your blueprint for this, it will be really handy for me and my friend.

            Comment


              #7
              Originally posted by Divinitize View Post
              Sorry to interfere with this thread but would you be willing to share a picture of your blueprint for this, it will be really handy for me and my friend.
              No problem, all help is welcome. Here is the picture of the Blueprint:

              Unreal Engine 4 C++ Programmer

              My projects:
              Ultimate Arena FPS

              Our Discord Server:
              Ultimate Arena FPS Discord

              Comment


                #8
                Thanks alot, much appreciated.

                Comment


                  #9
                  Originally posted by Scienziatogm View Post
                  Yes, but how? That is the class blueprint of my pickup.
                  https://www.unrealengine.com/blog/bl...king-tutorials
                  It'll teach you all the basics to do stuff like that for that and he gives examples about how you could use that as a HUD

                  If you need help with some HUD stuff this tutorial should get you started;
                  https://www.youtube.com/watch?v=jWVUr-i5zaM

                  Comment


                    #10
                    Originally posted by Scienziatogm View Post
                    No problem, all help is welcome. Here is the picture of the Blueprint:

                    Given your BP, can't you just take "Other Actor" From the Begin Overlap Event and cast it to a player controller? Since other actor returns the actor that overlaps, you should automatically access the right one.

                    Comment


                      #11
                      Originally posted by Fuchs View Post
                      Given your BP, can't you just take "Other Actor" From the Begin Overlap Event and cast it to a player controller? Since other actor returns the actor that overlaps, you should automatically access the right one.
                      I get the message "PlayerController problem".

                      Unreal Engine 4 C++ Programmer

                      My projects:
                      Ultimate Arena FPS

                      Our Discord Server:
                      Ultimate Arena FPS Discord

                      Comment


                        #12
                        Where does the message display? Also try casting other actor to your own pawn / character class first.

                        Comment


                          #13
                          Originally posted by Fuchs View Post
                          Where does the message display? Also try casting other actor to your own pawn / character class first.
                          Unreal Engine 4 C++ Programmer

                          My projects:
                          Ultimate Arena FPS

                          Our Discord Server:
                          Ultimate Arena FPS Discord

                          Comment


                            #14
                            Alright, I'm sorry my first few answers were ********. Now that I am home I could test a little bit and found this setup to be working for me:



                            Prints a string ingame "MyPlayerController_C1", so it should be working just fine.
                            Last edited by Fuchs; 07-14-2014, 02:45 PM.

                            Comment


                              #15
                              Originally posted by Fuchs View Post
                              Alright, I'm sorry my first few answers were ********. Now that I am home I could test a little bit and found this setup to be working for me:



                              Prints a string ingame "MyPlayerController_C1", so it should be working just fine.
                              It works. Thanks!
                              Unreal Engine 4 C++ Programmer

                              My projects:
                              Ultimate Arena FPS

                              Our Discord Server:
                              Ultimate Arena FPS Discord

                              Comment

                              Working...
                              X