For a demonstration I will be making a simple title screen and character select screen going back to the days of 4 player simultaneous arcade games.
The 4 gamepads are working. The game will be using the credits system with each player storing their credits in an integer in the game instance. I want it so that on the first controller select button is credits (left special) and start button is like 1 player key (right special). And each following controller is the same. etc etc.
Now honestly, what do I need to do all this? Up to this point I have only used 1 controller. Can someone break this down for me? Any links to videos or tutorials or explanations of this multi controller concept are appreciated thanks.
So you plug in up to 4 gamepads to the pc, and Windows assigns them in the order you plugged them. When UE starts I briefly see "Device 0 connected, Device 01 connected etc etc. But how does Unreal connect this or associate this with what character? Any help is appreciated thanks!
To create a multiplayer game with multiple gamepads, you will need to set up the game to recognize and handle input from all four gamepads. This will involve creating input actions for each gamepad and mapping the appropriate buttons and controls to each input action.
Here are the general steps you can follow to set up multiplayer gamepad input:
Create a new input action for each gamepad. You can do this by going to the “Input” tab in the Blueprint Editor and right-clicking to create a new input action.
Map the appropriate buttons and controls to each input action. For example, you might map the “A” button on the first gamepad to the “credits” input action, the “B” button on the first gamepad to the “start” input action, and so on.
Create a new function in your game mode that will handle the input from all four gamepads. This function should take in the input from each gamepad as a parameter and use that input to control the game state.
Call the new function from each gamepad’s input action. For example, you might call the function “HandleGamepadInput” from the “credits” input action on the first gamepad, the “start” input action on the first gamepad, and so on.
Here is an example of what the code for the “HandleGamepadInput” function might look like:
void AMyGameMode::HandleGamepadInput(float Credits, float Start)
{
// Check which gamepad is sending the input
if (Credits > 0.0f)
{
// This is the first gamepad, so do something with the credits input
}
else if (Start > 0.0f)
{
// This is the first gamepad, so do something with the start input
}
else if (Credits > 0.0f)
{
// This is the second gamepad, so do something with the credits input
}
else if (Start > 0.0f)
{
// This is the second gamepad, so do something with the start input
}
else if (Credits > 0.0f)
{
// This is the third gamepad, so do something with the credits input
}
else if (Start > 0.0f)
{
// This is the third gamepad, so do something with the start input
}
else if (Credits > 0.0f)
{
// This is the fourth gamepad, so do something with the credits input
}
else if (Start > 0.0f)
{
// This is the fourth gamepad, so do something with the start input
}
}
I hope this helps! Let me know if you have any other questions.
Right now I have two gamepads hooked up. When UE 5.4 starts you can see it finds them and sets them input device 0 platform 0 and input device 1 and platform 1.
Step 3 and beyond I need you to explain it further.
Ok made a new function in the game mode. What node am I looking for here to get those inputs? If u can, please make me a simple diagram here or list all steps / nodes. Thanks again.