Where to put specific game code (blueprints)

Hi guys

Would like to spark a debate on your opinions on where to locate specific blueprint code.

In a nutshell, I have code that moves my ship around the screen which I have placed in my PlayerController, makes sense no?

But I also have code that initiates thruster sounds, calculates fuel , and other, shall we say, none ship controlling code.

Where would you put said code?

  1. Ship Pawn blueprint
  2. PlayerController blueprint
  3. GameMode blueprint
  4. Other

Now I know all of these would probably work, but is there any pros or cons to any of them? What’s your opinion on where, why and how you would choose?

Thanks in advance

Stewart

They could all be components on the Pawn or if it is a more advanced feature then another Actor handling this feature.

The PlayerController should generally only have input from the player but not actually perform the calculations of how the ship would behave.

So the PlayerController receive input and decides if the input should be passed onto the controlled pawn. The controlled pawn then decides what to do with the input either by delegating the task to a MovementComponent or another appropriate Component or a combination.

2 Likes