#multiplayer

1 messages · Page 700 of 1

graceful flame
#

Thanks for the guidance @winged badger

winged badger
#

as for optimizing CPU use

#

blueprints really don't have any of the tools available

#

none of them work with BP, i think

graceful flame
#

which tools?

winged badger
#

like replication graphs, fast array serializers, net serialize functions

#

only thing BP has is dormancy

#

push model also doesnt work with bp i believe

twin citrus
#

hii I have the player with all the movement logic written in anim BP.. but after testing I had some replication issues with the movement animations.. so planning to convert all the movement logic into GAS abilities since it has better replication.. so is it good idea to do that?

#

or should i just polish the replication code?

low helm
#

Definitely the second one

#

Gas will just add complexity

#

You need to understand the fundamentals of replication BEFORE you try to implement gas

twin citrus
#

@low helm tq for the quick response. appreciate it. I'll look into it

graceful flame
#

At a high level, Network Dormancy set to "Dormant All" is essentially the same thing as disabling Replication, but they are technically different things. Is that correct?

low helm
graceful flame
#

If I disable Replication of an actor just sitting there not moving, the clients will no longer see it, but if its just set to Dormant, then its still visible but not replicating. Is that correct?

low helm
#

You may want to ask again in case some wizard is online

graceful flame
#

I think your explanation of it makes sense

low helm
#

I do remember hearing that initial dormancy is the preferred mode for open world objects in Fortnite

graceful flame
#

Right, so an actor such as a Tree in Fortnite has its Replication controlled by the Replication Graph and its Dormancy is set to Initial so it's not doing anything until a player walks up and starts chopping it down. Furthermore it won't even bother letting other clients know about what happened to this tree unless the Replication Graph tells them to based on their distance to the tree or something.

neat tulip
#

Hi everyone ! I have set multiplayer with replication, but I have a little problem, replication works well at low speed, but at high speed it starts flickering. Does someone has an idea on how to fix this ? thanks !

#

hmmm actually it seems the flickering starts if both client pawns are moving, so maybe I am doing something wrong during the update. What I mean is if one client stays still and the other moves, it doesn't flicker

kindred widget
#

What is replicating? What is flickering? What is moving?

neat tulip
#

pawn movement is replicated, pawn is flickering and pawn is moving

#

yup, flickering happens when both pawns are moving, if one pawn doesn't move and is spectator, the other can go fast without having this flashing effect

#

I mean, don't move like a spectator, not being an actual spectator in game network

hazy matrix
#

Support the channel through donations. Crypto accepted!
PayPal: https://paypal.me/reidschannel?locale.x=en_US
Patreon: https://www.patreon.com/reidschannel
Bitcoin: 1JFwWHr4X6uAeoZadukzqKjzFBj3Qjy7Sk
Ethereum: 0x2B2Bc108F1Cc0fF899959dEF3226637787d8C3dE
Dogecoin: DNQ33YnhpWoTBokBNVkZP5ub8KTLkpyjpv

Join our community discord!
Discord: https://dis...

▶ Play video
neat tulip
#

hmm yeah, I am not using CharacterMovementCpt, so it probably comes from that

thorny saddle
#

can use delegate on server func to figure out when the func end its job in client?

sinful tree
thorny saddle
#

if server done it's job

#

client should know this

sinful tree
#

Then have the server RPC to the client or use an OnRep variable to notify of the state changing.

thorny saddle
sinful tree
#

"Run On Client" events.

thorny saddle
sinful tree
#

Use the appropriate event for what you may be trying to do - normally "Run On All" is used when all clients need to know about something happening (eg. An animation or sound playing) whereas "Run on Owning Client" is used if only the "owning" client needs to know about something happening (eg. the server wanting the specific character to do something, but only on the one client). If it's something stateful however, use an onrep variable.

thorny saddle
sinful tree
#

That's the only place it should be called from.

thorny saddle
#

thanks so much

blazing spruce
#

Hi, Should all state variables be replicated/rep notified in some way? things such as IsDead, IsReviving, IsDowned, HasKey ect... Im understanding how to replicate variables and use rep notifies a lot more now so now I'm trying to figure out exactly what variables actually need replicating and what doesn't

sinful tree
# blazing spruce Hi, Should all state variables be replicated/rep notified in some way? things su...

You may have state values on the server that the player doesn't necessarily need to know, so replicate only what you need to, and if possible try to simplify state as well. For example, based on the examples you give, IsDead, IsReviving and IsDowned sounds like they could all be related and if these were booleans, it seems like only one would be true at a time - this kind of case it may be better to use an enumerator containing:
Alive
Dead
Downed
Reviving
Then just swap between these 4 as appropriate rather than having to manage 3 different booleans.

obsidian pecan
#

interfaces dont work with server calls unless it is already server? edit Z input gives "test works" aswell if it is played as server character

sinful tree
pine sage
#

Hey there ! What would be the best way to show connect/disconnect/death notification to a player in a multiplayer game ?
Array in game state ? A rep notify ?

#

A RPC net multicast ?

#

Gamestate seems a good candidate to me since it's on the server and replicated to clients

twilit hearth
#

ok

#

but it works fine in game tho in bp

#

it never fails

winged badger
#

@twilit hearth it doesn't work the same, blueprints don't actually have a replication callback at all

#

its a property changed callback, hacked to serve as OnRep

#

its also why it fires on server in BP, and why it fires if client changes the value of BP OnRep variable locally

#

none of which will happen with c++ OnRep

twilit hearth
#

so just use BP then ?

winged badger
#

my preference is just use c++ for networking exclusively

#

debugging a network issue on a packaged version in blueprints is just not possible

twilit hearth
#

ok

hard hinge
#

It seems like no matter what I do, I'm unable to find steam lobbies lol

#

I can find them just fine using the steam SDK directly, but when going through the online subsystem stuff, it's no good

plucky prawn
#

also im pretty certain that the steam OSS doesnt work in PIE so you will have to package your game to test it

hard hinge
#

It works completely fine with dedicated servers, but it seems like Epic has interlinked the Steam IMatchmaking API (lobbies) with Listen servers, and SteamNetworking() api (p2p)

#

I don't want Lobbies to be directly linked with p2p networking.

#

I'm just going to implement the lobby system myself, without the subsystem.

upbeat radish
#

I'm trying to learn UE multiplayer and replication and am having some trouble, if anyone could help out:

ChatSubsystem.h

void GenerateChatMessage(FText Content);
virtual void GenerateChatMessage_Implementation(FText Content);```
ChatSubsystem.cpp
```void UChatSubsystem::GenerateChatMessage_Implementation(FText Content){}```
Error:
```ChatSubsystem.gen.cpp(272): [C2511] 'void UChatSubsystem::GenerateChatMessage(const FText &)': overloaded member function not found in 'UChatSubsystem'```

After a while searching I found a forum post which fixed it, I turned my parameter into ```(const FText& Content)```
In that case, the question now switches - is that always necessary or did I mess up somewhere else?
fathom aspen
#

You didn't

foggy idol
#

Whenever I set movement mode to custom then set it back to walking my character cant move

#

anyone else experience this ?

boreal crag
#

hey, I set some attack combos using anim montages and i want to halt the character to stop whenever i attack and i used disable input but it also disable the camera movement as well, so if i anyone can gimme some better alternate to disable just forward and right movement.....

hazy matrix
naive dome
#

If you want to simply stop your complete character movement for a while, then simply set 'Movement Mode' to none, afterwards turn it back to walking.

neat tulip
neat tulip
neat tulip
#

@hazy matrix So I checked it all out, and my problem is really that I need to set the location and rotation of my pawn at each frame. So I can't use either FloatingPawnMovement or CharacterMovementComponent, because all I can do with them is to addInput with fixed max speed, acceleration etc... Put simply I did my own mini physics engine using c++ and set actor location/rotation. Since I have the velocity I could be able to use already coded predictions from epic & unreal engine with parameters in c++. But it's really vague to me, if you have a course/tutorial on how to create predictions based on velocity and happening them to clients it would be very helpful.

neat tulip
bitter oriole
#

yes

finite goblet
#

is there a callback I can reliably use to initialize variables on server that will be replicated only once for the lifetime of the object?

kindred widget
#

Sounds like something you would dump the properties into a single Struct for. Set it once on the server and they'll replicate together.

chrome bay
#

I mean, you can mark the property COND_InitialOnly?

kindred widget
#

Oh, yeah that. I don't know why I read that as he was looking for a single callback when all of them replicated.

heady geyser
#

hello! I'm welding an actor to a component (in a multiplayer context) and their physics channels are set to ignore each other. this works perfectly on the server, but on the client they do not ignore each other causing the object to glitch away as the objects are fighting each other. when I check the client actor's collider settings they are identical with the server's actor, does anyone know what I am doing wrong?

zinc light
#

oh yeah, it's the "Network Multiplayer Fundamentals" unreal official live video. It shows exactly your question as an example

#

in short: most probably the server is not replicating the variable to the clients, so the clients still think they should collide, while the server is constatly adjusting their replicated position because he says that they shouldn't actually collide

neat tulip
#

hmmm... I implemented the KrazyKarts solution and it's worse actually.

peak sentinel
#

KrazyKartz has issues

#

But it should work fine

neat tulip
#

@peak sentinel I tried to change the NetUpdateFrequency, but I still have this jittery movement

peak sentinel
#

You should not have

#

Its using CubicInterp

#

Something else is wrong probably

#

I was able to make it work even with 5 netupdatefrequency

woeful jacinth
#

Yo! So Android, how do I get the server files? Which packaging varity do I use? I'm used to packaging for Windows VR so using Windows Server

jovial dawn
#

Hello everyone,

#

I have create a demo, I want it to make Mutiplayer, I setup a widget with text name of each player, for some reason, some players we could see their name, if I test it, the server seem to see all the player but client #2 I can see only player #1 and itself but not the player #3, it is because I'm running it from the same host machine ?

mortal kernel
#

Hey Buddys I need a bit of help with replication :o
I've a button in the world players can go up to and interact with.
Once they do it does an server rpc and execute the Interaction Interface call on each overlapping actor (interface).
which then sets the button state (repnotify) only visual.
My concern is The interaction logic is now on the server no matter if a client of server called it however how do I filter clients out? I only want certain buttons to work on the server. like start game and stuff

neat tulip
#

@peak sentinel Looks like I didn't have the root set, now I don't have a jittery movement, I have a sort of spring movement, mesh going forward and backward, "gravitating" around its true position

neat tulip
mortal kernel
#

nono not that. So if I want a button to only work on the server I gotta use switch has authority but since I'm creating a Server RPC I'm always on the server anyway which leads to clients being able to do the same things as hosts do

neat tulip
#

when clients are connected to server, absolutely no client have authority on it, unless you run like in editor "play as listen server"

mortal kernel
#

Yea but I'm doing a RunOnServer event which means it's the authority executing this event FOR the clients

neat tulip
#

yes so in this event, filter your buttons, check if client can push it

neat tulip
#

@peak sentinel I don't get it, by manually changing the factor in VelocityToDerivative, I can kinda improve, but it seems like something is off. Is KrazyKarts an incomplete code just to forcebuy the course ?

peak sentinel
#

Its a free course in Epic Games portal

#

And not to throw a dirt to someones face, but all of their courses are shitty

#

Including KrazyKarts

peak sentinel
#

CubicInterp is not good at close distances

neat tulip
#

do you have some better course to advise ?

peak sentinel
#

Nope

neat tulip
#

I changed it to 10

peak sentinel
#

And still jittering?

neat tulip
#

yes, it seems like some vars aren't set properly, I am sort of turning around a good enough solution, but I am pretty sure it shouldn't be impossible to interpolate all this with success

#

it's more a spring movement now

#

going backward/forward around the server position

peak sentinel
#

It was working fine when my a few years ago past self copy pasted it

peak sentinel
#

Try another interpolation method to see

neat tulip
#

yes I am pretty sure the problem is around the interpolation now

peak sentinel
#

If still persists, you totally got something wrong

#

You should not use CubicInterp if this is a human movement anyway

#

See how CMC handles extrapolation

#

And steal it

neat tulip
#

it's a space ship movement, for my test now, just going forward at constant rate...

#

but fast

#

@peak sentinel What is CMC ?

peak sentinel
#

Character movement component

#
    NewLocation = FMath::CubicInterp(ClientData.Location, ClientData.LinearVelocity, NonQuantizedLoc, ClientData.LinearVelocity, LerpRatio);
#

LerpRatio is const float LerpRatio = ClientTimeSinceUpdate / ClientTimeBetweenLastUpdates;

#

Try this if your implementation is different

#

Client data is struct that cached in onrep only on simulated proxies

#

NonQuantizedLoc is just authoritative location

neat tulip
#

ok I try, it's close to the code I have with KrazyKarts

dark edge
#

Presumably your interaction interface is passing over the interactor, you can filter on that

#

It's all serverside, just the interaction in the button ignores interactions from pawns/controllers that are NOT the host.

dark edge
mortal kernel
dark edge
#

Should work perfectly out of the box for something as smooth in motion as a spaceship

oak oracle
#

hey guys , i got a question . player 1 spawns a fire on the ground and any player that overlaps it must receive damage . but in my case only the player who spawned it receiving damage ? does anybody knows why its happening ?

dark edge
#

All the client is telling the server is that it wants to interact

dark edge
mortal kernel
#

Yea I can show you the logic in a bit might be that I still can improve something

dark edge
#

Show the execution path from input to where the fire is spawned

dark edge
#

Pass the interactor (pawn or controller) in your interaction interface and then the thing can filter on that.

mortal kernel
#

That's the very first thing the Button press -> This calls the interaction for all overlapping actors

mortal kernel
#

I removed it cause it didn't work :o

dark edge
#

Just do this
Input -> RPC -> Choose what to interact with -> Interaction Interface Call

oak oracle
neat tulip
#

@dark edge no really I tried with physics and it works way better if I do the setLocation by myself, now since I have the exact infos on the location and rotation of the pawn I should be able to set all this, as my system is deterministic. I just can't grab a simple multiplayer interpolation that works

#

it sends me back to SA:MP when modders were creating a gta sa multiplayer where there was these kind of jittery movements

dark edge
dark edge
#

If your system is truely deterministic then just pass input around. I doubt it is tho.

mortal kernel
#

Like that? :/ Sorry but I'm hardcore confused rn lmao

dark edge
mortal kernel
#

so this... but this was what I did before and it didn't work

neat tulip
#

@dark edge believe me, I can't do what I want with unreal engine physics (chaos or physX) I tried during some years now, and got more motivation some days ago, finally managed to get what I want. And before going further I want to interpolate the movement I have in multiplayer

dark edge
mortal kernel
#

cause then in the button I'm always going to have authority no matter if it's the client or host :o

dark edge
#

Filter the interactions on the interaction target after the interface call

neat tulip
#

the script is raytracing => take the barycentric coordinates of the hit triangle to mix the normal vertices with a weight, then place actor at fixed height above hit using the interpolated normal. Finally use also the interpolated normal for rotation, up vector being aligned

mortal kernel
#

and how do I know if the person who called it is the host or the client?

neat tulip
#

(f zero like game)

dark edge
#

pass caller in the interface

mortal kernel
dark edge
#

don't remember which one but it'll be one of them

mortal kernel
#

that works :o

dark edge
#

I take it you have a velocity and desired acceleration vector?

neat tulip
#

yes

#

but before coding it all, I wanted to try a working interpolation just on a straight line

dark edge
#

Are you totally bypassing the Unreal movement replication?

neat tulip
#

I am unsure since on beginplay the KrazyKarts code set the replicates to true

#

but replicatesMovement on false

dark edge
#

yeah

#

so replicating the actor but not movement related properties

#

Right now what are you doing, replicating a position vector and in an OnRep applying it (moving self clientside)?

mortal kernel
#

So I remember seamless travel didn't work in PIE in ue4 :o But since I'm on ue5 I'm confused does it work there? I mean the host is being transitioned correctly but the client is getting thrown into titlescreen so I'm not sure if it's my fault or just the SeamlessTravel PIE thing

neat tulip
#

I am making a cubicinterp between (clientLocation,clientvelocity,serverSateLocation, clientvelocity, lerpRatio)

#

and changing the factors to try understanding what is happening

dark edge
neat tulip
#

I am running 2 clients, I am not using play as listen server

dark edge
#

You still have a server tho. Is any simulation happening clientside?

#

or is all simulation gated by authority

neat tulip
#

yes the simulation is on SimulatedProxy

#

yup, server is running in background on editor process

dark edge
#

That further complicates things, I'd start by just letting the server do all the sim and getting the client view to smoothly reflect the data from server

#

Then get a 4 point buffer going, and run cubic interpolation on it.

#

Get that smooth, then reintroduce simulating clientside as well

#

simulating clientside would be your extrapolation

#

you'll have to sync input state as well for that (steering, throttle, etc)

neat tulip
#

what I already tried is to replicate movement, but since there is no replication/interpolation, and raceships are going fast, there is a flickering effect. Now with the KrazyKart code and bit of help from @peak sentinel I set up the cubicinterp and it's indeed working to smooth the movement, but it's not perfect, there is still a sort of spring effect at high speed

dark edge
#

Vehicle netcode is hard man. If you wanna do any sort of prediction then it's a total rat's nest. My game is EZ but I'm ok with no prediction, it's slower paced (heavy vehicle combat)

#

so waiting ping ms to see it accelerate when you punch the throttle is fine for me

pseudo merlin
#

how is playerarray replicated? in code it seems to not be /** Array of all PlayerStates, maintained on both server and clients (PlayerStates are always relevant) */ UPROPERTY(Transient, BlueprintReadOnly, Category=GameState) TArray<APlayerState*> PlayerArray;

neat tulip
#

@dark edge well I don't think I will abandon, I am just looking for maybe good books, good courses/tutorials on how to interpolate / replicate / do some prediction to achieve what I want

dark edge
pseudo merlin
#

just found this with search This is one of the main reasons that the PlayerArray in GameState works the way it does. It isn't replicated. When a PlayerState arrives on client it adds itself to the array and runs callbacks.

#
void APlayerState::PostInitializeComponents()
{
    Super::PostInitializeComponents();

    UWorld* World = GetWorld();
    AGameStateBase* GameStateBase = World->GetGameState();

    // register this PlayerState with the game state
    if (GameStateBase != nullptr )
    {
        GameStateBase->AddPlayerState(this);
    } ```
#

and when gamestate reps it searches for playerstates for (TActorIterator<APlayerState> It(World); It; ++It) { AddPlayerState(*It); }

neat tulip
#

@dark edge actually, using a low NetUpdateFrequency the movement is smoother

#

a bit counter intuitive

tender acorn
#

Hi all, guys. Anyone of you ever worked with ALSv4 with replications?

brave oasis
#

Does anyone know how do you save player permanent inventory on dedicated server? Is it in database in table as some strings, Json, ...? 🤔

marble gazelle
dark edge
#

1 file per player

mortal kernel
#

Any Ideas how can fix this warning?

#

might need a branch for something right?

fathom aspen
#

GamePawn isn't owned. Thus the rpc isn't being fired

#

I guess this is a server rpc so you should be having an if statement before it's fired making sure you're running on client

#

Something like this:

if (IsLocallyControlled())
{
    S_SetLocation();
}
dusky yarrow
#

But yeah that function you're trying to call is being called from a client which doesn't have the ownership of

mortal kernel
fathom aspen
fathom aspen
mortal kernel
#

But Pawns are Actors :P

dusky yarrow
#

You can also use "has authority ()"

fathom aspen
mortal kernel
#

That I had before

fathom aspen
dusky yarrow
#

Lol sorry then

fathom aspen
#

It means that he's on server

dusky yarrow
#

Yeah i always wonder what was the difference so that makes sense

dusky yarrow
fathom aspen
#

It's the same

#

Same terminology

dusky yarrow
#

Well i would imagine clients being on the server does not count as the server

mortal kernel
#

that explains it good c:

dusky yarrow
#

Oh thanks!

fathom aspen
dusky yarrow
#

Yeah that does make sense. It's really complicated how the networking works in unreal

fathom aspen
#

Just takes time to get how stuff work and why

plush wave
#

Does InitNewPlayer() get called for rejoining players?

fossil spoke
#

Can someone remind me, im having a brain fart here, does OnRep_XXX get called when an Actor comes into net relevancy range?

lost inlet
#

you would hope it does but I couldn't give you a definitive answer :/

#

are you having a replication bug related to that?

twin juniper
#

what node can I pull out to get player number?

#

Like how and where can I assign player number, so the one that joins become player 2, 3 and so on

fossil spoke
#

But i couldnt remember if they were supposed to get called on simulated proxies or not when coming back into range

thin stratus
#

Is that actor placed into the scene?

#

@fossil spoke

fossil spoke
#

No. To be clear, its not an issue with OnRep not being called. I just couldnt remember if they were supposed to get called when it comes back into relevancy.

#

Brain fart blocking me from remembering lol

thin stratus
#

They are afaik. The only issue I encountered was when I tried to predict some state on an actor in the scene and the server didn't know about the change or so

#

I gave up the prediction and it worked as intended

#

But if you spawn it runtime or not have it set to net load on client, then it shouldn't be an issue anyway

winged badger
#

if the actor is static, it hasn't been sending any updates while not relevant

#

if the actor is dynamic, it will be respawned, so OnReps

#

one thing though - if it hasn't been sending any updates and not much has changed

#

your OnReps might not fire on account of having the same value as they receive from server

#

unless you're running RepNotify_Always condition

fossil spoke
#

👍

cedar citrus
#

how to hide ui widget multiplayer?

twin juniper
#

Hey, how can I keep some of player data when changing levels. E.g. inventory state from previous level? (Inventory is on the server)

bitter oriole
blazing spruce
#

Hi, Im having an issue with adding a HUD on to the screen for the server, I've got a Is Locally Controlled check before it creates the widget and adds it to the viewport on the BeginPlay of the player character, it works fine for the client but not the server, it seems that when the host spawns, there's a brief moment where its returning False on the Is Locally Controlled check so it isn't adding the HUD to its viewport when called on BeginPlay, if i add a small delay it then appears for the server but i know that this isn't a proper fix, any ideas how to get this working properly?

#

It also works if i dont have the Is Locally Controlled check in there at all, but im under the impression that i should have it in

peak sentinel
#

Is RPC queue always in order?

#

Can I assume first RPC I sent will get processed by server before others?

true grotto
#

Hey There! I have little problem with Super call.

I have a BaseWeapon class and its child class RangeWeapon. I override the UseWeapon() function in RangeWeapon and call Super::UseWapon() with the expectation that the logic in the base class happened before the child logic, but it runs after the child, or just works some other way. Can anyone explain my mistake?
BaseWeapon.cpp

void AKT_BaseWeapon::UseWeapon_Implementation()
{
    if (!CanShoot || !Character->ItemsManagerComponent->WantShoot) return;
    
    ActivateTimerBetweenShots();
}

RangeWeapon.cpp

void AKT_BaseRangeWeapon::UseWeapon()
{
    Super::UseWeapon();

    
    if (AmmoInTheClip <= 0 || IsReloading) return;

    //Another logic that works 
}
low gate
#

How can I replicate the Array I have, for a simple inventory system. I get an error when I try standard replicate methods.

simply what I wanted to do. a simple 2-slot inventory system

eternal canyon
#

Would recommend looking at this

past seal
#

Does anyone have an idea why my variable keeps incrementing twice on overlap? i have a Switch has authority node so it should only increment once, also my variable is set to replicated.

#

Could it be that since the server is a player AND the host it executes once on the host and once on the BP placed on the map?

past seal
fathom aspen
past seal
#

Im in my BP_FlagPickup

#

an actor with a mesh and a capsulecollision

#

Ah it seems i fixed it with a bool failsafe, it might have something to do with the overlap happening once more when i set its location somewhere else. I walk into the flag, overlap event happens -> i teleport the flag -> overlap event happens again

#

Or specifically it can have something to do with the fact that i set transform not set location. So maybe rotation or scale might have something to do with it, kinda weird

twin juniper
#

Hey, I have a few questions about RPC and destroying actor.

Lets say I have a function that is executed on server.

  1. Can I call client function on another actor before destroying self?
  2. Can I call client function on self before destroy self on server?
  3. Can I call multicast on self, before destroying self on server?

Obviously I have tested locally (PIE) and the answer was yes, but I am not sure if it's not "undefined behaviour"
Basically I am wondering if this behaviour is well defined and the functions will always be executed on clients before the object is destroyed on the client side.

chrome bay
#

If they are reliable, they will execute before destruction

twin juniper
chrome bay
#

But bear in mind that if ownership changes etc. have replicated first, ClientRPC's may not execute

past seal
twin juniper
fathom aspen
peak sentinel
#

Thanks

fathom aspen
#

BlueprintNativeEvent or RPC?

true grotto
#

RPC

#

Server function

fathom aspen
#

Ok if you're overriding an RPC in child then you override the _Implementation

chrome bay
#

^. You also need to call Super::MyFunc_Implementation(), not Super::MyFunc() or you'll get an infinite loop

true grotto
#

Give me a sec for try this

#

it works exactly the same

fathom aspen
#

You sure you compiled?

#

Sounds like a hot reload issue to me

fathom aspen
true grotto
#

Well I clicked "build solution" in the IDE and then "Run", if I did something wrong please tell me

#

If I write a call to parent functions in instead of calling the parent itself, then everything works correctly

fathom aspen
true grotto
#
void AKT_BaseRangeWeapon::UseWeapon()
{
    //Super::UseWeapon_Implementation();
    if (!CanShoot || !Character->ItemsManagerComponent->WantShoot) return;
    
    ActivateTimerBetweenShots();
    
    if (AmmoInTheClip <= 0 || IsReloading) return;

    //Another logic that works 
}

It works

fathom aspen
#

You should call Super::UseWeapon_Implementation() and not Super::UseWeapon()

true grotto
chrome bay
#

You're still overriding UseWeapon

fathom aspen
#

Exactly

chrome bay
#

You need to override UseWeapon_Implementation

#

The original UseWeapon() function shouldn't be virtual either

fathom aspen
#

@true grotto

chrome bay
#
{
    UFUNCTION(BlueprintNativeEvent)
    void SomeFunc();
    virtual void SomeFunc_Implementation()
    {
        // Actual Implementation
    }
};

class Child : public Parent
{
    virtual void SomeFunc_Implementation() override
    {
        Super::SomeFunc_Implementation();
    }
};
#

And using virtual/override on RPC's is grounds for being shot 😄

fathom aspen
#

What do you mean by "is grounds for being shot"?

fathom aspen
chrome bay
#

IMO overriding RPC behaviour in child classes is bad practice

#

Better to make another virtual you can call if neccesary

true grotto
#

I did it like this, right?
BaseWeapon.h

UFUNCTION(Server, Reliable)
        virtual void UseWeapon();

BaseWeapon.cpp

void AKT_BaseWeapon::UseWeapon_Implementation()
{
    if (!CanShoot || !Character->ItemsManagerComponent->WantShoot) return;
    
    ActivateTimerBetweenShots();
}

RangeWeapon.h

virtual void UseWeapon_Implementation() override;

RangeWeapon.cpp

void AKT_BaseRangeWeapon::UseWeapon_Implementation()
{
    Super::UseWeapon_Implementation();

    //Some    
}
chrome bay
#

That's correct yes

#

But bad practice, IMO

true grotto
#

Does not work

chrome bay
#

Be sure you understand what overriding means. The parent function returns early, but the overridden function will still execute all code after that.

fathom aspen
true grotto
#

I think it's better to really make a separate function that can be simply called from the heir

chrome bay
#

E.g, whatever you write for //some will still execute

#

Also it's still not 100% correct, UseWeapon() should not be virtual

#

You can't override those stub functions

fathom aspen
blazing spruce
fathom aspen
fathom aspen
true grotto
#

I removed the server call, it turned out like this. But it still doesn't work
BaseWeapon.h

UFUNCTION()
    virtual void UseWeapon();

BaseWeapon.cpp

void AKT_BaseWeapon::UseWeapon()
{
    if (!CanShoot || !Character->ItemsManagerComponent->WantShoot) return;
    
    ActivateTimerBetweenShots();
}

RangeWeapon.h

virtual void UseWeapon() override;

RangeWeapon.cpp

void AKT_BaseRangeWeapon::UseWeapon()
{
    Super::UseWeapon();

    //Some    
}
true grotto
fathom aspen
#

It also works if i dont have the Is Locally Controlled check in there at all, but im under the impression that i should have it in
It's because HUD isn't replicated so server has no idea what's that. But yeah you should have it as you can get errors in editor sometimes

quasi tide
fathom aspen
blazing spruce
winged badger
#

@blazing spruce use a class derived from AHUD for managing UI, its what its there for

#

1:1 relationship with local PC

chrome bay
winged badger
#

I will routinely override replication callbacks, but havent overriden a RPC in 5 years

quasi tide
#
AWeapon
 -AGun
 -AMelee

I'd imagine this would be a fairly common chain for inheritance.

#

And Server_Attack() would be in AWeapon

blazing spruce
latent heart
#

Nice layout!

#

Could use a bit of spacing, though. 😛

#

Why aren't you attaching anything to the owning player pin?

blazing spruce
#

lol thanks! and only cause it was working without anything in there atm, it still adds to the viewport just doesn't initialise the values

latent heart
#

Do you need to connect something to the target pin on your last node?

blazing spruce
#

Naa that function is on the same BP so self should work

latent heart
#

Debug the function.

#

See what's going on in there.

#

It's possible you're somehow ending up with 2 copies of the hud object, one that's being displayed and one that's in your bp.

#

Shrug

#

Or your hud object bp is broken.

blazing spruce
#

hmm looks like the begin play of the HUD gets called before the begin play of the player character where the health & max health get set in the first place so there all passing in 0 to the initialise health function when its called

#

not really sure how to get around that tho lmao

latent heart
#

On begin play of your character, trigger an event in the hud?

winged badger
#

@blazing spruce avoid the GetCharacter/Controller[Index] functions in MP

#

those are only good for 2 scenarios - splitscreen and iterating over all player controllers from BP

#

HUD has a function to get a PlayerPawn

#

i think its GetOwningPlayer for the controller GetOwningPlayerPawn for the Pawn

#

also, try the following:

#

put a BP_VictimCharacterBase ref inside your widget

#

mark it editable, and exposed on spawn in details panel

#

then refresh that CreateWidget node

#

HUD is there mostly to add/remove hide/show widgets to/from viewport

#

its not there to run the widget code

#

give your widgets a reference to the object they are displaying and let them handle their own stuff from there on

blazing spruce
winged badger
#

and now the widget has the character reference

#

and that entire InitializeHealthBar thingy can go inside that widget

#

instead of cluttering the HUD

#

EventConstruct will work just fine

#

after that you add an EventDispatcher to your Character, and you call it whenever the health changes

#

and during widget's construct you bind to that EventDispatcher, OnHealthChanged, and have the widget update its values when it happens

round star
#

Can you not spawn instanced meshes from thje server or something? Can anyone spot why this wont spawn on client? Thank you

latent heart
#

You probably can't call the server rpc on your ism.

#

You can only do it on certain objects, like player controllers, controlled pawns, etc.

fathom aspen
wild patio
#

can you call RPC on the gamestate?

fathom aspen
#

Server RPCs won't work

#

Client RPCs I'm not sure if they work, but I think yes. But it doesn't make sense to use them as you should be using the PlayerState then

graceful flame
#

What's an average KB/s for outbound traffic from server to client? AWS charges a lot for this. My netprofiling shows around 2.5KB/s for my base character not sure if that's good or bad.

#

One client on ShooterGame has around 3.6KB/s average. So I guess I'm doing something right? 🤷‍♂️

dark edge
#

the bandwidth is tiny

graceful flame
#

The pricing calculator for gamelift servers defaults to 4KB/s and adjusting it down to just 3KB/s results in a huge price difference (at scale)

dark edge
#

Well yeah but it's still tiny. It's like 10 cents a gig. Assuming a client plays for 1000 hours at 5KB/s the entire time, they've spent like $2 of your money. That's a rounding error in the grand scheme of things. If you can't get $2 out of a 1000 hour player then that's another problem.

graceful flame
#

Checkout the calculator here https://calculator.aws/#/createCalculator/GameLift (scroll to the bottom and click to expand the Data Transfer Out (DTO) and try adjusting the DTO per player. It's like a $100/month difference when using the default values for everything else.

hollow eagle
#

That's... yes? That's how scale works. With default options that's assuming 365 thousand hours of playtime - a $100 difference in monthly costs seems like a drop in the bucket. Not that cloud bandwidth is cheap by any measure, but at the scale the calculator is assuming by default that's really not a huge difference.

graceful flame
#

Any chance to save $$$ is of interest for me 🙂

hollow eagle
#

Then optimize your bandwidth usage, tools exist in the engine for that. But there is no "average bandwidth" for games, it is way too dependent on what you're building.

#

And for the record, the default calculations - $1300 a month for 1000 max CCU... if you sold your game for $20 you'd be able to run the game for 15 months if you have no other costs. Obviously that isn't realistic, but 1000 CCU means you have way more than 1000 paying customers.

graceful flame
#

I suppose ShooterGame is the best to compare against

hollow eagle
#

If you're making an FPS with a similar player count and limited interactions, yes.

graceful flame
#

Yea I built out an entire spreadsheet calculator with steam and sales taxes built in

#

Estimating CCU is so tough lol

#

Is it really like 50%?

hollow eagle
#

it depends on the game

#

literally everything in that calculator is entirely dependent on the game

graceful flame
#

I guess it rolls up and down like a sine wave overtime as players return home from work and play for a bit then go to bed...etc

#

Then you spread that across different time zones / countries and the average concurrent users becomes nearly impossible to predict until you've launched and see some numbers start to come in.

hollow eagle
#

These really aren't costs you think about until you're at a point that you can accurately estimate things. You don't just throw random numbers into the calculator, you profile your game, decide what a reasonable target for performance is by the end of development (both in terms of actual VM requirements and bandwidth usage), and then you figure out at what CCU the game becomes profitable.
These aren't things you can estimate from the start unless you personally have historical data from similar games.

graceful flame
#

An accurate estimate is kind of an oxymoron lol

hollow eagle
#

It's not.

#

Maybe I should have said an "educated guess" as opposed to throwing random numbers in.

#

The point is that you reach a point in development (not necessarily near the end) where you take a look at the game and try to decide how much you can reasonably fix performance issues, and you choose a target to further estimate costs.

#

You weigh the cost of paying for higher bandwidth and higher tier VMs versus the work required to fix performance issues. These are costs that you have to balance over the course of the project's development. Not from the very start - it's something that should be in your mind, but guessing at values on an AWS cost calculator will tell you literally nothing at that point.

graceful flame
#

Who said I'm at the very start of my project??

hollow eagle
#

Given that you're trying to estimate bandwidth from other random projects.

graceful flame
#

If I knew the targets for other similar games I could then use that information to make a better decision for my own one.

hollow eagle
#

But what decision could possibly be binding if you're at the point where you can't even profile your own game?

#

Looking at other similar games is useful as a target for your own, but not to estimate your costs.

graceful flame
#

"Profiling should be done early and often" - Zak Parrish of Epic Games

hollow eagle
#

I agree

#

To some degree, at least.

#

This is not profiling. This is estimating costs based on unrelated projects.

graceful flame
#

So why do you say I can't even profile my own? That's assuming quite a lot

hollow eagle
#

I'm assuming you can't because you're trying to estimate based on other projects rather than your own.

#

So either your project isn't far enough in development for those profiles to matter, or you're looking at other projects unnecessarily.

#

For the record, when I say "for those profiles to matter" I mean for them to matter towards estimating costs at release. Obviously they matter for the current state of the project.

#

Let me take back a bit of what I've said - knowing what general costs will end up being isn't a bad thing even early on. With emphasis on general - you're getting lost in the details of a $100 difference in a monthly cost. Yes, that adds up over time or at scale but you don't even know if that's going to be relevant until you have some actual data to show it matters.

graceful flame
#

That's the same conclusion I said a short while ago yes, its nearly impossible to tell until there's actual numbers coming in.

#

Glad we can agree

verbal tendon
hollow eagle
#

I agree but also "accurate estimates" and "project planning" don't go well together lol

verbal tendon
#

What you think we do sprints by drawing random numbers out of a hat and assigning them to tasks?

graceful flame
#

In plain English terms the words contradict one another so yes.

verbal tendon
#

An estimate is a definitive thing, accuracy is a moving target, a property of said estimate. Definitely not an oxymoron in my book

#

The better the accuracy of the estimate the better for the team and game/project in general

graceful flame
hollow eagle
#

Haven't tried it myself but it looks simple enough. Given how good oodle is elsewhere it's almost definitely worth investigating

graceful flame
#

Oodle all the things eh?

#

Gotcha

hollow eagle
#

I'm not too sure how well network data would compress since it's usually lots of small packets, but that looks simple enough to be worth trying.

#

downside is it sounds like you'd want to take new captures and retrain it if you make big changes to network stuff, but it's probably not a huge amount of work to do so.

graceful flame
#

hmmm I wonder how long training takes, seems similar to ML stuff. Could be hours, or mins probably depends on lots of factors.

#

Seems like something worth doing much later on once the network changes have stabilized a bit like you said.

dark edge
hollow eagle
kind ember
#

So how does Oodle network save bandwidth percentage wise?
10%, 20%, etc?

twin juniper
#

I thought Oodle is just turning plugin on and it will do work in background.Do we have to do any extra steps

kind ember
twin juniper
#

Yes I think so.Did anyone tried unreal dynamic network relevancy.I might tell it wrong but it will dynamically change network update rate

#

Of actors

#

Fortnite uses this

neon mango
#

Having an issue with server travel and streaming levels. I have a lobby level visible at the start, once server loads a new streaming level all clients load it as well, but server also unloads the initial visible lobby streamed level and so do currently connected clients so they match the servers state for each streaming level. However when a client joins after the server switch, the new client sees both the lobby visible and streams in the new streamed level the server switched to. What is the correct approach to ensure that connected clients match the servers streamed level visible state no matter when they connect?

neon merlin
#

Making a battle royal game I have spawn island that spawns to the plain but I want to create a new separate map to spawn characters from any help would be super appreciated

twin juniper
#

Most likely stop accepting connections when your servers goes to actual map

#

@neon merlin can you explain a bit better.You can use server travel to travel between maps

#

@neon mango generally if you are joining by ip you should join map where dedicated server is currently is

neon mango
# twin juniper <@142361971264716802> generally if you are joining by ip you should join map wh...

It does but because by default there is another streaming level visible you see both. The server travel tells clients to hide it but joining clients don’t. I could on loving check to see if the new client is in any other level let’s say and I’d so unload the lobby but trying to better understand if there is a more official way. I’d imagine the engine by default should have clients streaming levels match servers at all times.

finite goblet
#

What is the significance of NetUpdateRate when push model is enabled?

rare widget
#

Hi, Is there is any way to only replicate players who are in x metre radius or something like that.

twin juniper
#

@rare widget you can use net cull distance in relevant section of actor

#

Replicate section

rare widget
#

Thank you for the help.

fossil spoke
blazing spruce
winged badger
#

yes

blazing spruce
#

weird.. cause that print isn't printing at all

winged badger
#

and that lets you replace the widget without replacing the game code

blazing spruce
#

its as if the event isn't firing for some reason

winged badger
#

check if you have any accessed null errors after play in editor

#

typically, there is no guarantee you'll have character replicated by the time you run that logic in the HUD

blazing spruce
kindred widget
#

The object the FastArray is in isn't replicated.
The object the FastArray is in is an actor component and it's owning actor isn't replicated.
The FastArray property itself isn't replicated.
The Fast Array wasn't implemented correctly.
You didn't mark the item dirty when changing it.

balmy gazelle
#

an actor in the world getting all the time the camera manager component location from player controller 0, always get the local in use player, correct ?

#

I want something to get the active camera location (for effects etc)

peak sentinel
#

It might return listen server depending on the case, not the local

balmy gazelle
#

yeah but talking about controller 0

#

like getting it from world, I don't have the cast

peak sentinel
#
Calling it on the Listen-Server will return the Listen-Server's PlayerController
Calling it on a Client will return the Client's PlayerController
Calling it on a Dedicated Server will return the first Client's PlayerController
peak sentinel
# balmy gazelle yeah but talking about controller 0

In replicated environment %99 of the cases you dont need/want controller 0, if this is an actor that separate from players pawn to control the camera, I recommend referencing that pawn and accessing it controller anyway

kindred widget
#

@balmy gazelle If you want an easy global for the local controller, use GameInstance. It has a function to return the first local controller. Most times GetPlayerController(0) is okay. But there are conditions where it can spectacularly fail, specially on listenservers.

quasi tide
#

Thought it was dedicated servers where it it doesn't get the controller that you want.

kindred widget
#

You shouldn't ever be using GetPlayerController for anything server code related. So if it runs on a dedicated server, you're already doing something wrong.

neon mango
#

Does the server not already have a list of connected player controllers?

hollow eagle
#

The server has a list of connected player controllers, yes.

#

You shouldn't be referencing them by index, though. Which is the problem with using GetPlayerController functions.

neon mango
#

I’m trying to remove duplicate players via checking if their name already exists and kicking them but my test seems to show that The old player controller is still there even after the kick and even after calling remove player

fathom aspen
quasi tide
fathom aspen
#

Announce Post: https://forums.unrealengine.com/showthread.php?127674

In this session, Sr. Technical Writer Wes Bunn takes a look at a few different local multiplayer setups (split screen vs. shared screen) and how you can support a couch co-op style of gameplay. We also take a look at the Steam Blueprint Networking project and modify it so it s...

▶ Play video
#

YT has so many

#

Youtube

#

Not that I know

fathom aspen
#

There's this GetPlayerController(i) or GetPlayerPawn(i) based on what you want and they this index you specify to them. The index specifies a specific player.
AFAIK, first player is index 0, second player is index 1, and so on...

wild patio
#

ok i've gotta be missing something basic. i've got a "tutorial" actor on my level, and within that is a child actor that is an item from the game. when the game starts, the game state iterates through all the tutorial actors on the level and runs this destroy function on it on server only.

the server properly removed the tutorial actor and it's child actor no problem. but on client, the child actor remains behind, even though the tutorial actor is destroyed.

plucky prawn
#

does anyone know why my player controller has a netmode of NM_Standalone with using "Play as Client" in PIE?

#

im also getting this in the logs LogPlayerController: Verbose: Spawned spectator SpectatorPawn_1 [server:0] but i cant find the spectator pawn anywhere in the outliner, either for server or client

neat token
#

Hey everyone ! I have been looking for a solution for the following problem for 2 weeks now : When I do a servertravel (in Seamless travel) if the client loads faster than the server, the client is getting stuck (some random camera placement, no controll) and is completely ignored by the server. Has anyone encountered this problem and could they please help me ? Thanks

jade fractal
#

how can I make an actor execute something on the client, if “Run on Owning Client” executes on server?

plucky prawn
#

it doesnt

#

thats literally the point of that

#

are you testing this as a listen server host? if so then you need to do an additional check inside your client side function

jade fractal
neon mango
round cosmos
#

What would be a reasonable way to store some specific variable (integer) for each player state, which will be replicated to all connected players?

neon mango
#

any reason why timeout would not work for client? I exit client application and the timeout value set in config is no longer kicking in

#

oh looks to be an editor thing, packaged version respects the timeout time

elder sage
winged badger
#

by default they will last another 5 minutes sitting in InactivePlayer array in GameMode

#

and they can also be used to reference the Pawn directly, as referencing other player's controllers doesn't really help you when the code is running on client

neon mango
#

Yeah i think what I was doing was working the whole time but not in editor, packaged seems ok but need to run a few more test scenarios. I was second guessing a few things especially since Timeout in editor never times out when client disconnects.

winged badger
#

i find PIE singularly unhelpful for testing anything to do with network connections

dark edge
pallid mesa
#

pie got some cool features to enhance the testing such as netem or join new client

#

really really helpful

#

but yeah... launch game is closer to the real thing

kind star
#

Hey guys, struggling with some movement jitter (client / server fighting I suspect) after a gameplay effect. Struggling to find the source of the jitter, it is oddly 'reset' by a CMC command like jumping. Tried printing out all CMC variables but can't find any issues. Any recommendations on how to find the source of the conflict? I don't think its max speed

kind star
#

Never mind, Gameplay Tags replicating too slowly for my movement functions to see that the character is no longer 'mounted'... Sadge

shadow hatch
#

is using root motion for anims / montages in a multiplayer project generally a bad idea? for attacks and such for example

fathom aspen
fathom aspen
round cosmos
#

@fathom aspen that's what I thought, but how may I store this data on them?

fathom aspen
#

You simply declare the type of data you want in .h in your player state derived class and put it as Replicated in UPROPERTY

#

Just like any other variable you have there already, like Score, Ping, etc.

round cosmos
#

@fathom aspen Thank you. I'm working with a template so I didn't create all of that from scratch, but I was able to search for it and it makes sense.

grizzled stirrup
#

Is it possible to make a code based lobby system out of the box with the Steam OSS? As in you'd host a lobby and get a random code that anyone can join rather than having to be friends with whoever you are sending invites to

peak sentinel
#

What NetPriority you guys are using for weapons?

twin juniper
#

Hello guys, can somebody help me. I am moving an object with a timeline. The server sees the movement flawless, but for all clients its stuttering. Even with replicating the timeline it doesnt help

fathom aspen
#
twin juniper
#

Thank you

fathom aspen
peak sentinel
#

Thanks

stray badger
#

Can i use world origin rebasing in multiplayer?

chrome bay
#

Yes, but just bear in mind the Server always operates in zero origin space

#

So it doesn't solve the issue of world limits etc.

#

And your game code has to deal with the server and all clients being in different origin spaces

round cosmos
#

Hello, I'm having another likely noob issue. I have a game mode management blueprint that runs on the server. In my BP_CustomPlayerState I have a variable 'test var', an int with replication set to replicated and replication condition set to none. So in the server I get player state, cast to BP_CustomPlayerState and set the value of the int to '2'. Then in my BP_CustomPlayerCharacter 'tick' function, which runs on the client, I get player state, case to BP_CustomPlayerState, and print the value of test var. The behavior is that the print statement shows the default value for a few frames, then switches to '2' shortly after. Great, this seems to be the intended behavior. Next I try exactly the same thing, but instead of using an 'int', I store an instance of a custom object from c++ (derived from AActor), and spawned using 'spawnActor' in blueprints. In this case, even though replication is still enabled, the variable on BP_CustomPlayerState always remains none, all other things equal. -- how can non-primatives be replicated? Are there certain derived classes that need to be used?

fathom aspen
#

The Actor derived class you are spawning has to be set to replicate. You can do that in that class constructor like this: bReplicates = true;

meager wing
#

So I have to use Non-seamless travel in my project but it's disconnecting my client's immediately when triggered. Using seamless "works" but I can't use it for other reasons. Not really sure how to progress, it's almost like ClientTravel isn't being triggered at all

round cosmos
#

@fathom aspen Thank you, I appreciate the advice. I did set this line in the constructor and recompile, however, the issue still persists.

fathom aspen
#

Are you using hot reload?

#

to compile

round cosmos
#

I just clicked the 'compile' gui button in the top-middle of the editor

fathom aspen
#

There's an arrow next to it, if you press it and you don't have Enable live coding turned on, then you're using hot reload

#

Now that you know hot reload sucks, still live coding won't help here as it's not meant to be used for changes in the constructor or .h files. So you should be closing the editor and hitting F5 from your IDE

unborn nimbus
#

Do I have to have a dedicated server already running to launch using the -game flag?

fathom aspen
#

Yes, or a listen server

round cosmos
#

Sorry, I needed to perform some other sanity checks before I concluded what to check here

#

To I have het compile, saved and closed the editor, them opened it again.

fathom aspen
#

Don't hit compile in editor

#

Close editor, hit build in your IDE, open editor again

round cosmos
#

Okay, then I close editor, hit F5 in visual studio, it automatically launches the editor again

#

And I should also check the 'enable live coding' box?

fathom aspen
#

But LiveCoding is really good if you do changes only in .cpp files, so you don't have to close editor and relaunch, but you just hit that compile button in editor

wild patio
#

i keep running into strange replication issues when using construction scripts on my replicated pawns. when i create child actors in my construction script, it seems like the behavior is really inconsistent. are there some sort of rules i should be following?

#

for now i'm moving stuff into begin play, but it would be nice to have things in the construction script for easier editing in the viewport

fathom aspen
wild patio
#

huh. i figured the behavior would be the same as manually adding things to the root scene component.

#

but that kinda makes sense.

#

intuitively, though, if the construction script runs on all clients, then that should be the same on all, including server

#

so it shouldn't have an effect. but it almost seems like the construction script only runs on the server instance?

#

just some clarity on that would be helpful so i know what i can and can't get away with

fathom aspen
#

Think about replication as a thing that won't run at editor-time and would only run at run-time

#

Replication starts somewhere there at BeginPlay(probably earlier)

wild patio
#

but the root scene components are created at construction time

#

on client and server.

fathom aspen
#

And it's allowed only after the actor has been initialized. Construction Script executes before actor initializes.

fathom aspen
wild patio
#

right. so as long as i don't need to do anything with the actors that are created at construction time, then i'm good.

#

for example, if i add a hud element at construction time (donno the official name for this), i could hide it at begin play for everyone except the owning client.

#

is there anything fundamentally wrong with doing that?

fathom aspen
#

No, but I wouldn't do it that way

wild patio
#

the goal is to make it so the artist is able to position the hud element in the viewport without writing a readme

#

i could see only creating it on owning client on being play.

#

but then there's not reference for the artist

fathom aspen
#

HUD is local only

#

Or widgets(UMG)

wild patio
#

right.

#

so how would you achieve having the hud element position-able in the viewport, while also only making it viewable to the owning client?

fathom aspen
#

It's that way by default

wild patio
#

sorry, one specific. this widget is viewable in 3d space

#

(this is a VR thing)

fathom aspen
#

I'm not familiar with VR

wild patio
#

are you familiar with widgets in 3d space?

fathom aspen
#

Not really

#

Now I'm though hehe

#

It's easier than I thought

fathom aspen
wild patio
#

it is. it’s like any other actor you’d create and attach at construction time.

fathom aspen
#

Sounds like an Owner Only See to me

mellow stag
#

yo I had a question

wild patio
mellow stag
#

Okay so I am a bit confused on how to explain this but

#

Let me send a video

#

@fathom aspen as you can see in this video when I am looking side to side my character is delayed

fathom aspen
#

Do you see the same delay in single player?

mellow stag
#

I am the host of the server, but when I am on a high ping server the delay is more evident

elder sage
#

that wouldn't make sense, though

fathom aspen
#

That's normal

elder sage
#

listen server hosts are always zero ping, aren't they?

fathom aspen
#

That's why you need to do client side prediction and stuff

fathom aspen
#

I would print Ping from PlayerState to know though

mellow stag
#

How would I get started with client side prediction?

fathom aspen
#

UE4 has it's own already implemented. But if you want to mess with it I really has no idea where you can find tutorials on the subject

mellow stag
#

If I run a singleplayer there is still a delay, could it not be an issue with replication?

fathom aspen
#

It seems that way

mellow stag
#

I would think that but if I go on a laggier host, 200+ ping the delay is even more evident @fathom aspen

#

Most games I am familiar with have no issue client side seeing your character such as CSGO, Rust etc.

#

if you're on a laggy server for those games you don't seem to have a delay

#

Sorry if I'm explaining this poorly

fathom aspen
#

It's in the CMC

mellow stag
#

I am messing around with it doesn't seem to have an effect

#

Could this be something

fathom aspen
#

Could be. Try lowering it.

mellow stag
#

The delay still persists

fathom aspen
mellow stag
#

Yes I tried changing the Z value as well

#

It basically seems the character is being replicated always instead of clientside

fathom aspen
#

As long as you take any ue4 template example project and stick your character in, there shouldn't be such issues. Probably some other thing is affecting this

#

You probably can change the animation speed and make it faster

elfin sail
#

hi , I created server build But It's crashing on start. Here is the crash log

#

that was working with 4.24 . its happening after upgrade to 4.27

fathom aspen
#

Delete contents of this folder: "C:/Users/{system username}/AppData/Local/UnrealEngine" and rebuild

elfin sail
elfin sail
fathom aspen
#

Looks like you will need to install a .NET Framework

#

But I'm not sure which version you have and which version you need to install

elfin sail
fathom aspen
elfin sail
#

yes its 4.27 release source which is 4.27.2

long gust
#

Guys

elfin sail
#

I am stuck from two days on it 😭

long gust
#

i have a question

#

how do i package a multiplayer game

#

?

#

cause.... when i packaged it and runned it

#

it didnt have 2 players

fathom aspen
elfin sail
fathom aspen
#

I don't think you can

long gust
#

guys

fathom aspen
long gust
#

why

#

so how do i fix it

fathom aspen
#

You would have to run a server and make clients connect to it

long gust
#

SRRY

#

im a noob

#

in just started

#

yesterday

#

how do i do it

fathom aspen
#

How to build Unreal Engine from Source: https://youtu.be/MRJUWC90aJM

In this video, we go over how to set up and package a dedicated server for your Unreal Engine project. Dedicated servers are becoming a popular alternative to other game server options such as listen servers and peer-to-peer for multiplayer games. Dedicated servers provide man...

▶ Play video
long gust
#

oh

#

thx

fathom aspen
#

This video can help you both btw

bitter oriole
elfin sail
bitter oriole
bitter oriole
#

Run the server in VS - you'll want to keep the PDB files generated with your server for that

#

You should find the error quickly

elfin sail
bitter oriole
#

Okay

#

So debug the scenario where it doesn't work

elfin sail
#

I tested complete flow run 16 clients all is working proper

bitter oriole
#

I thought you had a crash?

elfin sail
#

crashed on started

bitter oriole
#

So debug the build

elfin sail
#

by attaching process ?

bitter oriole
#

Run the executable in VS

#

Attach the PDB files for your build when prompted to

elfin sail
#

okay let me try

elfin sail
# bitter oriole Run the executable in VS

LogSerialization: Display: AllowBulkDataInIoStore: 'true'
LogWindows: Error: === Critical error: ===
LogWindows: Error:
LogWindows: Error: Assertion failed: IsValid() [File:D:\Source\UnrealEngine\Engine\Source\Runtime\Core\Public\Templates/SharedPointer.h] [Line: 890]

#

same on VS

bitter oriole
#

Cool, so now check the call stack to understand the issue

elfin sail
#

yes i was trying to find callstack window

#

but its not there

elfin sail
#

getting the error on load symbols

bitter oriole
#

Yeah, like I said, you need to pass the PDB you generated with the build

#

Just add the file you stored it to in the symbol search path

elfin sail
bitter oriole
#

Should be under Binaries

#

And also in your staging folder I guess

elfin sail
#

sorry it require this one "BootstrapPackagedGame-Win64-Shipping.pdb"

bitter oriole
#

Yeap, that's the one

#

Though probably the client here

#

You should always back up PDB files every time you do a release, client or server, sicne that's the only way to debug crash reports

elfin sail
#

but i have "PhotonDemoParticleServer.pdm"

#

when i try to add thin one , complaining this is not the right file

bitter oriole
#

No idea what a pdm file is.

elfin sail
#

yes i know

#

to convert symbol to actual code

#

but error asking for shipping.pdb

bitter oriole
#

Yes, that's the one you build

#

Check the staging folder

#

Your build log when packaging the server should have the location

elfin sail
#

hmm okay

bitter oriole
#

If you're using project launcher to build, make sure to tick the "debug symbols" option

elfin sail
bitter oriole
#

You can always simply compile the server target in VS and replace the executable+PDB file in your build

#

It'll behave the same

#

And the PDB file will be produced

elfin sail
#

pdb file there for project

#

i think vs asking for "BootstrapPackagedGame-Win64-Shipping" which should be under source\bineries\win-64

#

i think am also missing this file \

winged badger
#

i never discovered how you can run shipping binaries directly from VS

#

Test is very close, and usually does the job though

elfin sail
#

it's in main class during loading of InstallMissingPrerequisites

little pendant
#

Hey, we're trying to replicate aiming in a game based on the Side scroller
More specifically, we'd like to replicate the player's controller's rotation so when we shoot a projectile from a client, it replicates the rotation/forward vector to all other clients for this projectile
Thanks in advanced 🙂

hoary spear
#

Is there anything special i must do to use the DOREPLIFETIME()macro ?

#

throws me an error about identifier not found

peak sentinel
#

have you included UnrealNetwork.h

bitter oriole
#

That, and the class getter for replicated properties must be defined

hoary spear
#

Gonna check, this is the ACtionRoguelike sample project by Tom, I believe

#

made for 4.24, i converted it to 4.26 as thats the lowest engine i got currently installed

#

That worked, thanks! 🙂

solar stirrup
#

hoi, if I set this to true, it'll mean blueprint props will use the push model right?

#

Looks like it anim_eyes

#

Holy shit that makes porting so much easier, only have to worry about C++ ones

dark edge
little pendant
wild patio
torpid nymph
#

is it possible to have cheat manager working on clients as well?

#

right now cheat manager only exists in server

fathom aspen
warped berry
#

Does PlayerArray in game state include spectators as well?

fathom aspen
#

Yes

heady geyser
#

Hello! I have a pawn which uses server spawned and attached actor components (via sockets) as legs. This works great server side when the pawn is possessed by the server and the pawn is standing correctly on its legs, but when the client possesses the pawn its legs go through the floor (but stops at the body of the pawn) - what could be the reason for this?

on the server the legs are still touching the ground while the client is trying to replicate its non-touching position, causing serious rubberbanding like behavior

hollow frigate
#

I'm spawning an actor that act as a pet, when running multiplayer the client can see the server actor getting spawn, moving and attacking, the client can also spawn a pet but then nothing happen he stand still. I did made sure that movement was replicated on the actor.

kindred widget
#

Need clarification. Is the client spawning that locally, or is the client making a ServerRPC to have the server spawn a pet that gets replicated back?

wild patio
#

what happens to the character camera on remote client?

#

does it just not exist?

fathom aspen
#

Why wouldn't it

pallid mesa
fathom aspen
#

He means from a ue4 binary version

pallid mesa
#

no need to do engine edits, since Global defs was included

fathom aspen
#

(From the Epic Launcher)

fathom aspen
pallid mesa
#

why is it not possible? is there any particularity I don't know of? 🤔

fathom aspen
#

But as far as I remember you can't

fathom aspen
pallid mesa
#

prior 2019 you had to recompile the engine for these details, that's what got me hahaha

fathom aspen
pallid mesa
#

ahhh what a bummer I was planning to use launcher version to reduce some overhead compiling the thing @ every version

fathom aspen
#

Yeah it would be really nice if it worked using the launcher version...

#

The engine source takes ages to compile 😢

pallid mesa
#

yes, some hours over here

#

not the best computer for compiling 😭

fathom aspen
#

Like I literally remember myself leaving it compiling and going to sleep lol

#

But that was old my setup, no idea what's going now

pallid mesa
#

😄 lol, anyways, this is getting quite off-topic... yeah

fathom aspen
#

Haha yeah, the orange hammer is watching us

hollow frigate
fathom aspen
fossil spoke
#

Nice little bug I just discovered.

#

Blueprint Integer Increment or Decrement nodes do not call OnRep on the Server, only for Clients.

fathom aspen
#

I thought OnRep has to be called on server manually?

fossil spoke
#

In C++ thats true.

#

In Blueprint its done for you.

#

OnRep_ functions in Blueprint are not BlueprintCallable so they cant be dragged into the graph.

#

To be clear

fathom aspen
#

True

#

I see

fossil spoke
#

This is only for Blueprint Properties

#

Not ones declared in C++ that you would have defined a OnRep_ for which you can mark as BlueprintCallable if you like

modern cipher
#

did you try has authority check before calling the decrement node?

fathom aspen
#

To do it manually on server?

fossil spoke
fathom aspen
#

Fair enough

#

If that's true, the bug has to be reported

#

But I have hard time believing no one has noticed it all this time

fossil spoke
#

I dont

#

Well im sure someone else has, but whether its been reported or not is another story.

#

And considering its pretty easy to avoid.

#

Its most likely not high priority if its known.

fathom aspen
#

Yes, but it's crazy, considering incrementing/decrementing does a Set

fossil spoke
#

It does a different type of Set

fathom aspen
#

Ye probably

fossil spoke
#

Which is specific to blueprint macros

fathom aspen
#

Oh I hate BP macros

fathom aspen
#

Nothing works out of the box in Unreal

#

Well technically most things

#

So who calls SummonPet?

#

Where is it called?

hollow frigate
#

Player Index 0

fathom aspen
#

?

#

It is called in some other function

#

Show me where it's called

hollow frigate
#

oh actually not right now it's while pressing G, sorry forgot to remove the custom event, Im trying to have it done through the interface so I'm trying various thing.

fathom aspen
#

Ok if it's on button press(G for example) then that's the client calling SummonPet -> not good

hollow frigate
#

oh, 😅

fathom aspen
#

So decide where you want that logic to happen

#

If you still want that to happen on button press you can

#

You can send a server RPC

#

So you have to make SummonPet event as a Server RPC

#

And make sure AI Pet is replicated

hollow frigate
#

so it is replicated, I tried to make the event Server RPC and it endend up having the pet summoned by the client to follow the server pawn

fathom aspen
#

What do you mean?

#

Isn't that what you want?

hollow frigate
#

So Player 1 (server) can summon no issue with anything.
Player 2 ( client ) can also summon but no movement.
If I set the Server RPC, the pet will move but will follow player 1 instead of player 2

fathom aspen
#

Then it's connected to the logic that tells the pet to follow the player

#

How do you make the pet follow the player?

hollow frigate
#

with the built in function

#

I guess a BB and BT might be better

fathom aspen
#

But the reason you getting this behavior is that you're doing GetPlayerCharacter(0) on the server which always returns Player 1

#

Who calls FollowPlayer?

hollow frigate
#

I thought GetPlayercharacter(0) was a way to say "current player"

#

now I feel dumb!

fathom aspen
#

But if the Server, then it returns the first player in the game

hollow frigate
#

hmm so Get controller could fix it

#

not at all 😆

sinful tree
#

Same problem. You can't use those getters reliably.

#

in multiplayer anyway.

fathom aspen
hollow frigate
#

it's built in the AI Pet at the begin play

#

with ... get player 0

fathom aspen
#

Send a screenshot

#

The thing is that the logic to follow the player is set on AI, so what you're doing is that you're telling all your AI pets on BeginPlay to follow Player 1.

#

You're not doing a distinction between the players

#

This shouldn't be handled this way

#

Also don't use recursion for AI when you have BT please!

hollow frigate
#

yeah now that you told me it was ref player 1 , use a playerarray to get reach player ref

hollow frigate
fathom aspen
hollow frigate
#

got it thanks will fix that!

stray badger
#

How do I origin rebase clients on a dedicated server?

marble gazelle
# stray badger How do I origin rebase clients on a dedicated server?

I don't think this works properly as each world just has one origin. If you now are in a multiplayer scenario, and players are scattered all over the level, which would be the correct origin for the server?
If you plan large multiplayer worlds, I'd go for Unreal 5 as with double precision there is no more need for an origin rebase which makes it easier to build larger multiplayer worlds.

chrome bay
#

Then you have to carefully make sure you send zero-space coordinates between the two, and rebase them client-side when required.

fossil zinc
#

Hello, not sure if this is the correct chat to ask for this. I'm making a local multiplayer game which won't have split screen since both players will be on the same screen at the same time. My questions is how to handle UI for both of them, since both have HUD's and technically both of them are showing in the screen, how can I have only one HUD?

mortal kernel
#

I'm using an actor with a 3D Widget Component and want to disable/enable it runtime :o
but the Widget Reference is always null for clients

#

so this part here returns nothing on clients

kindred widget
obsidian pecan
#

i have a ammo widget in the local player that updates when i call an event dispatcher. in the gun when i change the Ammo(replicated) variable on server i call the (update ammo) event dispatcher but the ammo variable is not updated yet on some clients so it shows the old ammo. how would i make sure i only update the ammo after the variable is set. should i use repnotify for this? does repnotify cost more bandwith then replicated variables?

obtuse temple
obsidian pecan
#

i call the shoot function on server and client

#

but it only does damage on server and call the event dispatcher on client

#

because event dispatcher is only bound on client with ui not on the server

#

repnotify on ammo with event dispatcher works really well but i wonder if it costs a lot of bandwith to call it all clients

bitter oriole
#

repnotify is a purely clientside concept

obtuse temple
#

Oh whoops wrong quote

bitter oriole
#

repnotify only executes on server in BP, and it's still client side as in not networked at all

obsidian pecan
#

repnotify doesnt work on server

obtuse temple
#

Hmm lemme try

obsidian pecan
#

if you print string in repnotify it doesnt print on the server

bitter oriole
#

(I should have said "local" instead of "client", but I'm a C++ guy so to me repnotify is client only while in Blueprint it's both)

obsidian pecan
#

but you can only call it from the server

#

i just wonder if you can do something like repnotify only on 1 client not all clients

bitter oriole
#

Sure, just replicate on that client alone

obsidian pecan
#

call on owning client function?

kind star
#

From a multiplayer perspective, is 'Player Index 0' always the locally controlled player? Is this safe to have in my multiplayer game (no split screen) or should I replace with 'get owning controller' or something?

bitter oriole
#

repnotify is a purely local concept, again, no networking involved

obtuse temple
kind star
bitter oriole
#

If you're on a pawn, get the controller

#

If you're on client generally you probably want the player state

#

Remember PC isn't replicated to remotes

kind star
#

E.g. checking if the player has an input key pressed. Should I 'Get Controller' and cast to a player controller?

bitter oriole
#

That code should probably be replaced by a player controller action but yeah, since you'll only call this code when the Pawn is Locally Controlled, get the controller and do that I guess

kind star
obtuse temple
bitter oriole
#

You should not use the player controller generally speaking

#

Well, you should never need to get it that way really

kind star
bitter oriole
#

Your UI being local only should be owned by the player controller

#

Code tied to a Pawn should use the player state instead (member of pawn)

#

You saw how to do it for input, etc

#

Don't use that node at all in MP

#

Instead, think a bit about who owns what and what's live on client or server

obtuse temple
#

But listen to Stranger and maybe read Exi's network compendium if you haven't already

#

This macro might also be handy

bitter oriole
#

Please don't do that

#

Here's your "is local"

#

The rule is simple: if you have GetPlayerController(0) in your MP project, remove it

kindred widget
#

Have personally had that node explode on me at work. :/

#

When in doubt. Widgets have a way to get local controller. Anything else you need, should really be a C++ BP Library static for GetGameInstance->GetFirstLocalController

kind star
obtuse temple
kind star
kind star
bitter oriole
#

A clean hierarchy of ownership is the absolute best way to work.

  • Working on Pawn? You have PlayerState for all replicated player data, and GetController if you're on server OR locally owned.
  • Working on UI? Your widget should be player-owned most of the time, sometimes attached to a pawn (see above).
#

Keep it simple, use the engine API, don't make assumptions

obsidian pecan
kindred widget
#
UFUNCTION(BlueprintPure, Meta=(WorldContext="Context"))
static APlayerController* GetLocalPlayerController(const UObject* Context);
APlayerController* GetLocalPlayerController(const UObject* Context)
{
  UWorld* World = Context ? Context->GetWorld() : nullptr;
  UGameInstance* GameInstance = World ? World->GetGameInsance() : nullptr;
  return GameInstance ? GameInstance->GetFirstLocalController() : nullptr;
}
bitter oriole
#

Nothing more

kindred widget
#

Something along those lines, may be typos.

obsidian pecan
bitter oriole
#

In particular repnotify implies zero networking, it's not an event sent by the server or anything

#

Which seemed to be misunderstood here

kindred widget
#

It's also not a good idea to manually call RepNotifies on server. Better to have a second function/delegate that server and the notify can call. It makes network breakpointing much easier for debugging.

obsidian pecan
#

its just the same as replicated then but you call the function when the variable changes

bitter oriole
#

Yeah (which doesn't mean every server change has a client call)

obtuse temple
#

While we're on the subject of good practices, I'm using a Map variable for my master item list in the game mode. This map holds small structs of items spawned and crafted in the game. Is there a max size to a map variable like there is with an array? Couldnt find anything on Google.

bitter oriole
#

Maps aren't replicated, but yeah probably

obtuse temple
#

It's a TMAP btw

#

It doesnt need to be replicated, it's server only

bitter oriole
#

I'd guess something like 2 ^ 31 entries, but idk

obtuse temple
#

Thats plenty, thanks

kindred widget
# kind star How can widgets get local controller?

Above is the static call. And all UserWidgets have a blueprint callable GetOwningPlayer that returns their player controller. When you use the CreateWidget node, you pass in some form of context. This function runs through the gameplay framework to find the local player and set it as a context for the widget. They use that context to get the associated player controller for it. You should be able to use it safely in any UserWidget.

bitter oriole
#

So the limit should be the same which IIRC is 2^31

obtuse temple
#

I'm not as savvy with the engine internals yet

obsidian pecan
bitter oriole
#

In Blueprint, changing a replicated repnotify property calls the event locally on server

#

Clients will call the event when the value change

#

Multiple server changes may result in one client change

obtuse temple
obsidian pecan
#

when i call a repnotify on server it calls the function on all clients and when i call it on a client it calls thefunction on the client isn't that how it is supposed to work?

bitter oriole
#

Repnotify events are handled purely locally so no change = no repnotify

kindred widget
#

Stranger is trying to tell you that networking isn't immediate. Replication is considered at the end of a frame, and isn't always considered if you have a lot of actors or things are out of relevance. If you change things a bunch of times before it's sent, it means that you can change a value 10,000 times on a server, and still end up with 1 RepNotify on a client.

bitter oriole
#

If you have a replicated frame counter that increments each tick - guarantee most changes will be skipped and you'll see repnotifies on client for like 1, 3, 5, 6, 7, 10

#

Which is why I'm insisting on the fact that repnotify doesn't change network behavior and is not networked at all

obsidian pecan
#

so you want to make sure i know that repnotify just gets updated when the variable changes on the client

kind star
obsidian pecan
#

and when the server changes the variable it can get updated on client but if we change it another time in a short amount of time it would only updates once to the newest variable, only calling the on rep notify on the client once

#

thanks!

winged badger
#

yes, because two things need to happen outside of normal RepNotify setup - server needs to change the variable, and server needs to decide to replicate that Actor to the client

#

if you change it several times between the 2 updates, you will get only one RepNotify

kind star
kind star
hot jetty
#

Hey Guys,
I'm trying to implement a test scene for multiplayer functionalities,
the idea is to have the same build executed twice,but the first one that is launched becomes the server and the other one connects to it.
If I play from Editor launching 2 instances like this ,it already works,but I have problems doing it with the build...

kindred widget
# kind star Super helpful dude! Just to confirm if this is the right node you're talking abo...

I pretty much use variations of the GetLocalPlayerController type, but the widget version is useful if you don't have C++ access in a project. But yeah. GetPlayerController0 should be avoided. It will work in 99% of cases. But there are some listenserver places where it can actually return a client's controller on the listenserver. 1% of cases is more than enough for plenty of bugs.

kind star
# mortal kernel Anyone able to help out?

If its returning null, you're either trying to reference it on the server (not possible) or on a client where it hasn't been initiated properly. I would check your initiation code. Or just have it hard-coded to initiatise on begin player for the client

kind star
mortal kernel
#

Also it works on the server (listen) and only returns null on the client

kind star
mortal kernel
#

I tried that and still is same result :/

kind star
#

You sure you're not destroying it accidently somewhere when you try to toggle it? This is working for me

#

(It's a widget component on the actor)

mortal kernel
#

I'm not toggling it at all. it's essentially some buttons in the level the players can interact with

#

with some text

kind star
#

(On Begin play)

mortal kernel
crisp wraith
stray badger
chrome bay
#

You just turn it on, then move the world origin on the client