Replay System problem

I’ve been trying to make the built-in ue4 replay system work for my game but I came to a wall right now.

The replay system docs Using the Replay System in Unreal Engine | Unreal Engine 5.3 Documentation states:

Now, I set up my project for replication as it can be seen here: https://www.youtube.com/watch?v=BkJZzUCoyWs

But the replay system is not as smooth, as it can be seen here: https://www.youtube.com/watch?v=MZlzUvst0w0

For the replication itself, I made the server do all the work, I centralized every input action on a method that switches to the right input, all of it is done in the server.


    UFUNCTION(Server, Reliable, WithValidation)
    void SimulateInputAction(const EInputActions Action);



void AWarriorPawn::SimulateInputAction_Implementation(const EInputActions Action)
{
    switch (Action)
    {
        case EInputActions::JumpPress:
            SimulateJumpInputPressed();
            break;
        case EInputActions::JumpRelease:
            SimulateJumpInputReleased();
            break;
        case EInputActions::DashPress:
            SimulateDashInputPressed();
            break;
        case EInputActions::HeavyAttackPress:
            SimulateHeavyAttackInputPressed();
            break;
        case EInputActions::HeavyAttackRelease:
            SimulateHeavyAttackInputReleased();
            break;
        case EInputActions::LightAttackPress:
            SimulateLightAttackInputPressed();
            break;
        case EInputActions::InteractPress:
            SimulateInteractInputPressed();
            break;
        default:
            break;
    }
}

bool AWarriorPawn::SimulateInputAction_Validate(const EInputActions Action)
{
    return true;
}


During replay, this method is not getting called while during multiplay, it does.

It may not be the best implementation but making the replay system work is my priority right now.

Is there something I am not getting? Is the replay system supposed to work that way?

I can’t really give you much direct code support since I’ve not mucked around with the replay system code personally, but is there a chance that it’s network code lag? Maybe offload the replay work to the client so there’s not a chance of dropped packets, or slow net code, or some kind of race condition? Or is there a lot of destroying or creating of actors going on in the SimulateInteraction functions?

Server RPCs from clients don’t get issued in replays, since replays are just replaying the stuff a client needs to receive.

Regarding smoothness, the default is to record at something like 15hz, there is a console command to bring it up to full speed.

You could try recording the replay with a listen server if you aren’t already (eg. “open MyMapName?listen”), we’ve run into issues where certain stuff doesn’t get recorded if it isn’t a listen/dedicated server. Although yeah as muchcharles said, a replay recording basically acts like a client, and so it will only record things that a client would receive. Does one client see the other client jumping etc.?

Thanks for the quick replies!

Yes, every replication works fine, server to client, client to server, client to client, every move is replayed perfectly on the other side.

As for Server RPCs not being replayed, I tried changing every Server RPC to Client. The Server RPC that makes the replication work, in fact replication stop working when I changed to client. Funnily enough, the replay got a little better but still not what I was expecting.

Is there a way to test if replay system will work other then replaying a level? It is really frustrating because I made replication work but the replay does not work so well.

I didn’t know about the listen server, it will be the next thing I try.

Geordie! I tried listenning to the map and it worked like a charm! It replays perfectly now. Thanks a lot!

Also, I couldn’t find in the docs the console command that brings the recording to full speed, where can I find it?

You can’t just change that without radically changing behavior of your game…

demo.RecordHz 60

Now, the replay system works wonders when there are only player controlled pawns, I cannot make AI pawns work in replay and I can’t figure out why. Is it because I’m using listen server? What could it be?

They work when playing normally, but when it goes to replay they do nothing. Is there any docs I can read to get some help?

Sorry reviving old posts but this new problem is related.

Hey I’m having a similar problem where I want to record the actions that are taken when the player gives keyboard inputs. So I’m trying to replicate the function being called by the key press, by making it a “Server” function. But when the replay starts those functions don’t get called. Is there a way to do that without doing the “?listen” server thing?

I’ve tried making the server function call a client function so that the client function would be recorded and played back, but that doesn’t work either.

Edit: I tried the listen server thing and it didn’t work for me.