x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How to replicate player on ship

Hello,

can somebody explain how to replicate player on ship while it's moving? It works perfectly in singleplayer but when I launch dedicated player jumps even he throws himself from side to side. I'm certain it's something I did wrong.

Product Version: UE 4.20
Tags:
more ▼

asked Dec 30 '18 at 12:47 PM in Using UE4

avatar image

Przemek2222
426 4 10 14

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

The issue here is that the server doesn't consider what the player is doing to be "normal", so it's constantly trying to adjust its position. You need to update the player position server-side in cases like this.

more ▼

answered Dec 30 '18 at 03:58 PM

avatar image

Evigmae
1.7k 8 4 8

avatar image Przemek2222 Dec 30 '18 at 05:22 PM

Okey that explains this a bit. Thanks

Can you explain how to do this?

By update the player position server-side you mean update player position with RPC to all clients?

avatar image Evigmae Dec 30 '18 at 06:43 PM

yeah, that's correct. once the player is "attached" to the the ship, the server should be in charge of setting and replicating its position.

The other way you could do this is adding "being on ship" to the CharacterMovementComponent. here's how the documentation explains it:

https://docs.unrealengine.com/en-us/Gameplay/Networking/CharacterMovementComponent#advancedtopic:addingnewmovementabilitiestocharactermovement

avatar image Przemek2222 Dec 30 '18 at 08:21 PM

Thanks a lot for your effort. Will try that tomorrow.

avatar image Przemek2222 Dec 31 '18 at 06:30 PM

What if I want player to be able to walk on ship while ship is moving?

Attach doesn't seem to be best idea.

Can you explain how to add new movement to CharacterMovementComponent?

I don't understand how to do it.

Can I do it in Character blueprint or I need to do it in C++ documentation doesn't specify that.

avatar image Evigmae Dec 31 '18 at 06:44 PM

well, i did say "attached", do not actually attach the actors together.

you would have to do it in C++. Despite how cool Blueprint is, it's not meant to implemente back-end features.

now, when the player is standing on the ship, and the ship is moving. the player moves with the ship because it checks for the movement of what's bellow it. Sadly that only happens locally. server finds that really confusing as is not meant for multiplayer, so it'll try to fight it.

However, you could have the input locally, and execute it only server-side. it might have lag, but at least the server will know what's happening since it itself is doing the movement.

Something like player press Forward, sends a move request to server, server moves the character, client sees the movement being replicated.

Implementing new movements to the character moving component is so players can move locally without lag, and the server understands whats going on.

If you're ok with a bit of lag (which might be imperceptible on a decent internet), then moving on server is your solution.

avatar image Przemek2222 Jan 01 '19 at 01:08 PM

I have created custom character and custom CharacterMovementComponent.

Should I use for example raycast to check if player is on ship or there is something else better buildin engine?

avatar image Evigmae Jan 01 '19 at 01:21 PM

it would be enough to set a bool when player enters / leaves the ship.

avatar image Przemek2222 Jan 04 '19 at 07:34 PM

You have said:

now, when the player is standing on the ship, and the ship is moving. the player moves with the ship because it checks for the movement of what's bellow it

Can you please tell me what's it's name or give some link on API? I can't find what is this.

avatar image Evigmae Jan 04 '19 at 09:56 PM

https://api.unrealengine.com/INT/BlueprintAPI/Pawn/Components/CharacterMovement/index.html

Ctrl+F "Base" and a few highlights will show up.

main one i think being "Get Movement Base"

"base" is the name of the think moving under your character.

avatar image Przemek2222 Jan 05 '19 at 12:44 PM

Thanks again!

avatar image Przemek2222 Jan 17 '19 at 11:03 PM

Hey,

I have another question.

Can I force somehow to execute that on server too?

as you said:

"Sadly that only happens locally. server finds that really confusing as is not meant for multiplayer, so it'll try to fight it."

avatar image Przemek2222 Dec 31 '18 at 07:28 PM

Thanks for this answer now I understand why this happends! Will try that.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question