Modern MMORPG Locomotion System

Add 8-Directional Evasion To MMLS

While evasive animations are not provided with MMLS at the moment, blueprint logic to implement an evasion system is already there. This guide will show you how to do it and give you a brief overview of network replication at the same time. You can see the end result in a short video at the end.

For demonstration we converted the DoubleJump animation into a front right (FR) evasive frontflip by playing with the root motion on the animation sequence.

Step 1

Add the input key

1. In Project Settings -> Input.

2. Click on the + next to Action Mappings, type your new input name and select the key value.

 

Step 2

Add input event in your character

In your character EventGraph, right-click and type the name of your new action.

Step 3

Add server-side custom event

1. In your character EventGraph, right-click and type custom event. Select Add Custom Event and type ServerEvade.

–> All inputs in the character are on the owning client only. We need to send this information to the server. This is done by creating an event that is executed on server.

 

2. Click on your new event and then on the + in Inputs. Change the input to Enum Direction. Select Run on Server and check Reliable.

3. Hit Compile.

 

Step 4

Add animations in your Anim BP

1. Add a new variable in your Anim BP, set the type to Enum Direction then select Map(Dictionary) as Container Type.

2. Select Montage in the 2nd variable type window.

-> Here you can create a custom structure instead if you want different evasive montage depending of state(Relaxed,Injured,etc.) or if crouching or proning.

Contact us if you want this & need help.

Step 5

Add new function to MMLS Animation Interface

1. Add a new function in BP_MMLS_AnimationInterface.

Click the + next to add output and create a new variable. Same thing as step 4.

2. Hit compile.

Step 6

Drag & Drop the variable in the Anim BP Interface Function

1. In the Interfaces tab, click on your new interface function. Drag and drop the variable created earlier and plug it in the Return Node.

Step 7

Final Character Setup

1. Hit compile if needed, then right-click and type the Server event we made earlier.

2. Drag & Drop MMLS Movement Component, pull from the output of the node and type Held Direction, select Client Current Held Direction. Plug in the event.

3. Drag & Drop your character mesh, pull from output and type Get Anim Instance, then from that output type the Interface Function name.

4. Repeat first part of step 7.2 but for Actions Blocked instead.

5. Add FIND, NOT, AND nodes and plug everything as shown in picture.

Step 8

Add root motion to your animations

1. Open your animations and check EnableRootMotion. ->Most packs from the Unreal Marketplace have root motion with them. If there is no root motion you can easily add a custom one by selecting Root in Skeleton Tree then hit the + Key (next to the Apply green checkmark).
 
In MMLS we use custom root motions, so from our DoubleJump anim, we removed the Z axis translation, kept the positive Y translation and added a translation in X (negative) because we wanted a front right root motion.
 
-> A front left frontflip would have a positive X translation, a backward frontflip a negative Y translation only,  etc. Repeat this if you want to for all 8 directions.

 

Step 9

Create montage and add Anim Notify Window

1. Right-click on your animation sequence and select Create -> Montage.
2. Right-click in Notifies and select Add Notify State -> Montage Notify Window. Change the Notify Name to BlockActions.
3. Adjust the blend in and blend out times if you want to.

 

Step 10

Add your montages in the Anim BP variable if not done already.

1. We tweaked some settings to make the montage look better in our video. Here are the custom DoubleJump settings.
->In the animation sequence* : Rate scale : 1.1
*important, don’t change rate scale in montage because it will mess up the blending in/out.
->In the montage : Blend In Time 0.25, Blend Out Time 0.6
You might need to drag & drop your anim sequence in your montage back again if you changed the anim sequence rate scale after creating the montage. The anim will break otherwise.

 

Done!

Everything should be working now

Some ways to improve the DoubleJump animation if you want to use it:

-> Split it in 2 or 3 parts, change the rate scale, put them all in a montage. Currently it does look like the initial frontflip rotation is a bit too slow. That is because we reduced the rate scale of the overall DoubleJump animation, it was not made to be a frontflip from ground.

-> In the video you can see that the character can rotate while under the effect of the root motion. To avoid this you can block horizontal mouse input with a Owner-only replicated variable while the montage is playing. Can easily be done with a custom montage window notify name, add it in the MMLS Movement Component (Event ServerPlayMontage). Then block the input with that variable in your character class.

-> Different montages by prone, crouch or standing. It would look way better especially the frontflip from prone. If you really want to implement this and need help contact us.

 

Result