#multiplayer

1 messages · Page 701 of 1

chrome bay
#

That's all there is too it

#

But just know this about origin rebasing, it sucks

#

It causes hitches, it breaks physics, and in multiplayer it frequently causes corrections and doesn't even solve the problem of large worlds because the server has to operate in zero-space.

#

If you still want to enable it, just add this to DefaultEngine.ini

p.EnableMultiplayerWorldOriginRebasing=True```

Then call GetWorld()->RequestNewWorldOrigin() to change it.
rancid orchid
#

Hey guys, I am trying to rotate my networked character (uses movement component) and has bOrientToMovement set to true).

I try rotate my character on the server using SetActorRotation() and this change is replicated to simulated clients but does not replicate to my Autonomous client or atleast it doesnt rotate on my autonomous client. Anyone have any clue why this is happening, I thought server would force that rotation onto me?

#

(Or does something happen inbetween that im missing? I SetActorRotation straight after an RPC call to the server to rotate character)

chrome bay
#

It has bOrientToMovement set true, so it will follow velocity. Setting rotation directly will break it.

rancid orchid
#

Hmm, thought it might be related, but I thought force setting rotation would work since it seems to work like that in under the hood logic.

chrome bay
#

It doesn't - the character movement logic rotates the character during it's movement tick, which operates at a very specific time

rancid orchid
#

(Im only turning the character 180 degrees around)

chrome bay
#

if you change the rotation outside of that movement tick, and/or you change it different during that tick on client vs server, it will break

#

Usually if you want to control it's rotation you use bUseControllerDesiredRotation = true, and set the ControlRotation

rancid orchid
#

I understand that, I thought it was done in this piece of code in PhysicsRotation()

chrome bay
#

It is

rancid orchid
#

which takes current rotation and then tries to modify

#

but it no velocity is present then it just reuses current rotation

chrome bay
#

PhysicsRotation() is called as part of the movement tick

rancid orchid
#

Im guessing my logic is executing after the tick then?

chrome bay
#

And on the Server the MovementTick is called as part of MoveAutonomous from ServerMove calls

#

So sending an RPC with the rotation will be out of sync

#

And it will still get a correction occasionally

rancid orchid
#

aH I SEE

#

caps

#

Hmm well thats a tough task then xD

#

Thanks for explaining, im guessing the work around to allow 180 degree rotation is to either use a modified movement component (somehow) or try use controller rotation

chrome bay
#

The easiest way is to just set the control rotation

#

Since the client effectively has authority over control rotation

rancid orchid
#

You mean set control rotation for the character, but that means Id still have to disable bOrientToMovement because that takes priority over using control rotation?

chrome bay
#

essentially yeah

#

ControlRotation is just an arbitrary rotation value that lives on the controller, usually that's what drives the characters' rotation

#

When not used for pawns it's just the camera rotation IIRC

rancid orchid
#

Hmm ye, the character is now dependent on bOrientToMovement but I think I can look into rewritting it to not use that. May not be a big deal. Cheers.

chrome bay
#

Since you're using bOrientToMovement you could also maybe just move them backwards a bit?

#

i.e. just apply a small acceleration in the reverse direction

rancid orchid
#

Possibly, but rotation speed is not instant, but I probably should give it a go before going with a rewrite.

chrome bay
#

depends if it's instant vs interpolating though

#

yeah

rancid orchid
#

Nice side project there, reminds me of something but cant remember what haha

chrome bay
#

It's not uncommon to modify the movement component a lot tbh

rancid orchid
bitter oriole
#

Changing a boolean quickly on and off on the server should usually result in no change on the client.

#

Hence no onrep event

#

Your design isn't gonna work here - you want explicit RPCs instead. Multicast/client methods

brave oasis
#

How are classes (UClass) stored in db? What's the best way to add it to json to send it on server to save in db? Is it even possible?

bitter oriole
#

Serialize your UPROPERTY to json and store that

weak copper
#

I want to create an Android online multiplayer game.
Is it necessary to use paid dedicated servers?!
Can one mobile host and others can join through internet?!.I want this type.
Is there any tutorial for this?!I prefer blueprint tutorials.

bitter oriole
elfin inlet
#

Hi all. New here - and I had a friend recommend this channel for a question

#

So I have a nice combination of Anim BP, ANim Montage and all in Multiplayer. So far everything works, State machine does what it is supposed to do and now I finally got to get deeper into Animation Monatge and notifies.

#

So my problem is that I have an animation notify in my animation montage and while the notify works fine I wanna cast to the player controller who posesses the pawn which is playing the attack animation montage. So naturally I thought I'd just get a ref to the controller and cast to my custom PlayerController (PlayerController is a child of "controller" I think). But the point is that the cast always fails. Actually I got no idea why. Is it generally not possible to cast to a PlayerController with getting the controller? Or is this a multiplayer issue somehow? What's weird is that the cast works fine in my AI Controller and AnimBP, but yeah I understand AI controllers run on the server, so there IS a difference. But yeah just thinking about it I believe it should also be possible to cast to PlayerController via controller reference, right?

#

What's also weird - the "isValid" returns "is Not valid", even though it returns the correct player name if i throw it on a print string

#

I am setting the ref in the Event Blueprint Update Animation - which should definitely fire before animation end

sinful tree
# elfin inlet So my problem is that I have an animation notify in my animation montage and whi...

Player Controllers only exist on the owning client and the server. Other clients do not get a copy of other client's player controllers. Animation instances exist on all clients. So every client would be trying to get the controller of any character using this animBP but can't since the controllers for others on the client. The one place you're probably getting the print string coming through ok is on the one client where the controller exists or on the server.

elfin inlet
#

Hmmm, so is there no way to communicate to the PlayerController from AnimBP in Multiplayer? I'd have expected that the reference to the controller should do the trick, but may it's a bit misleading that I can run "Try get Pawn owner" and cast that to the player controller at all? SInce there is no switch authority node in Anim BP it means it's generally not possible to reach the corresponding player controller from there?

#

I mean normally it throws something alike "the cast would always fail" if you do something on an object which doesn't inherit or so

#

So for a noob like me it looks like the reference is ok, but it's probably just never executed on the owning client?

#

Sorry for being a goof, just started multiplayer recently

sinful tree
# elfin inlet Hmmm, so is there no way to communicate to the PlayerController from AnimBP in M...

This issue is in using the player controller. You cannot use player controllers for anything that other clients need to know about and AnimBPs are something that other clients know about.
In this sense, the only time you should use a player controller for storing/retrieving data is when it is specifically meant for the client or the server to know about, and no other clients.

Whatever values you may be trying to use from the player controller you either need to move to the pawn/character or playerstate.

elfin inlet
#

Thanks for your valuable feedback. I will move such variables to the player character. I can query these from the playerController as well. Guess my idea was an invalid shortcut. I shall seeks more tutorials for ANimation notifies i guess. Thanks again. Really appreciated

elfin inlet
#

Basically just setting a variable "CanNotMove" while a part of the animation is playing. It seemed a good idea to me to have that variable in the playercontroller since i process mouse clicks here. And setting the CanNotMove to false when the last (uninterruptible)) part of the animation finished playing looked like "hey this is what i will do"

#

Like once the character swings the sword forward it should set it to "CanNotMove" and once done set it off

#

Silly thinking from me like "the controller owns the character doing this animation so it could just communicate back"

#

I guess there is still a lot i have to learn

#

Right now I think imma just do it the other way round, like setting that in the character and query the variables in character on tick in my player controller, being like "hey you can't move right now"

#

I really need to learn much more about animation notifies

thick scroll
#

Does anyone know why changing the size of the collision capsule on Rep_Proxies is sometimes very choppy in comparison to Auto proxies / Server? I am talking specifically about the character movement component in this case. They are running the exact same code.

leaden atlas
#

do repnotify variables not get sent to the client on join?

#

im having an issue where a rep notify bool isnt being sent to a client if they join in the middle of a round

#

im not sure if its related to level streaming, the object is in a sublevel

#

wait i think i understand, i think it is because im hiding the actor using a repnotify

#

that was it 😦

unborn nimbus
#

IsNetMode(NM_DedicatedServer) will only return true if we're connected to a dedicated server right? Nothing to do with authority or anything like that

fathom aspen
#

No. If you're the client then no

unborn nimbus
#

What's the correct way to check multiplayer vs local play?

fathom aspen
#

IsNetMode checks if the code being executed is being executed by a server of type DedicatedServer

#

You could be an NM_Client executing the code

unborn nimbus
#

Yes, that makes sense

#

I want to avoid calling my RPCs when I'm not networked

fathom aspen
#

That would be checking if IsNetMode(NM_Standalone) is true

unborn nimbus
#

Thanks

unborn nimbus
#

Trying to launch DebugGameServer from VS and I'm getting this check assert

#

seems like a common issue but no resolutions found so far

#

this seemed promising but still crashing

#

ah, missing -IgnoreChangelist flag to force it to resave

#

Which is now showing this dialog...

#

Works if I launch from commandline through uproject but not through VS debugger

barren flint
#

I have a blueprint bool variable that's set to RepNotify with a Replication Condition set to "Owner Only". I'm seeing some strange behavior for the rep notify conditions:

  • If I set this variable to true behind a "Switch Has Authority" node so that the variable is set on the server, the rep notify does not fire on clients.
  • If I set this variable to true without the switch node, the rep notify fires on all clients.

I was trying to make it so that the server sets the variable and then I can have the client respond to the rep notify but I'm not seeing how i can do that?

sinful tree
barren flint
#

So - it suddenly started working but no idea how. It's the Begin Play Event and I was manually setting the owner so I know it was valid.

#

Now I'm having a separate situation where something similar happens. The rep notify is not firing for the client when it's associated with a timer:

thin stratus
#

Is the variable already true on the client maybe?

winged badger
#

its because there is no replication callback in blueprints, just a hack that calls property changed callback a replication callback

#

so no authority switch = each client sets the variable locally, and that causes OnRep

twin juniper
#

Hello guys.I am developing a game in dedicated server model.Whenever I launch the game in standalone client is connecting to server but when I am playing in mobile preview it is not getting connected at all.I am getting time out error.Can I know reason for it??

bitter oriole
twin juniper
#

Yeah I guess.Now it is working fine

#

Maybe it is compiling shaders something like that which results in timeout

past seal
#

Hi im trying to make a nametag widget above each characters head in my multiplayer game and it is working almost as intended 😄 However i would really like it to scale with how close you are to the player, or that it just disappears/becomes irrelevant when you get too far away. Any ideas on how to do this?

past seal
marble gazelle
#

calculate the distance to the player / camera and hide it if distance is less than a threshold? (squared distance of course)

past seal
marble gazelle
#

yep

#

would be my first approach, if this become a performance bottleneck you can still think about an optimization^^

past seal
#

ah, i wish there was some way to net cull distance for component.

#

but ty for answer 😄

marble gazelle
#

this in the end will also do this per frame I guess

past seal
#

yeah i guess you are right 😄

#

just seems heavier to cast all actors in the level to characterBP each tick

marble gazelle
#

why do you want to cast smth

past seal
#

in order to get the widget component from the characterbp right?

marble gazelle
#

why do you need that? do the calculation in the widget^^

past seal
#

ahh, wait that makes a lot more sense

marble gazelle
#

or in the BP of the character, somewhere where you don't necessarily need to cast or can cache the casted value^^

past seal
#

how do i get the other players than the owning player actor in the widget exactly?

marble gazelle
#

the other player is the local player if you don't have split screen, so just get the first player controller and grab its pawn^^

past seal
#

oh gotcha

marble gazelle
#

and if your widget doesn't know its actor, assign it on begin play

marsh shadow
#

hey dumb question,is the charactermovementcomponent working with the networkprediction?

past seal
#

i think it should be replicated by default yea, but not sure

#

remember to set replicates movement to true on your character

dull tinsel
#

You could do it in the material as well and let the renderer worry about what cameras are close enough to see it

dusky kindle
#

howdy, I've got a blueprint setup in my ThirdPerson that scans for interactables in front of it as a server operation, I can mash my interact button as much as I want and I still get the tracer but once I actually interact with anything the whole system seems to fail (no more tracer, none of my item pickups work after the first time). If anyone could point me in the right direction that'd be great :)

#

I think it has something to do with game ticks but I'm not sure

sinful tree
#

You can't do this.

#

The InputAction happens on the client whereas the "Interact With" interface call runs on the server. The client's side will always return false and it's bad practice to drag wires across execution paths like this.

You're on the right track, but all that should happen on the client side is:
Interact Action > SR Interact Trace (Runs on Server)

On the Server:
SR Interact Trace > All the rest of what you need to happen (line trace, interact with, etc.)

dusky kindle
#

ohhk that makes sense

#

thanks :)

#

it's works beautifully now thankyou!

eternal lake
#

I am aware this is the discord equivalent of threadromancing, but is this still the case?

dusky kindle
#

@sinful tree Any idea why this wouldn't work for extra clients? This functionality only works for the host process not rlly sure why

sinful tree
#

Probably best just to get the camera component that is attached to the character and use its location/forward vector.

dusky kindle
#

I see I see, thanks for the help! wish me luck aha

hallow summit
#

im trying to replicate a flash grenade, i have a run on server to a multicast so the grenade replicates but its also replicating the flash hud to every player, anyone know how to fix this

quasi tide
#

In the event - just check if the client is facing the flashbang, only play the flash if they are (within a tolerance of course)

hallow summit
#

@quasi tide how would i add that here

quasi tide
#

Google how to check if an actor is looking at something. Then put that check in there at a logical spot. (hint - it'd be before the flash actually happens)

fathom aspen
edgy escarp
quasi tide
#

Yeah - that is exactly what he's doing. Can still only run the code on affected actors though.

quasi tide
edgy escarp
fathom aspen
#

I think AddToPlayerScreen is meant more for split screen and stuff

hallow summit
blazing spruce
#

Hi, im trying to create a session and load a pre lobby level when the player clicks the button on the main menu but once I've created the session, can i not use the Load Stream Level node if im trying to load a pre lobby map? theres no pin for Options on this node and i need to specify ?listen in there, do i just have to use Open Level instead? or is there a way i can use Load Stream Level?

ashen stone
#

Is GetWorld()->GetAddressURL() supposed to be called on dedicated server or client?

fossil spoke
neon atlas
#

So, I'm trying to convert a game blueprint game feature from single player to work with dedicated servers, and I'm currently getting the following error: [2022.03.21-19.57.43:006][668]LogNetPackageMap: Warning: UPackageMapClient::InternalLoadObject: Unable to resolve default guid from client: PathName: BP_ModernBookShelf_C_0, ObjOuter: /Game/Maps/AMap.AMap:PersistentLevel

I didn't know whenever to send this in here, or in #blueprint

thin stratus
#

@neon atlas is that function that you call UI function an rpc inside a widget?

#

Because you can't do that

#

Widgets aren't networked

neon atlas
# thin stratus Widgets aren't networked

I should have guess
What would be the best thing to do then?
Call a function in the player that spawns the actor? Or something else?

I really haven't gotten the hang of unreal networking and multiplayer yet SadCrying

thin stratus
#

You have to call it inside a client owned actor or a component that sits on one

#

Being PlayerController, possessed Pawn/Character or PlayerState

#

At least in most cases

quasi tide
dark edge
#

@neon atlasWhat's the gameplay here, what are you trying to make work in multiplayer?

neon atlas
neon atlas
dark edge
#

Could be as simple as passing over an actor class and a transform.

#

The general flow goes like this

Client
Input/ButtonPress -> Tracing etc to determine WHERE we want the wall -> RunOnServerEvent passing over the actor we want and where we want it to be

Server
RunOnServerEvent -> Spawn actor of the provided class at the provided transform

neon atlas
dark edge
neon atlas
quasi tide
#

If you want to do it server side, then yes. If you don't care for other clients to see where you plan on placing something - don't replicate the preview.

ashen stone
#

Can i use GetWorld()->GetAddressURL() on server to get the url?

hallow summit
#

all my players share a character blueprint. Is there a way to change boolean/enum values for one specific player when they all share the character bp?

dark edge
#

How many characters exist in the world when the game is running? I think you're missing the fundamentals of how objects and classes work.

hallow summit
dark edge
#

MySize doesn't mean anything, it's specific to the instance of the class. MyCharacter.MySize is a specific variable, and it's different from ThatOtherCharacter.MySize

#

Just like how you and me have the same variable Birthday but mine is different.

#

Asking what the value of Birthday is doesn't make any sense without asking WHO's birthday

#

Start by doing this. Make a replicated variable MySize and set it to RepNotify.
In the Onrep_MySize, do the size changing stuff. If you don't know what RepNotify is then go read up on it.

#

Don't bother with the shrinking, just get this working with your pickup.

hallow summit
#

Ok, what is the variable type for Mysize? Is that the enum variable?

dark edge
#

Do you see how it could be
ESize MySize = Big (can be Big, Normal, Small)
or
bool IsBig = true (can be true or false)

twin juniper
#

I need your help! I dont know why the rotation change is not visible for other clients! For the own player it works fine, but others dont see the changes!

#

This events cal the methods above

dark edge
#

also, don't just add relative all the time, modify some control variable and drive the movement directly by it

twin juniper
#

I already tried every replication checkbox of the characterblueprint.

dark edge
#

Also the CMC is weird and does a lot of internal stuff unknown to you. You won't be able to just flip gravity over like that I guarantee it.

twin juniper
twin juniper
#

Only thing that doesnt work is that other clients dont see the rotation

dark edge
#

are you just flipping the mesh INSIDE the capsule?

#

capsule is still oriented Z up right?

bitter swift
#

Not sure if this is complicated, but I thought it wouldn't hurt to ask.

How would someone go about synchronising an animation perfectly?
I know RPC calls are the most prioritized way of sending data. But is it possible to, maybe set the animations "start offset" to whatever amount of GameWorldTime the data package is behind?

twin juniper
#

I havent figured out how to properly flip the whole character

dark edge
twin juniper
#

This two addrelativerotation methods are the closest i got so far to get flipped body + flipped camera

dark edge
#

So you don't

twin juniper
#

what even is cmc

dark edge
#

Character Movement Component

twin juniper
#

ah

dark edge
#

Start by replicating some bool and doing stuff in the onrep

twin juniper
#

And how exacly should i flip the character?

#

If you know a good solution to make it visible to all players please tell me

#

I try since yesterday xD

dark edge
#

when the boolean changes, that's when you flip the mesh

#

don't replicate the mesh's movement, replicate what DRIVES it

twin juniper
#

I try to understand

#

I get a bool "isFlipped" onNotifyRep. When i inverse gravity i just change isFlipped value and do the exact same addrelativerotations in the repNotify func?

dark edge
#

DON'T ADD RELATIVE

#

ffs

#

just roll the mesh by 180 or whatever results in it being flipped

twin juniper
#

With what method?

dark edge
#

However you want to. Can just set local rotation if you want

#

figure that out before worrying about networking it.

twin juniper
#

Hm okay

dark edge
#

@twin juniperI would start with messing with the BP to find what combination of rolling/moving/scaling of the mesh and spring arm and camera results in what you want for the "inverted" view

#

then just do that / undo that in the repnotify

twin juniper
#

Yeah good idea. Maybe that way i learn it better^^

lunar birch
#

Do ListenServers not spawn AHUD for themselves?

low helm
#

They do not

peak sentinel
#

uhh... they do?

#

its also a player in the end

lunar birch
#

So I have to have all my Interface logic inside the PC (when I want Listenservers to be thing)? 🤔

willow garden
#

does anyone have an idea of why this value is successfully replicating, then 2ms later is being replaced with a nullptr?

[2022.03.24-00.54.27:534][596]LogTemp: Display: Replicated lobby leader: 0000019952165D00(PlayerState_1)
[2022.03.24-00.54.27:536][596]LogTemp: Display: Replicated lobby leader: 0000000000000000(N/A)

^ logs from the ReplicatedUsing callback. i have pretty high confidence that the server is not setting the value to null

#

this only seems to happen when playing as standalone or in the packaged game

summer tide
#

Anybody knows when I load network profiled file, it appears blank?

willow garden
low helm
#

Don’t clients reconnect when they travel

#

a new player state gets created?

willow garden
#

this is a property on the gamestate, i'm not sure why it survives travel on the server but not the client

#

ok it's a comedy of race conditions

#

if there are no players and a player joins, the gamestate makes them the leader. so it's losing it in the travel, but then the player connects, and it seamlessly makes them the leader (not a single tick where they are not the leader from the server's point of view). but I guess the gamestate doesn't exist yet on the client to be replicated to at that point

#

not really sure what to do about it. I could probably figure out a way to calculate it more lazily so it happens after the client is ready, but it feels like this could happen for any replicated property across travel. should I have the client run an RPC to demand the values when it starts up? is there a way to force replication? 🤔

#

but values should be replicated when the client actor is created right? otherwise you couldn't join a game halfway. so this must be some kind of really nasty race condition i've made for myself

scarlet olive
#

this is killing me. I'm just trying to set a single boolean variable on the server and replicate it. there's no maps or sets involved :/ I know that if there were I could work around it in some way but.. what do I do with this?

willow garden
#

the condition for that tooltip doesn't have much going on:

bool FBlueprintVarActionDetails::ReplicationEnabled() const
{
    // Update FBlueprintVarActionDetails::ReplicationTooltip if you alter this function
    // shat users can understand why replication settins are disabled!
    bool bVariableCanBeReplicated = true;
    const FProperty* const VariableProperty = CachedVariableProperty.Get();
    if (VariableProperty)
    {
        // sets and maps cannot yet be replicated:
        bVariableCanBeReplicated = CastField<FSetProperty>(VariableProperty) == nullptr && CastField<FMapProperty>(VariableProperty) == nullptr;
    }
    return bVariableCanBeReplicated && IsVariableInBlueprint();
}
scarlet olive
#

this runs from the level bp on beginplay. the only "set" here is setting the boolean to true

willow garden
#

as far as i can tell either CachedVariableProperty.Get(); is returning something wacky or IsVariableInBlueprint() is

#

my guess would be the latter

#
/** Returns TRUE if the Variable is in the current Blueprint */
    bool IsVariableInBlueprint() const { return GetPropertyOwnerBlueprint() == GetBlueprintObj(); }
willow garden
#

level bp is only on server right? 🤔

scarlet olive
#

level bp. yeah so I would assume it gets loaded on begin play concurrently with the client no? any variable I set there don't and can't get replicated

sinful tree
#

Anything you do on begin play on the level BP will get executed on the server and on any clients when they load into the level. So different clients would be trying to set the value too unless you use a Has Authority check.

sinful tree
willow garden
#

well potential replication issues is secondary to Galco's problem where the editor is preventing the dropdown from being used in the first place

#

my recommendation would be to stick a breakpoint in ReplicationEnabled() and see what's up 🤷‍♂️

scarlet olive
#

yeah that makes sense about the client and server having two different values. so I have to "has authority" and then multicast it or what

sinful tree
#

Are you able to show the full details from where this came from?

willow garden
scarlet olive
#

indeed, that's why I was hoping to just replicate the variable but.. I can't 😦

#

this bool is on the box bp, being casted to from the level on beginplay to set it to true

willow garden
#

if the bool is on the box bp you need to set the replication value in the box bp

scarlet olive
#

I can replicate the variable on the box bp itself but it doesn't show when setting it in the level bp, and also doesn't replicate anyway

willow garden
scarlet olive
#

this is the box bp. replicated or not, if the level bp sets it, it doesn't rep

sinful tree
willow garden
scarlet olive
#

I had this exact same problem on another bp btw but this one is much simpler so I'd rather solve it here first.. seems to be something like what wish is saying. if the bool is in a bp that is not owned by the client, such as thing box, even setting it and the bool within the actor to replicate doesn't do anything. if I update the bool within the actor, aka not from the level bp, it will replicate. I've tried combining this with rpc and multicast shenanigans as well

#

I must have a misunderstanding because I thought that the server owns everything so as long as I replicate what it does to those things I should be good.. right?

willow garden
#

hypothetically yes

willow garden
scarlet olive
#

it is already in the level, doesn't get spawned in during gameplay or anything

sinful tree
#

No, the level blueprint can set the value without issue.
Example here.... The client prints out the string "true" after 5 seconds.

willow garden
#

i don't use blueprints very often what even is this node

sinful tree
#

That's an array variable.

#

Since it's blue, it's more specifically a TArray<ObjectType>

willow garden
#

i see

#

wouldn't that still need to be populated in a BP then

scarlet olive
willow garden
#

with a GetActorsOfClass node or something

sinful tree
#

I'm assuming Galco is, based on not saying they're getting any errors 😄

willow garden
#

fair, in which case server should be the owner of them 🤔 so a dead end for that line of thinking

willow garden
scarlet olive
#

this prints true as expected, but the original issue of grabbing a random one from the array and setting it, doesn't replicate. same variable, same actor.. I have tried running as authority and replicating the variable in the actor bp but doesn't work.

#

What happens here is.. server prints the name of the one that should be set true. after 5 seconds, client grabs the same actor but returns false

willow garden
#

can i see the BP for populating the electric boxes array

sinful tree
#

You have the random int calling to 4 different pins, and each would get their own different random number.

scarlet olive
#

yeah I jsut noticed that lol setting it as a variable first

#

by the server

sinful tree
scarlet olive
#

yeah, you right tho. this works.. still having the "you can't replicate this variable" issue in another bp though :/

scarlet olive
#

yes

sinful tree
#

That's because you can't change the replication type when you have the variable selected in a different blueprint.

#

You have to go to the blueprint where the variable exists, and change it there.

scarlet olive
#

I tried that but I probably slipped up some other way. I'll dig it up and show ya

weak copper
#

Any idea to create android multiplayer game?

willow garden
#

i was setting the lobby leader in an override of AddPlayerState, but AddPlayerState was being called in the same tick that travel finished for the server, before BeginPlay had even been called on the game state! and then however many ticks later when the client actually finished traveling, AddPlayerState was called again, but as far as the server was concerned it had already calculated it

[2022.03.24-03.35.04:602][154]LogTemp: Display: GameStateBase AddPlayerState // ???????
// leader calculated
[2022.03.24-03.35.04:602][154]LogWorld: Bringing up level for play took: 0.003164
[2022.03.24-03.35.04:603][154]LogWorld: ----SeamlessTravel finished in 0.73 seconds ------
[2022.03.24-03.35.04:603][154]LogTemp: Display: Successfully retrieved lobby leader BP_PlayerController_C_0
[2022.03.24-03.35.04:604][154]LogTemp: Display: GameStateBase BeginPlay
...ticks...
// somewhere in here the client loads in

[2022.03.24-03.35.05:404][179]LogTemp: Display: GameStateBase AddPlayerState
// i already have a leader so calculating/replicating
#

so i fixed it by checking HasBegunPlay before i calculate the leader 🤷‍♂️

winged badger
scarlet olive
#

Ok so.. tracked down the final step of the issue I talked about. Character opens a lock, sends interface message to the door (which owns the lock component) to have it unlock itself. It can do that part, but it never replicates to server.

#

this is the interface message targeting the owner of the lock component aka the door from the first screen

winged badger
#

clients typically don't own a door on the level, so RPC fails

#

you should have a "No owning connection for..." warning in the logs each time you try

scarlet olive
#

So how would I work around that other than having the character class own all the doors? I tried sending off to the game state and having it do it then replicate the variable from there

sinful tree
#

You RPC to the server on the character or player controller before calling the interface.

#

Player Input > Line Trace to Actor (or however you may be getting the actor) > Server RPC requesting the action, passing the actor through
Server RPC > Validate player is within range to target actor to perform said action > Interface call to the actor

#

Interface > Do whatever needs to be done on the server, such as setting your boolean.

scarlet olive
#

So like this? Character RPC to interface which is picked up by the door, sets the bool

scarlet olive
#

Still only updates on the client :/

dark edge
scarlet olive
#

It does fire, I put a breakpoint on the initial RPC and followed it through to here

scarlet olive
#

It apparently is staying on the client even with RPC being called from an owned actor

dark edge
#

You sure? Put a print string

finite pendant
#

How do I get the first picture to be the same as the second picture

finite pendant
#

Yeah but I am not sure the name of it

#

I might have found it

#

one second

dark edge
#

I'd start with "Create Advanced Session"

#

Ah the plugin name will be advanced sessions or something like that.

#

Or just copy it from the old project

finite pendant
#

Yeah I found it I am going to get it from my old project rn

scarlet olive
# dark edge You sure? Put a print string

Dear god above. Apparently I was calling the original rpc from an unowned actor which I thought I had changed ownership of.. Sorted that out and, now it works 😵‍💫

dark edge
#

If the pawn is who's doing the lock picking then the RPC should go through it.

scarlet olive
#

Yeah it wasn't it was from a separate bp that I thought I made owned but didn't. Really need to just make it a component.. one day. Thanks for helping though!

bitter swift
#

What's the best way of replicating shooting guns?
I don't imagine that making an RPC call for every bullet, is good for bandwidth. How do other games go about it?

twin juniper
#

I implemented shooting via multicast but I also need to know if there is much better way

lone bridge
#

Hi Guys,
I need a server host, to work 24/7. The game will hold 50 players most of the hours.
All 50 players will be together watch event, and could talk.
Each player will have private room also, that will show art work, and can make purchase .

I never done the server side, and I hope to find some advices, and understand better what I should use and pricing.
Thanks

winged badger
#

show art work, as in upload it from their own computer?

cold magnet
#

Hi, is there any way to debug blueprint execution on a (local) dedicated server?

hexed pewter
#

are moving platforms something that would be hard to program in a multiplayer scenario?

lone bridge
sharp kestrel
#

What would be a good way of spawning characters on a networked game?
My goal here is to let players have multiple characters they can control (its a squad-based game, simple AI take over those not directly controlled) however the clients always seem to spawn one extra character and I'm not sure what replication I've messed up to achieve that.

#

Left is host with 1 character per player (as intended right now); right is a client with two characters for them and one for host.

#

Changed it so players have two characters each.
Now host shows four (two each) while client shows five (three for self, two for host)

calm hound
#

So I've been looking into creating large multiplayer maps - and it looks like all the posts say 25km is the max before you start getting floating point precisions errors, but no one explains what the repercussions of those precision errors are.

I'm assuming this just starts desyncing player positions with each other due to replication truncation? So like, if I'm at 26km away, and so is another player - we may be a few meters off from where we think we are? Or is it something else

#

Just curious as to what it actually affects

calm hound
# lone bridge Hi Guys, I need a server host, to work 24/7. The game will hold 50 players most...

if you want it running 24/7, you'd be best with programming a dedicated server as otherwise the "host" would have to be "playing" the game essentially, and rendering everything visually - which is a waste of resources.

When programming you would filter various stuff so it executes logic on the dedicated server, but doesn't try to render the visuals - like if you have an emitter/particle, the server doesn't need to actually see it - it's just visual.

But to create dedicated servers, you have to get the entire engine from GitHub (the source) and compile it manually which is quite a pain in of itself, as the version of the engine in the launcher has dedicated servers turned off and you can only turn it on by compiling from the source

calm hound
sharp kestrel
#

I'll get screenshots of the blueprint in a sec for you

bitter oriole
# calm hound So I've been looking into creating large multiplayer maps - and it looks like al...

25km is quite ambitious on UE4, 4Km is a more reasonable cutoff. The basic problem is that in computers, using a float type, you can differentiate 0.1 from 0.2, but not 1000000.1 from 1000000.2. Essentially, very big numbers start getting rounded - including the location of the player, which would snap randomly, first to the next cm, then to the next 10cm, then to the next meter, etc.

#

UE5 fixes that by moving to double coordinates, which has an exponential effect on precision - rather than a few km you can do the entire solar system

sharp kestrel
#

I mean... need to get better at dev in general but that's a bonus.

bitter oriole
#

Yup, everything's a double now. Not that most people actually need it 😛

calm hound
#

But it's so early in development/release. UE4 has that nice stability to it

bitter oriole
#

I would suggest that loading screens are very much relevant in UE5 - levels don't exist because of size limits

sharp kestrel
calm hound
#

I'm fine with loading screens, it's more of the "all players must be present to switch" thing

sharp kestrel
#

And the GameState does this

calm hound
#

and you probably need a "Server" Function to send the request to the server from the client, that calls that spawn

sharp kestrel
#

Sounds familiar. But when I've used that before I've found that it acts funny with the host player.

#

Remote doesn't work for host only clients, and host for some reason was triggered by every client's beginplay call.

bitter oriole
#

BeginPlay is fired everywhere

sharp kestrel
#

Or it was something to that effect. I'll give it a try.

calm hound
#

^

#

Yeah, Replication is a pain. But BeginPlay is played by all players, and the server, for all actors basically. You have to filter pretty much everything based on Client/Server using Authority (and even that can be wrong, as clients can "have authority")

sharp kestrel
#

Christ.

#

Actually wait I think I had a solution before

#

Something weird was happening with UI so I used a "is local controller" node.

bitter oriole
#

Multiplayer is 5x more work than single player, in my humble rule of thumb opinion

calm hound
#

Also true.

Is Local Controller limits it to just the current PC if owned by the player calling the function, but that could be server or client - based on who called it 😛

#

and if you have split screen, man! Throws that for a loop too

sharp kestrel
#

Thankfully I'm not going with Splitscreen. Tried that at Uni. Wasn't too bad but it would just add more complication to my current project.

#

Okay so... I added Switch Has Authority to the start of that Init Spawn Characters function.

#

Coming out of remote.
Host doesn't spawn anything, both clients spawn the normal amount but nobody can see anyone else's characters.

#

Which is odd given its calling to GameState which is server authority and these characters should be getting replicated?

#

oh

#

Running through authority seems to actually work.

#

From a client's perspective

#

Though its just occurred to me only the host can see the UI now.

rotund onyx
#

I am trying to sync a procedural mesh between both client and sever. The server is able to construct the mesh just fine, but for some reason when I get the client to load the file no mesh appears. I know these don't replicate (maybe someday...) so I am basically having everyone construct their own mesh. I don't know what could be wrong with the clients though. They fire the event and I have no errors.

#

There's basically no info out there on how procedural meshes interact in multiplayer, I don't know what needs to be replicated, owned, etc

#

I wonder if maybe it is an ownership problem but I'm not sure why that would be the case.

ashen stone
#

is it normal for dedicated servers to be huge in size even on small projects? what is included?

latent heart
#

All of your assets, probably.

little bloom
#

In blueprint, with repnotify arrays of structs, is it the intended behavior that setting a member on a referenced member of the array triggers a rep notify on clients only, as opposed to the normal server and client rep notify in blueprint?

ashen stone
latent heart
#

Texture assets probably aren't needed, but your meshes are! And no idea if it's grown that much.

#

@little bloom are you setting it in c++?

blazing spruce
#

Hi, im messing around with seamless travel, i have the command executing on the host screen once they press the Start button, its happening on the Pre Lobby game mode, its then loading up a map which has a different game mode set as the default, is this likely to cause issues since seamless travel has actors such as game mode and player controllers persist across automatically?

winged badger
#

all gamemodes will persist those by default

#

game mode will reinstantiate when server loads the map

#

it will reinstantiate game state

#

but it will persist controllers and player states, even if their class is different on the destination map

#

you do need to implement copyproperties on playerstates to preserve data in that case

silent valley
#

Milliseconds

twin juniper
#

hi, is there a way to have an actor be replication dependant on his owner ? Actually my weapon is replicating faster than it's owner (Pawn) and it causing me some issues on simulated while attaching the weapon

void AZircoWeapon::OnRep_WeaponDefinition()
{
    // attach weapon mesh to pawn hand
    USkeletalMeshComponent* OwnerMesh = GetOwner<AZircoPawn>() ? GetOwner<AZircoPawn>()->GetMesh() : nullptr;
    if (OwnerMesh)
    {
        WeaponMesh->AttachToComponent(OwnerMesh, FAttachmentTransformRules::SnapToTargetNotIncludingScale, "ItemSocket");
    }
}

so sometimes it will works and sometimes not cause the owner will replicate too late on simulated so it will just do nothing.

#

for example player 1 joins and then player 2 joins like 2min later, player 2 will see the weapon of player 1 floating cause at the moment WeaponDefinition replicated, the owner has not yet replicated

#

Also i know i can easily fix that by switching this code to my Equip function, but WeaponDefinition is only set one time when the weapon is given to the player so i prefer doing this.

#

got a repro recorded, as you can see it's rly random. player 2 has the weapon of player 1 attached but player 3 see the weapon of player 1 floating, so it's some race condition

prisma snow
twin juniper
#

the race condition is in the same actor, it's between Owner and WeaponDefinition

#

sometimes Owner replicates before WeaponDefinition and it's working, sometimes the opposite

prisma snow
#

I was wondering if it is possible to get the real-time Ping and Bandwidth values (the ones shown in Stat Net) to display in a debug widget in a packaged project 🙂

prisma snow
twin juniper
twin juniper
twin juniper
#

and use them on your widget

#

i know some people already talked about things like that (something like the fortnite net stat)

#

you can maybe find the messages if u search for it in this channel or #cpp

prisma snow
dark edge
rotund onyx
dark edge
#

If not, you'll have to parse the file to some format that can be replicated.

rotund onyx
dark edge
#

Replicate the file name or whatever you're using as the identifier

#

If it's a UASSET then you can just replicate it by reference.

#

You presumably made this, so just make the client do what the server's doing.

plush otter
#

Hello, I have a question about net Dormancy and NetCullDistance

#

When I set Dormancy to Dormant all or initial, the actor is not culled from client after cull distance is reached

#

Is there a way to fix this?
Or these 2 does not work together? Like dormant actor doesn't need to care about cull distance

blazing spruce
#

Hi, ive got a transition map set for loading, but none of the level blueprint code for the loading map gets ran while it transitions, any reason why this is?

short arrow
#

Anybody know how to get set view target with blend working for multiplayer? The pitch isn't replicated by default so you can't see when the actor is looking up or down

#

I have a replicated pitch variable but I'm honestly not sure what's the best way to handle this

fathom aspen
#

Make sure you are doing SetViewTargetWithBlend on server

short arrow
#

So the server needs to call it and not the client? Thats all?

fathom aspen
#

Yes

short arrow
fathom aspen
# blazing spruce Hi, ive got a transition map set for loading, but none of the level blueprint co...

Looks like this is a bug that won't be fixed, there are workarounds though, see this: https://community.gamedev.tv/t/transition-map-problem/74101

pallid yoke
#

hey so im working on a game that has some minigames, and basically I need the minigames to work purely client side, and then I need to have the player possess the pawn in the minigame, and then go back into the player when they are done with the minigame. It all works on the host, but not on any client. What do I do to make it work? I have each minigame packed into a single blueprint, with the whole setup.

#

I really dont get how it all works.... Just ping me if you can help.

fathom aspen
#

It's hard to tell without seeing what you are doing. So that's why you should be posting the relevant code.
If you want to make sure something is being executed on the client, you have a SwitchHasAuthority(in BP) and you use the Remote pin

#

Also possession happens on the server, so if you're doing that on the client already then it won't work. That's why you should consider calling a client RPC

dark edge
fathom aspen
pallid yoke
fathom aspen
#

Still that's a general question, show code so people here can help you

plush otter
fathom aspen
#

I would say no, but I'm not sure

pallid yoke
#

So im asking sort of generally here because all I can show is code that doesnt do what I want it to do. I basically just want the concept I should use in turn, like "every time X happens you need to do Y". Oh also im not 100% sure I can share the code as I signed an NDA, idk if that would violate it...

dark edge
pallid yoke
dark edge
pallid yoke
plush otter
# fathom aspen I would say no, but I'm not sure

I did some testing. The forced update doesn't reach out to out of cull distance clients. They only receive the update when coming back to range again. It's just the actor is not destroyed on client like a normal awake actor.

#

Also Blueprint seems to do some automatic flushing when changing a replicated variable on a Dormant actor.
I guess it's an intended feature?

fathom aspen
#

It's the intended behavior

plush otter
hearty vine
#

If I want to get started, how do I test my multiplayer project as a solo developer

fathom aspen
#

What do you mean by "as a solo developer"?

#

That won't make any difference if you're working alongside a team

#

You test your stuff and make sure everything is going as planned

hearty vine
#

I mean if I have a side project for example where I want to develop a multiplayer project on my own (hobby project)

#

how do you test to make sure it functions correctly on low ping for example

#

or functions as expected rather

fathom aspen
#

If you're asking about the ping then there is a console command you can type that goes as: net PktLag=<YourPing>

hearty vine
#

Nice. Alright I guess that answers my question. Hmmm okay

#

thanks

fathom aspen
hearty vine
#

Lag Simulation nice this looks like exactly what I was looking for!

fathom aspen
peak mirage
#

Hi, one small question, how do I disable animation on server? From my reading, Character Movement Component will replicate both transformation and animation. My game design don't particular care about animation sync, so I want to remove that for better server performance.

rotund onyx
#

Does anyone have some experience with the Physics Handle in multiplayer? I notice the interpolation for it looks really bad in my game and I'm wondering what the best practice for it is.

grizzled zenith
#

is there a way to replicate rotation?

fathom aspen
grizzled zenith
fathom aspen
#

A skeleton bone?

#

Or a regular bone AActor?

fathom aspen
bitter swift
#

I've put an Actor to Dormant All, but it's still calling its ReplicatedUsing methods on clients. Does anyone know why?

fathom aspen
#

The solution is to move to C++

fathom aspen
bitter swift
#

yes that is correct

fathom aspen
#

Heh

#

For a second I thought that is the bug I faced recently lol

bitter swift
fathom aspen
#

Yes

bitter swift
#

can i show u my code? it's very short. It's a test really

fathom aspen
#

It's what it is. Your actor shouldn't be sending any replication data

fathom aspen
bitter swift
#

i lied when i said it was in code... some of it is blueprint

fathom aspen
#

Lol

bitter swift
#

This is cpp

#

this is the header

fathom aspen
bitter swift
fathom aspen
#

No, that's not what I meant

#

You shouldn't be setting this in BP probably. Try doing all this behavior in C++

#

See if it fixes your issues

bitter swift
#

Thank you for your help.

#

I can see that you can use ForceNetUpdate() even if it's Dormant or Initial. That's really handy.
I imagine the idea is you can save a lot of Server performance by having replicated Actors to dormant and if they need to update something on a rare occasion, you can use this call without even turning them Awake. Is that correct?

#

It's kind of like an RPC call, except you can adjust its Net Priority ?

fathom aspen
#

It's not really an RPC. What it does really, it calls FlushNetDormancy which makes the actor Awake for a second and then makes him Dormant again or whatever state he was before

#

But it's similar to what an RPC does

bitter swift
fathom aspen
#

Yes for sure

hoary spear
#

@somber bluff I'd suggest checking out the third pin in this channel.

prisma snow
#

I'm working on a custom replication system for large (up to 2k) amounts of unit positions. To summarize it, what we do is to move the units in both client and server (by sharing commands and executing the movement code in both), and send a server update every second to keep everything in sync, with some smoothing. It works very well, and the bandwidth is reasonable, but I am worried that shooting RPCs from 2000 actors is too much.

Would it be more performant or advisable to "package" the updates (for example, by sending positions in arrays) so that we do much less RPCs (but still sending the same amount of data)?

hoary spear
#

I would expect the latter one being more performant due to package overhead, but I honestly dont know how unreal handles it at the end. Interesting question!

prisma snow
#

The problem is that sending arrays means to keep track of the index to later make it correspond to an actor

hoary spear
#

And they must be in sync between server/client 😮

prisma snow
#

And sending the actor reference probably results in much more bandwidth consumption

prisma snow
#

Unreal allows to share/RPC object or actor references right?

prisma snow
#

Although thinking about it, I could setup a system with custom IDs (ints) stored in a Map that stores the reference. So I could send the ID with the positions and then lookup the Map. A int16 should suffice

hoary spear
#

i wonder if at 2k actors, compression of data would be a benefit, or just more work than its worth

#

seems you've already optimized it by reducing sync frequency

#

so perhaps thats the better method

#

perhaps bandwidth is no problem at all

prisma snow
#

object pointers are sent as FNetworkGUID, which is basically a uint32

#

so maybe saving 16 bits is not worth it

hoary spear
#

yeah , but not sure if object pointers are synced ?

prisma snow
#

yes yes they are

hoary spear
#

Ah cool

prisma snow
#

So I can just create some actor that batches the RPCs and send an array of locationX, locationY, pointer

#

locations are uint16 so 64bits in total

#

64 * 2000 =128Kbps

#

Given that this is the mega worse case scenario, it should be fine

hoary spear
#

at 2k units, perhaps replication and bandwidth is the least of our problems x)

#

128kbps even my old ISDN could handle that

prisma snow
hoary spear
#

yeah there's a fixed ceiling, so most of what you can do is reduce what needs to be sent , and the frequency of it, if its not important

#

sounds like you've got some RTS going , so i assume its all quite important 😛

prisma snow
#

haha correct

#

I'm happy that this seems to be working out because I didn't want to do lockstep

chrome bay
#

Doesn't matter long term ofc

#

But short-lived stuff it can be a hindrance

prisma snow
#

?*

chrome bay
#

Yeah like, if you spawn an actor at runtime - it also needs to know the class name. If you've never spawned one of that class before, it's the full FName of the class.

prisma snow
chrome bay
#

Yeah nothing to really worry about then

#

classes get GUID's acked too so that evens out as well eventually

prisma snow
prisma snow
chrome bay
#

Also RE replication etc, I've had great success experimenting with using FFastArraySerializers' ReplicationID as a game-level handle too.

#

Using that currently to ID items in an inventory system, worked out really well. The only downsiee is you're limited to int32 handles - and can't default them to 0

prisma snow
#

My current idea is to batch the updates, so that I do for example 200 units, 200 units after 100ms, etc. So each second all get updated eventually

#

I was not counting on the packet overhead for the individual rpc that I do currently. So by sending pointers and batching the updates, I might almost save bandwidth, or have a very small increase, while increasing the performance

chrome bay
#

yeah, the packet overhead is not that big of a deal usually - but if you're sending the same RPC many times in one frame, it's better to send one with a batch of data

#

and/or find ways to pack it

prisma snow
hoary spear
#

Are there cases where packing data for single RPC's would decrease performance? If not, then why dont UE handle this by itself on the backside i wonder

chrome bay
#

Not really something it can do easily tbh

prisma snow
#

I'd say, that RPCs are supposed to be individual functions called for a specific reason of the user - therefore the engine cannot know really the intent of it, and whether it is acceptable to delay it for packaging/batching

#

Also RPCs are used in the core of many systems iirc, so I can see how they want to have a strict control on how they work

#

Also just as a side note, UDP overhead is 28bytes per packet in IPv4, and 48 in IPv6 - so batching the updates and sending a pointer actually is barely a bandwidth increase.

chrome bay
#

Don't forget the headers that UE adds to identify them also, there's a 2-byte header per RPC iirc that identifies it, and additional header to identify any subobject (if a component etc.) and the additional header identifying the actor channel to send it through

prisma snow
#

Damn

chrome bay
#

The actual outgoing packets will be batched ofc

prisma snow
#

That kinda explains that the bandwidth was higher than I expected from my maths

prisma snow
chrome bay
#

yeah, the network profiler can show them, can't remember the exact numbers

#

IIRC batches are sent per-channel so you only pay the actor cost once per network frame - but identifying the individual RPC has a minimum 2 byte header + extra header if it's in a subobject like a component

#

The latter is why Epic put the RPC's for character movement into the character class

#

Probably a micro optimisation for Fornite

prisma snow
#

btw now that we are on it, do you happen to know how to get the ping + bandwidth values from stat net to display in UI? Wanted to make a debug widget. I couldn't find a way to map the commands to the classes

chrome bay
#

Yeah you can get them from the NetDriver IIRC

prisma snow
slate basin
#

Hey, is there a bool I can set so that an actor isn't relevant to its owner, so it's only replicated to the simulated proxies, opposite of bOnlyRelevantToOwner

cold magnet
#

Is there a way to run RPCs on server on "neutral" actors, i.e. not owned by any particular player controller? When I try to do so I get the expected "No owning connection"... message and nothing happens. But I really would like to avoid putting all of my RPC logic in the player pawn/controller if possible.

I also tried assuming ownership of the actor from inside the player pawn (a RunOnServer RPC that just calls SetOwner on that actor to the pawn) and then tried to run RunOnServer RPCs from within the actor (not the pawn) graph, but that doesn't seem to work either.

sinful tree
# cold magnet Is there a way to run RPCs on server on "neutral" actors, i.e. not owned by any ...

No. RPCs to the server can only be executed on owned actors.
To get around this and trying to keep the logic on the other actors, you may want to see if interfaces would be useful for you. Eg. Using an "Interact" interface where you RPC on the character, and then the server calls the interface on the actor. The actor can then respond to that interface as needed.... So if it was a door, it can open. If it was a lightswitch, it can turn on. If it's an NPC you can talk to them. Etc.

#

Using an interface would limit the amount of RPCs you'd need to place on the character or controller.

cold magnet
#

I see... Disappointing to know, but thanks for the answer! Followup question, calling a multicast replicated event can only be done from a RunOnServer event, right?

calm hound
sinful tree
slate basin
#

and it won't replicate to the owner

calm hound
#

I've not tried to over-step relevancy like that. There is usually better ways

slate basin
#

does anyone know a way to change the replication condition of ReplicatedMovement?
I want to set it to COND_InitialOnly, however the member is private so I can't use

    RESET_REPLIFETIME_CONDITION_FAST(AActor, ReplicatedMovement, COND_InitialOnly);```
twin juniper
#

I'm having issues with 3d widgets and the widget interaction component.

I've been using it for a long time and it's been working perfectly, but now it doesn't seem to generate on_hovered or on_clicked events when in multiplayer. It functions perfectly in singleplayer.

I think it may have something to do with user/pointer index but I haven't had to change the user/pointer index before and it's worked perfectly

prisma snow
#

I've noticed that the Ping value that I can get from PlayerState->GetPing(); is quite different from the one shown in Stats Net. For average simulated network, GetPing() returns 40ms, and Stats Net is showing around 120ms. It could be that one calculates the whole round trip and the other just one of the directions, but it's weird.

fathom aspen
bitter swift
#

This might be an abstract question, but is it heavy for the server to turn dormancy on and off on an actor?
Let's say you have 10-20 actors that are set DORM_Initial and you use ForceNetUpdate() every 1 second on each actor.

ashen stone
#

If i don`t replicate health variable and uses RPC for damage events (subtracing from health variable locally) is there a way to sync the initial health value ?

ashen stone
#

but when?

#

i`m using replication graph, is there an even for when it was created on player x screen?

elfin inlet
#

How can i reach my character from an Animation notify? The thing is I want to write a variable "ANimation is playing" in my character. However trying "try get pawn owner" simply won't work. Any better way to get back to the character who triggered the animation?

solar stirrup
#

Does anyone know what exactly the SpatialBias in the rep graph's grid spatialization node does?

#

A little unsure

real ridge
#

So guys I have few problem in my game so I try to ask,sorry for my English maybe will be not the best, So I made dedicated server on my pc local server using unreal engine 4 I found turtorial on this Then I tried to make map etc I am logging there by IP 127.0.0.1 so and my problem is that If I run my server and then game from the folder and join there with for example 2 clients then divide my monitor to 2 windows with both clients and start play jump or something else I still see from the other client laggs very bad laggs in the client I am playing it's okay but from others it's horrible, but if I run game from editor in unreal engine 4 by hit play button it's okay no lags or anything else (but I need run server from cmd again) but here is another problem my first spawned client has everytime copy of himself which is not moving it's spawns at same place as first client and he is there..... And last problem is with physics replication of some objects for example I have Ball there or cube which I am moving by character and their move is also lagging. I. can also send some videos to explain problems better If anyone can give me a tip please

finite pendant
#

How do I get a crosshair to replicate

#

It doesnt show on the client

finite pendant
#

I am not sure why it doesnt appear on the client

fathom aspen
finite pendant
fathom aspen
#

Creating widgets and adding widgets to viewport is done on the client

finite pendant
#

so i can just get rid of that all together?

fathom aspen
#

No

#

Use the Remote pin instead of the Authority pin in SwitchHasAuthority

finite pendant
#

i tried that an it broke my game

fathom aspen
#

Well if you are in class HUD, you don't need it at all, as you're on the client for sure. So Just remove the node Switch Has Authority

finite pendant
#

no crosshairs show up at all then

fathom aspen
#

Weird hmm

#

If you're removing all widgets on begin play, then how you still have that widget up there that shows score?

finite pendant
#

this node casts the score

fathom aspen
#

Ok, which node creates the crosshair? I can't tell from the names

twin juniper
#

What is the best mulitplayer soultion without opening ports?

finite pendant
fathom aspen
#

It clearly has to do with whatever you're doing in that widget.
Debug your code, try uysing PrintString on EventConstruct and see if it's being constructed.

#

It just doesn't make sense that the former widget works, and preceding ones probably and this one doesn't

weak copper
#

I want to create an Android online multiplayer game.
Is it necessary to use paid dedicated servers?!
Can one mobile host and others can join through internet?!.I want this type.
Is there any tutorial for this?!I prefer blueprint tutorials.

dusky yoke
#

Hey guys 🙂

When I'm running the project as two players, one of them being the Listen Server, I've noticed that the Listen Server is not spawning my gun system's controller or something, as I'm unable to fire my gun. The server is able to spawn widgets & such, but the gun system is locked out it seems. Everything works fine on the client side. Any takes on what could be causing this?

fathom aspen
#

What do you mean by not spawning gun system controller?

#

Also the server shouldn't be creating widgets. Widgets are client only

#

You might wanna show code

prisma snow
#

If I send an uint32 in a RPC, and that number (2 for example) can be represented with less than 32 bits, do you know if unreal's net compresses it by default?

#

I'm currently sending int16 for unit positions, and I can divide the number (since there is some precision threshold) to get smaller values. So for example if position is 25, and the threshold is 2, I RPC 12, losing 1 unit of precision. However this might be an unnecessary lose if the net package is still sending 16 bits no matter what

onyx belfry
#

so im getting this error
LogNet: Error: ReceivedRPC: ReceivePropertiesForRPC - Mismatch read. Function: ServerMoveNoBase, Object: and i dont fully understand what it means

slate basin
#

hey, if you have a function that is used for ReplicatingUsing, do you need to have use UFUNCTION macro on it? I can compile fine without it, but not sure if it will cause any issues

fathom aspen
fathom aspen
fathom aspen
prisma snow
#

Thanks!

onyx belfry
fathom aspen
#

I've seen in some thread they had it in 4.18.1 and they updated to 4.18.2/3 and it fixed the issue for them

#

When it started to happen though? Have you noticed?

pliant kernel
#

Hey, i've a little issue with advanced sessions and steam advanced session, its working fine on local network with 2 steam accounts, but online i can't found any sessions of my friends but they can join each others. I'm from Belgium and they are both in France
The problem may be because I'm in a another country ?

#

System are p2p

pliant kernel
#

Just changed the steam region to France and now is working, can someone confirm is just region lock with the 480 test app ?

fathom aspen
dusk basalt
#

I'm learning multiplayer in blueprints, and I have a quick question.
So, if you use, get player controller, and then 0, does that return the clients controller? I am pretty sure it does, but not 100%.

I'm trying to make a score system that will show the 2 players their own score on their screen, so I need a way of getting the clients' player.

#

this is also just a learning project, so I'm not really worried about preventing clients from being able to manipulate stuff if using player controller will allow that

heady python
#

also, you cant get another players controller. controller is only on the server and owning client

dusk basalt
#

yea thats what I meant, I just need it to get that clients controller, because I just want them to be able to see their own score and nobody elses, at least not until the leaderboard screen, but thats a different battle.

hybrid zodiac
#

Hi everyone, I had a theoretical question: if I have several boolean values to replicate, is it more bandwidth-efficient to just define them all as separate replicated boolean properties, or to pack them into a byte and use bitwise operators to set and check certain bits?

Ordinarily, the bitwise operators would be more efficient since a boolean value has to be minimum a byte in size anyway, but I think UE4 does some packing of its own in the packets that get sent out, so I wasn't sure if I was stopping that behind-the-scenes magic if I was trying to do it at my end instead.

#

The reason I ask is I want to replicate a lot of data in the form of structs, to the point that saving even just a byte per struct could save multiple kb/s in bandwidth usage

prisma snow
#

I don't know exactly about the booleans, I remember reading that Unreal packs booleans but cannot find the reference right now

hybrid zodiac
#

@prisma snow Hmm OK. Which RPCs are you referring to? Multicast?

I'm basically doing a Total War type game with thousands of soldiers. They can't be actors because its too much overhead, so they exist as just a struct dictating which platoon they're part of, if they're dead or not, if they're crouching or in melee and so on. Each company contains an array of structs for their soldiers, hence my dilemma as to whether my struct should contain 8 bool properties, or one uint8

prisma snow
# hybrid zodiac <@455025316633772032> Hmm OK. Which RPCs are you referring to? Multicast? I'm ...

Welcome to the RTS club. They called us crazy for using Unreal 🤪

Yes, I refered to multicast. I don't know to which point RPCs save more bandwidth than replicated variables, but definitely they are more performant (replicated variables are checked regularly to see if they changed).

For your question, I'd say it depends if the properties are generally going to change all at once, or independently - If you want to just change one, better have individual bools, so that you only have to send the changing ones, and either manually or automatically they'll be packed on the net transfer

#

According to our friend Jambax, Unreal does pack bools:

#
hybrid zodiac
#

Ah interesting, maybe I'll unpack my bools then

#

I would expect max one or two to change in a given frame

#

And yes, Unreal isn't known for its RTS credentials, but I'd argue no engine really supports this kind of use case out of the box, and so far we seem to be doing OK! Had to be saved by 4.27 though: previous versions had catastrophic bugs with hierarchical instanced static meshes which my whole game hinges on :-P

prisma snow
hybrid zodiac
#

Indeed, my game targets the age of muskets when soldiers marched in tight formations. That means I thankfully don't have to replicate the position and velocity of each soldier unless they break formation (routing, hit by a cavalry charge etc) so only a small number of soldiers need movement replication at a given time

#

It's a really interesting challenge, small optimisations can make a huge difference at that scale

prisma snow
#

Nice, otherwise you're in for a nightmare

#

Depending on the pace of the game and other factors (unit count) I've seen different solutions applied

peak sentinel
#

I found it by chance a while ago

hybrid zodiac
#

@peak sentinel That is really interesting! I'll take a look. Our budget wouldn't even buy us a McDonald's happy meal, but could be one for the future :-)

peak sentinel
#

Our budget wouldn't even buy us a McDonald's happy meal
I feel you bro sad

dark edge
jade fractal
#

Blueprint Runtime Error: "Accessed None trying to read property Weapon". EventGraph Function: Execute Ubergraph WG Current Ammo Blueprint: WG_CurrentAmmo.

#

why does this happen?

dark edge
#

Also don't get player controller 0 pls

jade fractal
#

it works on standalone tho

granite spruce
#

It might be tied to Adriel's comment about not getting Player Controller 0

dark edge
#

Maybe it hasn't replicated by then. Also in multiplayer you don't want to get PlayerController 0 pretty much ever.

dark edge
sinful tree
#

It's probably not working because your current weapon variable hasn't been replicated yet when you happen to be creating the widget.

jade fractal
dark edge
#

My himch is you should be setting up UI in the onrep and not whatever you're doing here.

#

@jade fractal equip weapon sets the current weapon, but then you immediately try to use it in the next node. In multiplayer won't be replicated by then. Use the on rep to update the UI

jade fractal
#

yeah putting it in the onRep worked

#

thanks

granite spruce
#

woot

dark edge
# jade fractal thanks

Rep notify is absolutely awesome for anytime you want something to happen when something changes.

dusk spire
#

so AInfo is child of actor, how is that better than using an actor?

#

is it a lot better to use an uobject?

sharp cloak
#

Is it possible to use Firebase and EOS together? I want to use Email and Password as login but use EOS with P2P as Session Handling

round star
#

I need the server to handle what happens to instanced static meshes (overlapping an instance, removing it, spawning an actor in its place)...but calling a server function or just replicating an instance to remove the instance does absolutely squat for the client

royal valve
#

Is someone able to explain to me what "Play as client" and "play as listening server" mean. I know there's documentation but they don't word it to make sense on there lmao

strong vapor
# royal valve Is someone able to explain to me what "Play as client" and "play as listening se...

play as client means you're simulating there being a dedicated server.. if you play as listen server.. then well, your first client is the server.. you can really see the difference in these when using the "Switch Has Authority".. because if you're playing as listen server.. IT has authority.. its a server but also has a screen and a player controller... when playing as client.. it's running a dedicated server.. so players are never authority

#

listen server is a bit more of a pain to program for but you don't need to have any separate server machine for your end product.

strong vapor
unreal furnace
#

I'm seeing something kinda weird, I'm trying to pass a networkversionoverride on the command line, as in something like

UE4Editor myproject.uproject -game -ExecCmds="networkversionoverride 1234"

And the server sees that I am indeed setting a number, but it is getting a random number - not the one I pass it.

#

(I'd use net.IgnoreNetworkChecksumMismatch but it seems to be setting it in the console logs, but not respecting the request, that although other exec commands like resizing the display do work, so console exec commands are working otherwise)

hallow summit
#

ok so when a player dies and spectates someone else I want the spectator to see the hud of the player, anyone know how to implement this?

winged badger
#

use playerstate as a context

hallow summit
winged badger
#

if your HUD is made so it can take a pointer to a PlayerState

#

and initialize/run on its own from there

#

your problem becomes trivial

#

as you can then just push another PlayerState pointer to it to have it display HUD for another player

#

note that PlayerState does have a way to fetch its Pawn here

#

so if you can access PS, you can access its PlayerPawn as well

#

you obviously can't store any information displayed on the HUD in the PlayerController for this

#

as clients only have their own

hallow summit
winged badger
#

its not the PlayerState code that matters, its the HUD

#

your MainHUD (not AHUD derived class, but widget) has a pointer to PlayerState, instance editable, exposed on spawn

#

and when you create it you connect the PS ping into the widget

#

widget after that doeesn't get referenced by the game code until its to remove it from screen

#

but manages itself, hooking into even dispatcher broadcasts for notifications

#

i can't give you an example, as im way too lazy to write one

royal valve
hallow summit
winged badger
#

pointer = reference, a variable of your PS type that is injected into the widget at the time widget is constructed from the same code that constructed it

fathom aspen
# prisma snow Welcome to the RTS club. They called us crazy for using Unreal 🤪 Yes, I refer...

Unreliable RPCs are those that save more bandwidth than replicated variables. Replicated variables can save more bandwidth than Reliable RPCs.
There was a #notGDC talk about that lately if you're interested: https://www.youtube.com/watch?v=UstLLZbkmOQ&ab_channel=OmidKiarostami

For #notGDC 2022 I gave an informal presentation for people interested in multiplayer programming in Unreal Engine. This is a recording of our discord hangout.

We go over tools UE5 has for multiplayer development, good ways to use them, things to watch out for, and have a live coding session with examples.


00:00 - Intro
05:15 - Networ...

▶ Play video
#

15:57

prisma snow
kindred widget
#

To be fair in this regard, bandwidth should be the last concern in using those three. They're just differing implementations that all have differing specific uses.

fathom aspen
#

Well I agree. There are cases where you should be using a reliable rpc and you can't do nothing about it.
But having the bandwidth concern in head should be good for someone to ask himself if they need the rpc to be reliable or not

ruby parrot
#

Hello Everyone, Im new here, new to unreal etc. I wanna do something (I think) is pretty simple ... id say 80% of it is working already....
The Host starts a session and changes the level from the MainMenu to the World
The client connects to that and also changes the Map to World. The last part aint working....

I get the following error (blueprints inc as well)

meager spade
#

You can not travel in PIE

ruby parrot
#

aka I have to make a "build" to test it?

meager spade
#

yes

ruby parrot
#

😮

#

brb xD

#

Never made a build before,might take some time :S

#

Okay,i Hvae found where to package the project,but once I do so I get 😦

ruby parrot
#

Ill reinstall UE 5... dunno whats causing this yet, google says its the SDK kit and .NET etc... ive reinstalled em all..nothing worked 🙂

fathom aspen
# ruby parrot Ill reinstall UE 5... dunno whats causing this yet, google says its the SDK kit ...

There is a long ass thread with so many fixes, pick the one that works out for you:https://forums.unrealengine.com/t/issue-packaging-resolved/231242/32

ruby parrot
#

@fathom aspen Yeah thanks, as mentioned ive tried what google found already 😄 SDK Kit... .NET and now im reinstalling UE5... Ill let you know ^^

mortal kernel
#

Not entirely sure wether to go to plugins or to multiplayer but I think it also applies to the normal unreal online sessions.
I'm using the advanced sessions plugin and need a way of checking if the player already is in a session or not (host only) I looked and there is a "is player in session" node but that requires a unique net id and I'm not sure how to get it

mortal kernel
#

I did this now :o

#

@fathom aspen

pallid mesa
#

Anyone here used the interpolation feature of the projectile movement component? I'd like to shortcut a bit my research 😄 https://gyazo.com/7f3cf43251d47b1b51fc833809c4b944

Well turns out that I set all of this in BeginPlay for sim proxies and autonomous proxies:

if (ProjectileMovement && ProjectileMovement->UpdatedComponent)
{
    ProjectileMovement->SetInterpolatedComponent(Mesh);
    ProjectileMovement->bSimulationEnabled = false; // I really want this to be false
    ProjectileMovement->bInterpMovement = true;
    ProjectileMovement->bInterpRotation = true;
}

And I have this weird delay in which the projectile spawns, halts there for a sec and then starts moving. I guess it's because PostNetReceiveLocationAndRotation() didn't still kick in for an interpolation to happen... but I'd like to solve this in a non... let's say - very intrusive way - I thought about enabling simulation until PostNetReceiveLocationAndRotation() kicks in but... I'm not sure I very much like that solution... anyone here know if I could do something else to paliate this?

Extra info: Projectile is replicated and spawned in the server for a fully server authorative approach. Not doing any sort of prediction atm.

#

Feel free to @ me, I'll be out for some hours!

ruby parrot
# meager spade You can not travel in PIE

2Hours later and reinstalling basically everything related to Coding/Unreal engine... I can package my project 😄 Back to my issue.....

In Editor it does actually change from MainMenu to World Level, in the packaged version it DOES NOT.
so we gotta solve that now first, before we go back to my original issue 😄 Ill show you my BP for the "creating Lan server"...

meager spade
#

listen server?

ruby parrot
#

So basically what I want to do is:
Client 1 Starts a server and changes,obviously, to the World-Map
Client 2 Connects (currently via open(127.0.0.1)-Command,cause I dont know if there is a better way yet^^) to that server and joins the same world map 🙂

meager spade
#

you need to start listen

ruby parrot
#

Preferably yes, dedicated server stuff comes down the line once i got the "basics down" 🙂

#

Im listening 😄 (i know you meant to start a listen server^^)

How would I go about that?

meager spade
#
UKismetSystemLibrary::ExecuteConsoleCommand(PC, URL, PC);
``` in blueprint, you want ExecuteConsoleCommand like this
ruby parrot
#

is there anything after "listen"? if not..ill try that now 🙂

meager spade
#

never used the Open level node, so not sure if you can pass ?listen to it

opal stream
#

You might also be able to accomplish this in your openlevel node

#

If you hit the down arrow in the node, put this in options:

?listen

ruby parrot
#

Oi,i see... sec changeing everythign back LOL

meager spade
#

either one works

#

i know mine works, i use it in a released game

ruby parrot
#

@opal stream hm?

opal stream
#

Yeah for dedicated server i use the console command also

#

Yes

meager spade
#

you only want to do it on success tho

ruby parrot
#

Nice,lets see if that works in a build 🙂

meager spade
#

on failure, you want to throw an error

opal stream
ruby parrot
#

kk,changed that too 😄 Yeah for now idc too much about if its "on success" etc.... still learning the basics,but oviously its best practice to give errors etc ^^

#

I come from Unity3d and have got 1k + hours in C#.... I dont understand c++ yet,so i give this blueprint stuff a try 😄

opal stream
ruby parrot
#

Hm, it says "Hello" but it basically shows the MainMenu screen after I click the button that does this:

#

So CreateSessions seems to work,as it prints "Hello" but ti doesnt change the world (It does in PIE though)

ruby parrot
#

Wait I just realized the project is way too small. Do I have to tell the "Package manager" what levels to include?

meager spade
#

not sure if it defaults to all maps

#

nope, so yes you do

ruby parrot
#

Aight,ill try that 🙂

ruby parrot
#

Looks like it worked. Yay. But they cant see each other yet, so I guess theres a replication issue ^^

#

AH no, ... thats now where my original issue is I think 😄

#

I assume this is wrong.....:

#

Im 99% sure that the "Open Level" node is useless entirely, as the Host will "tell" the client what level to load.

thin stratus
#

Might even cause the client to disconnect again

ruby parrot
#

Yeah I assumed as much, but even if I disconnect that node, the players cant see each other 🙂

modern cipher
#

can you connect to a dedicated server using a domain name instead of IP?

ruby parrot
#

@modern cipher a domain naim IS an ip 🙂

ruby parrot
fathom aspen
# ruby parrot could you point me to what I need to do to get the client to connect and get to ...
thin stratus
ruby parrot
thin stratus
#

What and where is your server located?

#

Does the same happen if you launch the server locally?

ruby parrot
#

local

thin stratus
#

Are you using any Subsystems?

#

Remove the () from the open part

ruby parrot
#

No,im totally new to Unreal etc 🙂

thin stratus
#

It's open 127.0.0.1

ruby parrot
#

ah,lets see

thin stratus
#

And it's a Dedicated Server that you build or what are you trying to connect to?

#

Or is it a ListenServer?

ruby parrot
#

Ah wait. It "works"(more or less)... i dont see the other player but its there,as im colliding with it

#

kk, so its just a "rendering issue" now of the player 🙂 But they connect to each other after removing the brackets!

thin stratus
#

Cheers

ruby parrot
strong vapor
# royal valve Thanks for the explanation. The tutorial I'm following is in an older version of...

if you build your game to work as dedicated server... you have to actually have a computer or some playfab or something that's the dedicated server in your final product.. and also to build a dedicated server package you need to use a source build of UE4.. if you don't know what that means.. it means you have to download the gigantic 120 gigs of Unreal from github.. and do a bit of setup to get that working...... long story short.. Listen Server is the way to go for small scale games... it IS a bit more of a pain to code for but ya know... YOU can host the game on YOUR machine that you actually play on.. and if you put your game on steam it works fine... here's a link to my game on steam that works like this. (This game is mediocre but it did land me a job lol) https://store.steampowered.com/app/1568730/Heroes_of_Eldemor/

Heroes of Eldemor is a Medieval RPG that you can play with friends over the internet. Simply choose to host a game in the main menu and then invite some friends. Launch into a world in the throes of war as you Choose Your Side in the conflict at hand. Fight with melee weapons or a bow. Earn coin and hire some soldiers to build your army so tha...

▶ Play video
royal valve
strong vapor
#

No problem!

#

One thing you'll never want to do the is Get player controller 0

#

Well.. it depends

#

But ya.. listen server is a bit trickier because the server is also a player

strong vapor
old sorrel
#

I just upgraded a project from 4.26 to 4.27. I'm seeing a behavior where if the server's pawn is spawned too far from the world origin (guessing 20,000 units), clients are unable to see the server pawn, or specifically anything parented to the collision capsule.
The server pawn's mesh and capsule are visible but positioned exactly 1750 units in the -x direction and at 0 in the Z (so stuck in the ground halfway) from where they should be. They don't replicate correctly.
Even stranger, a hidden collision is still enabled where the capsule should be and it's movement replicates correctly.
"Always Relevant" is enabled.
Anyone seeing any behavior like this or recommend troubleshooting steps?
Again this seems only related to 4.27 as the same project works in 4.25 and 4.26.

twin juniper
old sorrel
junior wigeon
#

Hi, does anyone know how to fix this?

real ridge
#

So guys I have few problem in my game so I try to ask,sorry for my English maybe will be not the best, So I made dedicated server on my pc local server using unreal engine 4 I found turtorial on this Then I tried to make map etc I am logging there by IP 127.0.0.1 so and my problem is that If I run my server and then game from the folder and join there with for example 2 clients then divide my monitor to 2 windows with both clients and start play jump or something else I still see from the other client laggs very bad laggs in the client I am playing it's okay but from others it's horrible, but if I run game from editor in unreal engine 4 by hit play button it's okay no lags or anything else (but I need run server from cmd again) but here is another problem my first spawned client has everytime copy of himself which is not moving it's spawns at same place as first client and he is there..... And last problem is with physics replication of some objects for example I have Ball there or cube which I am moving by character and their move is also lagging. I. can also send some videos to explain problems better If anyone can give me a tip please

spark owl
#

So I recently added a bunch of foliage to a series of multiplayer maps, when I use the open the level node with the port and IP, depending on which map the multiplayer game is on, it will load really fast with the maps with low foliage, and it will load really slow, and sometimes timeout on the maps with lots of foliage.

TLDR: opening multiplayer levels is slow when there is lots of foliage

Anyone have an idea how I could deal with this? perhaps some setting that would make loading the foliage faster? or maybe progressively load the level somehow?

old sorrel
bitter swift
#

I'm currently doing some NetProfiling. Are there any standards that I should be looking for?
For instance, is there a standard for how high my OutgoingBandwidthSizeSec should reach at max?

strong vapor
#

I think its game.. might be engine ini.. but I think it's game

prisma snow
# bitter swift I'm currently doing some NetProfiling. Are there any standards that I should be ...

I cannot give you a standard/definitive answer, but what I do/did to profile my game:

  • Test the worse case scenario
  • Research or test similar games (similar genere, gameplay, etc) and see how they perform in those "extreme" conditions, their average bandwidth consumption, etc)
  • Try to find if there is some evident problem with your current net usage.
  • Playtest your current build with extreme conditions (might use the editor simulation, that allows to simulate ping and package loss), see how it behaves (lags, rubberbanding, etc)
bitter swift
prisma snow
#

RootFolder/Config

strong vapor
#

your config folder for your project

prisma snow
#

Iirc it's DefaultEngine.ini

strong vapor
#

ah crap

#

lol

#

knew it was one of those

prisma snow
#

But I had problems making it work, I think the settings might have changed from one version to another

strong vapor
#

hmm

bitter swift
#

The reason I'm asking is because I'm testing out how "heavy" NetForceUpdate is compared to standard replicated net frequency.

eternal canyon
#

why would it be heavier?

bitter swift
#

from my profiling, it is twice as heavy.

#

I placed 300 actors with a replicated variable. The variable changed every second.

Experiment 1: They were all Awake and updated 10 times per second.

Experiment 2: They were Initial (same as dormant) and used NetForceUpdate every second.

The second graph spiked twice as high with OutgoingBandwidthSizeSec

static willow
#

Hey fellow UE4 devs, I'm hitting a roadblock currently for my 3D multiplayer platformer game

The issue is I can't get the players' camera manager to work. When I'm playing with 4 people, only the listen server has all the camera functions behaving like it should

Looking at the map when the game is running, I only see one player character controller, so only one camera manager then? Is this correct?

How should I get all the different clients to have a camera manager (in the character controller) that properly applies camera effects, locally? This shouldnt be replicated right?

#

oh and I'm using blueprints 🙂 I come from a art and design background

spark owl
#

or i forget if camera manager is in the character class

fading birch
#

it's part of the player controller

static willow
#

I think so, but that's the thing. No matter the number of players, there's only one player controller. Is that correct even? I read in forums that's its alright as long as players are playing online (not locally)

spark owl
#

Im not sure if I understand you exactly, but a simple way I keep reference to all player controller classes in a session is an array in the gamestate

#

yeah if you just do "get player controller" node

#

then cast to

#

it will only give the 1st reference

#

what you should do is this

static willow
#

This is what I have in my character BP

spark owl
#

on beginplay in your player controller class, run a custom event run on server reliable, use the "get game state" node

#

cast to your gamestate

#

on your gamestate you should have a custom event run on server, reliable to add the player controller class to an array variable of your player controller class

#

then this way you can use the gamestate as a way to reference every player controller in the session

static willow
#

gamestate or gamemode I suppose would do the same?

spark owl
#

no they're different things

#

if you haven't created a custom gamestate class, you should do that

#

if you look in your gamemode class, it has an option for which gamestate class the gamemode will use

#

gamestate is a place where you can keep all valuable info that players will need access to

static willow
#

Yeah I haven't yet. ohh. interesting.

spark owl
#

and then idk if you know what playerstate class is, but it's basically a way to keep all info for players referencable

#

so like you could put the players name, position/team etc as variable in a playerstate class

#

and another thing you can do is when you do that event on begin play for the player controller class where it casts to the game state, you can also cast to your player state, so this way, you have a reference to all player controllers on your game state, and then the player controllers have references to their player state classes

#

so you can easily get any variables you need

static willow
#

Read about the player state somewhere, yup, that makes sense 🙂

Thanks for the info so far ^^

But then, in order for the client players to get assigned a camera manager... ?

#

If I understand properly I need to make an array of player controller in the game state... which would allow me to do that?

fading birch
spark owl
#

yes, so explain exactly what you're trying to do for me

fading birch
#

well, server and owning client

prisma snow
spark owl
fading birch
#

Only if you need to access specific things from your own child of the player state class

#

In that case you would just create your own array of player states and cast + add to it on PostLogin (which is roughly where the GameState class does it)

#

And if you need access to that particular player state's controller, you can just get it then

static willow
# spark owl yes, so explain exactly what you're trying to do for me

So. My player controller has a camera manager attached.
For example, when the player does a certain action, the camera changes some values for extra juiciness.
In the character BP, I have a ref to the player controller and the camera manager.
So that I can call the function from the camera manager Set X camera

  • image*

It works on the server, but none of the clients actually have any of the camera functions applied... which makes me think they're not being referenced properly or something??

spark owl
fading birch
#

no

#

the player state already has a reference to the controller on it

#

but it's only valid on the server or the owning client who owns that controller

spark owl
#

ok but it's just the class of playerstate right? not the specific class that's being used correct?

#

the reason I set it as it's own variable is so I wouldn't have to it everytime

fading birch
#

Do you understand inheritance?

spark owl
#

I think so yeah, if I made a custom player state, it would be inherited from the base player state class correct?

fading birch
#

You'll have access to all of the public variables from the base player state class

#

the PlayerController is one of those

#

You would just cast to the controller when you need it

spark owl
#

yes but that's what I was trying to avoid, I thought using cast to is inneffecient

fading birch
#

You can store an array of player controllers, but it's generally seen as a poor approach to do that when the player state exists

#

in BP it can be

#

in C++ it can be as well. Casts can get expensive.

spark owl
#

well yeah I would be using it a lot

fading birch
#

What would you need to cast for?

spark owl
#

like yeah I did it that way where it's using the specific cast variable

fading birch
#

to get access to the camera manager?

spark owl
#

I can't remember exactly off the top of my head, I just remembre thinking "i'm using a lot of cast tos, I should set these as variables so I don't need to constantly cast to"

spark owl
lost inlet
#

well how often are you really casting? why not just cache the cast result somewhere if it's going to be a problem?

fading birch
#

Yeah, generally if I"m accessing a particular class a lot, i'll just store a reference to it.

fading birch
spark owl
#

im not doing anything lol, I was trying to help mooncube with a problem

spark owl
#

I think maybe like I said, your reference to your player controller on the character isn't being access because you maybe set it on server, when it's actually the client that needs a reference to it

#

also

fading birch
#

the client already has a reference to their own controller

spark owl
#

do the custom events as on client

fading birch
#

they will never be able to see other player's controllers

lost inlet
#

yeah, the engine already stores the owning controller on a character

fading birch
#

unless you do some modifying that's completely unnecessary

lost inlet
#

and a controller owns its relevant player state

spark owl
#

ok but it doesn't have the direct reference as I said, it avoids needing to cast to all the time

lost inlet
#

where did the cast bad meme come from all over a sudden

spark owl
#

listen if you guys want to help him go ahead

#

since you clearly know much better

static willow
#

sorry guys I'm kinda new to multiplayer SweatThink
hoping to make it a bit clearer... I have multiple characters but only one Camera Manager in my scene when it's playing

fading birch
#

Yes, cameras only exist on the owning client. They're not replicated afaik

lost inlet
#

nor should they be really

fading birch
#

Yeah

static willow
#

and the issue is clients do not apply any of the BP_CameraManager bp code

lost inlet
#

all BP and multiplayer dang

#

but did you add any breakpoints to your BP?

hallow summit
#

i like your character design

lost inlet
#

also in the world outliner, you can cycle it through each client's world

#

from view options

static willow
#

ooooh I didnt know that, interesting. Hold on

lost inlet
#

if MP is important, I would also PIE in play as client mode which mimics a dedicated server setup

#

so the first PIE window will behave as a client on a server rather than a listen server

static willow
lost inlet
#

yes so they have one

#

so something your PCM is doing is likely relying on stuff that occurs only as the host

#

for example, do not expect the character to be valid in BeginPlay

static willow
#

so I should do it on which event then? onPossess?

fading birch
#

Yes

#

but that only runs on Server

#

there's a client version of it, but I don't think that's exposed to BP

static willow
#

PostLogin?

fading birch
#

That's also only on the Server

#

The GameMode only exists on the Server

lost inlet
#

I'm not sure if the client event has a BP-ready delegate

static willow
#

So the idea is to grab a reference to the camera manager by an event on the client, but later than begin play

lost inlet
#

which is why making a BP-only multiplayer game is pain

fading birch
#

Well worse case, you just make a Owning Client event and just call it from OnPossess

#

but yes, I agree

#

In any case, if you're going to be making a dedicated server game, you'll need to download source anyways

static willow
#

The plan is to make it peer 2 peer

#

no dedicated server, at least for now

lost inlet
#

well a listen server more than true p2p

static willow
#

So something like that?

#

I think I get it tho. The players not being ready/valid on beginplay was probably messing with the references to the camera manager.

#

I'll refactor a bit my existing code to account for that 🙂

THanks for the help guys ^^

Catch you later!

ashen stone
#

Can TSoftObjectPtr be replicated?

#

Do i need to load the mesh from disk if don`t need it server side?

lost inlet
#

should be able to be

fathom aspen
# ashen stone

ReplicatedUsing should be enough to make it replicated. You don't need both.

lost inlet
#

I still do both tbh

ashen stone
#

It is never called client side, but is it worth ? will it avoid the mesh to be loaded on server?

fathom aspen
lost inlet
#

why would it give errors

#

it makes it a little more error prone if you don't need the onrep later

fathom aspen
#

Yeah you're right

ashen stone
#

the OnRep is never called on client

fathom aspen
#

What UE version are you using?

#

Seems like this was an issue in 4.21

#

Also is the OnRep a UFUNCTION?

ashen stone
#

5.0 preview 2

#

yes

#

do i need to set the value server side in a special way?

#

some function?

fathom aspen
#

Are you sure this code is being executed on the server?

ashen stone
#

ye

#

it is here

#

but this function is not getting called after i change SK_ChestMesh

#

GetLifetimeReplicatedProps

#

it is getting updated client side, but not calling my function

twin juniper
#

If you are trying to change skeletal mesh on multiplayer my advice is to use on rep function so it will call a function when it gets replicated so it will work fine

ashen stone
#

How does it work? RPC?

fathom aspen
twin juniper
#

I don’t see any use case where you would replicate it since it’s an asset

#

You do not need to replicate it, clients already have it, it’s an asset they have it in their game

ashen stone
#

Yes, with normal pointer it is called

twin juniper
#

You might need to load it tho

torpid mantle
#

heya, QQ. Is there a quick start guide on async multiplayer games, or how you structure or think about client vs server?

low helm
#

The biggest obstacles I've seen with onreps is they don't fire if the new incoming value is the same as it was before on the client, make sure that isn't the case

twin juniper
torpid mantle
#

I've built tons of things in other tech, languages, etc, but UE is its own thing so asking

ashen stone
#

i don`t need the mesh on memory for any purpose on dedicated server

twin juniper
#

Replication have nothing to do with that 😄

ashen stone
#

but SoftObjectPtr does, right? it is lazy