I was wondering about something that is not exposed to blueprints so here it is!
My Fighting Game is right now local multiplayer. 2 Pawns are controller via one controller, by means of smexy blueprint-coding. It is working nice. Though I have one problem. Not everyone creates a PC game to play with his friends on one keyboard. That is old school and some people may have two gamepads to enjoy the game better etc! So here are my questions!
Is there any coding in engine that it recognises the plugged in gamepads into the computer/PS4/Xbox etc? Well the answer should be facepalmingly yes as that’s how it works, right? REAL question is, is it reachable for us? Or is it DONT TOUCH IT OMG no matter what we do?
Is that “Check for Plugged in Gamepads” is something that happens once, or it is checked constantly? Like, if I plug in a second gamepad in the middle of the game, would the second player be able to control the pawn it supposed to control?
Lastly, is it possible to expose the amount of current plugged in Gamepads/Keyboard to blueprints? Please NOTE that I am not asking how I can do it, rather that if it’s possible or not.
We actually did this for Eclipse(which was originally on one controller, but we split it to two).
I’ll have to dig out the project to remember how the hell we did it again… Although I have a sneaking suspicion we actually did just program it multiplayer-ready, and turned off split-screen mode to force both players to use the one camera.
EDIT: Yeah that’s how we did it. It was a rude hax since we made it in a games jam so it was a ‘whatever works’ approach. I think we also had to add a console command ‘DebugCreatePlayer 1’ to actually spawn the second player.
Thank you for your response Mr. The Jamsh. Though what I need might be something I need to explain better.
You see, When I create two players it all works. One is controllerd by Controller0 and the other one Controller1. It’s all cool and okay. Now. My system would work if you had two gamepads. Or a keyboard and a gamepad.
What I NEED is, I need to find a way to find out HOW Unreal 4 finds out there are actually TWO or more gamepads-alike. There must be a check that it is doing constantly so it says “ok I got two plugged in right now, so controller0 controls player1 and controller1 controls player2, cool”.
If there is any code inside Unreal 4, I would like to know if it is something I can reach out by any means. So that, I can make a check constantly for my game to realise that the players are using one keyboard to actually play, or they are using two gamepads to play.
PlayerControllerIterator is just a list of how many individual players there are in your game, not necessarily what device they’re using to interact with your game.
I think what the OP wants to know is if the players start with a keyboard and gamepad and then they play the game for a while and then suddenly they plug in another controller - will UE4 automatically assign the new gamepad to the keyboard player?
Thank you for responses everyone. Though Maxl understands my problem right now.
Here is the story.
My Fighting Game starts. The person who started the exe on the computer has only one keyboard. Then his friend comes and they decide to do a versus mode match. But here is the thing, the guy didnt plug in any gamepads! Unreal 4 should understand that, this guy is a regular PC owner with no plugged in gamepads, then will go local multiplayer mode. Which is having one controller, aka two guys playing with one keyboard.
My Fighting Game starts in PC yet this guy got two gamepads plugged in. (Or one + keyboard). Unreal 4 checks the plugged in gamepads/keyboard amount and says “ok this guy wants to play together but with different controllers”. So he goes on 2 gamepad 2 controller mode etc.
The guy is playing my Fighting Game. He is playing with only keyboard as player 1 in Single Player. It’s all cool and nice. Suddenly his friend comes up and wants to play together. This time owner plugs in a gamepad.Unreal 4 should go “Hmm, a gamepad just plugged in. Okay, I will let second player play with this.”
You see, I need to know if there is anyway to reach out Unreal 4’s plugged in gamepad/keyboard detection. So I can do things with it.
Again I need to say, I dont know any C++ so I will hire someone to do it with payment probably later. All I need to know is that if I can reach that part of Unreal 4, where it puts into account the PLUGGED IN Gamepads/Keyboard.
Oh well honestly I don’t know, I know that if it’s a packaged game, you need to connect the controller first then start the game or it won’t find the controller. That was at least true in Version 4.4 as that’s the version of the engine we used for it.
There are by default 8 input channels I believe and each subsequent controller is mapped to one of them, but honestly I have no idea where that is set up.