r/UnrealEngine5 • • 20h ago

Elevator + Multiplayer

Hey everyone! I’m looking for advice on how to properly implement a multiplayer elevator in Unreal Engine.
My current implementation works as follows:
The elevator actor is replicated with Replicate Movement enabled.
- The elevator moves using a Timeline that runs on the server.
- While moving, the elevator checks which players are inside and adjusts their Z position using Set Actor - Location to prevent them from falling through the platform.

Everything generally works fine. However, when the host has low FPS, players can still occasionally fall through the elevator platform.
I understand that using Set Actor Location to manually adjust player positions isn’t the best approach, but I haven’t found a more reliable solution yet.

Main requirements:
- The elevator cabin is open, so its movement must be visible to all players.
- Players must be able to walk freely inside the cabin while the elevator is moving.
The elevator must work reliably even when the host has low FPS.

Has anyone dealt with a similar problem? Is there a better and more reliable way to implement moving elevators in multiplayer?
Any advice would be greatly appreciated!

3 Upvotes

9 comments sorted by

4

u/SayuriShoji 14h ago

Try using a NetMulticast RPC to activate the timeline on both server and all clients for moving the elevator, so both the server and all clients are moving the elevator on their own, so clients can properly predict the elevator movement and smooth movements of any objects inside.

And issues are always to be expected when the server can't keep up a high update rate, this goes for any game. That's why usually the player with the best computer / best connection should be host.

2

u/Rev0verDrive 7h ago

Repnotify elevator state or floor. Let the onrep function handle action.

2

u/SayuriShoji 5h ago

True. Have an enum named elevatorMovementState, with enum values AtBottom, MovingUp, AtTop, MovingDown.
Add that enum as replicated variable to the elevator.

When elevator gets activated on server, set the enum variable to MovingUp or MovingDown and start playing the timeline.
When the timeline finishes, set the enum variable to AtTop or AtBottom.

On client, react to onrep-events of the elevatorMovementState variable:
- if AtTop, stop timeline and set elevator location to top
- if AtBottom, stop timeline and set elevator location to bottom
- if MovingUp, start movement timeline (start moving elevator up)
- if MovingDown, start movement timeline in reverse (start moving elevator down)

That way clients simulate the elevator all on their own, reducing jittering, and once the server tells them the movement has finished, the clients just set the elevator to the top or bottom. That way you can replicate the entire movement by just changing a single byte when the elevator starts/stops moving.

Minor adjustments could be made if multiple floors are needed, by using a single byte for the floor number and a bool for whether the elevator is moving.

2

u/Rev0verDrive 4h ago

Don't even need the states. Just an int or enum for the floor. Don't let clients input a new floor if the timeline is playing. Block it at the interaction level.

1

u/Time-Masterpiece-410 16h ago

I'm no expert but why do you even need to set actor location? Collision isn't enough?

2

u/Rukonon 15h ago

Yes, in multiplayer the characters fall through the floor. It happens only in multiplayer

1

u/stremely 13h ago

Glad I read this post. Might have to deal with this as well.

2

u/VideoGameOrcs 12h ago

The elevator actor is replicated with Replicate Movement enabled.

  • The elevator moves using a Timeline that runs on the server.

What are you using to move the elevator on the server? As in, SetActorLocation? A MovementComponent?

1

u/North-Aide-1470 8h ago

Many games attach their characters to the elevator. But I prefer to (with opaque elevators) just fake it. Pretend the elevator is moving but simply teleport the players when it 'reaches' it's destination, you can teleport the whole elevator too.

In your situation with your current setup have you tuned or disabled the NetWork Smoothing option for Character Movement Components?