Creating an MMO-style controller VIII: Future Improvements

So we’ve completed our programming objectives! Is there anything left to cover? The overview and list of sections is in this post.

Our controller is good, but its by no means perfect. There are a few little quirks that need to be ironed out:

Strafing not so smoothly

Something a little strange happens when we go from strafing left to quickly strafing right. The character appears to flip direction very quickly.

A potential fix for this would require looking at our animation blend spaces, which would require having some specific animations for strafing.

Fortunately there are some game examples available from the Unreal Marketplace which have some assets to pinch! The First Person shooter has some assets, such as a 2D blend space for motion, that could be re-purposed for our use.

Statically rotating

When we rotate, the character does not move. It statically rotates around on the yaw axis. Its a bit strange looking.

To fix this requires an animation update, and perhaps another boolean flag to indicate that we are rotating. We’d then feed this into the state machine that blends motion in our character, so it could perform some kind of motion while rotating.

Right and mouse click together

In some MMO games, if you click and hold both the right and left mouse buttons, your character will begin moving forwards for as long as you hold these buttons down.

This sounds easy to implement, right? Well, in that case, I’ll leave this as an “exercise for the reader”

Anything else?

If you’ve noticed anything else about the controller that is odd, or want to suggest an improvement, feel free to leave a comment! I’d love to hear about any improvements that could be made to this work, since I’ll be using it in games I make.

Advertisement

Creating an MMO-style controller VII: Click and Drag Camera Control

Part seven in the development of our MMO-style controller. The original specification with contents and an overview can be found in this post. Quite a lot of posts now, isn’t it!?

Now we’re moving back to our final feature in the MMO-style controller, using the mouse to move our camera around, and control the character’s orientation. All those functions we wrote earlier are really going to help us here!

Left and right click actions

Firstly, we’re going to need to set up some logic with for the when the user presses the right and left click buttons on their mouse.

First we’ll need some functions to control interaction with the UI and game world:

Function ToggleUIControlOn

Function ToggleUIControlOn, enables interaction with a UI.

Function ToggleUIControlOff

Function ToggleUIControlOff

These two functions change how we interact with the game world. We’ll use these support the mouse drag and rotate feature. When toggled off, the mouse disappears and we cannot interact with the UI. We’ll also disable mouse related events for the game. If we set UI control back on again, we’ll keep the mouse to the game window, and re-enable the things that were turned off.

Now we can add these into the left click action event:

Left Click action

Left click action

When we press left click, we set a LeftMousePressed boolean to true, and we turn off the UI Control.

When left click is released again, we’ll re-enable UI control if right click is not also pressed. If RightMousePressed is true, we do nothing.

The final node in the released chain is a little bit of polish. Once we’ve done rotating the camera using left click and drag, the next time we move, we want the character to move in the direction the camera is facing. We do this by updating the rotation of MyPlayerController.

Hoe about the right click action event?

Right click action

Right click action

This almost the same as left click, but we don’t add that final function to the released sequence. The reason for this, is that right click and drag will update rotation anyway, so we don’t need to do this twice.

Camera rotation control

The vital and missing information left out from the initial upload!

There are two functions to create which are used to control the camera:

RotateCameraLookUp

RotateCameraLookUp

RotateCameraTurn

RotateCameraTurn

This will allow us to control the position of the camera.

Left click and drag camera

We’ve done a lot of the hard work for this earlier in setting up our blueprints. EDIT: Looks like I missed adding this information when I first uploaded. It is now included in the section above.

Left click and drag blueprint

Left click and drag blueprint

Since we have the axes Turn and LookUp already set up, it is a simple task to only make these events do something is LeftMousePressed is true.

If it is true – that is the player is holding left mouse down and moving the camera – we simply rotate the camera, using our two functions CameraTurn and CameraLookUp.

Almost too easy!

Right click and drag camera

What does holding right click and drag do? We rotate the camera and the player controller. Easy.

Right click and drag

Right click and drag

Very similar to left click, except we also need to RotateCharacterToCamera, and add pitch input to the player controller. What could be simpler!?

All our hard work earlier really paid off in this section. Those re-usable functions really are worth their weight in gold, and make the blueprints a lot more readable.

Creating an MMO-style controller VI: Orient Character to Movement Direction

Development of our MMO-style controller, part six! The original specification with contents and an overview can be found in this post.

This is going to be the most complicated part so far. This section of blueprints replaces the functionality we removed in an earlier post, but adds some custom controls that we need.

This code will be added to the MyCharacter blueprint event graph.

Continue reading

Creating an MMO-style controller V: Character Rotation

Part four in the development of our MMO-style controller. The original specification with contents and an overview can be found in this post.

We’ll be adding in the options to rotate the character and camera this time, using the A and D buttons. It’s the final basic input axis for controlling the character.

We want to rotate around the character and also have the character rotate as we do so, depending on which way we go.  There is one complication: as per our design, if the right-click mouse button is held down, we want to strafe with our character instead of rotating.

Continue reading

Creating an MMO-style controller IV: Character Movement

Continuing the development of our MMO-style controller. Contents and overview can be found in this post.

Time to make our character move! This section will focus on movement on the forward/backward axis, and the left/right strafing axis.

First things first: Deletions in the default blueprint!

If you open up the default MyCharacter (or ThirdPersonCharacter) and open up the Event Graph, you will see that it is already populated by various input controls. Make sure to delete everything inside the Movement Input and Mouse Input comment boxes. We wont be able to properly control the character and camera for now, but that will be quickly remedied.

We’re actually going to code our movement controls in MyPlayerController, so open that blueprint up to add the following functions.

Continue reading

Creating an MMO-style controller III: Camera zoom with the mouse wheel

So part three for this mini series, and the first actual section of coding! Camera Zoom! The overview and list of sections is in this post.

I wanted to start with something relatively simple, and start out with a small victory. The zoom functionality is quite simple, it allows us to get a better view of the level by zooming in and out, but keeping the camera focused on the player. Continue reading

Creating an MMO-style controller II: Blueprint settings, input actions and axes

We’re getting started in Unreal Editor now, for part two in the MMO -style controller mini-series. The overview and list of sections is in this post.

Start by creating a new project, use the Third Person Template, in the blueprint section. You could do this in C++, and I will do in the future.

Create a new project using the Third Person Blueprint template

Create a new project using the Third Person Blueprint template

We’ll change some things in the blueprints that you are provided with by default, so we can add the features we want our controller to have.

Continue reading

Creating an MMO-style controller I: Overview

MMO Controller

I mentioned in this post the motivations for creating an MMO-style control system for a third-person game. But what is an MMO-style control system, exactly?

From extensive research (read: I played a bunch of games), I’ve selected a few criteria for a generalised MMO controller:

Movement of the character along the ground:

  • Move forward and backwards using W and S
  • Rotate the character and camera with A and D
  • Strafe left and right with Q and E
  • Moving backwards is much slower than forwards

Controlling the camera is also linked to movement:

  • Mouse cursor is visible, can interact with UI
  • Holding mouse left-click and dragging the cursor around rotates the camera (but not the character’s direction of movement)
  • Holding mouse right-click and dragging rotates the camera and the character’s direction of movement
  • While right click is held, rotate (A and D) will make the character strafe
  • Mouse wheel is used to zoom in and out

Other considerations:

  • The character needs to orient itself smoothly to the direction of movement
  • When moving backwards, the character orientates to the opposite direction to movement – that is, when walking backwards, the character’s back faces the camera

Creating an MMO-style controller in Unreal Engine

For the last little while I’ve been teaching myself Unreal Engine. Recently, Epic Games made it completely free to use for anyone, which I think is an absolutely amazing idea. It could possibly be fundamental for pushing video games even further by getting future developers hooked.

Since I’m learning from the ground up, I wanted to create an MMO-style control system, using the blueprint system, based on the third person template available. Control systems are pretty fundamental in video games, and I have some very specific memories of completely giving up on well known titles because of bad input design.

Continue reading