#multiplayer

1 messages ยท Page 444 of 1

twin vault
#

when you print a string on a client it shows on all screens

#

just remember on GameMode you cant use RPCs, because it doesnt exist on the client

#

so create your replicated variable somewhere that exists on the client, such as GameState

#

also its not needed to use a Multicast to set the replicated variable

#

also read that

crisp spruce
#

Thanks, i will check the PDF, hope I hvae not been a headache, This is my first time with unreal, but every tutorial i have seen is getting me more confused haha. Maybe ill come back tomorrow, thank you

high current
#

Hey, I am having issues with proper physics handle replication, currently I simulate physics only server side

#

thus I execute the physics handle location update on the server as well

#

but it is rubber banding all over the place

#

when holding the object

idle flame
#

Hey,
I'm using BeginDeferredActorSpawnFromClass to spawn on my server an actor.
Then I init some value on server side by calling a function of this actor.
And finally, I use FinishSpawningActor to spawn it.

My problem is that I want to replicate the value that I init before spawning it (here this value is a simple integer).
But it appear that this value is not replicated.

Chunk is my Spawned Actor (bReplicated true & bAlwaysRelevant true)

MainClass : (Where I spawn my actor)

            if (!HasAuthority()) // I spawn my actors only on server side so they can be replicated with my init data
                return;

            Chunks.Add(Cast<AChunk>(UGameplayStatics::BeginDeferredActorSpawnFromClass(this, ChunkClass, SpawnTransform))); // Start DeferredActorSpawn from Blueprint Class
            if (Chunks[Chunks.Num() - 1] != nullptr) { // Check nullptr

                Chunks[Chunks.Num() - 1]->InitServer(IAmAnInteger); // Call actor's function to init variables

                UGameplayStatics::FinishSpawningActor(Chunks[Chunks.Num() - 1], SpawnTransform); // End Spawn of actor

AChunk Class : (The actor that I spawn) In this function I just init a Variable only on my server actor

void AChunk::InitServer(int32 IAmAnInteger)
{
    LocalVariable = IAmAnInteger;
}

#

Thx for any help

winged badger
#

is the variable replicated, did you do DOREPLIFFETIME(AChunk, LocalVariable); for it?

idle flame
#

I do not need to do that, I want to replicate the variable after construction

#

The actor replication function (to init actor with default value on client) is called after the construction of this actor

real yacht
#

best way for passing some arguments when client is connecting on dedicated server?

thin stratus
#

Iirc you can do that via ClientTravel(URL)

#

And then URL can then hold options ala ?key=value

twin juniper
#

flushnetDormancy spam when firing a weapon vs keep weapon awake during fire and sleep after 5 sec ๐Ÿค”

idle flame
#

Someone know how you can replicate very long array ? Because my client get disconnect when I try to replicate it

#

I'm doing that : UPROPERTY(Replicated) TArray<int32> Map; (my array is 500*500)

thin stratus
#

Anyone worked with PostProcess Outlines in Splitscreen?

#

As far as I understand the postProcess outlines, they are done via the CustomDepth setting being enabled on a Mesh.
Since Meshes in Splitscreen only exist once (no local copy as everything is already local) turning CustomDepth on will turn it on for all players.

#

Any way around that?

twin juniper
#

@idle flame take a look at NetSerialize.h

idle flame
#

Ok thx

twin juniper
idle flame
#

Thank you ๐Ÿ™‚

#

@twin juniper After the spawn of my actor in the world and it's default replication, Did you know if I can call again the default replication construction function of this actor ?

maiden vine
#

If my host logs in first starting a game it works but if two players are in at same time then the host starts and I try to join Fails.

jolly siren
maiden vine
#

I broke it down to the host button on main menu only works for Client 1 but Client 2 fails. Whats the problem with the controller or authority ?

maiden vine
#

When two players are in the main menu the player state is not valid anyone know why?

#

client1 has a player state and client 2 does not

stone sentinel
#

Hello guys,
does anybody knows when PlayerName is set in PlayerState?
I do a GetPlayerName at BeginPlay and it returns an empty string

#

@maiden vine actually they both have it but if you see it in client from client 1 you can see PlayerState1 but not PlayerState2

#

From server you can get any of them

idle flame
#

Hey, Someone know why the function1 & function2 Are called on server but not on my client pls ?

FVector Location = FVector(0, 0, 0);
FTransform SpawnTransform(Location);
auto NewActor = (Cast<AChunk>(UGameplayStatics::BeginDeferredActorSpawnFromClass(this, ChunkClass, SpawnTransform))); // ChunkClass is my Bp Actor class

if (NewActor  != nullptr) {
    if (!HasAuthority())
        UE_Log(LogTemp, Warning, TEXT("I'm the client"));
    NewActor->Function1();

    UGameplayStatics::FinishSpawningActor(NewActor, SpawnTransform);

    NewActor->Function2();
}
stone sentinel
#

It looks like it depends on the function you are calling your other functions in

#

are you actually in a widget or in a only client object?

idle flame
#

I'm in an actor

#

I'm creating an actor within an actor

stone sentinel
#

what is the function wrapper of your codE?

idle flame
#

This code is call within the BeginPlay of an actor

#

This log

#

if (!HasAuthority())
UE_Log(LogTemp, Warning, TEXT("I'm the client"));

#

Is printed

#

So the client pass thought the code

stone sentinel
#

have you tried switching between Dedicated Server and not? and see if you got any difference?

idle flame
#

I'll try

#

No I dont have any difference

stone sentinel
#

did you call the Super:BeginPlay()

#

?

idle flame
#

I dont have any diff between listen server & dedicated

#

Yes

#

I call it

#

& Before my code

stone sentinel
#

another thing, probably you cannot create an Actor just in client this way. check if you create the actor twice

#

if (NewActor != nullptr) {
if (!HasAuthority())

#

between these two lines put a log

#

and check you can enter twice

idle flame
#

I'm trying to spawn this actor on client & on server so yep I think I need to spawn it 2 time

#

Am I wrong ?

worthy perch
#

Just make the actor replicated.

stone sentinel
#

true. and spawn just on server

worthy perch
#

The creation of it, on the server, will propogate the actor to the clients.

idle flame
#

I cant make it replicated

#

Cause I need to init variable with the function1

#

And I cant replicate Very big array

#

I was hoping that if I spawn it on client & server the game will know that he dont need to replicate it cause it is already

#

Did you know if somehow I can give parameters to my new spawned actor in the client from the server ?

winged badger
#

you can reference non replicated actors over network

#

and if server were to send a seed to the client, they used the same code to generate the level and naming was consistent

#
  • your chunks had virtual bool IsNameSupportedForNetworking() const { return true; }
#

you might not need to replicate them at all

#

trying to replicate 250000 Actors is a non-starter in any scenario

idle flame
#

I only replicate 25 actor

#

Cause I have chunk of 100x100

winged badger
#

and they are larger then the buffer allows

idle flame
#

yes

winged badger
#

i imagine

idle flame
#

That exactly my problem

winged badger
#

simulate it

#

you can do it per chunk

vapid egret
#

How can I make players create their own servers for my game? Should I make the "dedicated server" available?

idle flame
#

So if I load the same seed for the Math Random function it would work ?

winged badger
#

yes, random is not actually random

idle flame
#

That what you was sugesting ?

winged badger
#

its bitshifts on a seed

idle flame
#

Well this is legit genius xD

#

thx

meager spade
#

thats how minecraft handles bit maps

#

client and server generate the levels themselves

#

imagine the amount of data neded to be sent every time a chunk needed to be updated, thats why they use seeds

worthy perch
#

I've wondered how Minecraft handles changes done to blocks.

twin juniper
#

hello guys I want to ask you I want to learn the multiplayer because I want to make multiplayer survival game like LastDayOnEarth so can you send me link or links from where to begin? I read the documentation in ue 4

worthy perch
#

ShooterGame is a good (if not best) example.

twin juniper
#

okay but I don't want to make FPS shooter game I want to make Survival game

#

the truth is that I was motivated and bucked by the updates that are coming up in the game and I want to make myself like that I'm not so new in the ue 4 but I do not know all the bluffing and such things and I'm very interested in the multiplayer so I'd like to learn it learned and understood and learned @worthy perch

twin juniper
#

shootergame is still the best example for what you want to do

thin stratus
#

Check my compendium, pinnged to this channel

#

That's the only generic resource I can give you :P @twin juniper

#

Anything else you will have to learn from other projects that either aren't survival or somewhere lost in the internet

idle flame
#

Hey,
I have a question, I have multiples actors and I need to generate something within thoses actors from a seed.
But I want to avoid generating this thing each time I spawn a new actor of this class.
Someone know a solution for this ?
Can I maybe create a static class that I would call one time for the first actor and then for the others actor I'll get the thing from this static class ?
Someone have any ideas pls ? Would the static class work ?

thin stratus
#

You can put a custom ActorComponent onto the GameMode

#

And let that one spawn the Actor

#

Then it can generate the seed once and use it for the rest of the Actors

#

Basically a manager

idle flame
#

So I can get the GameMode from any actor and then get the ActorComponent within this GameMode ?

#

But the GameMode dont exist on client side, Am I wrong ?

thin stratus
#

That's correct, didn't know you need to spawn from the Clients(?)

idle flame
#

Yes I need sry didnt specifed

thin stratus
#

So the Actor isn't replicated?

idle flame
#

It is but the value I want to replicate is wait to big to be replicated

#

I just thing the only option is to generate the thing from my seed on every client

#

Thx for the help ๐Ÿ˜‰ I'll do that

thin stratus
#

That's correct, but you can still spawn the Actor on the Server

#

And then replicate the seed

idle flame
#

Yep

thin stratus
#

Just don't mark that Array as replicated :D

#

So yeah, GameMode + ActorComponent

idle flame
#

Thx

idle flame
#

I'm having some problems on my client side when spawning replicated static mesh component,
I dont have prob on server-listen, only on client :

StaticMeshComponent <CompName> NOT Supported.

I also have this when walking on it :
LogNetPlayerMovement: Warning: ClientAdjustPosition_Implementation could not resolve the new relative movement base actor, ignoring server correction!

Someone have any suggestion pls ?

#

I'm spawning this actor containing mesh on server, and when it's replicated I'm sumulating the spawn of static mesh component from a seed

fluid flower
#

hey guys, anyone here run into the issue where listen server with a high framerate uses a ton more bandwidth than needed? If so, how did you mitigate this problem

idle flame
#

Maybe you can reduce the default brandwidth limit

autumn swift
#

does any one know how can i do in app purchase using stream plugin?

jade gazelle
#

Does anyone have experience passing Options keys/pairs through ClientTravel()?

#

I can't seem to get the Options to appear on my dedicated server, the client travel URL string looks correct when it executes but when the server accepts the connection, the only Options flag is SplitScreen=1

night jay
#

How does your travel url look like?

jade gazelle
#

the ClientTravel address that is being supplied is "192.168.1.155:7779&Param1=Test"

#

it loads the new server fine but it seems like the &Param1=Test gets dropped, as it won't appear in the InitNewPlayer Options string

pine kindle
#

I'm just using the editor's PIE multiplayer

#

it looks like it's restricting the client's ability to call events on the game state

pulsar slate
#

Hi all I need a little help with something
I've got this situation:

  • An object on a map which players (clients) can interact with (I use an input key for this).
  • Each player has an UI, when a player approaches that object, the UI is updated with a message (only on the client who approaches the object). This is exactly my problem, on the server this is workiong, on the client
    this doesn't work.
  • The UI is created throught the PlayerController.
    I am really confused on how to reach the UI from the Actor Character. Can someone help me?
    The interact action runs only on server and this part is working but I'm unable to make the UI part working.
    I'm not running with dedicated server option. 1 client acts as a server
worthy perch
#

@jade gazelle Perhaps try "192.168.1.155:7779?Param1=Test".

jade gazelle
#

@worthy perch I have been trying to solve this all last night and all this morning

#

and I just realized that was the issue

#

Ahhhhhhhhhhhhhhhhhhhh

#

Thank you

twin juniper
#

all the pinned to watch or? @thin stratus

thin stratus
#

@twin juniper The top most pin now again

twin juniper
#

okay

#

it is created by you?

#

@thin stratus

thin stratus
#

Yes

twin juniper
#

realy bro? omg

#

evala

#

is there in the tutorial info for dedicate server? not local? @thin stratus

winter harness
#

@thin stratus that conpendium was a life saver when I was learning UE4.

thin stratus
#

@twin juniper OnPostLogin is part of the GameMode class only

#

And DedicatedServer vs ListenServer isn't that much different

#

Only thing you have to take care of is that you don't run visual effects on the DedicatedServer

#

Either by only using "Remote" on "SwitchHasAuthority" nodes, or (if you also want ListenServers), filtering with "IsDedicatedServer" and a Branch

#

@winter harness (: glad it helped you

twin juniper
#

about my question had you made a dedicated server tutorial because I want to do a server-based multiplayer if I have to pay for a server but I think if you did not make a tutorial how to use a freeware server from the Microsoft website would it be a good idea?

#

@thin stratus

thin stratus
#

@twin juniper Games that require Dedicated Servers are very expensive if you need to host them yourself

#

And no, there are no such tutorials afaik

winter harness
#

You should look into things like amazons game server hosting since it handles a lot of the much more difficult things. assuming you are using an executable dedicated server. Also SpatialOS is a very cool solution.

#

All requires more advanced skills to set up and implement though. If you just want to lease a windows machine to host one server for testing amazing lightsail is probably the most affordable option. Linux is much much cheaper though

jolly siren
#

Has anyone seen issues where a dedicated server hangs and stops logging? It seemingly has nothing to do with our code and happens at different times.

#

It is a somewhat rare issue but is happening

twin minnow
#

Having issues with setactorscale3d, I've tried running it in both server and netmulticast functions but the size of my actor still isn't changing. Anyone else ever run into this issue?

twin juniper
#

okay I understand but is there a way for now for now to download the fre dedicate server from the microsoft site to configure it aand to use it?

#

@winter harness

thin stratus
#

The only thing you would download is the Source of UE4 of the specific Engine Version you are using.

#

Then you follow the DedicatedServer tutorial (which you can easily find via google) and compile your own DedicatedServer.

#

That one you can host whereever you want.

twin juniper
#

okay I use ue 4.18.3 version what to download? @thin stratus

bold mica
#

quick question, does the validation function get called if the rpc is called locally on the server?

#

apparently yes

#

does ue4 autokick players after too many failed validation checks?

thin stratus
#

One "False" should already get rid of them

twin minnow
#

do changes to scale replicate? I've tried setting the actor scale, world scale, and relative scale

winged badger
#

not by default

#

it is rarely changed, so it would not make much sense to clog the bandwidth of 99% of games that don't alter scales at runtime by default

twin minnow
#

would there be a way to do so?

#

ive tried calling setscale in server and netmulticast methods

#

@winged badger

twin minnow
#

actually nevermind

#

it seems that the netmulticast function is not being called on the clients for some reason, just the server

twin minnow
#

does anyone know how one would get a netmulticast function to run on all clients for an unowned actor? I'm trying to recreate something like the storm from fortnite, where I have a cylinder that gets smaller over time

#

correction, the actor is owned

red ledge
#

How would I link a database with a data asset? I have a remote database that should have tables containing weapon attributes to be able to update them for all clients but in order to spawn them in the world I would need to have some sort of a reference to them in unreal
Do I have to create the data assets beforehand and update them from the database using a shared ID or something? Probably the only way to have a reference to stuff like skeletal meshes too or is there another option?

twin minnow
#

actually nvm the actor is unowned

#

i guess my question now is, if I have an actor placed into a level and want it gradually shrink overtime and have that be replicated to the clients, what would be the best way to go about this since the actor is not owned by anyone technically?

thin stratus
#

Ownership is only required if you perform server or client rpcs

#

You can still use Multicast and Repnotify variables etc

twin minnow
#

hmmm

#

that's strange because ive tried using setscale on this actor, which ive set to replicate, in a multicast function and it doesnt run on client

#

according to logs

#

right now i put a netmulticast function in a settimer to have it run every second to shrink the actor by a certain amount

#

does this approach make sense?

#

@thin stratus

thin stratus
#

Na, you want to use a RepNotify

#

Vector for example and use that in the repnotify function

twin minnow
#

thank u i will try this

idle flame
#

Hey,
Someone know how in c++ I can print a msg only from Localy controlled PlayerState pls ?

if (IsLocallyControlled())
{
    APlayerState *state = GetController()->GetPlayerState<APlayerState>();
    if (state == nullptr)
    {
        GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::Blue, FString::Printf(TEXT("Team : nullptr")));
    } else {
        GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::Blue, FString::Printf(TEXT("Team : %d"), state->GetTeam()));
    }
}

I've try this but the messages are only on 1 client, the other client have nothing on screen.
What am I doing wrong ?

#

This code is in my tick function within my PlayerCharacter, I dont know if it matter

thin stratus
#

For once, you can get the PlayerState directly inside of the Character

idle flame
#

And it will give me the LocalPlayerState ? or a random one ?

winged badger
#

one associated with pawn's player controller

#

its in PlayerState variable

#

and it being on Tick

#

it will return nullptr for a while

#

until the PS replicates

idle flame
#

So, if I want to store a team for each player It's not a good idea to store it in PlayerState ?

winged badger
#

try virtual void OnRep_PlayerState() override; instead of all that

#

doesn't even matter from controller or pawn

idle flame
#

Controller is only store on the owner client & server, pawn & playerstate are stored on all client & server

winged badger
#

if you want to print it only if its local, doesn't matter

#

as both pawn and controller are around

idle flame
#

Ok

winged badger
#

that function will get called on each PlayerPawn after their PlayerState variable is valid

#

and only on clients

#

if you override pawn's you'll get a printout for every player pawn

#

if you override controller's you'll get a printout only for the local one

#

on each client

idle flame
#

So If I print my message from controller it's supposed to work ?

twin minnow
#

@thin stratus does the repnotify function get called every time the replicated variable gets updated?

thin stratus
#

jop

twin minnow
#

i tried implementing this in c++ and it seems that the function is not getting called

#

im updating this property server side currently

thin stratus
#

C++ requires the server to call OnRep by hand

#

In addition

twin minnow
#

oh i see

#

then what's the difference between this and a netmulticast?

thin stratus
#

Multicast -> Fire and Forget. Whoever is in relevancy range gets it, others don't.
RepNotify -> Calls for players who aren't relevant but become relevant by either getting in range or just joining the server later.

twin minnow
#

interesting

#

i will try this thank u again

#

@thin stratus so i got the on rep function to call, but setactorscale3d doesn't seem to be doing anything, is this normal behavior?

copper owl
#

Ok so in my HUD before a session is joined, there is a checkbox

#

When checked, it sets the value of a replicating boolean in the PlayerState to the value of the checkbox

#

It then prints the value just to check

#

just fine

#

wait

#

I am trying to put the next part in gamestate before I carry on with describing my issue

winged badger
#

HUD is only local, so if you expected that replicated variable to be propagated, you're in for a dissapointment

#

with notable exception of listen server host

twin minnow
#

@thin stratus so i was able to actually get my actor to shrink through a netmulticast function in my character class

#

it's strange how i couldn't do that in the actor class itself

thin stratus
#

Well just be aware that people who get relevant later won't see that effect

twin minnow
#

that's what im worried about

#

@thin stratus is there a specific place where i should be called setactorscale3d in my actor class if i want everyone to see it shrink?

copper owl
#

ok forget what I said before @winged badger

#

In the HUD

#

I am setting the value of the checkbox to the value of respawn in the gamestate

#

In the game state I am running this on tick

#

It joins a new level when I create the session and I feel like that is causing the problem

#

so I think I should set all of this after I join the level

#

Still no

winged badger
#

that is terrible

copper owl
#

gee thanks

winged badger
#

you are sending a reliable RPC to Server, on Tick, for every PlayerPawn from every Client

#

so, you're welcome

copper owl
#

No I'm not

#

There is a branch before any sort of replication happens there

#

And on true, it sets itself to false indirectly

grand kestrel
#

Shouldn't be using any get all actors nodes either. They scale poorly and are never necessary with proper chain of references

winged badger
#

all you need to do is have a Replicated boolean Respawn

#

in your PlayerState

copper owl
#

I did

winged badger
#

and a ServerRPC to set it server side when its changed

#

like having a ServerSetRespawn event with boolean input in PlayerState

#

and instead of setting a variable directly, like on first attempt

#

you call that event and push the boolean thru the RPC

#

you don't even have to check if you're on server or not

copper owl
#

I don't think you quite understand

#

Every client needs to be set to the same as the host

winged badger
#

and every client controls his respawn bool ?

copper owl
#

No

#

He controls everyone elses

winged badger
#

that is... weird

#

and what does that boolean do?

copper owl
#

It decides whether you respawn or spectate

#

It is set when the host is setting up his session

winged badger
#

then it controls only its own bool, as in can set it

copper owl
#

what?

#

I know what I am doing is wrong

#

but I don't know the right way

winged badger
#

to be clear

#

you want the client to be able to choose the value of its respawn boolean?

copper owl
#

no

#

When the host creates the match, he checks the box depending on whether he wants respawn enabled or not

winged badger
#

how did you imagine 1 bool will work for those 5 players?

#

its for all of them?

copper owl
#

yes

winged badger
#

ok, getting somewhere

copper owl
#

Everyone's respawn bool should be the same

#

Including the hosts

winged badger
#

and how do you transition from that menu to the actual level they play in?

copper owl
#

I create the session, remove the widget, set the input mode to game only, and open the map with the "listen" argument in options

winged badger
#

no server travel?

copper owl
#

no

#

I don't know what that is so I'm assuming no

winged badger
#

in that case you need to dump the Respawn value to an object that persists through the level transition

#

which is in this case, limited to GameInstance

copper owl
#

Game Instance

#

Thank you

winged badger
#

there is no point keeping it in PlayerStates

#

as its same for everyone

copper owl
#

That is what has been causing me issues

winged badger
#

GameState or GameMode would do nicely

#

depending on client needing to know the information or not

copper owl
#

I can't get it transitioned from level to level

#

I tried everything but gameinstance so far

winged badger
#

then server, say, GameState on BeingPlay can just fetch the information from GI and set its own value

#

GameInstance cannot be in any way replicated

#

using Seamless Travel would allow for the GameMode, GameState, PlayerStates and PlayerControllers, along with anything attached to them to persist through the level change

copper owl
#

Trying this out now

#

I'll look into the server travel thing

#

(incredibly new to networking & stuff)

winged badger
#

i can tell ๐Ÿ˜ƒ

#

you could also send it as an argument to OpenLevel

#

but i don't know how to do that off the top of my head

copper owl
#

It still isn't working for some reason

#

I might have done something wrong though

#

So the GameInstance is the same throughout all levels?

winged badger
#

GameInstance persists from the moment you start the Game

#

to the moment you close it

copper owl
#

Ok

#

So I have respawn being set in my GameInstance

#

This in my GameState

#

Oh wiat

#

Respawn is replicating that might be an issue

#

might

winged badger
#

you need to do it only on server

#

or clients will overwrite the replicated value

copper owl
#

I think I can figure this out from here myself

#

I just needed a way to transition through levels

winged badger
#

BeginPlay runs on every machine

#

so with current setup

#

server sets the respawn to value cached in GI

#

GS replicated with correct values

#

runs BeginPlay on clients

#

who fetch false from their own GI (default value)

#

and overwrite whatever they got from server

copper owl
#

setting respawn to false

#

got it

#

Switch Has Authority is daddy

#

wait no

#

yeah that should work?

copper owl
#

I moved it to gamemode and it works!

#

I spent 2 days trying to do this!

#

Thank yoU!

twin minnow
#

@thin stratus do you know how one would spawn a server owned actor?

#

or if it's even possible

grand kestrel
#

What does server owned even mean

#

The owner is an actor not a client

twin minnow
#

im not sure

#

im trying to recreate the storm in fortnite

#

so i want to spawn an actor that shrinks on its own

grand kestrel
#

It would just be an actor set to replicate and spawned on the server

copper owl
#

You could just make an actor and set it to replicate?

twin minnow
#

where would i spawn it exactly?

#

gamemode? level blueprint?

grand kestrel
#

Game state

#

If it's in every level

twin minnow
#

yes

grand kestrel
#

There you go

#

You could always just physically place it in the level editor

twin minnow
#

maybe when i do setactorscale3d it'll work

grand kestrel
#

The scale doesn't replicate

twin minnow
#

i tried that before just to test setactorscale3d and it didn't work

#

also i want to spawn it in a random location in every level

#

but yea i tried setting the scale in a netmulticast and it didn't turn out great

grand kestrel
#

You'll need to either make a replicated value with onrep or multicast RPC which isn't the best idea here

twin minnow
#

it only worked when i did a netmulticast in the player class

grand kestrel
#

Or you could simply RPC the shrink events

#

Then run the shrinkage locally too

#

So you'd have multicast RPC, start shrink, which simply sets a bool and a start time, then on tick it would scale it over time until start time + duration exceeds current time then disable the bool

#

Since the servers applying the damage from the storm doesn't help potential hackers to change what happens locally

twin minnow
#

i tried doing something similar to this in the storm actor class but it didnt seem to scale

#

down

grand kestrel
#

Then you did it wrong to be blunt

twin minnow
#

most likely

#

i used settimer

#

instead of tick

#

in my storm actor class I had something like this in begin play,

#
FTimerHandle StormShrinkTimerHandle;
GetWorldTimerManager().SetTimer(StormShrinkTimerHandle, this, &AStormActor::NetMulticastShrinkCircle, 1.f, true);
#

and then the netmulticast function looked like,

#
FVector OldScale = GetActorScale3D();
FVector NewScale = FVector(OldScale.X * 0.99, OldScale.Y * 0.99, OldScale.Z);
SetActorScale3D(NewScale);
#

@grand kestrel this only works for some reason in the player class, not the storm actor class

buoyant wedge
#

hello guys. I can't join on the session that i created. This is my test. Is in VR

Thx for any suggestion :)

twin minnow
#

wow

#

all i had to do

#

was set my storm blueprint to always relevant

thin stratus
#

@buoyant wedge You need to pass the SessionInfo to the Widget you create

#

So that each created widget has the specific session in it

#

And then when pressing one of these widgets, you call "JoinSession" with its info

twin minnow
thin stratus
#

Always relevant is technically bad

#

Cause that makes it relevant for literally everyone

twin minnow
#

but in this circumstance, couldn't a storm be relevant to everyone?

#

i guess ill see how the bandwidth is affected by this

buoyant wedge
#

I see the join session to the server list. But can't join.

autumn swift
#

how can i replicate physics objects?

thin stratus
#

You technically just replicate their movement

real yacht
#

how can i replicate interface function?

opaque tinsel
#

how can i get client/server to spawn their own local, non-replicating actors? such as items

worthy perch
#

Just call SpawnActor locally.

astral gust
#

Hey guys, so we have an issue where actors that are in the map aren't being destroyed properly. The actor is set to replicate, and we call a multicast to then call Destroy(). When its invoked from the server, the actor does get destroyed, but when the destroy is invoked from the client the actors isn't destroyed at all. Any ideas?

#

We are testing it by running two game instances in the editor, without joining a session. This does output a warning about not being able to find the owner, but we aren't sure if that is the issue.

worthy perch
#

Clients can't destroy the non-replicated version of a replicated actor.

#

If the actor is replicated, just call destroy on the server.

astral gust
#

As in calling UFUNCTION(Server, Reliable, WithValidation) void Server_DestroySomeActor(); from the client to the server?

worthy perch
#

You can do that.

astral gust
#

Would it also matter if the function is called from the actor itself?

worthy perch
#

I don't think it would matter.

astral gust
#

Alright, thanks!

#

I will try it now and let you know ๐Ÿ˜ƒ

#

Okay so that gives the following output: UNetDriver::ProcessRemoteFunction: No owning connection for actor BP_Gatherable_Stone2_5. Function ServerDestroyGatherableActor will not be processed.

#

Which seems to prevent it from being invoked by the client.

bitter oriole
#

You can't call RPCs on object from the client that the client doesn't own

astral gust
#

Although when done from the listen server it replicates to all clients.

#

Hmm okay that makes sense.

bitter oriole
#

If the client player doesn't own the object, you need to basically RPC on something like playercontroller to tell the actual owner on server to do stuff

astral gust
#

Alright I will try that and see if we can make it work.

jolly siren
#

Has anyone had an issue with bot's using more than 3x as much bandwidth for replicated movement than human characters?

#

@worthy perch I see you were running into bandwidth issues with replicatedmovement for your AI characters. Did you ever get this figured out?

worthy perch
#

No, I have not really investigated it yet. However, at this moment, I don't think there's anything that can be done to reduce it, unfrotunately.

jolly siren
#

Okay, I'm experimenting with reducing the NetUpdateFrequency for bots

#

I had them at 100

#

Which seems to not be necessary for bots at all

#

Reduced all the way down to 10 and didn't notice any issues yet

worthy perch
#

Mine are at ~10, which is still quite a lot of bandwidth. Movements can be pretty choppy and rotations are a bit stiff.

jolly siren
#

Yeah, I'm trying to find a good number to settle at. 100 was definitely overkill for bots tho that is for sure.

Bots in my game were using 2.43 KB/s for 7 of them. And changing to 10 NetUpdateFrequency reduced that all the way down to .63 KB/s

#

I assume you probably have a ton of bots tho

#

If that isn't reasonable enough for you

#

What ClientNetSendMoveDeltaTime are you using?

#

That is another place to save a lot of bandwidth for movement

#

You could even try experimenting with have different values for bots and humans there

worthy perch
#

Thanks, I wasn't aware of ClientNetSendMoveDeltaTime, I will look into this. I just did a quick profile and my ReplicatedMovement is at 14.1 bytes average size for 5 bots at 7.5 NetUpdateFreq.

#

I'm a bit confused on how some multiplayer games can have ~100 bots in one place with several people. The net bandwidth must be so high, but maybe that's okay?

jolly siren
#

Yeah some games have higher network usage. It's also possible to not using replicatemovement and do it yourself.

wary wyvern
#

Guys. I spawn players as spectators at start, but spectator camera rotation points to 0 0 0, despite the fact it spawns at player start. Is it possible to tell spectator pawn to receive player start rotation? I guess it is controller rotation, so I need to tell controller to set rotation based on player start actor

#

Because of that, my character has wrong rotation as well at spawn

vale steeple
#

Hi guys! I need to create a Dedicated Server for an Android game... I need to do something different to make it for Android or I make it for Windows and will work?

jolly siren
#

It should already do that by default @wary wyvern

#

Oh spectators, missed that part

wary wyvern
#

@jolly siren My controller with spectator rotates toward 0 0 0, and this is the reason why my character spawns with 0 0 0 rotation as well. Right now I solved this issue by setting bUseControllerYawRotation to false and set it back to true after character is possessed

jolly siren
#

That makes sense to me, I think that solution is fine

chrome bay
#

ClientNetSendMoveDeltaTime will only help for client-controlled pawns, not bots

#

For remote chars, replication frequency is entirely controlled based on the net update freq

#

Having 100 characters in one place with multiple players is... ambitious

jolly siren
#

What net update freq are you using for bots James?

chrome bay
#

No bots in HLL ๐Ÿ˜ƒ

jolly siren
#

Ahh okay gotcha ๐Ÿ˜ƒ

chrome bay
#

But we've dropped it down to less than 1 for some items

#

And we're using Rep Graph which helps a bit with processing time

#

But **** me.. never again would I switch to rep graph mid-project

jolly siren
#

haha yeah I don't think we ever plan on touching that. Doesn't seem necessary for UT type gameplay

chrome bay
#

Yeah, and the flexibility you lose in the process can be a pain too

#

It's also buggy asf

#

Best to wait until it's out of experimental, unless you have UDN access :/

jolly siren
#

Makes sense, yeah I would like to learn it just to know it eventually

chrome bay
#

It's a good idea, but you pretty much need to know the full functionality for your game before using it I think.

#

If you set it up wrong initially it can cause nightmares

#

But it does allow you to do some crafty stuff. E.g. playerstates we use a net update freq of 1, but even split those updates out accross multiple net frames - so it sends a max of 50 in one go I think is how we have it atm

jolly siren
#

Ahh yeah the complexities of a large number of clients in a match sound fun ๐Ÿ˜ƒ

chrome bay
#

it is not ๐Ÿ˜„

#

thank god for fortnite

jolly siren
#

haha yeah it's an amazing piece of tech โค

vale steeple
#

Hi guys! I need to create a Dedicated Server for an Android game... I need to do something different to make it for Android or I make it for Windows and will work?

jolly siren
#

I'm still not understanding why bot movement would use more network than a human character tho

thin stratus
#

Did UE4 have a replicated Control Pitch somewhere?

#

For an AimOffset

#

Thought I found a function or variable once, but can't recall

#

@radiant falcon Buddy, you once wrote on a Forum Thread that "Authority does not equal Server. Here the Client has Network Authority over its Pawn." and I'm pretty sure that's wrong.

#

Client has Ownership of it's Pawn, but the Server will always have the Authority if it's a Replicated Actor.

radiant falcon
#

that was prob. a long time a go

#

xD

thin stratus
#

Yeah 2015 :D

#

I also like the additional "It's a common beginner mistake."

radiant falcon
#

yeah well XD it is what it is

thin stratus
#

(I also wrote wrong stuff on forums and answerHUB, just thought I might ping you about it :D)

#

That said, I really don't want to replicate the ControlPitch by hand

radiant falcon
#

pretty sure you still need to do that if you want all the clients to have it

#

i believe pitch is between owner and server by default

thin stratus
#
/** Replicated so we can see where remote clients are looking. */
    UPROPERTY(replicated)
    uint8 RemoteViewPitch;
#

Not exposed

#

fml

grand kestrel
#

@thin stratus GetBaseAimRotation from pawn is on all. Follow that up the chain if you want to check. I use it for aim offset for this reason

radiant falcon
#

oh thats noice

thin stratus
#

Seems to work, but updates very slowly

#

Guess I'll interpolate it

#

Thanks! @grand kestrel

grand kestrel
#

Change network smoothing mode to linear and see if it helps just in case. Exponential is bugged in some ways but not sure if it applies in this scenario, probably doesn't

#

They are replicating a uint8 for the pitch,fyi

#

So losing precision

thin stratus
#

Interpolating is probably gonna solve it

grand kestrel
#

Yeah

#

I use a little too

#

You should do a role check and get it from GetControlRotation if server or owning client

#

Since it won't be compressed

thin stratus
#

Yeah I also have the small problem that the AimOffset goes from -90 to 90

#

And the Pitch from 270 to 0 to 90

#

.>

grand kestrel
#

Just normalize

#

GetBaseAimRotation().GetNormalized()

thin stratus
#

Blueprint

grand kestrel
#

Delta and subtract zero

#

It normalizes

#

Looks retarded but it does the job

thin stratus
#

Just leave B all zerod

grand kestrel
#

Yeah

thin stratus
#

Yop that does the trick

grand kestrel
#

Delta rotator in BP is (a-b).GetNormalized()

#

It's silly that normalize isn't BP callable

#

If it's code others will read then add a comment to the delta

#

So they don't think WTF and delete it

thin stratus
#

There is tons of stuff they could properly expose :P

#

Now to figure out why an out of the box character lags (Server Char on Client Side) >.>

grand kestrel
#

What kind of lag. Prediction correction, aim offset jitter, etc

thin stratus
#

A good chunk of everything right now.

#

Predriction corrects and Aim offset is also still jittery even with the interpolation

#

But I'm sure I know why :P we have a lot of replicated actors in the scene atm

grand kestrel
#

Ah

thin stratus
#

They might fill up everything

#

Yop, it's them. Let's optimize!

grand kestrel
#

How many players in one server are you aiming for

thin stratus
#

Ah just like 4-6 atm

grand kestrel
#

Or is it bots too

thin stratus
#

Main issue is the amount of Physics Actors we currently have on the screen :P

radiant falcon
#

since im here, do you guys have any clue why when playing from server host, the clients look jittery, but when playing from client characters are smoother? (thats with default char. movement component etc.)

grand kestrel
#

Oh the server can't keep up

thin stratus
#

Marked them as "Start Awake: False" which already solved a good thing

#

Yeah, will have to replicate their locations etc. a bit different

#

Server moves them but the replication of them is so much that the server's character isn't replicate often enough anymore

#

I love how easily you can create these problems.

jolly yoke
#

Just wanted to ask, how a server or rather everything is set up to make battle Royale/multiplayer games?

thin stratus
#

BR Games use DedicatedServers

#

And a Backend that matches x Players together before request a Server Instance.

#

You want a scaling Service for this, so that only Service are active if you need them.

#

Still pretty pricy

jolly yoke
thin stratus
#
  1. Battle Royal games are not for "Single Person" Dev Teams.
  2. I don't know, I don't use Udemy Courses.
  3. By the name of it, it's most likely just the basic network code, nothing related to hosting servers and their backend.
#

Hosting BR Servesr (or any form of Matchmaking Servers) costs a few hundred.

jolly yoke
#

Is starting with steam multiplayer the best choice?

thin stratus
#

The best option for small teams or a single dev is ListenServer Steam Multiplayer

#

at least right now

jolly yoke
#

Hosting BR servers costs like how much?

thin stratus
#

Depends on:

  • Your Game (how many resources it needs)
  • Amount of Players
  • Windows or Linux Server
#

You can go to Amazon GameLift and check the Linux Server Prices

#

Still vague cause you probably don't know what sort of Tier your DedicatedServer needs.

#

(you can technically host multiple servers on one GameLift Server Instance, but without knowing the required specs, you can only guess)

jolly yoke
#

I am confused. This whole networking stuff is like ๐Ÿค”

thin stratus
#

:P Then don't make a complex Multiplayer Game like Battle Royal

chrome bay
#

If networking stuff confuses you, don't start with a battle royale game

#

ninja'd ๐Ÿ˜„

#

Start small

fringe dove
#

on the contrary, wait yeah

jolly yoke
#

Something like CSGO?

fossil spoke
#

Make a small puzzle game or something

thin stratus
#

Still pretty big, but yeah a very simple shooter is also a thing

#

If you keep it to shooting some balls at each other

chrome bay
#

Multiplayer complicates game development 10-fold

jolly yoke
#

A simple shooter 12 v 12

thin stratus
#

Doesn't matter if 1vs1 or 12vs12

#

If you can pull of 1vs1, then you can pull off 12vs12

#

You first have to understand the whol replication process

jolly yoke
#

I'm reading your PDF eXi

thin stratus
#

That's a good start :P

#

Next step, read @chrome bay tweets where he cries about being a network gameplay dev and prepare for the same sadness.

chrome bay
#

๐Ÿ˜„

fossil spoke
#

Heh

chrome bay
#

i cri erytim

fringe dove
#

1v1 testing only and you'll end up with a lot of bugs that only show up later with >=3 total players

thin stratus
#

Yeah maybe make it 2vs2

#

Just in case :P

#

Cause then you have all 3 roles in it. Server, Local Client and Simulated Client.

jolly yoke
#

I really need an individual who could clear me out

fringe dove
#

yeah that's the main thing, it hit me when moving to dedicated server

thin stratus
#

Paid if you really want a good one though

jolly yoke
#

I had some random questions

#

Not much

chrome bay
#

Oh the questions will flow soon ๐Ÿ˜„

jolly yoke
#

Can't I make my own server using a pc rig?

chrome bay
#

If you want the outside world at large to play on it, then I wouldn't advise it

#

If you're playing with a few friends? Sure

jolly yoke
#

I meant for a commercial game ๐Ÿ˜‚

chrome bay
#

Definitely not then

#

It won't have enough power, and it absolutely won't have enough bandwidth.

#

Then again, given the chances of commercial success in the Battle Royale genre right now - you might be fine after all

jolly yoke
#

A BR can be made using steam multiplayer?

chrome bay
#

Sure it can

jolly yoke
#

Damnnn.. And if you want to further grow it up to multiple platforms then set up your own server. Right?

chrome bay
#

Well you would setup servers all around the world using some kind of 3rd-party server provider usually

jolly yoke
#

Like PUBG did?

chrome bay
#

Well like any serious multiplayer game really.

jolly yoke
#

They first started with steam and then set up their servers

chrome bay
#

Your average home PC wouldn't last 10 seconds trying to host games for the outside world

jolly yoke
#

Yeah

#

PUBG started with steam multiplayer if I am correct?

chrome bay
#

They still are AFAIK

#

Steam multiplayer doesn't really mean anything

#

steam is just the middleware service between the game and the server hosting the game

jolly yoke
#

Umm?๐Ÿค”

chrome bay
#

This is exactly why you shouldn't be considering a Battle Royale for a first project ๐Ÿ˜‰

#

start small, learn stuff, then work up

jolly yoke
#

Can you please explain if am not irritating ya

chrome bay
#

The path of communication is Server -> Steam Servers -> Client Machine when it comes to connecting to a game through Steam

#

An instance of your game registers itself with Steam, then clients use the Steam client to find sessions.

jolly yoke
#

PUBG was using this when they started new?

chrome bay
#

They're most likely still using it now

#

Unless they've developed their own cross-platform matchmaking service since then.

#

Like for example, Rocket League

#

Rocket League uses it's own matchmaking service, because they wanted cross-platform play. Steam Matchmaking can't do that.

jolly yoke
#

Only PC gamers can use steam.

#

That's why fortnite has its own match making server for cross platform

chrome bay
#

Yep

jolly yoke
#

Now it's getting clearer

chrome bay
#

Epic have developed their own online services, so that they can link players together their own way.

#

But developing that kind of infrastructure takes years

jolly yoke
#

Wasn't there a news that they are planning to develop the same for small developers?

chrome bay
#

They're going to be opening it up to everyone yeah, but I don't think they're rolling that out until the end of the year

#

And I expect for the first year or so it'll be closed off to select studios while they test it etc.

jolly yoke
#

Yeah

#

That would be great.

#

The same way as steam, would Google play store and apple's app store would provide a platform for same?

chrome bay
#

I'm not sure, I don't think they have the full feature set of Steam I.E. matching making etc.

#

They might, but I have no idea

#

I shall never touch mobile again with a barge pole

jolly yoke
#

Need to research a lot then. ๐Ÿค”

#

So you need to rent some third party servers and pay them monthly so that gamers could play your game on cross platform all over the world?!

thin stratus
#

Most likely yes, if they don't host themselves (which would allow cheating)

jolly yoke
#

Got it!

#

@thin stratus, have you explained about player bandwidth, packet size etc in your PDF?

thin stratus
#

Nope

jolly yoke
#

What is spatialOS gdk for unreal?

plush wave
#

if a player disconnects and reconnects do they use the same player state?

tribal solstice
#

it's very confusing to me that there is no proper, complete, updated documentation on how to do this.

red glade
#

@tribal solstice dedicated server isn't technically possible using blueprint only. But it pretty much is blueprint only, just with some rather empty CPP code page fot Target CS files

tribal solstice
#

@red glade Got it. Is that wiki still relevant and the proper way to set it up?

red glade
#

Ue4 supports dedicated server basically out of the box, I've setup myself a few times using that wiki because I'm a rather amateur myself

tribal solstice
#

@red glade I am having trouble understanding where that ends and where nodes like 'Create Session' begin. I don't really see where the level and player pawn are being selecting.

red glade
#

Remember you need to use ue4 from source (built yourself from GitHub clone)

tribal solstice
#

@red glade Good to know, thank you

red glade
#

Blueprints seem to be a little lacking on networking sessions, level is picked by server on start

tribal solstice
#

@red glade Ah so if I do a default map within the server build that will be the map?

red glade
#

Pretty much

#

In ue4 your game mode maps & modes in project settings has a "default map"

#

That'll load instantly when the ue4 server starts

tribal solstice
#

@red glade I see, and then from there the server can call 'Open Level's which will trickle down to the clients?

red glade
#

Should work, yes

#

Make sure the clients do an "open level" and have the server IP as the world

#

As far as I know ue4 servers have weird port systems as well, it's pretty much stuck at one port.

tribal solstice
#

what do you mean by 'server IP as the world'?

red glade
#

Like "open level > 127.0.0.1"

tribal solstice
#

and that triggers each time a new level is opened or only at beginning?

red glade
#

That's so client connects to server

tribal solstice
#

so that's original connection logic

red glade
#

Yes, but a client can't issue the open level command itself

jolly siren
#

@plush wave yes, see the pinned compendium. It's covered there.

tribal solstice
#

right. that makes sense

red glade
#

Ethan you got a good way to do cpp networking ๐Ÿ˜†

tribal solstice
#

@red glade appreciate the help!

smoky ore
#

Hi, I have a question regarding character movement for a personal project. It seems the animations are playing at a lower framerate (though he movement itself is fine), what would this be an indication of?

#

I'm using a listen server for reference

red glade
#

If client plays animation itself it should be fine, if server is replicating movement to client it'll be "laggy".

Prime example (my learning experience) was making a box open smoothly, the box would be fine on server and would lag around on client.

glass plaza
#

Having an issue with my collisions in Multi. On both Client & Server, if a player hits an actor, their Hit() event is properly fired server-side. However, if something falls on my players, on the Client, I only get a Client Event.

real yacht
#

does gameMode automatically add playerState in PlayerArray (inherited array from GameState) or i need to add playerState when postLogin is called

#

?

thin stratus
#

PlayerStates add themselves

#

You might notice that the PlayerArray isn't replicated, yet all Players have access to all PlayerStates in it.

#

A PlayerState registers itself to the Array, so the order for each client might be different.

#

You don't have to add them by hand.

#

@real yacht

real yacht
#

thanks

#

so is it correct to save in playerState informations like (email, nickname, picture, telephone number, etc)

#

?

#

i'm reading network compendum, i think that all relevant informations for player should be in playerState

#

?

bitter oriole
#

Something like telephone number should be absolutely off limits ?

#

PlayerState is public to all players

real yacht
#

i give example

#

of variables, string, ints, floats, etc

#

doesn't matter which information

bitter oriole
#

PlayerState is for holding all public, replicated, data on players, that all players on the level need to see.

real yacht
#

okay, so i can store player avatar for example there

bitter oriole
#

Yes.

real yacht
#

okay, thanks

urban dew
#

@thin stratus

#

something i've noticed is it seems that the blackboard vector

#

and the move to location

#

dont get allocated together

#

they both get assigned a seperate object?

#

ill see if saving it changes it

real yacht
#

after adding MyGameState and MyPlayerState , my pawn is not spawned on start, i got spectator pawn

#

probably is some bool, but i can't find it.

#

any hint here? ๐Ÿ˜„

#

@thin stratus

thin stratus
#

You need to make sure that you don't mix up GameMode and GameState with GameModeBase and GameStateBase

#

Only GameMode with GameState and GameModeBase with GameStateBase

#

Not GameMode with GameStateBase or other way round

real yacht
#

MyGameState is inherited from GameStateBase

thin stratus
#

And your GameMode?`

real yacht
#

MyGameMode -> GameModeBase

#

my settings

opaque tinsel
#

im working on an item spawner and im trying to have it spawn locally as in each client and server spawns their own, how would i do that?

idle flame
#

You have multiple solution, you can replicate your actor : When you will create an actor on server, the client will create the same actor. Or if you want to locally spawn it, you can use rpcs, and when you spawn your actor on server, you call this rpc to make it spawn on all clients too

#

Someone know why I have this error when walking on a mesh spawned on client & server ? LogNetPackageMap: Warning: FNetGUIDCache::SupportsObject: ProceduralMeshComponent /Game/FirstPersonCPP/Maps/UEDPIE_2_FirstPersonExampleMap.FirstPersonExampleMap:PersistentLevel.Chunk_0_0.Chunk_0_0 NOT Supported.

bitter oriole
#

Usually it means you've created a client-only, non-replicated component on a replicated actor

idle flame
#

Yes, but I'm using seed so this actor is spawn on the same place on server & clients

#

Cause I cant fully replicate this actor

bitter oriole
#

Why not ?

idle flame
#

Cause my array of meshes is wayyyyyy too heavy and the stack cant handle that

bitter oriole
#

You don't need to fully replicate the procedural content - but you should mark the mesh as replicated, and spawn it on the server alone

idle flame
#

I've read that a mesh can't be replicated

bitter oriole
#

Any component can be set as replicated

#

That doesn't mean its settings, or content, or values, will be

idle flame
#

But I'm spawning meshesh at runtime after the constructor & the beginplay function

hardy dome
bitter oriole
#

Setting a component as replicated just means it will be created on clients after being created on server, and both client & server will know about it, be able to understand it's the same object

#

That's why you have a warning

#

You can spawn the mesh in constructor, and build the proc content after that

hardy dome
#

Spawns for the server tho

idle flame
#

Ok thx I'll try that

hardy dome
#

The altar wasn't set to "Replicates" goddamn, I thought I set it. What a stupid mistake

#

Thx guys lol!

opaque tinsel
#

yes i can get it to spawn in all server, however say when my client picks it up, it will no longer exist for my server and other clients, im trying to have it where even if the client picks up the item, it will still exist for the other clients or server until they pick theirs up

idle flame
#

@bitter oriole I'm creating this actor at runtime, and I've set it to replicated but I still have this error, If I create an empty one at construction and then fill it will it work ?

bitter oriole
#

Do you create it on the server only ?

idle flame
#

No I create it on client & server

bitter oriole
#

Create it on the server only

idle flame
#

But client wont see it ?

bitter oriole
#

It will because you just set is as replicated

real yacht
#

Can anyone help why my pawn is replaced with spectacorPawn on game start?

opaque tinsel
#

change it from your game mode

real yacht
#

it is set to my pawn

#

but on start, that myPawn is destroyed an spectacorPawn is spawned

#

i figure it out

#

i have overrided this event in myGameMode

#

so, game mode was expecting from me to handle new player

idle flame
#

@bitter oriole Thx it worked : Need to first spawn for server the component in constructor + set it to replicated and then I can use it in client

raven holly
#

@thin stratus You ever got seamless travel working from a menu map to a dedi?

#

Im trying to use ClientTravel but it just reloads the menu map

thin stratus
#

Connecting to a Server is not a Seamless Travel

#

@raven holly

raven holly
#

hmm

#

so you cant do a non-blocking load to a dedi?

#

Looking at the docs, this is what it's meant to do

bitter oriole
#

IIRC you can't seamless travel to connect to a new server

winged badger
#

you recall correctly

#

seamless travel is just for changing the map without having to connect to anything

raven holly
#

How does fortnite do non-blocking loading then

winged badger
#

you can still ServerTravel, just not Seamless

raven holly
#

that's blocking no?

winged badger
#

don't recall ๐Ÿ˜„

raven holly
#

as in the process will freeze

winged badger
#

what will freeze?

#

loading widget?

raven holly
#

no the whole process freezes while it loads

#

so if you have a spinning loading screen for example, it wont actually move

winged badger
#

yeah, MoviePlayer

#

it runs off thread

#

so it won't block

#

just google Unreal Loading Screen and you'll land on the complete-ish wiki page for it

raven holly
#

๐Ÿ˜ฆ

#

i wish async loading to servers was a thing

bitter oriole
#

I've actually tried that in depth some time ago, thinking it would work

#

In single player it works perfectly ofc

raven holly
#

there's a post on UDN asking about loading screens from 3 days ago, will wait for a reply and see if there's updated methods, Surely something came out of fortnite in terms of server travel & loading screens

bitter oriole
#

In any case, what's trivially (really) done is a loading screen that has animated UI

#

I've implemented my server connecting with a fade to black, loading widget, fade from black that's pretty seamless and that is easy to do

raven holly
#

Yeah I just use a widget before I connect

#

Although it's destroyed on map load so there's no join transition

bitter oriole
#

I use the HUD for UI so it's persistent

thin stratus
#

You just need to use the MoviePlayer

#

There is a wiki post about this

#

As well as a Plugin from Nick Darnell

#

The Wiki Post require you to use Slate though, not sure about the Plugin.

#

The MoviePlayer will keep your Widget playing even while loading (minus times were the loading takes too many resources, that will make your loading screen lag for a bit)

#

That's a loading screen done with the MoviePlayer

#

Welp, Dropbox made it a jpeg

bitter oriole
#

Not sure why you're tagging me, I do use that already with a Slate widget ๐Ÿ˜ƒ

thin stratus
#

Slipped in the list

#

Sorry :P

bitter oriole
#

np

thin stratus
#

(read above)

raven holly
#

ah ok

#

cool

#

can movieplayer be exposed to bp?

thin stratus
#

You might want to check the plugin

raven holly
#

this?

thin stratus
#

Yeah

#

Can't say it works though

#

It's from Nick directly

#

Otherwise, follow the Wiki

#

It's copy paste in the end

next hawk
#

a proper way to use the player controller?

idle flame
#

Hey, someone know how I can get an iterator of the player state class within an actor (on server side) ?

bitter oriole
#

@idle flame for (TActorIterator<APlayerState> It(GetWorld()); It; ++It) ?

idle flame
#

Ok thx, is this correct ? ``` for (auto it = this->GetWorld()->GetControllerIterator(); it; ++it) {

#

Cause at BeginPlay of an actor it dont work

bitter oriole
#

"it dont work" meaning... ?

idle flame
#

It dont iterate in my for loop

bitter oriole
#

I thought you were looking for PlayerState ?

idle flame
#

Yes but I thought I need to get Playerstate from PlayerController

#

In this case, I dont pass thought the for loop, but I dont know why```
void AMapGenerator::BeginPlay()
{
Super::BeginPlay();

if (HasAuthority()) {
    for (auto it = this->GetWorld()->GetControllerIterator(); it; ++it) {
   // A UE LOG
        auto state = (*it)->GetPlayerState<APlayerState>();
        if (state != nullptr) {
            state->SetTeam(ETeam::TeamDay);
        }
    }

}

}```

bitter oriole
#

Not sure if players exist at this stage though

#

Stuff like setting the team is better handled on login

fossil spoke
#

The controllers probably wont exist at that stage.

#

Use OnPostLogin to initiate Team setting logic like it was suggested

#

Its in the GameMode and will pass the new PlayerController that just logged in.

idle flame
#

I'll do that thx guys

idle flame
#

Hey, I'm trying to get list of all player connected in the GameMode class. Someone has any suggestion pls ?

tribal solstice
dark edge
#

What's the best way to wait for things to replicate before proceeding with a setup? I have a modular player pawn that is designed client side then spawned on the server. I have some setup logic that depends on references to the pawn, but the logic is being fired off before the pawn even exists. Is using a RepNotify the best way to do it?

next warren
#

Hi..in my gamemode ctf when player overlaps the flag it attches to the player and when he returns to the base he scores point ""but i need to update player location constantly to all other players who is carrying the flag before he returns to the base so that enemy team can try to find and kill him" 1.so anybody give some ideas or suggestion to get player location constantly to all players

dark edge
#

Isn't the player pawn already replicated?

next warren
#

S replicated

#

In a map i need to show the player location

dark edge
#

Just replicate the flag and attach the flag to the player pawn when they pick it up.

next warren
#

I did that..

dark edge
#

Every player should have a reference to the flag

#

just use get location on the flag actor and you should have what you need.

next warren
#

Thnks..bro

#

I will try

dark edge
#

You can also have a variable in GameState which is the current flag carrier, or even just current flag location.

modern basin
#

Hi all,
Array OnRep Notify don't run on server.
Wondering if any one has a good workaround ?!

cloud ledge
#

Workaround for what exactly

#

Have your OnRep Notify call a function, call that function manually on server

#

Does that sound like a workaround?

modern basin
#

So, it's a known issue that Array OnRep Notification don't run on server

#

but it is a behavior i would need in my project.
Wondering if there is any workaround to get an array to replicate with notify

#

yes I got a function called in the OnRep_

#

doesn't get called from server

dark edge
#

What he's saying is to have the OnRep call an RPC from client to server, sending the new array

#

Or just calling so you can do something when the array changes

#

Hacky but it'll work

cloud ledge
#

I think he is changing array on server and he gets the notify on client, but not the server

#

Idk

dark edge
#

Yeah that happens with structs as well

worthy perch
#

I don't think OnRep is supposed to be called from the server.

modern basin
#

yes blackfox

dark edge
#

It is for base data types

modern basin
#

so, if I play with Dedicated server, both client are fine and get the array as they should

#

but if not Dedicated server, the server doesn't execute the OnRep, so that "client" doesn't get the array values

#

ok

cloud ledge
#

I don't think OnRep is supposed to be called on the server either, but I never actually checked it ๐Ÿ˜„

modern basin
#

I might need to rephrase my question then ๐Ÿ˜„ :
A good way to get an array replicated from server to clients

dark edge
#

The array will be replicated, it just won't fire the OnRep function on the server

cloud ledge
#

The best way is to use C++ and the Fast Array replication

modern basin
#

C++ is still a barrier I'm too shy to cross at the moment ๐Ÿ˜ฆ

dark edge
#

It has something to do with Set w/ notify being different under the hood vs increment or add or set array element

modern basin
#

ho

dark edge
#

using incrementint won't fire the repnotify on server either

cloud ledge
#

Ah, that's interesting, OnRep does get called on server and the clients

#

Good to know, somehow I never actually ended up using OnRep much anywhere in the current project

#

The custom netcode I have runs via RPC's

dark edge
#

It does for base data types. Doesn't seem to be consistent with arrays or custom structs tho

cloud ledge
#

And other variables are passive and don't need replication notification

modern basin
#

So Array replicate fine from server to client, but OnRep doesn't work. Could still get my client to fire a function to "read" their replicated copy of the array then I guess

cloud ledge
#

@dark edge yeah

#

@modern basin well in that case just have your OnRep be calling a function and call this function manually on server after setting the variable

#

Like

#

Not the OnRep_ function, but an extra helper function

modern basin
#

ok

dark edge
#

@modern basin You setting the array or adding/removing from it?

#

I'm not sure but I think it'll fire on a set, but not on the adding/removing. You'd need to do some testing.

modern basin
#

It's an array of Enum.
I'm resize it on initialization (populated with "empty" entry)
and changing first "empty" entry found for another of the Enum during gameplay

#

adding "Set w/Notify" don't help

#

will try to make an helper function

#

maybe use a bool variable with OnRep to fire that helper function when need

#

will just need to change that bool along the array from the server side, and get the client to fire the helpper function from the bool OnRep ...

#

yeah ... will try that

dark edge
#

From my testing the onrep is firing clientside

cloud ledge
#

Variables are not guranteed to replicate in any order @modern basin

dark edge
#

just at the end of the onrep function fire an RPC

cloud ledge
#

So you might get a notify before your array replicates

dark edge
#

In my testing the Set fires on server and client, the add only fires it on clients

modern basin
#

@cloud ledge ho ... thanks, didn't know that, didn't thought of it

#

hmmm ...

dark edge
#

Just do something like this inside your onrep

#

call back to the server to do whatever stuff you're doing with the onrep

cloud ledge
#

I don't know why that would need replication

#

Calling back to server wasn't mentioned I thought?

dark edge
#

He's prolly got some logic that operates on the array, and has to fire every time the array is changed.

#

OnRep only fires on the clients for add/remove elements. Just add the RPC event to fire whatever logic server side as well

modern basin
#

everytime the array change, I want clients to execute a "refresh" function, and it work well when I use a dedicated server.

cloud ledge
#

I think he just wants something to happen on both server and clients

#

Without any client to server feedback ๐Ÿ˜„

#

In that case, you just call a function (not a RPC one) - once when setting on server, once in OnRep on the clients (put it behind an authority switch so it never fires twice on server)

modern basin
#

the problem is when I don't use dedicated server, then I got my server and client #1 together ... (still confuse on that) and in that case, it doesnt seems to work

#

yes

dark edge
#

Then just do it server side seperatly like blackfox said

modern basin
#

that array need to show up in the UI let's say, when I dont use dedicated, the UI of the game on server side doesn't show the array content.

#

ok

#

I got few things to try

#

thanks guys

ivory portal
#

Hi everyone, does anyone here have experience with Gamelift? I can't really find any good blogpost/tutorial about it and their official documentation kinda feels more like a selling page to business peeps. Anyone has some secret documentation somewhere or some blog?

thin stratus
#

There was a GitHub Repo once that gave away some knowledge

#

But overall, if you need to use GameLift, you gotta fight through it

modern basin
#

I expect the "SomeEventForEveryone' to fire for everyone ... yet it does only on server.
I see the "Has authority", the event is called by only the server, but should not the event fire for all client as well ?

#

I thought I understood that, seems I might have not

worthy perch
#

Maybe the clients have not had their Gamestates created yet?

modern basin
#

ho, a timing issue ?!

worthy perch
#

Maybe. Probably in this case.

modern basin
#

yep

#

it is

#

Is using a short delay a good practice here ? or is there a way to verify that every instance has started ?

worthy perch
#

Hmm, a delay isn't super awful, but it's certainly not good. Maybe RepNotify is more fitting.

modern basin
#

Could I assume that the Server instance will always run before the client one ?

worthy perch
#

Well, you would usually have the server instance run, and then have the clients join. So... yeah, I guess.

modern basin
#

right

#

cool

#

thanks ๐Ÿ˜‰

real yacht
#

how can i tell to player who kill him

#

im using myGameMode and myGameState

#

and myPlayerState

#

im tryining to figure out, how can i use instigated by variable from take any damage event

#

so i want to show on screen "player123 killed you!"

next warren
#

This is the procedure u should do.. @real yacht

ivory portal
#

@thin stratus ah that sucks, I was maybe hoping Epic would release some thing with the Fortnite announcement

real yacht
#

@next warren thanks mate!

thin stratus
#

@ivory portal Well Epic doesn't use GameLift

ivory portal
#

Ah no? I thought they would because of the short matches etc

#

But currently trying out the AWS plugins on the marketplace

real yacht
#

is playerState destroyed when moving from map to map (Map_MainMenu -> Map_Lobby)

#

etc

ivory portal
#

Depends if you do it seamless or not I think

thin stratus
#

From MainMenu to a Lobby, most likely

#

Cause that usually means you connect to a Server

#

Or at least host one

plain flume
#

Evening. Any new news about Epic's own subsystem?

thin stratus
#

The Roadmap is long out

#

It will release over the time of 2019

#

You'll def read about it if it releases :P

unique thunder
#

I have a playercontroller reference in my GameMode, is there any way to get access to that player's local gameinstance via his playercontroller reference? I don't think I can loop events around sicne this happens on LogOut and I don't know if this is time-limited or waits to complete the chain.

plain flume
#

@unique thunder Only servers knows game mode and all player controllers. Clients only know their own player controller. So If you are server then yes, you can get access to every controller there is inside game.

#

So If you store player controller to GameMode and try to access it as a client then it would not work

rotund sapphire
#

Sinn is looking for a way to access the client's gameinstance class, which is possible, but only indirectly

#

like for instance, calling an event on client's player controller, that will execute some predefined operation locally on gameinstance class

plain flume
#

Aah, yes

rotund sapphire
#

It's kinda hard to predict whether client will still be connected when onlogout gets executed

#

i think it's very much possible, the original intention of that event was to do some last moment operations on server only

#

but worth to try address some event calls see if that reaches the client (pry not)

#

personally i'd do it in a controlled manner, eg at when the client knows it will leave the game (exit from menu etc) then sending a command to server "hey we all cool can i leave?" and server will respond to that "ok youre good to go" when it has finished executing these calls and all that

#

until then client will wait for the response (and will execute the event calls)

thick storm
#

has anyone been able to get steam multiplayer to work? I cant seem to get it to work for me. I only need it to have 15 online in the same game. If anyone knows of a tutorial online that works it will be great. im using 4.20

tribal solstice
#

@thick storm Have you tried Proteus' Multiplayer Template?

#

It's VR-ready but I know it works with Steam. I was able to successfully connect with a friend so maybe open it up and dissect how it works.

thick storm
#

my friend said its only lan and thats also for VR

tribal solstice
#

Just don't use the VR aspects

#

It works with Steam though, I've connected with a friend that wasn't LAN

thick storm
#

Okay ill give it a shot. I already am steam partnered so Ill just upload it and test it out

tribal solstice
#

Yeah give it a shot. Can probably look inside the blueprints and see how it's connecting to Steam

thick storm
#

says its missing Proteus and ProteusAvatars

#

so it wouldnt build

idle flame
#

Hey someone know in witch class and how am I supposed to implement a respawn system in ue4 (with multiple team)

tribal solstice
#

@thick storm Not sure, did you follow instructions from the Git? I think you need to build it in a source built engine

thick storm
#

i dont use source build. Ill need to check it out then

gleaming vector
#

@idle flame respawning players is best done by calling "RestartPlayer" in the gamemode class

#

it can only be done on the server

#

there are a few version, such as "RestartPlayerAtTransform"

naive shell
#

servertravel/Game/Maps/Map1 Does someone know why that cmd doesnt works after a session is createds?

maiden vine
#

should I be trying to use listen server to host from my dedicated servers main menu it works for my computer same one with the dedicated server running, but if a client host it uses the default port which Im running my main dedicated server on and I cannot connect any ideas thx

#

If I change the dedicated server port do you think it will work ?

glass plaza
#

Having some architecture issues carrying over information from my Player when he joins a Server. Where should I store information to be carried over to the Joined server?

ivory portal
#

How do you mean? Does he transfer from one server to another one?

thin stratus
#

When joining a Server, you can pass some info via the ClientTravel function of the PlayerController (C++).
Despite that, there is not much you can do, despite literlaly saving whatever you need before joining, loading it after joining and then passing it to the Server.

jade gazelle
#

@glass plaza The GameInstance will persist between hard server travels. I did some testing with player info there that I then loaded on the new server that was joined

#

At this point though Iโ€™ve switched over to the method Cedric mentioned above where I pass parameters into the ClientTravel url

real yacht
#
  1. both player have nickname in playerState (picture 1)
  2. when i'm trying to print who shoot me, cast to my PS_PlayerState doesn't fail, but prints empty line and health is decreased (picture 2 and 3)

What is wrong?

And apply damage is on server