Manage Player state and the action allowed

Hi

It’s more a debate than a question :

In my current projet the player can do some action, sometimes at the same time (like walking and crouching or walking crouching firing and aiming)

I was thinking about State like in UDK but not existing in UE4, I see PlayerState, this thing can be use like UDK’s states

or I can do something more complexe by using binary mask

this is my list of posible state for the player, this states will affect the movement, the camera, and action that can be done :

  • IDLE → no movement in x and y
  • WALK
  • RUN
  • SPRINT
  • STAND → just standing like a pilar
  • CROUCH
  • COVER
  • FIRE
  • AIMING
  • RELOAD
  • SWITCH
  • WEAPON
  • INTERACT

what do you think about that ? have you some idea ?

any states that you want to be able to mix should be held in separate variables.

so you could separate that list into 3 separate modes:
CameraMode, MovementMode, and ActionMode

CameraModes:

3RD_PERSON, RTS, SIDE SCROLLER, AIMING_FPS, AIMING_TPS, CUTSCENE, SPLINE, ARENA, MENU,

MovementModes:

IDLE,
WALK,
RUN,
SPRINT,
CROUCH,
COVER,
AIMING,
LADDER_CLIMBING,
LEDGE_CLIMBING,
WALL_CLIMBING,
CUTSCENE,
MENU,

ActionModes:

FIRE,
RELOAD,
SWITCHWEAPON,
INTERACT,
CUTSCENE,
MENU,

that way you can climb while reloading or aim while swimming or take away control during a cutscene (except for controls to skip the cutscene).

i believe with these 3 modes you could describe any type of gameplay with a gamepad, and most other control input devices are even simpler.

Yeah that can be great, but what about WALK + AIMING + FIRE in CROUCH position, in that case we have some trouble

walk and crouch are mutually exclusive, so both would be movement modes.

you could set the movementMode to walk, idle, crouch_Walk, or crouch_Idle, but you can’t do these movementModes at the same time because these options replace each other.

if you wanted to set up a character with 4 modes, you could use:

CameraMode, MovementMode, RightHandItem, and LeftHandItem

but for your example it would be:

MovementMode = Crouch_Walk;
CameraMode = Aim;
ActionMode = Fire;