Replication or Loading Problem?

Someone know what this problem is?

I have an actor placed in world.
The actor spawn a Niagara System loop.
When the map is loaded only the host can see the first loop.
Clientes can see the second loop too.

Watch video:

This is the actor code:

This is the project files:

Project.zip (535.9 KB)

The actor BP and the Niagara System are in this folder…

What the problem is?
How can i fix it?

Thank you so much!!


This man says about to use multithreads to wait for levels loaded (min 7:15) (FAsyncTask)

He says that when the level is loaded you receive a notification.
Is this the solution?
Can someone provide an example of this please? (C++ or BluePrint, everything is fine for me)

Your First instance is only playing on the server by your design.

Should be…
Begin play → Switch has Authority [Auth]: MulticastSpawn → Server Respawn

1 Like

Do you mean like this?

Like this it does not work neither…
In this case i have exactly the same problem.

Thank you so much for your help :hearts:

If the clients aren’t seeing the first spawning, then they aren’t loaded enough to receive and process it. After the Switch has authority add a 2 second delay.

1 Like

Ok, the delay does work “In my computer”!!

But… It is going to work in a real scenery?
I mean… the loading time could be different depending of the kind of CPU, RAM, SSD, bandwidth…
So it may be that a client takes more than two seconds to load.

How can I handle this situation?
I mean, is there a way to synchronize the start of the game when all the client machines have loaded the map?

Thank you so much!! :hearts:

given its a niagara effect, does it even need to be in sync with server? if not you could just run it on beginplay (ie not authority only)

1 Like

I understand what you mean.
In some cases that is the best solution (do not replicate it).
But in this specific case I am interested in all clients seeing exactly the same as the server.
It is not a cosmetic particle system. It does critical things for the game.

Furthermore, I think it is an excellent example that shows very well the problem of loading maps and synchronizing players.

I want to learn to handle it correctly. I think it is something very basic and fundamental in a multiplayer game.

Thank you so much for your help!! :hearts:

Depending on the game complexity and the map size, clients can take well up to a minute to load a level on connect.

I’d use the game mode and a client polling setup.

1 Like

this thing is, itll never be truely in sync with the server, even if you start them at the same time the multicast will take a delay to execute, ie lag.

otherwise, have the client tell the server its loaded in an RPC then when all clients are loaded send the multicast

1 Like

Hence the polling recommendation. Even then you still won’t get proper sync. Servers will always be ahead of clients. Clients ping differences will always desync client to client views of the game world.

Furthermore, FX shouldn’t be played on the server. It’s a waste. They don’t render anything, nor play audio.

1 Like

Thank you very much for your answers @Rev0verDrive and @Auran131
I guess the problem now is knowing when the clients have finished loading.
(Knowing how to do the client polling setup).

You are right, in the case of a dedicated server the FX does not need to run on the server. But if the host is a player then it is necessary.

The problem seems to be more complex than I thought.

Any information on how to do the client polling setup is welcome.

Thank you so much!! :hearts:

just use begin play on remote

1 Like

Something like this? This seems to work…
However, I’m not sure if it works because of the timer or if this is really the way to do it.
I would like to do it without the timer but I do not know how.

Game Mode:

Player Controller:

Actor/Niagara:

Thank you so much!!

you could set the expected number of players in the game instance. you’d likely know this before you load a map/gamemode. obviously your timer will fail if they take longer than 3 seconds.

other than that if it works it works :slight_smile:

1 Like

Thanks a lot for your help @Auran131
And @Rev0verDrive thanks a lot for your help too.
Without the help of you two I would be very lost in this matter.
I would like to accept all your answers as a single solution.
This is a dilemma!! :upside_down_face:

Maybe a moderator reads this and knows what to do in these cases.

This isn’t telling the GM that the player has loaded their world (map). It’s just counting connections.

When we connect to a server it creates a controller. The GM then spawns the pawn assigned in the settings then the possesses it with the control. The pawn is then replicated. At the same time we are getting world information and starting to load the map on our end. Reality here is the pawn will load and start falling before the map is ever ready. This isn’t an issue on simple content example maps, but full production ones it is.

What’s needed is a way to have the pawn notify the GM when the level is loaded on their end. The way I do this is with a barebones pawn class set as the default in the GM settings. When it determines the level is loaded it calls it RPC’s the server controller which calls the GM to swap out the loading pawn to the actual character.

The swap point is where you’d want to do the counting.

1 Like

My Loading Pawn process.

Game mode Classes… Note the Default Pawn
image

BP_LoadingPawn is the base Pawn class. No input, no mesh, no movement.

For simplicity the code shown does a simple delay then calls the controller event. In production you’d have code to determine if your level was sufficiently loaded in order to spawn the main character without it falling through the map.

Controller class event:

Game Mode

Replace Loading pawn w/main character class


For clarity I should note that most production levels have a 15 to 30s+ loading time. Sometimes its drastically longer, but that depends on the clients hardware and the overall performance of the level.

1 Like

I have tried it and the simulation works.
I just need to know how to do exactly this step for a real context.

I tried this but it doesn’t work (the loop is infinite)…

The Level Display Name is “Persistent Level” when it should be “First Person Map”… I don’t know why it’s pointing to the wrong map.

Captura de pantalla 2024-02-25 125256

I am looking for information about it.
But any example about this is welcome.

Thank you very much for your help and your time @Rev0verDrive !! :heart:

I prefer checking for the existence of specific large actors inside a radius of the player. I also do line traces downward checking for ground underneath the player.

i will do as you say.

I was all day looking for the reason why the “is loaded” function is failing.
i found nothing.
Then it must be bugged.

Thank you so much @Rev0verDrive !! :heart: