Announcement

Collapse
No announcement yet.

More than 4 players local multiplayer

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

    More than 4 players local multiplayer

    Hi,

    I have been trying to get 8 players local multiplayer working using xbox one wireless/wired controllers and so far, not succeeding.

    I have 8 official microsoft controllers, all running off the official microsoft wireless receiver which supports 8 controllers. I use this set up a lot when playing other party games like Gang Beasts, Knight Squad, so there is no issue in connectivity with the computer, or usability.

    I have found a few times, this same question has been asked, or similar question has been asked, but no solution given, actually works, or at least I must be doing things wrong, which is a likely possibility.

    So far I have tried this solution which I got from here, however the person who created the solution doesn't appear to have tested with more than 4 controllers. It creates more pawns, and removes the restriction on the 4 player cap, but at the same time, doesn't allow more than 4 controllers to work with pawns.
    https://answers.unrealengine.com/que...can-you-1.html

    1. Create new thirdpersontemplate blueprint project called MYLOCALGAME.
    2. Once project loaded, create C++ class based on GameInstance called MyGameInstance and close down the editor.
    3. Copied the code from the first snippet you provided and placed that inside the header file.
    4. Copied the code from 2nd snippet and placed that into the cpp file.
    5. Rebuild in Visual studio 2017. No errors. Close VS2017 and open the project via launcher.
    6. In engine settings, change default game instance to MyGameInstance.
    7. Create new game mode called MyGameMode.
    8. On event BeginPlay , do exactly as your blueprint snippet does.
    9. Set level game mode to MyGameMode.
    10. Add 8 spawn point locations (I don't think this matters much), and test. Only 4 pawns are controllable.
    11. Add extra code to game mode which adds force feedback/rumble to every controller detected. Only 4 are detected.
    12. Disable one or 2 of the working controllers and test. The engine delegates control to another of the connected controller that weren't working to begin with.

    I have also tried a solution below on that same answerhub page, suggested by eXi and shadowriver, which was to create a C++ class that derived from GameViewportClient and within the constructor, set the MaxSplitscreenPlayers to whatever I want (8 in my case).
    This solution did not work.
    I went to this forum thread below to go more in depth, but this did nothing either, and nobody provided any proof of it working, which means i'm unsure if it's something wrong on my end, or something wrong with the engine.
    https://forums.unrealengine.com/comm...over-4-players

    Has anybody gotten more than 4 players to work on the same screen, with shared camera or split screen? If so, what steps did you take?

    I think that having 8 players, or even 6 players in a local multiplayer game is a big feature that people definitely appreciate in party games. So I am determined to get it working.

    Thank you in advance, any help or suggestions will be greatly appreciated
    Developer of the party game "Metal Heads".
    www.metalheadsgame.com
    Follow on Twitter @MetalHeadsGame
    Follow on Facebook www.facebook.com/MetalHeadsGame.

    #2
    So I found that all controllers are being created as expected, so I create a custom PlayerController blueprint that overrides the A button to output a message to see if any of the controllers work.
    As expected, only the 4 that are controlling pawns actually work.

    Another discovery was that when I turn on "Skip assigning gamepad to player 1", I can control 5 pawns, the first can only be controlled via keyboard as expected...but no more than 5 can be controlled. Also if I turn split screen on, the keyboard player doesn't get his own section of the screen.

    I am trying to figure out what c++ class handles physical gamepad controllers...I figure it's the PlayerController class, but I'm probably wrong.
    Developer of the party game "Metal Heads".
    www.metalheadsgame.com
    Follow on Twitter @MetalHeadsGame
    Follow on Facebook www.facebook.com/MetalHeadsGame.

    Comment


      #3
      In Engine\Source\Runtime\ApplicationCore\Private\Windows\XInputInterface.h is this line:

      Code:
      /** Max number of controllers. */
      #define MAX_NUM_XINPUT_CONTROLLERS 4
      Try changing that to 8.

      Comment


        #4
        Hi GBX_botman, I tried to change this earlier today to no avail. Have you had success in changing that line?

        There was also a XInput.h found in the engine's external dependencies, which has the following line:

        Code:
        #define XUSER_MAX_COUNT                 4
        The Xinput.h file cannot be altered, at least not without saving a copy of the header somewhere else, then finding all references to it in the source code, and replacing the references with the new copy somehow.
        Developer of the party game "Metal Heads".
        www.metalheadsgame.com
        Follow on Twitter @MetalHeadsGame
        Follow on Facebook www.facebook.com/MetalHeadsGame.

        Comment


          #5
          Just to make sure - any changes to engine source requires you to rebuild the engine.
          https://www.casualdistractiongames.com

          Comment


            #6
            XInput supports a maximum of 4 controllers at a time (Xbox's could only support four, and it's carried over to the Windows version).

            DirectInput supports many more:
            https://en.wikipedia.org/wiki/Direct...nput_vs_XInput

            Comment


              #7
              Thankyou so much for your answer TheJamsh, that gives me a lot more clarity on the situation, and saves me from wasting even more time trying to get more than 4 players with just the default engine.
              I remember reading about it briefly, and seeing plugins, and remembered that Gang Beasts needed Xinput to be disabled or something in it's options in order for it to support 8 players. (I know it's a unity engine game, but the same principle applies).

              Does UE4 have any directInput support? Or must I use plugins such as:
              https://www.unrealengine.com/marketplace/controlysis

              Perhaps I'll have to look into implementing directInput at a later date, as I don't think my skill level in programming would be suitable to writing my own DirectInput implementation unless there is some thorough documentation somewhere to make the implementation easier.

              Once again, thank you TheJamsh
              You've saved me a lot of time, and it is greatly appreciated.
              Developer of the party game "Metal Heads".
              www.metalheadsgame.com
              Follow on Twitter @MetalHeadsGame
              Follow on Facebook www.facebook.com/MetalHeadsGame.

              Comment


                #8
                No worries. I'm not sure on the solution to be honest, I did have a very hacky wrapper for controllers sometime ago but I've since lost it.

                Controlysis might be overkill for what you want but in all honesty I'm not sure as I haven't used it. You can write custom input wrappers though to pass input to UE4. Have a look at IInputDevice, there are a few classes that use that as a starting point!

                Comment


                  #9
                  1. Check your "output log" not your "Message Log", it will give you more info of your error, like:
                    LogPlayerManagement: Error: Failed to Create Player: Maximum number of players (4) already created. Unable to create more.
                  2. To increase the limit, you need to change the "DefaultEngine.ini"
                    Code:
                    [/Script/Engine.GameViewportClient]
                    	         MaxSplitscreenPlayers=10
                  3. As mentioned here, this is an XInput Limitation, and it's limited to 4 controllers. While it will work, it will not let you use more than 4 controllers. To fix that, you might want to explore looking into the RawInput plugin (built into Unreal)

                  Tested with 4.26
                  Last edited by Atiq.R; 11-18-2020, 03:12 PM.

                  Comment


                    #10
                    Could not imagine 8 players on 1 screen. Players view would be so tiny. <Almost makes it not worth trying it.

                    Comment

                    Working...
                    X