mercredi 6 janvier 2016

networking ue4 : day 2

You got speed management... but now how to move your pawn?

First of all, check that your spaceship is using physics... Go to your pawn blueprint, and look at your static mesh


Check simulate physics, put linear and angular damping at 1, to have enough frictions, to slow your ship in rotation or movement (otherwise it will speed very highly, and rotate very quickly... :p)

It is a space game, I disabled gravity.

Physics is important  on server, but totally unusefull on client, so desactivate it, on begin play event.



As you see you choose remote on switch autority, to disable physics simulation only on client side.

I am using physics because, I wish to have bounce behavior, collision, and so on. So I will add Force to my mesh, to make it move forward.
I will do this on server



And this is it, your pawn is moving. But client didn't see the move...
I created a custom event, I will use to broadcast the new position/rotation to client. I give to it, vector and rotator as parameter.
Multicast == broadcasting


On server side, I will get my rotation, and location, and give it to my custom event. Custom event will run on client side, I set to my mesh, the new position and location.


Global schema is this
































2 commentaires:

  1. Hi, great tutorial, it's a shame you stopped, can you please help me. Pm me if you get this, thank you very much

    RépondreSupprimer
    Réponses
    1. what do you want as tutorial more than that? I am open to suggestion...
      I share my time between developing, and writing down my development, but most of my time in development.
      often I am waiting to well understand what I ve done, before write it down :p

      Supprimer