12. Unreal Engine MMO – Easy way to handle jump synchronization

This is an extension to the previous post where we handled motion.

In this chapter, we will explore how to synchronize other motion, such as jump/fall and you can actually extend it to other motion, such as attack/combo animations etc.

The rundown of this post and the previous post (synchronizing motion) is covered in the following video.

Synchronize character motion

Background

The MMO server will effectively be synchronizing ALL the motion, so you will want to display all of this information too.

We’ve linked some information already, such as position, velocity and rotation – but we will need to do others such as jump a little differently.

In my example, to make a ‘proxy’ character, I’ve copied the ‘StylisedThirdPerson’ blueprint, which implies they share the same Animation blueprint.

Ideally, you will have them shared as otherwise you will have to maintain 2 different animation blueprints.

The main thing that you need to do is be able to pull in information from your server and apply it to the animation blueprints.

Editing the animation blueprint

First of all, let’s find the animation blueprint that you will be working on. An easy way to do that is to find your character blueprint, open the ‘Viewport’ and select the mesh which will indicate the ‘Anim class’ that’s used.

Finding your Anim class

Click on the magnifying glass icon which will take you to the file location.

Now we need to check, is this a ‘Proxy character’? If it is, we should set some values based on server input, rather than evaluating from movement component etc.

If this is proxy character, get info from blueprint / server

This is achieved by simply casting the ‘Pawn owner’ to ‘ProxyCharacter’.

If successful, it implies that this is a proxy character and we want to pull our data from the server.

How can we pull the data from the server?

We can model it in the blueprint.

Add ‘isFalling’ to the Proxy Character blueprint

Add the ‘isFalling’ boolean variable to your proxy character blueprint and make sure that its public (eye is open).

And now you simply want to link it all up. You can do this inside the ‘StylisedThirdPerson’ blueprint.

Link up ‘isFalling’ variable

At the moment, the proxy characters are spawned and controlled via the server through the ‘StylisedThirdPerson’ blueprint. So we can just extend the functionality there – we simply add the setter for the ‘isFalling’ variable and link it to the payload of the server response.

That’s it! You’ve now synchronized the jumping motion via your server.

1 Comment

Comments are closed