#multiplayer

1 messages ยท Page 64 of 1

kindred widget
#

Your issue is timing. Chances are that your multicast is arriving on your clients long before your actor is.

For the immediate issue. Frequency should probably be a replicated float on the actors that has an OnRep. InitializeGeneration can be called on server when spawned and on client when OnRep runs.

For a more robust method with a ton less networking, consider simply replicating Frequency strictly from the AChunkWorld where it already exists. You can develop a way to stably name your actors created here and network them that way so that your client can locally spawn everything here without any networking besides the single main frequency float in the AChunkWorld

honest rain
#

I see, so the actor would go get the information directly from querying the necessary informations when they need to ?

kindred widget
# honest rain I see, so the actor would go get the information directly from querying the nece...

Not sure what you mean by this? There's no querying. The actor simply doesn't exist on the client yet.

Your initial issue is basically a shipping problem. You put a package in the mail(replicated actor). It'll arrive at some point later on. Then a minute later while your package is still at the shipping place you directly call the destination it's going and tell them to do something with the package you've sent. They have no clue what you're talking about. No package exists. You get hung up on.

Instead, you need to put directions in the package. IE putting replicated float on it. This will most likely arrive when the actor is first replicated. Then the people on the other end know what to do with said package.

Instead of making calls everywhere(RPCs), just put instructions in your packages(replicated state). Stuff just gets gracefully handled when it exists.

honest rain
#

When you talk about replicated float, you mean for example ReplicatedUsing = OnRep_Function ?

#

I understand the issue indeed

kindred widget
#

Correct. For example if you put it in the ChunkWorld. The Client's ChunkWorld can run that the moment it has a valid float to work with. The only issue with that will be networking. Those actors won't be name stable, so you'd need to name them uniquely yourself to network them and set.. Can't remember the variable, NetLoadOnClient or whatever I think? to true. May be other requirements for that.

twilit radish
#

Vori made a topic about as well which is in the channel pins ๐Ÿ˜„

#

Also net load on client is not for dynamically spawned actors. It's meant for one's inside the map that were placed and are replicated.

kindred widget
#

Right, right. That's the one I had to turn off for some actors on the map.

#

But yeah. Would recommend that pin as well if you're doing heavy world spawning like this. ๐Ÿ˜„

honest rain
#

oooooooooh Actualy, I did what you mentionned, which works since it accesses local float values, but also I discovered that my Actor World.cpp which is in the world at start of the game, had no owner.
It seems that this was not any problem server side, but Client side would not executes functions called without owning...
I fixed that but forcing set owner in blueprint after the game started, and it works now.
I wonder if we have to set it on all clients in begin play and assigning Player controllers so it runs fine client sides

twilit radish
#

I mean generally you don't go assign player controllers to every random actor for the reason that you only can have one owner per actor and it just doesn't make a whole lot of sense. But yes, you can't call a RPC from client -> server or server -> to a specific client without an owner.

#

That's why the player controller as an example is pretty handy as every client has their own one ๐Ÿ™‚

#

But in the specific case of chunks, yeah not so ideal if you want to use actors for them.

honest rain
#

it doesn't seem to be a problem for the chunks, but more for the WorldManager itself, and since there is only 1 in the world, I guess it would be fine to assign it Clients as owner ?

twilit radish
#

If you have one per client I guess.

#

Because if you only have one world manager in the entire game you get the problem what if a different player wants to do something with it?

honest rain
#

Hum thats a good point, although I can't assign anything else other than PlayerController as owner right ? :/

thin stratus
#

That or whatever is owned by the PC

#

So a chain works

#

But you can still only assign one owner at a time

#

So best is to route (server) RPCs through owned actors (like the PC) and then access your world actor on the server

honest rain
#

I am getting a bit lost sorry. World Manager exists from the beginning in the world, for both server, and clients. So you mean that before calling any functions from that World Manager, I need to access the world manager through the PCs first right ?

thin stratus
#

Depends

#

This is about the client performing local actions that need to run on the server

#

Then you need to RPC first

#

In the PlayerController for example

#

If you are already on the server, then that's redundant

honest rain
#

right, but since this is more something that supposed to exists on all clients from the begining, I guess assigning from the beginning the locally controlled PC makes sense

#

this is quite complex concepts to grasps I found when you are not used to it xD

twilit radish
#

But that's the point Cedric and I were trying to make, you can't do that. You mentioned there's only one world manager in the game right? You can only assign one controller at the same time per actor, so lets say you have two clients then only one of two could be assigned. That's why Cedric is suggesting to use the Player Controller.

thin stratus
#

Yeah only one can be the Owner

#

And that has to be set by the Server

#

So you would have a Chicken/Egg situation

#

If you can get to the server to set the owner, why needing the owner? :D

twilit radish
#

Why is that called the chicken/egg situation ๐Ÿคฃ

thin stratus
#

IDK

honest rain
#

well because on client side it is asking me to set the owner ๐Ÿ˜†

thin stratus
#

What comes first, the RPC to set the Owner or the SetOwner to allow the RPC

#

DON'T JUDGE ME

twilit radish
thin stratus
#

๐Ÿ”๐Ÿฅš

twilit radish
#

โค๏ธ

thin stratus
#

๐Ÿฅฒโค๏ธ

honest rain
#

this is so confusing ๐Ÿคฃ So my worldManager actor lives on the server, and I need to set the owner on the server, and I am using the player controller as the owner to launch whatever function lives on it. But this is wrong since only 1 owner can be set on the actor, and since there would be multiple player controller in the session ,I cant do that

#

this is correct right ?

twilit radish
#

That's what we are trying to tell you, there's no need to set the owner as it's pointless because there's only one of your world managers. But yes what you explained is the problem. There can only ever be one owner per actor and no more. So what Cedric suggested is that you place the RPC inside the player controller (as each player has their own player controller) and then from there on grab a reference to your world manager and do whatever you want.

thin stratus
#

You should read the ownership part of the compendium if this isn't clear yet

twilit radish
#

Compendium has some good stuff yeah ๐Ÿ˜„

honest rain
#

I think this is why I dont get it, since my world manager is used to spawn actors ( replicated ) in the world, it seems wrong to call RPCs from each PCs as this will continously spawns already existing actors ?

honest rain
thin stratus
#

Well I'm not sure what the origin of this discussion is

quasi tide
#

Speaking of compendium...where is that hot new wiki-like site for the compendium Cedric?

twilit radish
#

I also wasn't there at the very beginning. But what I understood was there's one world manager on the server with clients wanting to make RPC calls to it. Which just doesn't work.

thin stratus
#

Like an RPC is only needed if you have some local event that then has to move to the server. Like an input press or a UI interaction

#

Most other events are usually server side anyway

thin stratus
quasi tide
#

Tell your clients to stahp

thin stratus
#

):

twilit radish
#

"Please give me free money while I do fun things."

quasi tide
#

๐Ÿ‘† that too

honest rain
#

Right, so with my world manager being used to spawn actors from the beginning of the play session, up until now that didnt work client side since it asked me for an owner to execute the functions in that world manager ( functions that are being called in the begin play of the actor), thats why I was looking at setting the owner of this instance from the beginning ^^

thin stratus
#

If you just need it to spawn actors from Beginning of the Session, all you need to do is use its BeginPlay, slap a SwitchHasAuthority into it and then call SpawnActorFromClass with a replicated actor class

honest rain
#

๐Ÿ˜ฎ

thin stratus
#

On the Authority pin fwiw

honest rain
#

omg and this is type of stuff I already did but in blueprint, totally forgot about this.... thanks many thanks

twilit radish
#

I still hate that Epic did not expose net modes to BP.

quasi tide
#

Be the change you want to see in the world

twilit radish
#

To then get ignored on Github? No thanks ๐Ÿ˜‚

quasi tide
#

I was able to get something merged ๐Ÿ˜ˆ

twilit radish
#

You used your one free PR per century card. Rip.

quasi tide
#

I'll be making more PRs in the future. Just not about to sit through a 2 hour compile for each PR ๐Ÿ˜…

#

Plan on upgrading my CPU later this year.

real ridge
#

Can I send replicated variable to widget?

#

or its impossible?

clear island
#

even on epic's source build instructions they say build times are between 10 minutes and 40 minutes, like, has anyone ever compiled UE from source in 10 minutes on one single machine? or are they using build farms or something

quasi tide
#

Epic's machines are extremely beefy

clear island
#

10 minutes on a single machine? no way thats real, maybe these numbers are from older UE versions?

#

I mean if my daily job involved compiling even for 10 minutes every single time I wanted to test my changes, I'd probably just quit and find somewhere else to work ๐Ÿ˜„

fathom aspen
#

Build farms are crucial

fathom aspen
#

I don't think any real company would let you work without them

#

Not if you don't have a decent PC

clear island
quasi tide
#

64 core threadripper

#

256 GB RAM

#

Like I said - beefy machines

clear island
real ridge
#

slowly getting there lol

#

still have som problems

#

now everyone has different XDDwhich stayed from blue team before I changed their team ah

#

do you think guys this value can be right if I am trying to send it to this widget replicated?

#

sending it like this

dark edge
#

all this multicast stuff is goofy

#

you should just have a repnotify on some data and that's it

#

simple

modest crater
#

Hey there, I'm trying to bind my widget to a delegate inside my player state, but, my playerstate cast is returning null for clients (not listen server tho), this function is being called through the SetPawn() function on the player controller

void UMinion_Widg_KillScore::InitilizeWidget(AController* owningController)
{
    if (owningController) 
    {
        AMinion_PlayerState* ownerPlayerState = owningController->GetPlayerState<AMinion_PlayerState>();
        if (ensure(ownerPlayerState))
        {
            ownerPlayerState->GetOnScoreChangedDelegate().AddUFunction(this, "UpdateScore");
        }
    }
}
modest crater
#

Im passing this

#

Ive tried passing the playerstate through to but its null

#

only for the server

#

So what are you saying?

#

The function is being called from a delegate inside of SetPawn(), I was passing through "this" as SetPawn is inside the playercontroller

#

void AMinion_PlayerController::SetPawn(APawn* InPawn)
{
    Super::SetPawn(InPawn);

    if (IsLocalController() && InPawn && InPawn != currentPossessedPawn)
    {
        OnNewPawnPossessedDelegate.ExecuteIfBound(InPawn); // this will call OnNewPawnPossessed()
    }
}


// This is the function that runs from the delegate
void AMinion_PlayerController::OnNewPawnPossessed(APawn* newPawn)
{
    if (!newPawn) { return; }
    currentPossessedPawn = newPawn;
    CreateOrUpdateUIOnPossession(newPawn);
}


void AMinion_PlayerController::CreateOrUpdateUIOnPossession(APawn* newBody)
{
    /** If we have a widget already added to the screen but the owner has possessed a new pawn */
    if (IsValid(instanceOfMainHUDWidget) && IsValid(newBody))
    {
        LogServerOrClient(this, "Widget being Updated", FColor::Orange, 5.0f);
        instanceOfMainHUDWidget->UpdateWidgetsOfNewPawn(this, newBody);
        return;
    }

    
    /** If possessed a new pawn but dont have a HUD */
    LogServerOrClient(this, "Widget being Created", FColor::Orange, 5.0f);
    instanceOfMainHUDWidget = nullptr;
    instanceOfMainHUDWidget = CreateWidget<UMinion_Widg_MainHUD>(this, mainHUD_WidgetSubC);
    if (instanceOfMainHUDWidget)
    {
        instanceOfMainHUDWidget->InitilizeWidgets(this, newBody);
        instanceOfMainHUDWidget->AddToViewport();
    }
    
}
#

probably is but this was the only place I found that runs on both client an server where the pawn is valid so I can bind to the health delegates an what not when respawning or possessing a new pawn

#

it works fine for the server but for clients its returning null on the playerstate so I assume its too early to try call it an bind to a delegate inside

#

here im using the word HUD but its really just the main widget with the health an default stuff you would see on a HUD

#

maybe I just find somewhere else to bind to the Player State delegate, its too early here

modest crater
#

alright, no matter it seems to be null so I'm doing something wrong, ill investigate haha

real ridge
dark edge
#

on the playerstate or pawn

#

and if team = local player team, show it green, otherwise show it red

#

that simple

#

Player seeing their own hp bar -> pawn team matches player team -> green
Player seeing an allies hp bar -> pawn team matches player team -> green
Player seeing an enemy hp bar -> pawn team does not match player team -> red

real ridge
twin juniper
#

Hey, is it possible that net dormancy (dormant all) stop RPC replication or this is only bug in old (4.22) unreal? I noticed that I can't send rpc from dormant actor's because channel has been closed

chrome bay
#

By design

#

It's not a bug, a dormant actor has no actor channel

#

That's what it's meant for

twin juniper
#

thanks, where I can find more details about it? wiki?

chrome bay
#

Probably not. Dormancy isn't well documented. If you make an actor dormant, it can no longer send any requests from clients. If you want to send data from server, you need to "wake" it first. That's about it.

#

But key things to keep in mind, waking from dormancy is a similar cost as spawning a new actor as far as networking is concerned. ALL changes properties are sent when you wake it, not just what was changed.

#

Including Initial_Only properties. It's treated like a "new" actor, except it doesn't spawn one.

twin juniper
chrome bay
#

Yep, you have to pick and choose when to use it

#

Not something you use a lot

spring peak
#

Hello guys! I'm have problem. Car's working on the Chaos wheeled vehicle movement component, and after spawn wheels collision stay on spawn point on server-side. At same time work is stable on client-side. Version 5.0.3. I will can remove wheel collision from phys assets but it's not need me.
Because of this problem car other clients can stuck and solution - destroy car.

#

I read hotfix 5.1 and 5.1.1 but they not decided solve

twin juniper
chrome bay
#

It can't

#

The server decides on dormancy

#

But it would be very strange for a client-owned actor to go dormant anyway

#

You can still send references to it through RPC,s just can't call the RPC on the dormant object

pallid stone
#

Do instance static meshes replicate the instances by default?

chrome bay
#

no

pallid stone
#

Best way would be to ask the server for all its generated instances then give them to the client to make on their end?

polar wing
real ridge
prisma snow
#

what determines the instances trasforms in the first place?

jolly delta
#

hey, anyone that has already use a FSocket and have a public code snip to look how you use it ?

pallid stone
#

Can you put tmaps into replicated functions?

#

I know you can't replicate a tmap itself

#

But can it be passed as a variable?

chrome bay
#

Negative

pallid stone
#

But you can pass a struct via a rpelicated function?

chrome bay
#

A struct yeah

pallid stone
#

Man, that is soooo stupid

chrome bay
#

But if the struct contains a TMap, then no

#

Well it's inherently unsafe to send TMaps over the network

#

If the keys can't be resolved, you can't have a valid map

#

Plus it's terrible for efficiency, an array is preferable

pallid stone
#

A struct of a Umaterialinstance* as a key and a tarray of transforms would be fine?

chrome bay
#

No it wouldn't

#

In fact using an Object as the key is the most unsafe use of a TMap

pallid stone
#

No I mean in a struct

chrome bay
#

Ah I see, yeah that's fine

pallid stone
#

My current setup is storing a instanced static mesh component in a tmap, with the material instance as its key

chrome bay
#

But obviously you have to ensure that objects will resolve at the other end

#

UMaterialInstance should be fine since it's an asset

#

And will send using the path name

pallid stone
#

At the moment, my creation of the uinstance static mesh components is the following

{
    UInstancedStaticMeshComponent* createdISMC = NewObject<UInstancedStaticMeshComponent>(this, UInstancedStaticMeshComponent::StaticClass());
    createdISMC->RegisterComponent();
    createdISMC->AttachToComponent(RootComponent, FAttachmentTransformRules::KeepRelativeTransform);
    createdISMC->SetRelativeLocation(FVector::ZeroVector);
    createdISMC->SetIsReplicated(true);
    createdISMC->SetFlags(RF_Transactional); 
    return createdISMC;
}```
#

That then gets added to the tarray

#

to the tmap*

real ridge
#

then widget looks like this

pallid stone
#

Since it is replicated, and just sort of floating around, what is going to be the best way of getting the same reference on the client side so I can just create the same instances? @chrome bay

chrome bay
#

My question would be why created replicated components at all

#

Unless they have collision or something

#

Hard to give any advice without context

pallid stone
#

One mo, let me get a screenshot

chrome bay
#

The way you don't want to do procedural generation is replicating lots of ISM's with their transforms, that's the main thing

#

Usually you send a seed, clients rebuild locally using that seed.

#

And you ensure the generation is deterministic

pallid stone
#

So it's being generated (by a seed yes), and the floor, parallax and decals are all instance static mesh instances. The tress, rocks, villages are actors because they are usable by the world and are spawned, but they also use the seed to decide if they should be there.

#

So those actors are made on the server and replicated, so the client doesn't need to spawn on their end, that already happens, but the instances aren't being updated

#

Would passing in the seed to the client, telling them to run the details, but skipping any spawning then be the best way?

#

Instead of just passing a large tarray of transforms and saying to remake those instances on the certified ustaticmeshcomponent?

chrome bay
#

Yeah so the way to do this is not spawn any replicated components/actors at all

#

For a decent sized level that's way too much info

pallid stone
#

Oh thank you

earnest comet
#

Hello folks, a smol question if I may.

#

Is there a way for server to know how much time it took to send a response and get a response back?

#

I just want to press a button on host and check how long it took client to get that "Hello" Print String

#

in blueprints that is

prisma snow
earnest comet
#

However I am unable to find how to do it as the "make host send message to client"

#

the same system gives like 0.02 seconds response time, which is obviously wrong

prisma snow
#

maybe send timestamp in the server and compare with current time in client. But that could be subject to clock variations so I woldn't count on it

twilit radish
#

Could also depend on how you're using the emulation profile.

prisma snow
#

exactluy

#

some profiles affect only server on only clients so it is a possible outcome

twilit radish
twilit radish
#

I had 2 PCs at some point next to each other that had over an entire second of difference between their clocks.

#

That was probably a bit of an extreme case, but the point stands that they can definitely desync from each other / aren't perfectly in sync.

earnest comet
#

I am using this bad boy and it works for client.

I also checked it. Emulation for server is same. I mean the message is sent in 0.4 seconds but difference between "first game seconds" and last one are wrong

#

ugh I am not getting paid enough for this! Not even a penny T_T

prisma snow
#

iirc somebody did a synced network clock

#

but idk the precision

twilit radish
#

Also that node you're using suffers from latency, just FYI.

twilit radish
prisma snow
twilit radish
#

Although one choice I still don't really understand from that post Vori made is why the buffer only gets used upon hitting the limit of 10 entries. Just seems like a lot of unnecessary delay in the beginning of the game. @pallid mesa we need answers ๐Ÿ‘€

earnest comet
#

PS: I will bother with latency laters, for now game is 60 fps ^-^

#

This is where as a HOST I press Left CTRL click

#

and sending the server time

#

This is where the event triggers in 0.4 seconds

#

but Server World Time here gives almost exact same value

#

so the difference is minimal

#

Could it be because it is the Host that is also the Server that values are same?

#

almost, that is

pallid mesa
twilit radish
earnest comet
#

Like it triggers after 0.4 seconds.

twilit radish
earnest comet
#

But still gives the same World Time seconds? o_O

#

So in this case, should I get the Client's World Time instead?

twilit radish
#

An authority switch does not have any delay. Not sure what you mean.

pallid mesa
#

if you suggest any improvement with proven numbers, feel free to do a PR over the article, I'll accept it happily

twilit radish
#

Lol sure. Expect a PR today xD

earnest comet
pallid mesa
#

evidence

twilit radish
# earnest comet That Event triggers twice, one for server and one for client. So it is instant o...

In this case what you're doing is you're sending the server's time over to the client with that multicast as GetServerWorldTimeSeconds on the gamestate is just the server time on the server. Then your subtracting the servers replicated time (which is very similar by the time your multicast arrives) by the server time. So well yes you're going to get a very similar result if subtracting the almost same numbers by each other.

earnest comet
#

Client is following from behind 0.4 second. So when the request is send from the host, 0.4 second time already passed.

#

Aka, the same result almost is being told.

twilit radish
earnest comet
twilit radish
earnest comet
#

Thanks for the help. Now I understand it more clear.

twilit radish
#

๐Ÿ‘

cold moat
#

round 3 of ruining your feng shui with spazz questions:
Currently our game runs in listen server mode, but it 100% has to work with dedicated server
The way grenade throwing is synced -> we play the animation and it produces an event when you are supposed to throw a grenade
It wont work with a headless dedicated server, right?

#

"play animation" makes no sense for a dedicated server

#

(right?)

chrome bay
#

Depends

#

you can play them on servers if you want, but usually you don't

cold moat
#

the actual throw im trying to make into an instant triggered by tag ability

#

i guess i could replicate the tag instead?

chrome bay
#

If you play a montage from the ability, the montage notifies should trigger

#

The raw anims may not play, but the montage should IIRC

cold moat
#

yeah, it uses a custom ability task "PlayMontageAndWaitForEvent"
so, the montage itself will still work for timing on a dedi?

chrome bay
#

It should do yeah

cold moat
#

thanks!

chrome bay
#

The animation won't be evaluated (unless you force it to), but montage notifies should work

cold moat
#

i guess even if it doesnt work for no reason, a workaround wont require a massive reengineering anyway, so, shouldnt worry about it

#

thanks again

old sequoia
#

AFAIK if you play an animation on a dedicated server it will evaluate just like on any other machine.
Otherwise shooter games / Unreal Tournament wouldn't have functioning hit detection

cold moat
#

i guess it makes sense, havent thought of that, im still beating on the grenade system and had a random thought of "animations -> wait, thats graphics?!?!" lol

#

but yeah, the server has to know where things are lol, should have thought about that

old sequoia
#

The only thing skipped on a dedicated server is rendering and audio, everything else is just the same. Picture it as everything existing in complete darkness and silence

cold moat
earnest comet
#

Dear ultracute people, how reliable is this node from 1 to 10?

#

It seems to update per second but I might be wrong, just wanted to hear opinions! Thanks!

earnest comet
#

pretty new in multiplayer business so sorry if it doesn't make much sense what I ask Ayaya

cold moat
earnest comet
#

will check, thanks!,

cold moat
#

serious question though

#

gameplay events somehow replicate internally, right?

fleet viper
#

Trying to make a server callback for my interaction event. It of course only executes on client, but my server rpc is never called, it should tho right? Yes I checked, the class has replication turned on

kindred widget
fleet viper
#

oh right

fleet viper
kindred widget
#

If it's set on the server.

fleet viper
#

ok

#

Same pattern inside of my game state. Server RPC's are not being called

kindred widget
fleet viper
#

oh well ok

gray latch
#

Hello brains trust. I am having trouble showing an AActor when it is 'equipped' on an client (from another client's perspective). I played around with it, and it seems that if the server equips the item, all clients can see it on the server's character, but if a client equips, no other clients nor server can see it. I equip the item using a function with the NetMulticast macro. Any hints would be highly appreciated

cold moat
#

outside of not very helpful "your client isnt properly replicating the action" its hard to say anything

gray latch
#

That actually is not a horrible hint. It sounds like perhaps my DOREPLIFETIME is not being fired properly

cold moat
gray latch
#

Just to be sure. If I have 2 clients running, the multicast should only be called on the client that actually equips the item, right?

pale obsidian
cold moat
#

well, the client obviously can communicate with the server, i think to put it better, only the server can make authoritative changes

gray latch
#

Thank you for the input Shiro, and it's a good point. I am indeed spawning the AActor object on the Server, where I also set it to be owned by the relevant client. Then I call the NetMulticast function where I attach the spawned object to a certain socket on the client mesh

cold moat
#

so the client can tell the server "do something", but not just doing something itself and hope for the best

#

i guess i made it super confusing xD

gray latch
#

Hehe yeah I completely understand what you're saying emp ๐Ÿ™‚

pale obsidian
#

So are you calling the NetMulticast from the Server or the Client in question?

gray latch
#

I am calling it from the server

#

I have a feeling that perhaps I am somehow forcing it to only exist on the server

pale obsidian
#

Is the spawned object replicated? Or do you have each client spawn the actor themselves? We might need to see some code if you're able to share it.

gray latch
#

the object has bReplicates = true. Oh and of course, I'll find the relevant snippets!

pale obsidian
#

@gray latch Do you have a _Validate function as well for your Server RPC?

gray latch
#

Sorry to be ignorant here, but what is "RPC"?

pale obsidian
#

Remote Procedure Calls; when you specify UFUNCTION(Server) or UFUNCTION(NetMulticast) etc. you're saying this function is a RPC.

gray latch
#

Ohhh that is good to know!

#

Can you link me to some documentation on this validate?

#

I think I need to read a bit before continuing ๐Ÿ™‚

pale obsidian
gray latch
#

Awesome. Thanks a lot. I will study this for now

pale obsidian
#

For validation in C++, check out page 68.

#

Good luck

gray latch
#

Thank you very much - this is brilliant information

twin juniper
#

https://forums.unrealengine.com/t/how-to-approach-networked-procgend-worlds/121592/5 Anyone has any ideas for this?

I'm doing procedurally generated streaming worlds, where each world chunk is an actor. Because its fully deterministic and procedural, I dont need to replicate anything, just make sure that the server in fact has the same chunks streamed in as all players do combined. I do this by iterating over the PlayerControllers and getting their pawns, and adding these as "observers" for the streaming. This works on both server and client as expected, and seems to stream in the right chunks.

I also make sure that the world chunk actors have the same FName across clients/server. However, every now and then I still get that warning, and it has led to player position desync when testing.

peak sentinel
#

is this what you are looking for by any chance

twin juniper
#

I think I just solved it, thanks a ton though I'll read through it!

twin juniper
#

hi guys i need to make a system on unreal by which vehicles/structures are serialized and then recreated serverside as players approach/move away from them and im not sure of the best way to go about it, my first thought is to run a check for every structure/vehicle currently spawned in and destroy/serialize them if they are not near any player, and then check the proximity of players to serialized entities and respawn them accordingly but the implication of this is running a function every tick to do these checks, which i feel would be bad for performance and especially bad if there is more people substantial amounts of people on the server or substantial amounts of structures/vehicles, does anyone have any ideas for how i can go about doing it? Its kind of an integral system so i dont wanna mess it up and need to totally rework it down the line. would prefer to get it mostly right (atleast conceptually) from the beginning. Thanks!

green fjord
#

hey i want to have run mechanism on my character this is my blueprint:

#

however it make stuttering effect on the character movement when walking or running on the client side
i already call the timeline node both on server and the client side
i want to incrementally the max walk speed using timeline both on ther server and client

twilit radish
# twin juniper hi guys i need to make a system on unreal by which vehicles/structures are seria...

I would very much recommend just seeing it from a regular save game perspective first but with multiple people who are able to load/unload things. Look around and see what kind of save systems there are in general and what fits your game, we don't know your game so it's difficult to say "just do this" as if that's wrong you're going to have to do it all over again in the end regardless. That's pretty much why I'm recommending to look around your self some more as a save system is a very important part of most games. Some general things to consider though is how much you're going to save and thus need:

  • Is the world endless or big enough that I need to consider that by splitting up files? (Chunks).
  • Can I get away with perhaps defining / saving distinct areas?
  • Can I get away with just throwing it all in one big save file?
twilit radish
# green fjord however it make stuttering effect on the character movement when walking or runn...

It probably has to do with the issue that the character system and your BPs don't match up. The character system has a bit of a complex system behind it to prevent cheaters from doing whatever they want to but that makes it basically impossible to do stuff like this BPs. It will likely also not work very well with rollbacks this way.

If you're not afraid to use C++ you can look in the pins for some examples on how to extend the CMC (Character Movement Component). If that's not an option you could consider allowing client authority on the movement. If both are not an option then I don't have a solution any more.

real ridge
#

guys how I can make this health + name widget for seeing it on others but not at me?

#

when I set visibility I Dont see it anywhere

#

any tips?

#

I clicked owner no see but I still see it

solar stirrup
#

Yeah but not for components heh. And yeah what Jambax said

twin juniper
#

so i want to serialize these structures/vehicles when noone is around to save server performance

#

cuz the game simply wont work otherwise

#

the world isnt infinite maybe ~12x12km

#

but when a player base could have 2000 structure entities and however many other shit this becomes a problem

glad escarp
#

Hey guys. Quick question. I have a world space widget component on my items that the player can interact with (pickups, buttons, switches etc). I display that widget when the player looks at it (line trace) but it displays to all other local players. Is there a way to only change visibility of the widget for the player that is looking at it?

real ridge
#

guys I Do have problem I am calling this event from event tick, when I will fly to wall or anything its called and I will die and last is function for restart/respawn player but when I am shooted down and call it over on damage Its not called

winged badger
glad escarp
winged badger
#

Trace itself should be gated with local control

#

Ah

glad escarp
winged badger
#

You dont really need to use a widget component at all

#

Just put a canvas, deproject actor to screen and add interaction widget there

#

One canvas for each player

#

Also much more performant

glad escarp
#

I don't really want a screen space widget though. I want the widget to hover over the item contextually.

#

I've done "LookAt" messages before that set variables on the player HUD but that's not what I'm looking to do in this instance if that makes sense.

final quest
#

I have a problem in my local multiplayer project where the a bunch of static meshes are flickering for the second third and fourth players unless I am really close to them(the static meshes). can anyone help me

gaunt cliff
#

I haven't found a linux/server dedicated channel so I think I might get help from this one:
i uploaded my dedicated server build to the master server and when trying to execute it I get the following error: "./Server-Arm64.sh: 5: /home/dsuser/TestGame/Binaries/LinuxArm64/TestGameServer: Exec format error"

latent heart
#

"to the master server" ?

gloomy tiger
#

Not sure how common this question is but - DormantAll vs. Replicates = false. What's the technical difference between them?

gaunt cliff
#

the main server where we have a process to "clone" the build into instances depending on matchmaking etc...

latent heart
#

Have you run the arm64 build on it before?

gaunt cliff
#

nope, should I try building and uploading an arm build (no 64)?

latent heart
#

You should find out what you actually need to run on that machine

gaunt cliff
#

sadly its weekend and I don't have direct ssh access T_T

real ridge
#

how I can make client call from server call?

#

because when I die on damage event is server only

#

and after I have 0 life

#

I am calling respawn

#

but its only on server

#

๐Ÿ˜ฆ

real ridge
#

problem is I want call event for client from this event any damage but it cant be called because event damage is authority only

#

so whats then... I need call it onclient which is taking damage

#

so he will create widget

#

already calling this on it but its not working as its called on server and not on local player

#

when I use switch has authority and put "pan died" to remote its not working neither

unkempt tiger
#

How do I net serialize a float with an explicit amount of bits optimized for an explicit range?

#

Say I want to net serialize a float that's always in [0, 1] range and use X bits just for that range

#

Oh with Write/ReadFixedCompressedFloat

quiet fjord
#

Guys I have a problem I want to save an actor type variable with some properties in a component of my character where it manages the weapons. Well, it turns out that when I save that variable and try to access it, it says that its parameters do not exist and it gives me an error, does anyone know why? I have everything replicated in a RunOnServer

shrewd tinsel
#

Owner No See i mean

heady python
final quest
#

do local multiplayer projects use multiple game instances?

quiet fjord
#

I already found the problem, it turns out that the variable that does not save me is an actor type variable

#

It turns out that the other types of variables do save them for me

heady python
heady python
final quest
heady python
quiet fjord
#

If the problem is that the parent variable is not replicated and that is why it is giving me an error, if I solve the problem I will tell you

final quest
heady python
real ridge
#

solvved

heady python
real ridge
#

guys how to make healthbars visible only for some range?

#

in mp

quiet fjord
#

ready i got it

final quest
#

the walls are just static meshes

real ridge
# prisma snow "range"?

for example i will be 6000+ "range"points away from enemy so his health bar will disappear

#

when I will be close enough it will show again

prisma snow
real ridge
#

now its like this

#

distance yep

#

but its not working heh

prisma snow
#

well

#

you need to calculate distance, either every frame or at. regular rate

#

to make it cheaper this case would benefit of comparing squred distances, it avoids a square root operation

#

Unreal's vectors have functions for this in C++, probs also in blueprints

real ridge
#

ok i dont care what distance it will be problem is how to set it for some players visible and for some no

#

not

#

so first problem i need solve it how to show it for some and for some not in same time

#

as someone should be not far and someone not

prisma snow
#

well need to iterate through the actors and check distances for each one of them

#

also this is barely multiplayer, UI is client side only

real ridge
#

ik i am doing it all in pawn

#

kekw

prisma snow
#

or maybe in tick for all pawns of the relevant class, they can do the distance check to the locally controlled pawn

real ridge
#

lol its working now

prisma snow
#

๐ŸŽ‰

real ridge
#

ok guys I know I am asking it here 151515x times but finally want to finish dynamical healthbars /allies are green for allies and enemies are red but for their allies also green how i can compare alll other players teams with mine and set color to healthbar

#

i have variable enum teams

#

every player has it its replicated

#

and it has only 2 values red or blue

#

doing it like this and also its comparing fine when i print I see false sometimes when enemy is there

#

but he dont change color anyway

#

he is like immediately rewrited with true

teal frost
#

Anyone able to help with this?
I've Got an event with a timer I'm trying to set.

Upon interaction - everything works normal and replicates to all clients when calling from the server window.
Calling from a client window - Only replicates the event, not the timer.

If I hook up the event tick node I'm using to count down the timer to say the branch after the input/interact button node, the event fires on overlap without pressing the button as normal, and everything including the timer is replicated across the board.

This works regardless if the client or server overlaps it.

kindred widget
# teal frost Anyone able to help with this? I've Got an event with a timer I'm trying to set....

First of all. The Interface event being called on the Timeline's update is unncessary. That should be a simple CustomEvent and called directly.

The likely issue you're having here is that you cannot ServerRPC from a client through an actor that is not client owned. Client does not own this MRI machine, and they should not.

What you should do is make a generic interact RPC in your character or controller. And call that by passing in the MRI machine as a generic Actor reference type. Then you can call a generic Interact function on the MRI machine on the server version of the player's controller or pawn. This is where you would start your logic on the MRI machine.

real ridge
#

hah sorry guys again me but i have no idea why my bars still not working when i change team enemies will change to red but enemies still see me as blue this is how i am doing it

#

via time function

#

its on begin play

#

any ideas whats wrong?

dark edge
#

Gate by Locally controlled or disable collision on overlapper if not locallycontrolled

#

Or a sphere overlap on a timer

kindred widget
#

Indicator system would be much better for this.

#

Widget's indicated component's screen space projected Z value can determine if it's too far away to be shown.

dark edge
#

@real ridge repnotify my dude

dark edge
#

I was mostly thinking in terms of having an up-to-date list of nearby actors of interest for whatever mechanic, not just displaying health bars

kindred widget
#

Possibly. Probably cheaper than a tick check at least. But that depends on the amount of movable things triggering the overlap checks. Still probably cheaper than a tick check.

teal frost
# kindred widget First of all. The Interface event being called on the Timeline's update is unnce...

Trying to work through what you said. Sorry I'm new to this. By the interface being called on update do you mean the event dispatcher? If So that is how I was shown to replicate that event through my playercharacter bp as shown in the ss here. This is driven by my interact system (also attached) It may not be 100% set up right cause I've been experimenting with it in probably the dumbest of ways.

I'm sorry if I'm just outrageously dumb. I'm trying to fix that too.

dark edge
#

Just check if the widget's pawn's team matches the LOCAL player's pawn's team.

kindred widget
dark edge
#

@teal frost what's the high level gameplay mechanic you're trying to do here?

teal frost
teal frost
dark edge
kindred widget
#

I would start with that generic interaction thing I mentioned before. Your core problem here is the Actor's Ownership. You cannot ServerRPC through this actor. Which is why it only works for the host.

โ€ขMake a new ServerRPC in your PlayerController that takes in an actor reference.
โ€ขMake a new Interface and a function in it that takes in an Actor reference.
โ€ขMake your current control press that interacts call this ServerRPC in the local PlayerController, passing along whatever you're trying to interact with, in this case you'll pass a reference of the MRI machine.
โ€ขIn the ServerRPC function, call the interface function on the actor reference from the RPC.
โ€ขImplement the interface in your MRI and call your multicast from this function call.

heady python
dark edge
#

The Client -> Server RPC needs to happen in the pawn or playercontroller.

#

Then you're serverside, and can do whatever you want.

prisma snow
dark edge
#

I would probably do this in scanner:

InteractionEvent -> Set bool bIsScanning(replicated, repnotify)

OnRep_bIsScanning -> update state based on the new bIsScanning, call an event to fire off a timeline if this is a timeline thing

#

That simple

#

One Run On Server Event(in pawn), One RepNotify(in scanner)

#

You could use a multicast instead of the RepNotify but I prefer repnotify pattern myself

teal frost
#

Thanks guys! Gonna try to work through what you've both said for educational purposes.
I appreciate the input!

dark edge
prisma snow
real ridge
#

I used comparing self with pawn of my type

#

and get distance to and set visibility

#

on event on timer

real ridge
final quest
real ridge
dark edge
#

Team should be a replicated variable with a repnotify

#

every time the repnotify fires, you update Color

real ridge
#

team is replicated now yea

#

hm so let's say

#

Begin play-> set rep notify team -> in rep notify ( do comparing) cast to widget and set colours)?

real ridge
#

comparing = get local player pawn -> get team = get somehow other pawns

dark edge
#

Make a function in the pawn to calculate the color. Have it read the pawns team and the local player's pawn's team. Have it set color

#

You don't need the other pawns, this is happening on every pawn

#

Every pawn looks at their own team, and the LOCAL player's team, and chooses color based on that

#

on every machine

real ridge
#

bruh but this will set only color for myself

dark edge
#

You can trigger it with a repnotify or just do it in a binding.

real ridge
#

u don't get my point meh

dark edge
real ridge
#

I will try explain

#

4 players yes?

#

2 in red team 2 in blue team

#

Red = Roger Simons Blue=Zed and Karlas

#

now

#

they are in game

dark edge
#

Say it's on Roger's screen

#

Simon's pawn is red. Rogers pawn is red. Simon's bar is green.
Rogers pawn is red. Rogers pawn is red. Roger's bar is green.
Zed's pawn is blue. Rogers pawn is red. Zed's bar is red.

#

that's how it works

real ridge
#

Roger sees Simons as blue , roger sees zed and Karlas as red but Karlas sees zed as blue and Roger and simons are red for him also for simons is Roger blue but zed and Karlas red and for zed is Karlas blue and Roger and simons red

#

i mean sees as blue ( his healthbar is blue)

dark edge
#

just remember that the health bar color is NOT replicated

#

Roger's pawn has a friendly healthbar on his and Simon's screen. He has an enemy healthbar on Zed and Karlas screen.

real ridge
#

i need exactly this

#

what is in this plugin check

dark edge
#

OK do exactly this. Do you currently have a team variable that is replicated?

real ridge
#

Yep

#

it's enum team replicated

#

posted it above check

#

here is how I am comparing now

#

works only sometimes

dark edge
#

It's really simple to do with a binding. In the UI widget, for the bar color binding, check if the widget's pawn's team matches the LOCAL PLAYER PAWN's team.

#

that's it

real ridge
#

should I go try it on computer?

dark edge
#

That's simple enough and will update for any team change.

real ridge
#

and I was doing this above....

#

let me try it

dark edge
#

You'd want to use a repnotify if you had some more complex UI but binding is fine for simple stuff if there's not an insane amount of UI around.

real ridge
#

literally nothing only color

#

make bind on variable or as Function?

dark edge
#

as function

#

your widget will need a reference to the pawn it's on

#

you should have one already for getting the hp value

real ridge
#

i don't have I am sending hp via

#

repnotify

dark edge
#

You can send team via repnotify too if you want

real ridge
#

no sorry I am just getting health bar reference then getting progress bar and setting percents

#

for life

#

no repnotify nothing

dark edge
#

Just give the widget a ref to it's pawn.

real ridge
#

problem is now I am trying to get local player but I can get from it tean

#

team

#

i need cast

dark edge
#

yeah you'll need to do a cast here

twin juniper
#

I'm trying to use projectile movement to have players drop an item

Does this require a multicast or is dropping it on the server enough since projectile movement "replicates"?

real ridge
dark edge
twin juniper
#

I'm pretty comfortable replicating custom events and all that but I'm not 100% certain about projectilemovement.

I've heard it's great for replication. Is that because it's very easy to share the values via multicasting or because UE already has replication built-in just like with charactermovement?

real ridge
#

just player pawn?

dark edge
#

that's local pawn

real ridge
#

so far I did this

#

@dark edge

#

now call it on tick on pawn?

dark edge
#

binding runs on tick

#

assuming you're passing the right pawn ref to this

real ridge
#

but I am not sending anything inside function yet

#

from pawn

dark edge
#

you don't need to send anything

real ridge
#

just asking if send it on begin play or tick

dark edge
#

it gets what it needs

#

dont' send

#

it gets

#

it jsut needs to have a ref to pawn it's on

real ridge
#

what but it's custom function in health which is called nowhere just variable color is binded

#

and I am nowhere sending pawn inside it

#

pawn ref is empty

#

i thought i need call it in player pawn

dark edge
real ridge
#

nah my only problem is I can't get pawn of other kek

dark edge
#

This simple

real ridge
dark edge
#

You aren't understanding what a binding does

#

The binding runs every frame

#

just make sure the widget has a set MyPawn ref and you're golden

real ridge
#

k i need edit it

dark edge
#

You don't need to call the binding

real ridge
#

I do have binding on variable color, not on function

#

aware

real ridge
#

this should be fine or?

#

casting to variable color, sending my replicated pawn to widget

#

in widget compare local with replicated ones

#

setting color

dark edge
#

Your whole setup is a mess

real ridge
#

lol why

dark edge
real ridge
#

same as yours

#

it's same bro instead my pawn i do have player

#

and instead bool I have enum

dark edge
#

it's just self

real ridge
#

because I can send pawn of others to your widget without replicating it or?

dark edge
#

you don't do that

#

here's all you do

#

and it's all local

#

each widget checks if it's pawn's team is equal to the local pawn's team

#

that's it

dark edge
# dark edge

You just do this to let the widget know what pawn it cares about

dark edge
real ridge
#

i did

#

it's now working same as my previous not for 100 % weird

real ridge
#

and here is test

#

maybe problem is I am on same machine :/ u see also my team on the left upper corner and name color is related to name too

dark edge
#

it's the widget's Pawn it cares about, not a player.

real ridge
#

okay

#

need to package it and test on 2 different machines bcs

#

now it's messy on one propably

dark edge
#

You don't need to package, you can just launch

real ridge
#

because I am setting team in menu and I can't here set it before game because my menu is joining me to session on dedicated server so I have to test it packaged with running server on my server

real ridge
#

it's confusing my mind

dark edge
#

On my machine, my pawn is LocalPlayerPawn

#

Your pawn and my pawn both exist on both machines

real ridge
#

how they can if it's not replicated?

#

i can't understand ah

#

i thought i can send something to you only only if I replicate it

dark edge
#

if what's not replicated?
The pawn and the pawn's team are replicated. That's enough

#

LOCALLY, the hp bar color depends on if the pawn and the LOCAL player's pawn have the same team.

real ridge
#

yes

dark edge
#

Team is replicated, Friend/Enemy is not, it's derived by whether the teams match.

real ridge
#

hm did u see video ? what it was doing on one side it was fine on second it was weird I will test it tomorrow hope it will be good

real ridge
real ridge
#

i will try test it Tommorow in real match and hopefully it will be fine

#

( that team changing in game) i do have only because testing when I don't have time to package and test server

low niche
#

Hi, I'm starting to lose my mind, I want to send a server RPC from a client owned actor but it just doesn't fire
1- The node gets called because the print string after it does work.
2- Verified that the actor is owned by client when I set owner from server
3-all actors involved are replicated
I'm pretty sure its a dumb thing I forgot or something not right with project, any help is appreciated thanks.

fossil spoke
#

Typically a Client Actor cant send an RPC unless it has a NetOwningConnection.

low niche
#

@fossil spoke Thanks for reply, no log, I do set the owner of actor from server if that is what you mean

fathom aspen
#

Do you have access to C++?

low niche
#

I can try but I want it in blueprint because prototyping

fathom aspen
#

Well the point is to find out why the RPC is "failing"

#

You can keep guessing or you can debug the RPC and find out what's going on

#

Another reason why BP can even limit you when you prototype ๐Ÿ˜”

low niche
#

Will try thanks for input!

fathom aspen
#

If you get to try, breakpoint AActor::CallRemoteFunction and good luck on the debugging journey ๐Ÿ˜‰

mortal tusk
polar wing
upbeat basin
# mortal tusk Anyone know why this is happening?

I'm going to make a blind guess and say that you attach the weapon directly on the locally controlled character instead of the character that is overlapping the sword, which we will probably figure out how/why if you show what you do on the body of the for each loop as KyleL also asked for

surreal plaza
#

If I have a server function for some action, in this case, spawning a game relevant object, do I need an authority check anywhere or do I just call MyServerFunction() and in either the case of the client or the server, I know that the server processes it?

frail barn
#

sry if this question is stupid, but i dont know how to ask it correctly
if i made a moba game, do i need to store champions information using Data Registries, or it can be stored in a blueprints, different for each champion?
do i really needs all these Data Tables, or it is an overkill in my case?

dark edge
#

Think about how character selection works.

#

Where does the selection info come from?

frail barn
# dark edge Think about how character selection works.

right now selection works fine, because there's no multiplayer and only 2 characters in one blueprint, just to see, how it works
but, before i start to place another characters, i need to understand, how to do it correctly, before they hit 50+

surreal plaza
#

gg

#

Lol, oops.

twin juniper
#

game prints the name of the pawn I'm passing through

#

game simultaneously insists that no value is passed

dark edge
twin juniper
#

OnPossess is something that does not seem to trigger on clients

I eventually found this thread: https://forums.unrealengine.com/t/in-a-networked-environment-when-does-the-players-pawn-actually-get-created/66413/18

I don't see where I'm going wrong. Really, PossessValid shouldn't even have an input, it should just get the possessed pawn.

I'm so lost. If Possess isn't triggering, then why is the client's camera snapped to the pawn, as if it's possessing it?

Epic Developer Community Forums

GameMode only exists on the Server, ergo no Authority Check needed. Possessing should give the Controller, on Server and Client side, the โ€œControlledPawnโ€, so you donโ€™t need to save it. From the Pawn side, you can do โ€œGetControllerโ€, which should also work on Clients. To get the correct Client Controller on a Client, you just need GetPlayerCo...

fossil spoke
#

I would be more concerned about CPU. But the main thing that you should be doing is Profiling. Every game is different, you wont know what you need until you test it yourself.

#

If RAM is the bottleneck (which is unlikely), then focus your optimization efforts on improving that.

#

Same goes for any other bottleneck.

#

It requires testing and profiling.

#

What do you mean? Host however/wherever you like.

wheat niche
#

Hey, how can i check if steam is opened

fossil spoke
wheat niche
fossil spoke
#

You want to know if another program is open in the background?

#

The Steam integration with UE should provide that functionality for you. It will tell you if Steam is available, but not necessarily if its in the background to the degree which I think you are asking.

twin juniper
#

the client just returns nothing when I ask what its possessing, which is a bit of a problem since I have a reference to the possessed character

#

what I think should be happening is the game mode runs its event that spawns a pawn and tells the player controller to possess it. As far as I can tell, that happens

Then I want the client to set a reference to the character it's possessing, and add its HUD. And add the appropriate mapping context based on what it's just possessed

#

that's not happening

#

listen server works great though

cosmic yew
#

Was curious to check out multiplayer and set the clients to a size of 2 and listen to server option. Launched in Unreal and when I attempt to interact with a door I made that normally rotates, it doesn't rotate on the other screen. Also noticed my widget I add to viewport for walking near a door is displayed on 2nd client as well. Any advice?

twin juniper
# cosmic yew Was curious to check out multiplayer and set the clients to a size of 2 and list...

you need to look into replication. I imagine you have some event called like "OpenDoor" or something that opens the door. When the server opens the door, is the server the only one that sees it open?

are clients the only ones that see it open if they open it?

If you haven't put any work into replication at all then that's probably the case.

What you need to do instead is have players not just directly open the door, but send a message to the server that the server should open the door. The server will then activate a multicast event that tells all the clients that the door is open.

You should also probably have a RepNotify on the door for "IsOpen" or whatever you measure that with. If its true, set the door to the open position, if its false, set it to closed.

You can trigger the RepNotify at the end of the server's door animation. That seems to work really well for me

twin juniper
# cosmic yew Was curious to check out multiplayer and set the clients to a size of 2 and list...

๐Ÿง‘๐Ÿปโ€๐Ÿš€Get the project files here on Patreon: https://www.patreon.com/posts/66842088

In this video we take a look at the basics of replication. We will cover the concept of replication and what it takes to replicate the server instance to the client instances to keep everyone in sync.

We also take a look at how we set an actor to replicate, we l...

โ–ถ Play video
#

check this series out

cosmic yew
weak linden
#

You will likely also need bRelaunchInSteam=True in your DefaultEngine.ini under the [OnlineSubsystemSteam] section

twin juniper
cosmic yew
#

Ok, thank you.

dim trail
#

does a server->client rpc take as much resources as client->server?

glossy kettle
#

default UE one wont cut it in 2023

#

for more than 2plyrs

twin juniper
#

this seems so basic.

fossil spoke
glossy kettle
twin juniper
#

if I do a delay or manually wait before pressing Z here the HUD appears on the screen for one frame then disappears but my mapping context stays

tranquil swallow
#

Hey guys I'm creating a weapon system and I'm wondering if this would be one of the better ways to replicate the shooting aspect of it.

Player Shoots > FireWeapon_Client is called > Calls fire weapons server > Calls fire weapon all (multicast) which then calls my fireweapon method which then gets handled in the weapon

Is there a way to do this better or what would you suggest.

twin juniper
tranquil swallow
twin juniper
# tranquil swallow So anything visual I would want to handle in the client and the server?

Pretty much? Things like blood splatters you might want to wait for the actual server confirmation though. MOST players will not know with certainty that their shot "should" have hit from their perspective.

But they will know, "hey I shot this gun .6 seconds ago, why hasn't it shot yet?"

The answer is because there's .6 seconds of latency for them. But you can disguise that by having them see an animation play and particle effects fire and all that

#

you're basically lying to them, like every other FPS on the planet

tranquil swallow
#

Also if I have a bp and it has many variables, if I tick is replicated for the bp does it replicate all the values or is it only the ones i manually set

twin juniper
#

that I'm not as sure on but I do know that if you're not replicating a variable or passing it through RPCs there's no way for networked players to see their values

#

so like your gun firing is a multicast, right? That's because you want all the relevant clients to see that the gun fired.

Your ammo though should probably be a RepNotify. That way if a player joins late or becomes relevant after the gunshot they will have the correct ammo-count replicated to them

tranquil swallow
twin juniper
#

Yeah, if a player joins late, anything handled exclusively by multicasts won't show up. Because they weren't connected when it happened

thin stratus
#

Same goes for when they are out of relevancy range

twin juniper
#

so for like doors opening, on the server I play the animation, and I do a multicast to tell everyone a door is opening. And then only on the server when the door finishes I use a repnotify to show that the door is open/closed

tranquil swallow
twin juniper
#

Does anyone know if Lyra has genuine network stuff inside of it? I'm downloading it now to see what their solution to my problem was but if they don't do networking there's no point

thin stratus
#

The whole game is multiplayer

#

Anything else depends on what your problem is

twin juniper
#

why didn't I think of this 16 hours ago

righteous thanks

#

I just switched over from having assigned a default pawn in the game mode's default classes to having the game mode spawn and assign controllers and it totally ruined everything

#

WHOA WAIT A MINUTE I read your compendium at work yesterday! You're a legend thanks a ton for that

dark edge
#

So you can detect old state that just got replicated in vs fresh state that should have sound and animations etc?

twin juniper
dark edge
#

Basically to tell the difference between an incoming repnotify that's fresh vs an old one (late join, relevency)

twin juniper
#

ohhhhhhhhhhhhh

dark edge
#

I suppose you could make a struct for your state that includes a timestamp?

It'd be like

bDoorIsOpen
float TimeStamp

twin juniper
#

idk I've just kept all my stuff totally separated between mulicasts and notifies

dark edge
#

And in the repnotify you play the animation if Timestamp is recent and just snap the door angle if it's not

twin juniper
#

that's interesting though

#

is the idea that you'd be saving resources?

dark edge
#

More like saving programmer headache and time

#

Repnotify all the things

twin juniper
#

Hmm, I'd say once you're really familiar with it its not that bad

I was furious a few weeks ago trying to figure out what the differences between all these options were and now I appreciate them since it helps compartmentalize everything

dark edge
#

Like say I late join and there's a bunch of nearby doors that are open.
All the repnotifies would notice that the doors were last modified over 1s ago (server time), and just snap open and skip playing the sound etc.
But if I watch another player open a door the repnotify would be within the time window and I'd see the animation and hear the sound.

twin juniper
#

I basically divide everything up into RepNotify = "info a player who JUST joined would need to access"

and Multicast = "show current relevant players an animation or something"

dark edge
#

Yeah I'm talking about just jamming it all into the repnotify. Might be worth trying I think. I haven't tried it myself yet.

twin juniper
#

I have tried and failed miserably haha

dark edge
twin juniper
#

I'm not the best at this stuff though so who knows

#

Yeah but that's why you'd multicast the soudn and animation

cramming it all into notify may be doable tho

dark edge
#

Yeah im talking about ditching the multicast. I'm sure someone's done it.

graceful flame
#

If you ever find yourself using a multicast and adding variables such as a vector into it, itโ€™s probably better to stop and refactor the blueprint to use a repnotify for a single boolean and then get the vector without sending it over the network.

dark edge
#

if it's a replicated variable you're not assured that it's up to date when the boolean repnotify fires

#

and if it's not a replicated variable then why were you RPCing it

#

It's presumably some vector the server cooked up that the clients gotta know about

twin juniper
#

Lyra does not have easily accessible blueprints for things like their controllers so I actually cannot find a solution here. Damn

graceful flame
#

I found that when I was first using multicast Iโ€™d be sending vectors over the network without realizing I didnโ€™t have to. But a repnotify removes that temptation.

dark edge
#

Hell yeah lets go

#

Testing my graph / network simulation plugins I'm making, working with indices into FStruct arrays is scary but it's zoomy.

#

TSparseArray is awesome

#

whoops this isn't cpp

mortal tusk
dark edge
#

Spawn a REPLICATED actor on the server

#

don't multicast the spawn

mortal tusk
#

omg it works

#

thanks

dark edge
#

Pretty much don't multicast anything. You'll find yourself using it mostly for unimportant stuff like cosmetics

#

not a hard and fast rule but your code will be much better if you use replication and repnotify

mortal tusk
#

ok imma gonna note that

dark edge
#

Basically instead of MulticastOpenDoor, you'd instead want to have a boolean bIsOpen, and in the repnotify for it, do the stuff that should be done when that changes

torn obsidian
#

Guess I will ask here since I'm not sure where else... I have a game using VR and Desktop. They have to be in the same scene. But there's stuff I want to disable in VR for performance reasons, foliage for example, I've been looking at data layers and the older sublevel stuff and I can make it somewhat work with sublevels but I'm having a lot of trouble finding a way to do this. Anyone have ideas? Most stuff I'm trying to load or unload will get done on all instances...

soft relic
#

is it possible to replicate a UObject instead of an actor?

chrome bay
#

Not without an actor

soft relic
#

I see

twin juniper
# chrome bay It can't

Hey, if I set dormant all on actor then how can I use RPC? Is it possible? or is there any workaround?

chrome bay
#

no

#

Clients can't call RPCs on a dormant actor

#

Server can, but you need to wake it

twin juniper
chrome bay
#

Nothing you can do about that

#

If an actor goes dormant it's network data is destroyed. Waking it means it creates all that again

dire tusk
#

Hi peeps!
I was wondering about network testing a basic asset.
Nothing fancy, I just want it to play an animation.
The blueprint does have a few variables like a bool to toggle the actor on an off.
The animation is playing fine on both machines?
I launched 2 game instances and it looks like it is replicated perfectly on the other machine.
I have not added anything for networking or set up anything specific for replication.
Or set any variable for replicating or anything at all?
Is this just UE5 default behavior duplicating my object on the other client?
Or is it just an editor thing and I should be testing with a dedicated server?
From what I'm seeing I'm making the assumption animation play just easy replicates in networking?

hushed rain
#

How would one approach a rank system in a listen server game? Is it possible to secure it against hacking ranks?

short arrow
#

Hosts will 100% cheat. As far as sending off the match results, the server has to do that aswell...

#

I dont know what dead by daylights solution was because they had a ranking system in their listen server game. Which is weird because that meant they were trusting the server host to send data about the match results which I believe could have been hacked

#

But the hosts were definitely cheating quite often, or they would leave as soon as they were about to lose to avoid match results being sent

hushed rain
#

hmmm, thats interesting about DBD... thanks, i thought that was the case sadly lol.

short arrow
#

Yeah it slowly became unplayable. They had no choice but to switch to dedicated servers

elfin sail
#

hi , I am getting an issue , when 2nd player join it does not have first player state data but 1st one have data for both

#

any idea what i am doing wrong

elfin sail
#
void AMirrorCharacter::OnRep_PlayerState()
{
    Super::OnRep_PlayerState();

    PawnExtensionComponent->HandlePlayerStateReplicated();
    if(GetMirrorPlayerState() && IsLocallyControlled())
    {
        if(UMirrorGameInstance* MirrorGameInstance = Cast<UMirrorGameInstance>( GetGameInstance()))
        {
            UpdatePlayerDataOnServer(MirrorGameInstance->MirrorSaveGame->PlayerProfile);
        }
    }
}
#

this how i am updating data on server

twilit radish
# short arrow I dont know what dead by daylights solution was because they had a ranking syste...

I think the assumption can be made that by far not all players on a certain game cheat though, so you can probably assume that a good amount of games will just bring back fair results of who won/lost. To prevent cheating to some amount however you could probably just keep track of what matches have been started by the matchmaking system and keep track of who played, then you can not just 'randomly' ruin people their ranks beyond at best one game IF just the host sends back the results. If you go a step further you could have all players in a game send over their match results and if they differ you just invalidate the match results. That would eliminate the scenario of "the host said they won" because then it doesn't match up that 2-3 other player say they won instead.

#

Still not perfect whatsoever in the end. Although the last scenario overall sounds decent-ish in general, it's basically impossible with random matchmaking to get a full game of cheaters and even then obviously they all want to "win" so the match result will just be disregarded. But that does suck in the scenario of people who just want to see the game burn and ruin random matches. But I don't think that's fixable whatsoever no matter what you do without dedicated servers.

#

But again, the chance of that being such a big problem in the first place seems small to me. That's never going to be the majority of people ๐Ÿ˜„

eternal canyon
#

Maybe

twilit radish
#

If you go a step further you could have all players in a game send over their match results and if they differ you just invalidate the match results.
I got dietered

eternal canyon
#

But that might be a lot of data

twilit radish
#

You can to some degree, but I don't think that's worth the headache of dealing with stuff like that whatsoever. Also it's still very much a game you will lose in the end. People will find new ways to cheat and there's also going to be stuff you can't really validate. It's basically the same madness as with GTA V.

#

Giving authority to a random client is just never going to be trustworthy ๐Ÿ˜„

grand hatch
#

i have this code to decide for the ai what player to chase but it doesnt work properly for some reason. The ai only chases the host unless the player being chased touches the ai then the ai for some reason swaps target.

dire tusk
#

Hi peeps,
My blueprint plays an animation and its working by default in both clients?
But I didn't even enable my blueprint to replicate.
I'm just trying to understand if skeletal mesh animation plays just network properly by default.
Or should I be safety adding anything?
I figure if it does just "work" then my safety layers is just networking what manipulate calling the 'skeletalMesh Play'

unkempt tiger
#

If a replicated component is created serverside and immediately multicasts a reliable RTPC, that reliable multicast is likely not to make it to clients, right?

rotund onyx
#

Is there a way to send a small array of bytes (limit in UE is 65,000 I think?) from client to server without making a whole new replicated variable?
For reference I'd like to send teeny tiny files from client to server or vice versa

rotund onyx
elfin sail
#

I have replicated variable , its correct on server but not updating on client

#

what i am doing wrong ?

dull tinsel
#

Hey anyone know a reason that a server event would lose a reference to a replicated variable? (whether it was passed in as an input or attached directly)

dull tinsel
#

I got a client who is making a VR naruto game and they're trying to replicate the hand animations but whenever they try to send the reference to the new animation it comes back accessed none on the server

dire tusk
#

I just want to hire someone for 2 hours to talk unreal network and blueprint designing and call it a day lol

indigo brook
#

Hey, what's the game flow to do a win state?

Example, if player reaches the button and interacts with it first, they are the winner. I'm having a bit of trouble with the pipeline.

#

So like, does the PlayerState tell the GameMode, or does the actor that I interact with tell the GameMode?

quasi tide
#

There are a couple of ways to do it. Completely up to you.

#
  1. Actor can tell the GM, sure.
  2. Actor can tell the GameState.
  3. Don't forget to notify all the clients that the match is won
indigo brook
quasi tide
#

Get the widgets PlayerController, then do a server RPC.

indigo brook
quasi tide
#

Most all UI stuff will be routed through the PlayerController in a networked scenario

indigo brook
#

Like this? The GM is GameMode and PC is Player Controller

quasi tide
#

Yeah

indigo brook
#

@quasi tide Also, thanks for answering

indigo brook
#

So I do that, the widget does come on, but I'm trying to also set a tag or variable that when that owners widget pops up, if they arn't the winner, they see loser. I have the binding all ready but it seems like the Server is the winner, and the client is the loser, even if the client wins

dire tusk
#

Yeah but It doesn't help when I feel I understand the concept.
I see videos using the concepts how I thought they worked.
But not see the same outcomes on my end lol
So its like I get the subject matter and concept but I'm obviously leaving out small mistakes or miss understandings.
Got used to class environments for studying I guess lol

quasi tide
dire tusk
#

95% of the time I talk to someone and I go "oh got it" or "i see what you were going for you were close" lol

quasi tide
#

That's a practice issue.

#

You just need to do it more frequently. Make small games.

#

Super small games.

dire tusk
#

Yeah I haven't been knee deep in networking in a bit lol

low helm
#

I'm thinking about the cheapest way to send a weapon fire notification down to clients(BP only). I've seen plenty of warnings against multicast, that replicated variables are generally cheaper. Would it make sense to send weaponfire notifications simply as an OnRep Byte that increments

quasi tide
#

Multicast is fine. Just depends on what you are trying to do.

gaunt cliff
#

ControlChannelClose is being shown in the server log and the clients cant do anything
no google search results...

low helm
#

Well I'd like rapid fire machine guns, why not Byte OnRep

#

Or as rapid as I can get it

indigo brook
# quasi tide Just need to track who is the winner and then pass a simple bool "bHasWon".

Agreed. Just seeming to not make the right connection haha. I'm not sure if it's because I'm calling things weird. It makes sence

  1. Character interacts with interactable actor
  2. Actor casts to GameMode and tells it to run the ShowWinScreenGM event
  3. GameMode tells PlayerController to fire event for ShowWinScreenPC
  4. ShowWinScreenPC event opens widget on owning clients
  5. Widget opens up and the player can see if they are a winner via text bind or loser
quasi tide
low helm
#

Thank you

quasi tide
indigo brook
#

The winner is whoever interacted with the button

#

So pass that through to the GM event maybe from the Actor

quasi tide
#

Okay. So whoever flips it, get their controller and flip the bool to true and then notify the game mode.

indigo brook
#

Gotcha

#

I was trying to use tags and stuff first haha

quasi tide
#

Then the game mode just passes that value from the PC into the client rpc

#

So when the client gets it, they just need to check if it is true or false

#

Because this is specifically about the end game, part, onrep doesn't really matter. Going to be going to a new map anyway.

indigo brook
#

True, alrighty, I'll give the bool variable inside the PC a try

indigo brook
#

@quasi tide Alrighty, I'm still having the same issue. Where am I going wrong?

quasi tide
indigo brook
#

roger, I'ill give that a shot

quasi tide
#

You're always getting the first PC (which will be the server or some random one on dedicated server). So it is not reliable.

indigo brook
quasi tide
#

Yeah

#

And this should be getting ran on the server

#
  1. Client tells server it wants to interact with object
  2. Server validates and processes the interaction
indigo brook
#

This worked!

#

Both times, the correct player I was playing as got the winner status

quasi tide
#

๐Ÿฅณ

indigo brook
#

@quasi tide Thanks for rubber ducking man. Turns out the whole time I had to get the char ref, then get owner...

quasi tide
#

When I do networking code, it helps just thinking about what computer I am on in the flow of events.

indigo brook
#

I tried at first with adding a tag to the player character, but that seemed to not work originally.

dire tusk
#

Question about RunOnServer replication.
I'm noticing sometimes calling a RunOnServer function does nothing?
It won't enter the function at all? I was thinking it would always call onto the server to use the event?

quasi tide
#

Won't work if the actor is not owned by w/e connection is trying to do the server event

indigo brook
dire tusk
#

currently its a button on the ground that any player can walk on and there's a dispatch on the level blueprint to use the RunOnServer event.
On what the button triggers.

quasi tide
#

I'd recommend doing a BPFL to handle some of these cases, so you don't necessarily have to keep doing the same few nodes (get pawn -> get controller -> cast to blah, etc..)

indigo brook
#

Agreed

quasi tide
grand hatch
quasi tide
#

You have to configure it to do so. Just have the character be a stimuli source (or w/e it is called)

#

And make sure to turn off the setting where all actors auto-register as a source

#

It's in some .ini file, I forget where

dark edge
dire tusk
# quasi tide Still depends on who "owns" the button.

So this is what I have
LevelBlueprint has a dispatch for an overlap pressed that's set on the button.
I added an event in the level blueprint to do something when the button is pressed.
When you walk onto the button a gate opens. The gate I'm working on networking.
I was thinking that gate could use the RunOnServer but if RunOnServer functions only work for whom ever owns the gate.
Then when the button is pressed do I have to some search for the gate owner then call the gate open?

grand hatch
indigo brook
dark edge
#

It's the brains, the GameState is just the state

indigo brook
#

Thanks, you guys are helping me wrap my brain around all this ๐Ÿ™‚

quasi tide
#

Use GameState to do any GameMode desired communication to the clients.

#

Because GM only exists on server, GS exists on clients as well.

indigo brook
#

For sure. Next course on the menu is when to make variables replicated and during what use is and isn't acceptable

quasi tide
#

I use GM to literally set the rules. GameState tracks the progress of stuff.

quasi tide
dire tusk
indigo brook
quasi tide
#

Do it right. Don't cut corners.

#

Make a BP button. Make a BP gate. Link them together.

#

When player crosses BP button's trigger box, open the BP gate.

quasi tide
dire tusk
#

you're still going to end up on the exact situation I'm in already.
Player walks on button triggers overlap event, the function to trigger the gate

#

thats the key to level BP or internal BP

quasi tide
#

The GM then does w/e it needs to do and then tells the GS to trigger w/e it needs to do

dark edge
#

you set it in the level

#

so button knows who to tell that it got stepped on

quasi tide
#

GM/GS is kind of meh, but they are tied together.

dark edge
#

They really should have called it GameController to mirror PlayerController/PlayerState

dire tusk
#

the ownership of objects can change at run time @dark edge last I remember

quasi tide
dark edge
#

don't change ownership of button

#

is the trigger an input or just stepping on the button?

indigo brook
dark edge
#

If it's input, it'll go like

Pawn:
Input -> run on server event
run on server event -> choose what to interact with -> interact with it

Button:
Interacted with -> tell Door

Door:
Interactedwith -> open

#

You'd have interfaces if it's a system with more than just buttons and doors

quasi tide
#

You can also just simplify this process and have the GM set the rules on the GS at the start. Then just handle it all internally in the GS. And leave the GM to just handling connection stuff and what not.

#

Completely up to you

indigo brook
#

Rock on. I'd have to see this in action to fully understand it. '

quasi tide
#

The combination of GameMode/GameState is pretty much however you want. They are intrinsically tied together and GM exists only on server.

#

There really isn't a "right" way per se.

indigo brook
#

That's what bogles my mind haha. They are tied together, meaning they share the same variables?

quasi tide
#

No - meaning they are tightly coupled.

#

IE - they are expected to work together

#

And reference each other and all that jazz

indigo brook
#

Agreed, I just need to understand how, that's a problem for another day though

latent heart
indigo brook
#

I just need to spend a few more hours in tutorial land

quasi tide
#

Nah - just build shit

#

Tutorials don't even understand them.

indigo brook
#

LOL

#

True

#

Building things does help for sure, it's how I learn

#

But I also need to see visual aids as well

clever rain
#

So maybe someone can help. I'm trying to have a hacking system based on a puzzle. (Its just a simple decrypt a caesar cypher) I build all the logic in a replicated component and added a ui that displays everything for it. I put that component on what I'm wanting to "hack" (in this case a door which is also replicated) but for some reason it won't replicate from client to server when the puzzle is solved. (I have a post on the forums with pics if I need to post it/dm it).
I'm thinking the problem I have is with how I'm checking for success every time the value in the editable box changes (I use an event dispatcher to pass back to the component) but since widgets aren't replicated it's not being called back to the server as a success. I can't think of another way to do it.

gaunt cliff
#

ControlChannelClose Control Channel result types Control channel closing
any clue to why this error happens to clients trying to connect to the server?

dark edge
#

Widgets just renders the puzzle

#

What kind of puzzle is it?

dark edge
stray badger
#

Could anybody outline any best practices for eliminating network latency for an owner spawning a projectile? Iโ€™ve heard of client side prediction but Iโ€™m having a hard time grasping the concept. Many games handle this very well. Such as, Squad, Hell Let Loose, and pretty much any major game involving ballistics.

dark edge
#

Basically all that passes the network in my setup is the projectile data at time of fire.

#

Won't work for wildly chaotic stuff like bounces etc but for bullets it's great

stray badger
#

Sounds promising

kindred widget
# indigo brook Agreed, I just need to understand how, that's a problem for another day though

There is nothing largely complex about GameMode and GameState. At their core they are just two Actors. GameMode is not replicated because it's server only. GameState is replicated. GameMode does logic handling and stores said "state" on the GameState, where it can be replicated to clients.

Unreal was created on the premise of being an FPS engine. GameMode was designed to handle the game's mode's specific stuff. It would tick up points gained in capture point modes, track kills for elimination modes, track scores and respawn both teams when one team scores a point for team elems, etc.

And while game mode was handling all of that actual logic, it was storing it's states, like current kill counts, current team wins, current capture point progress all on GameState where even clients had access to it.

You're very free not to use these systems as well, they were just designed as an anti cheat ideology to keep game code cleaner because the only actor in the game that determined victory conditions was the GameMode and it only ever existed on the server.

Later on the GameMode became a basic way to store some default classes for a map. An easy way to change out AHUD actors, or use a different PlayerController. These being for games that have vastly differing modes like a game with combat maps and then a strategy mode maybe.

These days with Lyra the Experience system has taken over handling the default classes and extended on it heavily. GameMode can still do it's core job of determining game progress, and GameState can still stores game progress. Except they now do it via dynamic components. Instead of having "GameMode_CapturePoints", "GameMode_Elemination", Lyra just dynamically puts a single TeamDeathMatchScoring component on their GameState that handles the game's scoring and victory flow.

dark edge
#

Simulates independently on all machines that care

#

When a hit happens:
"Projectile 3453 hit Pawn Pastas in the left ass cheek at time 36.0035, please approve it Mr. Server"

#

Server checks and makes sure it's close enough to be legit

#

Basically clientside hit detection with the server giving the thumbs up

#

Can only work if your projectiles are pretty deterministic. If you're doing air drag you'll have to be careful

clever rain
stray badger
#

@dark edge Last question, and the question is about timestamps. Are they available in blueprints or just c++?

#

Should just be a get timestep function right?

dark edge
#

The component can be replicated. Just the UI can't

#

You would probably want a general "send text input to component" RPC in your Pawn or player controller unless you just assign ownership of the puzzle to the player when they interact with it. Up to you.

#

It depends on how worried about cheaters you are. You could just as easily just add an activate function to your interaction interface. And just trust that the client solved it. That's pretty cheatable though

clever rain
twin juniper
#

My game is first person and networked

When players equip an item, their 3rd and 1st person meshes play an animation

But they can't both attach the item to themselves. So I always attach the actual item to the third person mesh

For first person I locally spawn a fake item and put it in the first person character's hand.

For clients this works great

If the listen server equips an item though, it looks like SpawnActor spawns that fake first-person item for everyone else.

My next attempt is going to be having clients locally destroy the fake item if possible as soon as it spawns, but I'd rather they just not have it spawn at all since that's clearly info being sent over the network that doesn't need to be

dark edge
#

Or actually

#

just swap out the actual mesh, use the same meshcomponent

#

and make sure the socket names are the same

#

so everywhere, the gun is attached to MyMesh.GunSocket

#

jsut MyMesh is the 1pp one for client, and 3pp one everywhere else

twin juniper
#

there's two though. First and third. I have functionality on these actors too, they can't just be flat meshes.

The fakes could be, but that's a bit obnoxious compared to just spawning a duplicate and turning off its functionality

twin juniper
#

I should be able to pass the info along from the actor the mesh is copying it won't be that bad I guess

dark edge
#

Try that. See if 1 mesh component can have different meshes on different machines

twin juniper
#

it won't even exist on different machines it'll be purely local

dark edge
#

The rule would be like

BeginPlay -> is locally controlled? -> true -> Meshcomponent.Mesh = 1pp
-> false -> Meshcomponent.Mesh = 3pp

twin juniper
#

Yeah haha I have that for the spawning only the listen server was spawning it for everything else

If its a mesh component that's set to OnlyOwnerSee then this problem should go away

dark edge
#

You won't have to do any of that

#

you just have 1 mesh component

#

the mesh ASSET it uses depends on if locally controlled or not

twin juniper
#

for shadows I need it to always exist on the third person mesh

dark edge
#

ah true

#

hm

twin juniper
#

yeah weird edge case I just spent the morning fixing shadows and all that

dark edge
#

do you need shadow of item in hand?

twin juniper
#

yep

dark edge
#

yeah fake duplicate it is

twin juniper
#

Its already done nbd

just gonna have a FP mesh component thats set to only owner see

dark edge
#

I'd do it like this

twin juniper
#

OnlyOwnerSee and OwnerNoSee are lifechangers

dim trail
#

im getting errors when i try and declare my method as a multicast, for some reason when i add _Implementation it wont work:

    UFUNCTION(NetMulticast, Unreliable)
        void ShowDamageText(const FText Value, FDamageTextSettings DamageSettings, bool DurationTrue, float Duration);

.cpp

void ADamageText::ShowDamageText_Implementation(const FText Value, FDamageTextSettings DamageSettings, bool DurationTrue, float Duration)
{
    // Find Settings of Damage Type Gameplay Tag

    //ShowText(Value, DamageSettings, DurationTrue, Duration);
}

with this error:
Severity Code Description Project File Line Suppression State Error C2511 'void ADamageText::ShowDamageText_Implementation(const FText,FDamageTextSettings,bool,float)': overloaded member function not found in 'ADamageText' OpenWorldStarter

twin juniper
#

hi everyone. when a client opens a remote level, is there a way to perform logic on the server before the player controller is actually spawned into the level? i've been looking at virtual functions in AGameModeBase, but i can't prevent the player from spawning while i'm performing logic

#

not sure if i'm misunderstanding something fundamental here

kindred widget
dim trail
#

thanks

serene furnace
#

hello !
I have this code that does some weird stuff ๐Ÿ˜„
My "Pure cast" node is not failing, it's rendering true, and firing all the code.

But for some reason, the break points in the orange zone (S_ItemLooted) are not triggering at all, the events either, nothing actually fires there >< any reason why ?

twin juniper
#

void WeirdStuff();

serene furnace
#

and even the "Print sting" does not fire

I was thinking it might be my inventory component ref that feeds the event that would fail to access but I would get an error, and My message log is never displaying an error

#

I wanted to double check So I putted a print string to the inventory component reference and it renders a value of a component.

#

okay I did one more check, when the server (listen server) executes the code, then the entire things is displaying...

kindred widget
serene furnace
#

Question is in image is that makes more sense

dark edge
#

What's the high level overview of what you're trying to do?

kindred widget
#

No. You're sending a widget reference from the server through the OwningClient RPC. Ignore everything else except for the OWN_TransferLootedItemStruct and the RemoveFromParent.

First of all, widgets cannot exist on a dedicated server. Which means it'll be null there if you tried to use this code on a dedicated. Second is that widgets cannot replicate. So even if your server DID have a widget, sending it through an RPC would not resolve correctly on a client and thus the pointer would be null.

kindred widget
# serene furnace

If this is running on server, it's because server owns this actor.

dark edge
#

If this is just looting things in the world, split it up.
Have a TransferItem function serverside that does the actual inventory management and calls ClientOnTransferItem which plays the sound and does the little popup (or repnotify on player inventory)

#

test that with just giving the player items

#

once it works, have looting just change the state of or destroy the lootable AND call TransferItem

#

The state change or destruction of the inspected object should be caught by whatever is responsible for your UI and remove the Loot Me widget

serene furnace
# dark edge Whatever you're doing can probably be much better done without RPCs all over the...

I'm Looting a dead player,

When I interact with the dead body, it sends an owning client event to who ever is looting to open a looting window, the Actor looted (dead player in that case) is having his inventory accessed in the owning client event, that is creating a widget and add it to the window, one widget per Item added. and the structure of the item is sent to that widget as well.

Then when you clic a widget, it sends it back to the player looting that Struct related to that widget you cliced on, its requesting the server to spawn the item with the data, Item is replicated, and it sends interface call (message LootInventory) to the item that it is looted, using the looting code.

then it destroys the widget, then its accessing the Looted actor that the item looted as been removed out on his inventory on the server "Item looted" event

dark edge
#

Or just do it clientside if inventory is clientside too

kindred widget
#

Looting should be a local only event from interaction. Local player presses F, local player line traces and hits body, local player tells a widget to go on screen and passes in the hit actor's InventoryComponent along with it. The only networking here is replicated items and RPCs to move them.

serene furnace
#

all interaction with inventory is server sided

dark edge
#

Is the inventory data replicated or requested?

serene furnace
#

inventory component replicated

kindred widget
#

But is the items it stores replicated?

#

Do you replicate an array of the item structs, or whatever?

dark edge
#

K then the first thing to pass the network should be something like "I wanna grab these items from this container"

serene furnace
#

its all holded by the server and sent back to clients

kindred widget
#

Sent how? Replication or RPC request?