Unreal 5 Tutor: Essential Blueprints 02: Player Controller

แชร์
ฝัง
  • เผยแพร่เมื่อ 25 ส.ค. 2024
  • This video discusses the Player Controller blueprint that is used in the Unreal Engine to mediate player input, and forward instructions to whatever the player is currently controlling. It goes on to show how the developer can replace the standard Player Controller with one of their own devising, and uses a quick example that allows the player to switch which character they are controlling.
    It is part of a short playlist designed to give an introduction to blueprint classes that every Unreal Engine project uses, and which the developer can make their own versions of, giving a lot of control: • Unreal 5 Tutor: Essent...
    This playlist is part of a suite of videos designed to give entry-level teaching for Unreal Engine V. There are many videos on TH-cam about how to achieve specific things in Unreal, and the vast majority focus on a set of steps to achieve a specific aim, without really helping you understand what you are doing and why. My videos focus more on understanding what you are doing, so you can become a practitioner, not a copier. I have quite a few years experience of teaching Unreal in person with students, so think I have a good grasp on what needs explaining, and what can be confusing.
    I am happy to try to answer questions in the comments, but won't go so far as to engage with your actual projects to help you debug. Sorry. That's a service I only provide to my students.
    This channel contains videos on several subjects related to game development (some quite peripherally). These videos have been made for teaching at Northumbria University, but has been made publicly available. www.northumbri...

ความคิดเห็น • 48

  • @JoblessJoshua
    @JoblessJoshua 11 หลายเดือนก่อน +24

    Wish you could've added a tutorial on how to improve the third person template by refactoring the player controller functionality into its own blueprint

  • @Sacrentice
    @Sacrentice 7 หลายเดือนก่อน +11

    God that intro killed me

  • @TC9
    @TC9 5 หลายเดือนก่อน +1

    That intro was so clean.

  • @behrampatel4872
    @behrampatel4872 2 หลายเดือนก่อน

    superb tutorial on possessing different players

  • @Flowerpot2905
    @Flowerpot2905 หลายเดือนก่อน

    I'm watching these again 4 months later... Understanding it much better. In this video I'm still unsure of what else should go in the player controller. How do you fix the "lazy" construction in the template? Thanks again Dan.

    • @dansgamedevchannel6297
      @dansgamedevchannel6297  หลายเดือนก่อน

      Been asked this a few times now so... th-cam.com/video/FVmpg_TJ_o0/w-d-xo.html

  • @jamesonvparker
    @jamesonvparker 11 หลายเดือนก่อน +3

    Thanks. This is one of the most confusing things for me. I used a template that has a controller and it completely takes control of my project when I use it, bypassing all of my directly implemented controls on my character. This helps me understand a little bit. So I guess I need to move all my controls into that one controller.

    • @dansgamedevchannel6297
      @dansgamedevchannel6297  11 หลายเดือนก่อน +1

      There are always many different ways to do the same things in Unreal. You probably can create an effectively empty controller and keep your controls in your character that way. The intention from Epic, though, is that you are encouraged to use Player Controllers to control Characters (and other pawns). It's an added level of complexity, but it does give some great versatility. For example, in multiplayer, you can swap in an AI controller if a player's internet drops, and it makes multiplayer easier in the first place. If you had a racing game for example, your car would be your pawn, and you can have a player controller that can possess any car in the game.

  • @menso3852
    @menso3852 9 หลายเดือนก่อน +1

    Ah, so it's that kind of thing, an abstraction. Actually pretty well explained, thanks.

  • @charlesvanzee4879
    @charlesvanzee4879 8 หลายเดือนก่อน

    A nice, thorough explanation. Please keep it up!

  • @King-mj2bn
    @King-mj2bn 11 หลายเดือนก่อน +1

    Great stuff, though it definitely would've been preferably if you hadn't used the prebuilt third person character with predefined input mappings, since knowing how to create your own is absolutely essential to this topic. I'd recommend avoiding using any kind of starter assets for these tutorials since it encourages you to gloss over or emit key knowledge.

    • @dansgamedevchannel6297
      @dansgamedevchannel6297  11 หลายเดือนก่อน +1

      Really good point. The reason I do it like this is to help people get as quickly as possible to the stuff I'm covering. Also, they are aimed at relative novices (they are primarily used for my 1st year teaching) so it helps to maximise results.
      I thoroughly agree, though, that anyone getting serious about Unreal needs to master this stuff. My own projects almost always start from empty.

  • @Bad.At.Guitar
    @Bad.At.Guitar 11 หลายเดือนก่อน +1

    thank you for the videos

  • @kritterrallyaspeedracingan3201
    @kritterrallyaspeedracingan3201 ปีที่แล้ว +2

    thanks dan, good stuff but please lose the high pitch intro music, it grading, shocked me. FYI

  • @cr3ap3r1
    @cr3ap3r1 6 หลายเดือนก่อน

    I was beginning to suspect that those controls should not be in the player character blueprint. I came in here in search of some videos that would explain the essential blueprints as is seems no TH-cam creator wants to discuss them. They would rather spread bad habit coding. Thanks for these videos!

    • @dansgamedevchannel6297
      @dansgamedevchannel6297  6 หลายเดือนก่อน

      You are welcome. Epic are huge, sometimes the right hand not only doesn't know what the left is doing, but is only vaguely aware of its existence. They are moving too fast to be able to keep up with themselves, and they are a bit like the keystone cops with people falling off and having to run to keep up. Otherwise, of course, Unreal is awesome.

    • @cr3ap3r1
      @cr3ap3r1 6 หลายเดือนก่อน

      Could you make a video describing Cast To, Blueprint Interface, and Event dispatcher and appropriate usage.

    • @halfbakedproductions7887
      @halfbakedproductions7887 4 หลายเดือนก่อน

      My advice is to avoid blueprints as much as possible. It totally breaks the usual programming paradigms and simple things like passing variables between objects is just total agony.
      You shouldn't need to be casting to 300 different types or firing events just to share the player's health with the thinger. Use blueprint and the Viewport etc. to set the basics up, but try to avoid after that.

  • @FraztheWizard
    @FraztheWizard 4 หลายเดือนก่อน

    This is so helpful! Thankyou

  • @Flowerpot2905
    @Flowerpot2905 6 หลายเดือนก่อน

    Very nice - thank you!

  • @deusvult980
    @deusvult980 6 หลายเดือนก่อน

    when you change the skeletal mesh to manny, NEVER forget to change the animation as well.

  • @user-vq6ti9tp7j
    @user-vq6ti9tp7j 11 หลายเดือนก่อน +1

    unfortunately for me, all the class options under selected modes are greyed out. so I'm not bale to replace the default playercontroller with my custom player controller. Any idea why my options are greyed out?

    • @dansgamedevchannel6297
      @dansgamedevchannel6297  11 หลายเดือนก่อน +1

      Are you on the default GameMode? That's the only thing I can see that greys out the options. Try making a new GameMode (inheriting from the default one) and selecting that in maps and modes. You should then be able to change the other things. I Hope.

  • @celery8643
    @celery8643 5 หลายเดือนก่อน

    would using two separate player controllers allow two players to get input at the same time? I'm trying to do a UE5 local multiplayer game with one player using WASD and the other using the arrow keys and they control separate actors

  • @jakon134
    @jakon134 4 หลายเดือนก่อน

    So what if the blueprint i want to possess when xyz happens isnt in the Level yet ? How do you Spawn blueprint instances from code and then possess them?

    • @dansgamedevchannel6297
      @dansgamedevchannel6297  4 หลายเดือนก่อน

      This is just off the top of my head, rather than trying it, but "Spawn Actor at Location" should allow you spawn an instance of any actor blueprint, and if it's a pawn type you should then be able to possess it with the player controller.

  • @guillermofleitaspulido
    @guillermofleitaspulido 11 หลายเดือนก่อน

    Awesome example ! Thank for the video Dan , i give you thumb up and suscribe !!🙌

  • @quackcharge
    @quackcharge ปีที่แล้ว

    hey Dan, great series thank you!

  • @hjomua
    @hjomua ปีที่แล้ว +1

    Cool tutorial! Thank you for your effort for it but I'm confusing because I have no idea that how controller recognize between 'possesed pawn' and 'will be possesed pawn'. Each of Third person characters has the same name 'BP_ThirdPersonCharacter'. Yes I'm a beginner,,,How is it work?

    • @dansgamedevchannel6297
      @dansgamedevchannel6297  ปีที่แล้ว +2

      I'm sorry if I misunderstood your question. I think this is about instances of classes. Try this video and see if it helps: th-cam.com/video/LPpypap53lE/w-d-xo.html

  • @nessieloch5564
    @nessieloch5564 4 หลายเดือนก่อน

    I have a question but its not related to this video at all. Its a bit complicated but...
    Do you know how to use a gyroscope of a ps5 controller into unreal ? in order to for example control an object....
    I find no topic on this :(

  • @srawdawg6188
    @srawdawg6188 2 หลายเดือนก่อน

    But how to manually make it assign two player controllers you make to device 0 and 1 for gamepad 1 and 2?

    • @dansgamedevchannel6297
      @dansgamedevchannel6297  2 หลายเดือนก่อน +1

      I'm sorry, I cannot tell you, because it is something I don't know. Never tried to do that.

    • @srawdawg6188
      @srawdawg6188 2 หลายเดือนก่อน

      @@dansgamedevchannel6297 Its ok, it seems no one knows. I am watching a tutorial right now for local 2 player multiplayer, maybe I can find a way to reverse engineer it to achieve this.

    • @dansgamedevchannel6297
      @dansgamedevchannel6297  2 หลายเดือนก่อน

      @@srawdawg6188 I don't know if this will help you: forums.unrealengine.com/t/multiple-controllers-one-game/59132/6

  • @SalamiMommie
    @SalamiMommie 7 หลายเดือนก่อน

    If I wanted functionality where when my character dies I possess another pawn. Is that functionality supposed to be in the player controller? And if so, how do I communicate the death state with the player controller?

    • @dansgamedevchannel6297
      @dansgamedevchannel6297  7 หลายเดือนก่อน +1

      I don't know how strongly "supposed to" applies, but it would be a good place to put it. How you communicate with the Player Controller, depends where from. For most places you would do "GetPlayerController" then cast it to your version. If you were doing it from the player character, you would probably use "GetController" instead. I hope this helps.

    • @SalamiMommie
      @SalamiMommie 7 หลายเดือนก่อน

      @@dansgamedevchannel6297 thanks for the reply! I'm still a little lost regarding my project -- if both pawns have different control schemes, should I create two different player controllers, one for each? Or is there only supposed to only be one player controller?

    • @dansgamedevchannel6297
      @dansgamedevchannel6297  7 หลายเดือนก่อน +1

      @@SalamiMommie I don't think you can have more than one player controller (I could be wrong, there are many things in Unreal I don't know everything about). In Unreal 4, I would have said that if you want different control schemes, you should use different Game Modes, but you probably would still have to do some logic to differentiate controls. In 5, they have the new input system that seems designed to help with this by switching in and out different mapping contexts. It's complex but quite powerful.
      In the first person and third person templates, Epic handle the controls in the pawn, but they use the new input mapping stuff, which they do kind of backwards-connecting to the player controller. If you did what I call "simple input" in the pawn, when you switched pawn, the controls *should* change as well (I have never tried this) but if you have any aspirations for multiplayer this will totally break. For example, if you have the pawn responding to W for forwards, and you have more than one player in the game, if any player presses W, all pawns will move forwards.
      So, what I recommend, and what I think is intended, if you have different pawns with different control schemes. Create different input mapping contexts for the different pawns. In each pawn have appropriate movement functions. In the player controller, wire up the control events to the relevant movement functions (you will have to do a cast with the pawn anyway). Then, when you want to switch pawn, as part of that process swap out which mapping context is being used. A slightly simpler version does this with one big mapping context, and in the player controller check what pawn is possessed, and call movement functions appropriately.

    • @SalamiMommie
      @SalamiMommie 7 หลายเดือนก่อน

      @@dansgamedevchannel6297 thank you so much for your help! When I'm swapping mapping contexts, should I be calling this function in the player controller or in the pawn's blueprint?

    • @dansminialbumreviews
      @dansminialbumreviews 7 หลายเดือนก่อน +1

      @@SalamiMommie I would do it in the player controller.

  • @DunceVideoGameDesign
    @DunceVideoGameDesign 8 หลายเดือนก่อน

    There is some concept I am missing as simple as you made this haha. Would I be able to implement this if Im using a different Character blueprint then the original one Im currently possessing??

    • @dansgamedevchannel6297
      @dansgamedevchannel6297  8 หลายเดือนก่อน

      Yes you should be able to. If you put the character in the world and look for auto-possess in the details you should be able to set it up so that your controller controls that character. There may be some work to get the player controller to talk to the player character. One thing I have never done is create a rigged and animated character from scratch (one day I will brave it) but the other day I created a simple pawn that only has a camera, and got my controller to possess it like this.

    • @DunceVideoGameDesign
      @DunceVideoGameDesign 8 หลายเดือนก่อน

      I figured it out. I set up some variables in the blueprints that allow it to happen and have it running on an event tick in the character. Ill set it up to an input button so its not continuously firing.@@dansgamedevchannel6297, Do you have a discord channel up and running?