#multiplayer

1 messages · Page 67 of 1

kindred widget
#

Sounds like you're doing spawning logic locally and trying to call possess calls locally.

Everything you're doing needs to be done on the Server's version of the client's controller, if that makes sense?

Basically your input, or whatever causes this needs to do a ServerRPC from the client's controller to make this logic run on it's server counterpart. This will ensure the Destroy, Creation and Possession work.

frail barn
opaque dagger
#

Looking for some general advice on this basic? question:

What is the correct way for a client/player to invoke an RPC on an AActor the server owns(HasAuthority)?

The client doesn't own the AActor since it's a world actor any player can interact with (in my case).

I could call SetOwner on the server, but that prevents more than one client interacting with it at once (which I'd prefer not to do).

Is they best way to just route the Server_XXX calls through the player so it uses the player's connection? That will get really messy when there could eventually be many different types of objects a player can interact with, so lots and lots of Server_ defines in the player's .h file.

fathom aspen
opaque dagger
#

So, what I'm saying in my last paragraph is the best approach then? Just lots and lots of interact style methods in the player/controller class.

fathom aspen
#

No, there is only one if you make it polymorphic enough

#

And yes it is the most sane method

opaque dagger
#

Perfect. Thanks!

short void
#

I am not understanding something very fundamental about how clients communicate with the server... The first screenshot is on my Player Controller, 2nd on my GameState

Why can the server call this RPC, but a client cannot?

#

Disregard the name of the variable... I'm not trying to say a client should be able to call a game over function

fathom aspen
#

On the server, it's executing because it's running locally, i.e. no replication is being made

#

On client, it's failing due to the GameState actor not having NetConnection

#

SetBoolOnGameState should instead be the Server RPC and SR Set Bool should be a normal function/event

short void
#

So it should just be like this instead? Is it really that simple? lol

fathom aspen
#

If it's what I said then yes

short void
#

thank you, i have struggled with this for days

wooden abyss
#

Hello everyone, i'm using the the client-server model for my co-op game and I'm wondering if there is a good way to handle the scenario where the host leaves the lobby while there are still clients connected. Is there any way to select a new host and transfer the session without creating a new session and having the players "swap over" to the new one?

#

Or are there any best practices for those kind of scenarios?

#

In a perfect world I would like to have a new host selected randomly that takes over the lobby 😅

#

Or would I have to create a new lobby and have all the players join that session before than destroying the old one and sending the host that left like for example back to the main menu?

kindred widget
wooden abyss
kindred widget
#

Not a clue. I'd try to catch some of the more savy networking people on a little earlier. Maybe they'll know different. But generally as far as I know this isn't possible in Unreal's networking system. And it's not something I'd advise trying to take on without a network engineering background or a ton of free time with a source build.

wooden abyss
#

Sorry might be a misunderstanding now. Question was regarding this exact idea "create a new lobby and have all the players join that session before than destroying the old one and sending the host that left like for example back to the main menu"

#

Or where you also referring to that?

#

Cause in my head that should be possible with what is already available in UE

kindred widget
#

That's possible. But it would be a new lobby. You would need to have sent and kept clients updated on the game's whole state like a save file, if you intend to have a client rehost the game. And it would still require loading into a new persistent world I believe. So you'd have to set everything back up.

wooden abyss
#

Thanks for your input @kindred widget !

#

I have a different problem now though. I keep track of all the player controllers in my GameMode in the OnPostLogin Event like this

#

So when a new Player connects I update the player list. This updates the Overlay Widget for all the clients and the server as well to show widgets for each player. Just a basic lobby player list

#

It does work for the Server and the first client to connect

#

If i try this with a third player the list updates fine for the server and the first client showing all 3 players

#

The new client that connected doesnt seem to get any info on the server and the first client

#

This is how it looks for the server and the first client to connect

#

This is what the third client sees

#

They all get the PlayerStates from the GameState

#

Which looks like this

#

When a fourth client connects the third one gets updated correctly but then the fourth client has the same problem

#

I can increase the delay to 1 second and then it works again but you start to feel the delay on the update

#

I'm not really sure how to check if the client got all the info it needed to properly display all the players

#

And even with a 1 second delay it doesnt really work for the fourth client cause it is still missing some data

kindred widget
#

If you have C++ access, there are virtuals where you can override when a playerstate is added to the PlayerArray and do a delegate broadcast.

#

An identical check on an array of PlayerStates is super fast though.

fossil merlin
#

I'm trying to play a sound (play sound 2d) just to a single client, but it seems to be playing on all clients. I have it make a call to the server and then to a 'client only' rpc but it still plays on both clients. Other effects routed this way seem to work as intended, just not the audio. Any ideas?

wooden abyss
#

Is there a way to find out which of those PlayerStates belongs to the host in a client-server model?

#

I'm trying to show all the players in a list but I want the Host to be shown on top so I have to sort the player states

native tapir
#

when breakpoint is hit in c++ code, how can i know is this code breakpoint executed on server or client? (I'm talking about running game using play in editor which means, not playing using standalone. is this mistake..?)

kindred widget
graceful viper
#

is this switch even useful in this scenario? how?

#

also is this how you should be doing things? It works but I am not really sure how this switch works at all

kindred widget
kindred widget
graceful viper
kindred widget
#

Or the other way around. It's not needed unless per say unless you have specific logic that you only want ran on remote or ran on authority.

graceful viper
#

makes sense to me, what would be a good example on something that should ONLY run on a server?

kindred widget
#

Initial initializations of stuff that needs replicated usually.

Some stuff is best only done once the server has had an opportunity to finish it's initialization. So client just sort of chills around waiting for the second replication of the actor(first being when it was created on the client)

graceful viper
#

that makes sense

kindred widget
#

Using the remote of Authority is kinda rare. I think it gets used a lot more in prediction like stuff than general gameplay. Remotes doing predictive behavior on ticks while waiting for server replications. Stuff you wouldn't actually want the server to do, but to do absolute logic on the server and set it for replication.

graceful viper
#

remote is less rare?

#

or just the switch in general

kindred widget
#

The use of the remote side of the authority check is rare.

graceful viper
#

alright thanks

lucid viper
#

Hello!

I am working on a gliding system, I simply modify my gravity and air control for this system. In my anim graph i'm using a bool to check if my Gliding Flag is on.
This is a multiplayer game and replicate this bool,
Before I do that, I was just curios to know if anyone would know if I could possibly get away without haivng to manually replicate a bool by using other formulas to check Velocity.Z maybe?

#

I tough I would get away with using a forumla for my bool like :
If GravityScale = 0.07 = true
But GravitySclae is not already replicated like velocity

#

Would anyone know if theres a sneaky formula I could use to calculate when a player is currently gliding ( Slow fall? )

graceful viper
#

very interesting, I predicted that the host server was going to keep its movement since it owns the server it teleports back to its spawn location. What's exactly managing all this then?

vague fractal
#

Would it make any sense to create another level for a lobby which would be UI only or can i just keep use the "main menu" level for that ?

wooden abyss
#

Thanks again @kindred widget !

covert igloo
#

so is floating pawn movement networked. I cant get it to sync my test pawns movement across both ways. i have the pawn and Component set to replicate, as well as ive ticked all of the movement capabilities.

but so far the most i get from it. is that on a listen server i can see host movement via the client. but the host cant see the client.
and in dedicated. nobody can see anyone moving at all.

#

so i would think the issue is my client side. but from what i can find. the movement Component should handle all that.

dark edge
#

The reason why just adding input to the CMC clientside works is because it handles the passing of moves to the server for you

#

floating pawn movement doesn't

warm socket
#

Hello,

I'll really appreciate a link to access a good multiplayer tutorial or training. Especially blueprint created.
I don't mind if it's paid package.

Thanks.

dark edge
#

BP-only multiplayer will be a pretty rough experience unless it's a turn based game or something.

covert igloo
# dark edge Not like the CMC is

ok. so as i suspected the floating pawn movement is not networked in the same way that the character movement is.
cool that clears up a lot of frustration. because i had all my other replication like weapon inputs and damage calculation working.
so movement not working was driving me crazy.

thankyou. i think i know what im going to try and do with this now that i can rule out built in reps

covert igloo
dark edge
#

You could always just send inputs to server but you won't have prediction so it'll feel pretty sluggish.

covert igloo
#

honestly this flying test pawn is a experimental thing anyways. im not even bothering to server side any calculations.

ill be using this to prevent my self from constantly going into VR as i learn replication.
the base VR pawn i have is already networked for me. i just have to rework my input events and logic to replicate my additions.
but for now. i just want to know that my other components and actors are replicating correctly, and that's difficult if my test pawn doesn't rep at all.

covert igloo
graceful viper
hollow swallow
#

I am trying to remove a tree that was placed with foliage, then spawn an actor in its place (so i can cut a tree down) it is removing the tree, yet not spawning it. Have i got this setup wrong?

ruby parrot
#

What is common practice?
Setting playerCharacter variables... OnPossessed in the PlayerCharacter or in the PlayerController "Possess"....or a 3rd way that i havent thought of yet? 😄

ruby parrot
hollow swallow
#

Damn haha, was using the snipping tool xD cheers for the feedback

#

Think i got it working, just had to tick world space anyway 😄

#

So now, i place them as foliage, on the first hit, it removes it and spawns it as an actor, then i can destroy it based on its health in the bp

#

But it flashes for like 0.1 seconds as it swaps to an actor

ruby parrot
#

especially on high ping,lets say 500ms it will happen that the tree disappears for 1 seconds( 2*0.5) in this case and then pop up 😄

hollow swallow
#

Will it trip out if I spawn it in the same location? 😂

#

Jumped straight in the deep end with my game dev, no previous experience, straight to multiplayer RPG survival 😂

ruby parrot
hollow swallow
#

Haha it's a good learning curve that's for sure

ruby parrot
#

well...you mean cause of collisions? if thats the case... spawn it with collisions OFF and once the new tree is there and old removed...turn on collision? thats what im thinking at least 😄

hollow swallow
#

Yeah could turn the collision off the foliage one just before it spawns the other

ruby parrot
#

ye...i got a really good tutorial for a singleplayer RPG...i just learn unreal basics by following the guide whilst at the same time adding multiplayer functionality. ive got 3years experience with unity so i learn this way faster though 😄

hollow swallow
#

I tried unity for 2 weeks. Enjoyed typing code more than blueprints but God damn multiplayer is easier in unreal

ruby parrot
#

prolly should dm if we talk further,no mp talk anymore 😄 1 sec

hollow swallow
#

rogeyyy

covert igloo
#

ok. so this is the last part of replication i need to get right in my test pawn. for some reason, my pawns are refusing to acknowledge any changes in the test menu on the left side. some times on first spawn they do. but most of the time they dont. its random. i dont know what ive done wrong. all of this code should run locally. and it works when i play single player.

but almost always on dedicated server, the pawn in my main editor screen wont get any results out of its menu.

but for some reason if i kill the player and it respawns. the menu starts working. but the respawn code literally just deletes everything, waits a sec, and then reruns the player controller code as is. i dont get it. can someone help me out.

umbral creek
#

Hello amazing community ☺️

I have made a subsystem to handle a feature, and naively expected it to be able to spawn actors that would be automatically replicated. (I made a RPC in this subsystem, expecting it to be executed on the server, and expecting the spawned actor would be then automatically replicated)

Turns out it's not the case (RPC needs to be made on actors that are replicated from what I've read, and my subsystem is neither an actor nor replicated)
So, in my case, if the spawning through the subsystem is done on a listen server, it's properly replicated on the clients (because the spawned actor is set as replicated) but if the spawning is done on the client, then the subsystem RPC method doesn't get to the server, and the actor spawning is only done locally: it's not replicated on other clients/listen server.

Is there anything obvious I'm missing here? Or should I make an external replicated actor that my subsystem will use to spawn new actors?

Thanks a lot for any thought 🙏

prisma snow
ancient adder
#

Is there a way to tell if a component has replicated everything it has?

When i replicate a component at runtime the BeginPlay is called before the variables inside are updated on client

I want to make sure everything the component has is replicated before calling BeginPlay or a custom function on client

dusky yoke
#

Hey guys. How can I replicate a Hit Stop effect where time dilation is in use? 🤔 Is it even a good feature for a multiplayer game? Lets say I hit an enemy, and then time is dilated for another player who doesnt even see the combat happening. If I do it only on the owning client, would that put the time of the player out of tune with the server?

fathom aspen
umbral creek
prisma snow
hollow swallow
#

Im trying to destroy the foliage instance i create with the foliage tool, then spawn an actor in its place. It is spawning correctly for client and host, but only destroying the foliage instance for the host and showing not valid for the client. How can i destroy this for everyone?

wooden abyss
#

Hello everyone, in my client-server model I have a lobby. When the host starts the game from the lobby it destroys the session and then executes a servertravel command. When the game is over i try to call a servertravel again to move every player back to the lobby. This works fine so far. The UI in the lobby gets some information from the session settings.

#

This works for the clients after returning to the lobby but for the host it fails to get the session settings

#

Is this because of the destroy session when first starting the game? Shouldnt this destroy the session for the clients as well? Why do they still get the session settings? I'm kinda confused on this part

#

I was following a tutorial which said to destroy the session so that no player can join the session while the game is already started

winged badger
#

Why would you destroy the session?

#

Session != unreal server connection

#

You can have both

#

You can prevent join in progress in other ways

#

Like putting in a bool bStarted in session data and use that to filter your sessuon search results

wooden abyss
#

Well I'm completely new to the whole online subsystems and like i said i was following a tutorial that did that so no one can join after starting

#

But i will give it a try with adding a bool to the session data

#

Thanks for the input @winged badger

winged badger
#

Session is usually convenient to kerp around

#

If youre keeping the players together

#

Also

#

Any session request is a latent call

#

So server creating a session needs to wait between its create session call snd callback from service that actually runs those sessions before its safe to use

indigo brook
#

Question; I want to show a widget component (world) widget only on the player who's colliding with the actors sphere collision volume.

Example, when a player walks up to a button and the floating text says "Press E".

Currently, when walking into the volume, the text shows up on all players screens in PIE instead of just the player who's inside the volume. How do I do this properly so that the text only shows up on the player who's inside the volume?

rich locust
#

is this component replicated ?

#

do not replicate widget component

indigo brook
#

@rich locust Good question. Let me check

#

The component isn't

rich locust
#

overlap fires on everyone because this object is server authority

indigo brook
#

The actor isn't either.

rich locust
#

you are better off triggering this widget component from the player`s logic

#

but

#

solution would be to check if the overlapped actor is the local player

indigo brook
#

I was thinking that to, or making a component to slap inside this BP_SpawnObject

#

Ohhh true

rich locust
#

go further if it is only the local player else it wont

#

so that way whoever enters it would only affect the entering player client-side

indigo brook
#

@rich locust ?

rich locust
#

no you never get player controller 0

#

you have other actor coming from the function

#

cast to pawn, get this pawn`s controller

indigo brook
#

Dude I was thinking that to after I hooked it up haha

#

@rich locust it worked but I got an error now haha

rich locust
#

check if controller is valid

#

maybe you have npcs running around with that pawn ?

fathom aspen
#

Which is what IsLocallyControlled does

#

Nah that's because sim proxies have no controller

rich locust
#

but clients are not aware of eachother controllers

#

yeah, it should do a valid check

fathom aspen
indigo brook
#

I changed it to this but I still get an error only when both players enter the same volume

rich locust
#

add is valid to Get Controller

indigo brook
fathom aspen
#

And you don't even need to cast to your BP, but just Pawn

#

Will make you load all hard refs which you don't even need

rich locust
#

I always get confused about IslocalPlayerController and is locally controlled

#

but if it works you are correct

indigo brook
#

This seems to work so far with no errors!

fathom aspen
#

IsLocallyControlled just checks if the controller is valid and that is the local one

indigo brook
rich locust
#

I am well sure he doesnt need to know about the loading hard refs at this point

fathom aspen
indigo brook
#

Yeah, I mean the cast could be replaced with a interface right

rich locust
#

better yet, use collision channels

#

and yes

fathom aspen
indigo brook
#

True, in a sense

#

What do you suggest?

rich locust
#

Really? I thought interfaces are not that way

#

as long as interface does not have parameters of the said BPS

fathom aspen
indigo brook
#

Also, you guys rock. I'm learning how to do multiplayer stuff (used to single player) so this is all a learning experience

fathom aspen
rich locust
#

yeah, thats what I meant

#

its a chain reaction

indigo brook
#

@fathom aspen @rich locust This worked wonderfully, no errors as well. Solid solution and rubber ducking guys! Bravo

rich locust
#

his solution is better one if working tho

fathom aspen
# indigo brook <@393501253184913418> <@851442942962434120> This worked wonderfully, no errors a...

However you didn't notice my other note and it is to Cast to the type you need. If all you need is Pawn class, then cast to Pawn, you don't need to cast to your own custom BP Character class. This avoids loading additional stuff in memory that you don't need. I suggest you read this: https://raharuu.github.io/unreal/hard-references-reasons-avoid/

indigo brook
#

Agreed, also offers more flexibility

#

I really need to read that, I need to start using soft references

#

Thanks for the resource

#

My only rub is that sometimes I need to yoink a custom variable out of a player controller or character at times. I'm sure there is a work around

ruby parrot
#

Question
What is common practice?
Setting playerCharacter variables... OnPossessed in the PlayerCharacter or in the PlayerController "Possess"....or a 3rd way that i havent thought of yet? 😄

hushed rain
#

Is there a "beginner friendly" way to integrate an anti cheat like EAC or VAC?

#

Meaning almost no c++ knowledge required

wooden abyss
#

Well, it seems there is something about replication I didnt quite understand properly I guess. I handle the spawning of actors in my Gamemode and the actors are set to replicate. Now those actors try to shoot other actors and I only want this to happen on the server for the damage calculation.

#

The Shoot Event that is called is set to Replicate to Server

#

Now I get tons of messages: No owning connection for actor BlizzardTower_BP_C_0. Function Shoot will not be processed.

#

Can someone explain this or how I could fix this? I would think this means the clients are trying to call the event shoot but they dont own the actor?

#

Would I have to use a switch authority? And only call an event for the animation if my clients try to "shoot"?

wooden abyss
#

So this actually says what I was thinking just now? Have a switch authority to do the shoot event as dealing damage should only be handled by the server and not the clients

#

Animations could then be run for each I guess?

#

Or am I misunderstanding this

jolly delta
#

i need to do an action on every clients, so when the owner (is it player realted) do the action, i send a Server RPC that call a netmulticast RPC. That is supposed to do the related code on every clients + server right ?

latent heart
#

Yes.

#

As long as the server rpc is called on a locally owned actor and the multicast will only be sent to clients relevant to the actor it's called on.

jolly delta
latent heart
#

What are you calling the multicast rpc on?

jolly delta
#

I have a component, this component is attached to a character (player)
this component has a A function that is called when user input,
this A function call a Server_A rpc
Server_A call Multicast_A rpc

latent heart
#

Both on the component?

jolly delta
#
    UFUNCTION(Server, Unreliable, WithValidation, Category = "Ability")
    void Server_RunAbility(int _index, AActor* _target = nullptr);

    UFUNCTION(NetMulticast, Reliable, Category = "Ability")
    void Multicast_RunAbility(int _index, AActor* _target = nullptr);```

like that
latent heart
#

Why unreliable on the Server one?

fathom aspen
#

Living on the edge must be cool

jolly delta
latent heart
#

Are you sure the component is replicated to the other clients?

jolly delta
latent heart
#

Shrug sorry

#

I would make sure it's triggering on the srever correctly 😦

jolly delta
#

if i do the action on client, is it well executed on the server (listen server) but nothing on caller client

graceful viper
#

do these need to be checked? or does replicate automatically replicate those components too

fathom aspen
#

If that was the case then why these checkboxes would exist

#

And you don't need to replicate any of them

graceful viper
fathom aspen
#

Why would you?
CMC replication was a thing of the past but Epic did an optimization by using the Owner replicated Character to handle replication.
Replicated SkeletalMesh/Capsule comps is just wrong and would break the networking of CMC

graceful viper
#

alright

rose egret
#

whats the right way to handle replication of a timed task. I mean JIP and NetRelevancy problems.
I have an actor named Building that can be upgraded by player and its not instant, its takes some seconds and I have to show the remaining time in UI as well.

latent heart
#

Send an rpc when it starts?

#

Or set something to the start world time.

#

World time is consistent across all clients

#

Or it tries to be

prisma snow
#

the first one is optional

#

the timer would be client-side and maybe have a way to accomodate a certain amount of delay from the timer end to the upgrade kick in

#

I don't think any player will care if the upgrade takes some ms (or even a full second) since the timer shows completion

graceful viper
#
  unresolved external symbol "public: virtual void __cdecl ABlock::GetLifetimeReplicatedProps(class TArray<class FLifetimeProperty,class TSizedDefaultAllocator<32> > &)const " (?GetLifetimeReplicatedProps@ABlock@@UEBAXAEAV?$TArray@VFLifetimeProperty@@V?$TSizedDefaultAllocator@$0CA@@@@@@Z)
#

what module do I need for this?

latent heart
#

That isn't a module problem.

#

You need to implement the method yourself... Assuming ABlock is your actor.

#

Read up on how replication is set up in c++

graceful viper
#

no idea what the 2 variables mean at the bottom though

#

can you send the docs?

latent heart
#

You. Missed a replace.

#

No, I cannot.

#

There's probably some info in the stickies.

hollow swallow
#

just working on my tree harvesting, and im up to the point of needing to make a tree actually fall. What is the best way to do this on multiplayer?

near granite
#

What code can check if a cube actor placed in a level is owned by the local 0 player or not?

deep shore
#

fixed

hushed heart
#

Personally since you're replicating the bool already, I'd probably do that logic within the game mode itself, since it's pretty specifically gamemode dependent logic, grab the player array and enable respawns from their controllers.

#

Assuming you know when the players are all ready. Out of curiosity, when you say it ignores all the others, what do you mean?

deep shore
#

You have a good point, but this is kind of an unusual situation where the ability to respawn may change, and may be not be the same for all characters across the board. So if not in the Controller, it will need to be tracked somewhere individually

#

I mean it only sets the bool on one character

twin juniper
#

hey so just a question, when i code with a dedicated server do i code the same way as a normal build of unreal? like in bp if player character hits button, call custom server event?

#

or is there a different way of coding for a dedicated server?

hollow swallow
#

does chaos physics work okay in multiplayer?

limber gyro
limber gyro
#

basicly u do everything like normal in the bps/classes but u do it throug rpcs

#

there is not coding directly on the server

hollow swallow
twin juniper
limber gyro
twin juniper
#

get me on the right track?

hollow swallow
limber gyro
limber gyro
graceful apex
#

If I'm using a Material Parameter Collection in a multiplayer game, is there a way to edit the value of that parameter locally (every client having their own value for that same MPC value?) or does it act as a singleton throughout all clients?

hollow eagle
#

MPCs are local.

#

they don't get networked unless you specifically wrote code to do so.

twin juniper
#

So i have server map and when client connects to the server, is it better to have a hud class in the game mode of the world settings? or should i just create a HUD widget on begin client play and set it to my viewport on my own without goin through the server?

covert igloo
#

im just looking for a bit of proof reading here. im working on several versions of this health system, and this is my most basic. but i want to make sure i have replication understood before i get into the complicated health models and do something dumb.

assuming the attack calculations are correctly handle by the player(server side) and the final call for the attack damage/health interaction is sent by the server to my health Component attached to a different player(the target).
is this valid or are there any suggestions for best practices.
this works the way it is on both listen and dedicated. but i just want to make sure i havent made any obvious mistakes.

hollow swallow
#

trying to work out why my players wont spawn since making a new map. What is the order everything runs so i can make my way through it?

dark edge
#

@covert igloo replicated variables my dude

#

Don't multicast setting of variables

hollow swallow
#

If i go to the starter map, it works fine. if i go to the new map i made, they wont spawn. i have added some player starts too. is there something im missing?

covert igloo
# dark edge <@264268374320611329> replicated variables my dude

yeh actually ive been looking at this and each event needs to be handled differently.
and the damage calculation should be run server side then set on client.
i was telling every single client to run there own damage.

should i rep notify the variable changes after the server calculates damage

hollow swallow
#

i cant understand why changing a map would make a difference

covert igloo
#

i have a tendancy to forget this when i make new maps

hollow swallow
#

i forgot to set the game mode xD thanks mate

covert igloo
#

👍 gets me all the time to man

hollow swallow
#

How do people handle trees falling when they get chopped down? struggling to get it to seem good

latent heart
#

Yell timber?

prisma snow
covert igloo
#

im getting janky behavior out of is locally controlled when i switch from dedicated to listen server. is there a reason for this im not seeing.
like my players debug HUD wouldnt spawn with the player unless i put a 3 second delay in and run the locally controlled check again.

hollow swallow
#

ive yelled... many times xD @latent heart

short arrow
#

iirc sons of the forest also uses physics for their tree's

hollow swallow
#

I would rather physical movement i just cant get it to happen nicely

short arrow
#

physics tree falling is probably advanced

prisma snow
short arrow
#

yeah I guess I agree animation is probably the easiest then ^

covert igloo
hollow swallow
#

im currently doing it like this, but obviously my sound is a full sound and the tree hits the ground at different times. if i set multiple collisions on the mesh itself, can i check a hit on a certain collision by name? to play the ground hitting sound

covert igloo
#

your not appling anything to the clients but sounds

hollow swallow
#

they can all see the tree falling the same

short arrow
#

okay, so unironically, I would highly recommend not using physics for this especially in a multiplayer game unless you really know what you're doing, and yes they'll always hit the floor at different times.

hollow swallow
#

yeah its my first project and this has been the hardest thing so far xD

short arrow
#

anyway, I put a collision box on the tree, and it ignored everything except for static floors, so that way whenever it overlapped a floor it would know to play the floor hit sound

hollow swallow
#

thats why i was wondering the best ways. i didnt want an animation, as what if it hits stuff?

covert igloo
#

dude im 6+ years in and im just now learning replication. mabey try some single player mechanics before you get into the really juicy stuff.

hollow swallow
#

yeah rogey, i was hoping i could keep it as a seperate collision box on the static mesh itself, as im trying to make it modular for many tree's etc... but thats easier just adding it to the component

#

tbh im not trying to make a full game or anything, having fun learning really. already got combo system, hp, xp, inventory system, equipping, blocking, 2h / 1h weps. just starting on gathering now. done all this in about 3 weeks with 0 experience and everything is syncing nicely so far

#

single player games dont really interest me 😛 just doing it for a hobby to jump on with some mates and hack and slash each other and learn / have fun

covert igloo
# hollow swallow tbh im not trying to make a full game or anything, having fun learning really. a...

ah very nice. lol. because it took me a month to get any traction. and now im doing heavily simulated vr guns and stuff. power to you man.
i dont know the proper way to simulate physics from server to clients. but i do know that if you set simulate via multi cast. everyone will see a different fall of the tree. a cheap way to show the same result is to tell the server to send the new location to the clients. and they can set that location.

but that might get into data traffic issues if you have a lot of physical trees, and then probably having to do some work with sleep states. im speculating by the way. im still learning this. but my logic leads me in that direction.

hoary spear
short arrow
#

aka super expensive

hollow swallow
#

Yeah i was a bit concerned with that, but once it hits the ground, i despawn it after a second and spawn the wood at the moment. Its not the best solution, but for a tree falling for 5 seconds it shouldnt be too bad i think

#

but i will try do it server side at some point

hoary spear
hollow swallow
#

most trees chopped all at once will probably be 2-3 tops xD takes a few hits to down one, and only sharing game amongst friends

covert igloo
#

if your cleaning up the trees quickly. as long as the sources of falling trees is minimal your probably good.

hoary spear
#

The transform replication would be for a limited time anyways

short arrow
#

depends, I'd steer clear. I mean I guess it'd be fine if it's the only thing you'd need to ever use physics for. It's a slippery slope imo

hollow swallow
#

yeah they get destroyed pretty quick

hoary spear
#

It wouodnt be straight forward i think

#

As youd want some client prediction

hollow swallow
#

i was trying to do destructable mesh for a while, but thats on the back burner for now xD

hoary spear
#

Which.. im not sutr how youd do reliably

short arrow
#

I don't think clients could ever predict physics

hoary spear
#

Not sure how mich variation there is when physics is on

#

Thats the slippery slipe

covert igloo
hoary spear
#

You could 'predict' by simulating the tree falling on server, prepping up transforms and timeatamps

short arrow
#

That's definitely a method, never heard anyone think something like that up lol

#

I bet it'd work too

#

pretty good idea

covert igloo
hoary spear
#

yeah its not an out of the box solution, thats for sure

short arrow
#

eh, we just do everything physics related locally, and then lerp whatever get's too far from the server

hoary spear
#

im sure it would have its caveats aswell

hoary spear
short arrow
#

JANK AF

#

only bad when an item falls down a hill

hoary spear
#

ugh

short arrow
#

we don't have too many hills though so realistically it's not even noticeable

#

there's a lot of things you can throw at replicated physics

covert igloo
# short arrow eh, we just do everything physics related locally, and then lerp whatever get's ...

hey so this question got buried a while back, anyone know what im missing. all of my stuff worked on dedicated.
but any command that pass though "is locally controlled" may or may not work on the host

im getting janky behavior out of is locally controlled when i switch from dedicated to listen server. is there a reason for this im not seeing.
like my players debug HUD wouldnt spawn with the player unless i put a 3 second delay in and run the locally controlled check again.

short arrow
#

all kind of are suboptimal imo

hoary spear
#

i had the same issue just recently 😛

#

or a very similar one atleast

covert igloo
hoary spear
#

beginplay is unreliable

#

as you may or may not be possessed at that point

#

You should use OnPossess instead

covert igloo
#

ah. so i need a Initalize event from the controller

hoary spear
#

yeah

covert igloo
#

cool thanks

hoary spear
#

there's still some "gotchas", but it'll get to you : P

covert igloo
#

i had a feeling that it hadnt be possesses yet. but i hadnt made the connection with begin play.

hollow swallow
#

What are some big things I should be aware of whilst doing a multiplayer game? Are there any huge performance hit things I should keep clear of?

covert igloo
#

now i get to figure out why my guns arent working ether. but i think i can work through that one.
i know they need to be a bit different.

#

RPCs are more expensive than rep notifies, which also cost more than repped variables.
use RPC when it need to happen now. and rep things that arent as critical

hollow swallow
#

Or with only up to 10 players tops it should be all gravy to just go in uneducated and make stuff 😂

covert igloo
#

there was a really good video that explained the hood stuff. ill see if i can find it

hollow swallow
#

Cheers

hoary spear
#

It will surely be a learning experience if nothing else

hollow swallow
#

ive had quite a few of those already haha

#

been on this falling tree thing most of the day

covert igloo
#

i havent found the video. but thats some of the notes i got from it

hollow swallow
#

Thanks mate appreciate it

#

gonna @hollow swallow so i can always find this xD

covert igloo
#

its like what to use to get correct authority from where and when

hoary spear
#

Cedric also has the compendium, which is a great asset

hollow swallow
#

also, im getting rid of my second collider sphere, and ill make it so when the tree falls, the normal tree mesh collider will check if its hit something, if it hits a player ignore it, if it hits anything else, play the landing sound, seems a bit easier

hoary spear
#

pinned to this channel

covert igloo
#

@hollow swallow theres the vid.
everyone else slaps you with a do this, without telling you it only works case by case.
this guy tells what it actually does, so you can figure out why and when you need to use it.

hollow swallow
#

Thankyou, appreciate it!

#

This is on my trees bp, should it not show the players actor when i walk into it? its showing its own actor

#

if i go to other actor its fine, but i thouight the break hit would be of what it has actually hit

covert igloo
#

try it in single player and see if you get the same result.
as i was testing my health system i discovered that i was spawning Test Dummies on server an client. making a duplicate as the server also makes a second representation on the client that might be tripping your collider. and reading the same class name

jolly delta
latent heart
#

This is why you give us code.

chrome venture
#

hello

covert igloo
# hoary spear You should use OnPossess instead

hey so whats the proper process for running my spawn code in the player controller. i switched over to on possessed, and now the clients are broken.
i i ask the clients to run throught the server, nothing gets fixed. and i tried also making a custom event initialze event to play after the player was spawned. but still nothing

ember vine
#

can rpcs aarrive out of order ? unp prevents tthat right

short arrow
hoary spear
covert igloo
hoary spear
#

I mostly followed GASDocumentation's order of execution

#

so player is spawned by the gamemode,

#

then playercontroller react to being possessed, and creates the hud if locally controlled (this would be listen server i guess)

#

and react to playerstate being replicated

hollow swallow
#

It took all day, but thats my outcome for now, not too shabby i guess

hoary spear
# covert igloo yes, im doing some setup in there also
// Server only
void AMyPlayerController::OnPossess(APawn* InPawn)
{
    Super::OnPossess(InPawn);
    AMyPlayerState* PS = GetPlayerState<AMyPlayerState>();
    if (PS)
    {
        // Init ASC with PS (Owner) and our new Pawn (AvatarActor)
        PS->GetAbilitySystemComponent()->InitAbilityActorInfo(PS, InPawn);
    }
    //Dedicated Server
    if (IsLocalController())
    {
        CreateHUD();
    }
}

// Client only
void AMyPlayerController::OnRep_PlayerState()
{
    Super::OnRep_PlayerState();
    CreateHUD();
}
hollow swallow
#

not sure if i can post it without having to download it xD

hoary spear
#

Keep in mind im very fresh to multiplayer so perhaps someone else could fill in if this is a bad idea

covert igloo
hollow swallow
#

ended up using physics, then once it starts falling, it does a sphere trace, and plays the hit sound once the tree hits the ground

old sequoia
#

Anyone here with experience optimizing server performance? Specifically in terms of replication

hollow swallow
#

it goes for 22 seconds

#

oh no thats for hd

covert igloo
hollow swallow
#

took me all day to do that hahaha

covert igloo
#

for like the last 6 years working without reps, i could just do anything and get away with it lol

#

ill pick this back up in a bit

hoary spear
#

its a different bucket of worms, that's for sure

covert igloo
hollow swallow
#

atleast you guys know what youre doing

#

try 3 weeks deep in any game dev

#

ill give someone an aneurysm if they see my bps

hoary spear
#

now we're forced to do it "properly" to avoid issues 😛

#

things you could do on beginplay simply wont work anymore

hollow swallow
#

if it works, it works i reckon

hoary spear
#

it's a start , lets you get warm with it atleast

#

But you might stumble into issues with late joiners, high ping players or otherwise if you haven't thought about it properly ^^

#

tech debt can be big untill you experience the issue 😛

#

local testing is also not enough obv

hollow swallow
#

yeah ill cross that bridge when i get to it i think xD

hoary spear
#

thats fair

#

only fix it if it becomes an issue x)'

hollow swallow
#

im just happy ive got a semi functionable project so far so quick

#

let me chuck a few things, ill make a 1 min video of where im up to in 3-4 weeks

covert igloo
hoary spear
#

I wont post a video of what i made in 2 years, safe to say

hoary spear
#

sorta miss some big overview of the actual sequence of things

#

i've seen some epic ones, but havnt found one with the actual startup sequence and join sequence etc

covert igloo
#

so far. ive got a fully networked custom flying pawn with no dependencies on the original input system.
meaning i can drop him in any project without any setup. and my base model health code is fully functional across network also.

covert igloo
#

now im working on some equaly impressive health systems from basic to limb. the big is already done. but im starting over to clean and network it.

cold moat
#

Got a bit of a metaphysical question, as usual:
I'm doing franken grenades. When the projectile is spawned, it is controlled by ProjectileMovementCompoment AND RotatingMovementComponent, until it detects the projectile is sliding, at which point, those movement components get disabled and the collision capsule starts simulating physics instead
It looks very very good in single player, but so far pretty miserable in multiplayer
Did anyone try doing something stupid like that?
Is it a definite foot gun?
I think projectile movement component replication is "fighting" actor replication, because the projectile is jittering everywhere in networked Vs standalone

hollow swallow
#

yeah its been a rough start thats for sure, but i just keep chipping away one thing at a time. im sure once ive learnt more im going to have to rewrite 90% of my game but thats half the fun learning i guess

#

not the greatest vid but thats what im up to. so far everything is working well over multiplayer, but i havent tested someone joining late, or with lag etc

cold moat
#

It looks pretty damn good 😮

#

I think my favourite little thing was how dropping things in world space works lol

hollow swallow
#

yeah other players can see it and pick it up too which is good

#

just need to make the tree crush people now >:)

hoary spear
#

also dodgy when it says stopify...

solar stirrup
#

<@&213101288538374145>

#

likely phishing link

broken geyser
#

Feel free to use the right click menu -> Apps -> "Report to moderators" option instead of a tag, makes it easier for us to respond to.

hoary spear
#

Didn't even know that existed, will do that in the future, thanks

graceful viper
#

I don't get how the player controller is the optimal choice here... Isn't it also owned by the client? What am I missing here?

quasi tide
#

It being the optimal place for a server interact just depends on your overall design. The main takeaway is that you can only call server RPC's on things you have ownership over. PlayerController is the first thing that the client has ownership over.

graceful viper
quasi tide
#

They do.

#

Possession changes ownership.

#

PlayerController is the first thing the client has ownership of.

graceful viper
#

Why's it important that it's the first thing?

quasi tide
#

It's not necessarily important. Just extra knowledge.

graceful viper
#

So this same logic would work in the character? I just can't create an RPC on the door that's being mentioned here?

quasi tide
#

If the client has ownership of the character, yes. Call server RPC that then just calls w/e interact method.

graceful viper
#

Alright makes sense thank you

cold moat
#

Got a bit of a metaphysical question, as usual:
I'm doing franken grenades. When the projectile is spawned, it is controlled by ProjectileMovementCompoment AND RotatingMovementComponent, until it detects the projectile is sliding, at which point, those movement components get disabled and the collision capsule starts simulating physics instead
It looks very very good in single player, but so far pretty miserable in multiplayer
Did anyone try doing something stupid like that?
Is it a definite foot gun?
I think projectile movement component replication is "fighting" actor replication, because the projectile is jittering everywhere in networked Vs standalone

olive kraken
#

Hey! seamless persistency question! one of my widgets have references that come from the different player controllers (tested with PS too), all works good when the first level is loaded by both server/client. After the first death, I use seamless travel as a hard reset of the level. I destroy and reconstruct all widgets (fired by the HUD class).
Properties that come from the controller/ps are lost or maybe wrongly referenced, for example, the player name or id now is null. I understand that PC are reconstructed, but if widgets are too, shoudn't widgets refer to the new PC after seamless travel?

noble sentinel
#

What is the correct way of using get player controller in co op games?

#

Like when I make a jumpscare, how can I make this apply to all players, or only affected player?

dark edge
#

You have 3 movement systems

cold moat
#

rotating movement component is designed to be used with projectile one, literally says so in the code (projectile movement component does not do rotations at all)
so, it's more like 2 + 1
Actual physics get turned on (and the fake physics from movement components off) once the projectile movement component stops bouncing and decides it is sliding, because they are abysmal at that

ember vine
#

anyone know if there's a way to run 2 viewports, and only simulate lag on 1 client while both server and 2nd viewport arent laggy ?

cold moat
#

you use network emulation

#

right

ember vine
#

yea

#

how do u enable that for just 1 client

cold moat
#

im assuming you can just use the console on the client to set it only for that one instance?

#
You can specify settings from the console at runtime using the syntax:

NetEmulation.<SETTING_NAME> <VALUE>
ember vine
#

ahh yea perrfect cheers, was trying all sorts of stuff in the console window and couldnt find any relevant networking ones LUL but makes sense its netemulation.

floral mauve
#

Is there a guide somewhere to setting up a barebones multiplayer system on two computers?

graceful viper
#

I may be wrong though I'm just learning mp

dark edge
noble sentinel
noble sentinel
dark edge
noble sentinel
acoustic veldt
#

Hello all,

Having an issue with dedicated server:

It seems the tick rate is capped at 30 on the dedicated server (having the sever dump out the delta time average each tick to clients so they can see). which is consistently reporting .033 and .034. The VM the dedicated server is running on is barely working so I don't believe that is the issue...

I have tried setting properties in engine config file but no luck there.

[/Script/OnlineSubsystemUtils.IpNetDriver]
NetServerMaxTickRate=61

[/script/engine.engine]
NetClientTicksPerSecond=61

This is not happening when running as listen server which is expected.

Edit: I have used the search function in discord but nothing that worked has come up for me.

Can someone educate me on what I should be doing instead?

acoustic veldt
#

Ah, think I figured it out. If using steam sockets you have to set in engine.ini

[/Script/SteamSockets.SteamSocketsNetDriver]
NetServerMaxTickRate=61
LanServerMaxTickRate=61

Or I assume you can preset these in BaseEngine.ini before building the dedicated server(?)

cold moat
#

Does ProjectileMovementComponent do it's own replication?
Should i disable actor movement replication when that thing is running?
My projectiles are pretty unhappy in networked tests rn lol
(jittering and spazzing)

graceful viper
#

Well, I'll be done with the compendium slides very soon...

What is the recommended next approach? (Other than just practicing, I've already started on that)

quasi tide
#

That's literally all you can do. Practice practice practice. Look up stuff as you go.

graceful viper
quasi tide
#

That's too complex. Go smaller.

mortal mica
#

what's the best place to initialize the enhanced input bindings on a multiplayer game that allows me to bind/unbind when PossessedBy/UnpPossessed (I just realized those methods are only called on the server and my bindings arent working on multiplayer)

#

I saw a suggestion for APawn::Restart, but that only solves the possessed part, not the unpossessed

graceful viper
graceful viper
#

🥲

mortal mica
#

😛

quasi tide
#

The game doesn't need to be "fun" or even released. Just need to keep practicing the basics. So they get drilled into your head.

graceful viper
#

Alright

quasi tide
#

Just keep doing ultra small games.

#

Focusing on one or two things at a time.

#

The basics should be as easy as breathing.

graceful flame
#

Just make a free to play mmo rpg with dedicated servers, no cheat prevention, NFTs and marketplace assets. What could go wrong?

hoary spear
#

Look back to the old playmachines

#

Plenty of games to mimmic there

#

Anything from snake to zelda (in its most basic form)

mortal mica
#

Aren't bp replicated variables supposed to be updated on the server if set on the client by the owner?

#

I just made this quick test in my character, but the server always prints false

#

(this is in the character blueprint that I'm currently controlling/possessed/owner)

#

or does it need a repnotify to work ?

hoary spear
#

Only server can

quasi tide
#

You change it locally to do cheap prediction.

#

Replication only goes from Server -> Client.

mortal mica
#

I thought I read that it was supposed to work for the owner

quasi tide
#

A) You read wrong/misremembering what it actually said
B) Material was wack

mortal mica
#

that does apply for RPCs afaik

hoary spear
#

Yes

quasi tide
#

RPC is not replication

dark edge
quasi tide
#

You can do it that way, yeah.

hoary spear
#

If you dont need verification i guess

acoustic veldt
#

@quasi tide but its got all the letters in it... 😉

mortal mica
meager raptor
#

Hi everyone, quick question. For those who use AWS, what sort of EC2 instance (on Windows) are you using for what kind of usage? For a FPS of 5vs5 what would you recommend ?

mortal mica
meager raptor
#

and I have another question, to display the score at the end of the game I created an array from a structure which contains enum, integer, string & float. The object is dormant by default and I set a Flush net dormancy when the stats are ready so that every player download the stats. I'm just amazed that it does a super spike of data when it happens. Is this the correct way to manage this ? Before we updated the stats during the game but I thought it would save some bandwidth to do that at the end. I didn't expect to upload that much data.

meager raptor
mortal mica
#

that's the whole tick

#

(I've nailed it down to this simple test case that doesnt move properly)

meager raptor
#

I'm not sure if this is the right way but I would have replicate a vector and update the client also with the value of the vector. Why don't you set a rotation from a replicated rotator ?

#

I didn't used torque but I would guess it's not replicated right away

mortal mica
#

replicating the vector should have the same effect than plugging the remote pin to the add torque, and even if I do that so that both simulations are updating the torque, it still moves weirdly like in the video

meager raptor
#

yes but if you use a setrotation

mortal mica
#

which is what "replicated movement" should be doing I guess

dark edge
#

@mortal mica Do you have Replicate Physics turned on?

mortal mica
dark edge
#

What does the movement look like on the server?

mortal mica
#

perfect

dark edge
#

Smooth acceleration?

#

Tune your physics replication settings some.

#

It's insanely strict out of the box. Although I've only ever done replicated physics where I was running the physics on both sides.

#

If you're accelerating I think you'll end up with constant hard snaps clientside unless client is accelerating it too

mortal mica
meager raptor
dark edge
#

Basically the client side doesn't know it's meant to accelerate, it just knows the velocity is meant to have

mortal mica
#

I would just assume that the default replicated movement would handle that... 😐

dark edge
#

Try add torque on both sides. Replicate the control variable

mortal mica
dark edge
mortal mica
#

that should in theory run the same simulation on both sides

#

oh wait, tick on the client could be faster

dark edge
dark edge
mortal mica
#

I wonder if add torque multiplies by delta time ?

dark edge
#

Add torque already takes into account the time.

mortal mica
#

oh ok

dark edge
#

Impulse does not. That's the difference.

mortal mica
#

then that has the same result

dark edge
#

Well not exactly the same. There are integration differences etc. But when you do this the physics replication has a lot better starting point to sync them up

mortal mica
dark edge
#

Also, make sure the thing isn't going to sleep client side or something. Try turning off physics replication and making sure it's smooth on both sides first

mortal mica
#

I just tried with an "Set angular velocity" node, no acceleration there, it should be the simplest thing to replicate

dark edge
#

It's in project settings under physics

mortal mica
#

still similar effects

dark edge
#

Start by making sure nothing else is screwing it up. Turn off the physics replication and make sure it's butter smooth on both sides. It won't be synced at this point but it should be smooth. Then turn on the physics replication, and fine-tune your physics replication settings to not be so strict and janky

mortal mica
#

I disabled both, silky smooth on client and server

dark edge
#

Okay so start dialing in your physics replication settings.

mortal mica
#

autonomous proxy would only be replicated to the owner right_

#

?

#

in this case neither player is the owner of that rotating object

dark edge
#

I'm not quite sure why it's phrased like that.

mortal mica
#

but yeah, as soon as i tick "Replicates Movement" in the root actor, it just starts bouncing around

#

it's like if the client is still trying to update the object with it´s own values, without taking into account the server´s correction

#

what I mean is that obviously the client starts ticking later (since it joins a few seconds after the server) and it just never updates the client side simulation with the "current server position / rotation"

dark edge
#

Is the simulating object the root component?

mortal mica
#

ah crap

#

I found it

#

"Component Replicates" was off in the static mesh

#

🤦🏻‍♂️

#

I'm still a bit confused on how unreal handles the root actor and the root component as different things

#

but as the same thing sometimes

dark edge
#

The location of an actor is the location of that actors root component.

mortal mica
#

I thought so too

#

but then you have a "Replicates Movement" setting in the actor

#

which doesn't work unless the root component has "Component Replicates"

#

(my case just now)

dark edge
#

That just means it'll try to replicate movement related properties.

#

Stuff like position, physics, attachment probably, I'm not quite sure what all is considered a movement related property

mortal mica
#

ok so now if I unpin the "Remote" node, ie just call the set velocity on the server it works most of the time

#

I can still occasionally see some stutter

#

which is weird, I would assume that it could interpolate a simple constant velocity ?

dark edge
#

I told you, the default physics replication settings are insanely strict. You're probably getting some sort of oscillation. Right now, are you applying a constant torque or just setting an angular velocity, or what are you doing?

mortal mica
#

no acceleration or anything, just setting it

#

and there's no angular damping either

#

it should be constant

dark edge
#

So you should just be able to call that once and it will just coast right?

mortal mica
#

yup just tried that in fact

#

changed it to on begin play

dark edge
#

Mess with your physics replication settings.

#

By default, 1 cm of linear error or one degree of angular error is considered full error, that's obviously insane.

mortal mica
#

I'm guessing the jitter is at the point where the server sends some position update

#

aren't updates smoothed out over several frames or something ?

dark edge
#

Have you looked at the physics replication settings? There's all the settings for hard snap and lerp and all that in there

mortal mica
#

in Project Settings -> Physics I don't see anything like that

dark edge
#

Physic replication settings

#

It's misspelled

mortal mica
#

ah "physic error correction" ?

#

ok it seems the default for "Angle Lerp" is 0.4

#

moving that to 0.0 makes the snapping disappear

#

although now I wonder why the default is 0.4 😛

#

the tooltip says "how much to DIRECTLY lerp to the correct angle"

#

im assuming that even with 0.0 it WILL correct

#

just not drastically at the beginning?

dark edge
#

Yeah it has a sort of phantom Force / torque system. Basically it kind of like gradually eases toward agreement.

#

It's pretty complex but that's what all those coefficients and stuff are for

mortal mica
#

right, I was assuming that was being done, which is why I couldn't understand this glitchy jump

prisma snow
mortal mica
#

worked on mp game many many years ago, and we did that, we would just store the "Servers position" and slowly lerp towards it over several frames to avoid jerkiness

dark edge
#

I'm using it right now for my multiplayer vehicle building game, it works pretty well but I'm really not replicating all that much. I pretty much only replicate the movement of the chassis. And I run the full simulation on all machines.

mortal mica
#

of course it didnt always work since the client prediction would still be happening and in the end it could diverge drastically making the lerp more obvious

dark edge
#

Basically I don't care if what I see happening with the tires bouncing and the jiggly bits jiggling agrees at the server, all I care about is that the chassis transform is the same between machines

mortal mica
#

how are you handling the player's input to the vehicle physics?

dark edge
#

Stuff like throttle, steering, stuff like that.

mortal mica
#

ah ok yeah that's why im doing now, i thought it would be a good enough approach at least

#

there would be some lag to the inputs

prisma snow
mortal mica
#

but since I'm thinking of a slow to react vehicle, it should be good enough

dark edge
#

It works pretty well, as long as you don't need prediction. There will be lag but who cares, they're Giant tanks. It's not like a tank responds in 15 milliseconds

dark edge
dark edge
#

It has a lot of stuff for extrapolation etc. But the Sim is running everywhere, forces are being applied on all machines.

prisma snow
#

I'm working. on something different (RTS game) but some challenges are actually similar

dark edge
#

So if I missed a couple updates I'm not going to be that far off

prisma snow
#

probably the most challenging mechanic will be cavalry charges/trampling since it is semi-physics based

dark edge
#

Prediction is an absolute no-go for my project, it's all player built vehicles that can collide all the time.

mortal mica
#

@dark edge thanks a lot for your help btw, much appreciated!

#

I knew unreal couldn't be that bad at replicating basic physics 😛

dark edge
mortal mica
#

mmm, yeah I guess that will suck a bit

#

but that's why I was doing my ship movement using torque/forces instead of kinematic

#

I just tested with emulation at 100ms and it worked fine

#

gonna test with a friend in a real scenario later and see how it goes

dark edge
#

Spaceships are really smooth so physics can probably work there. You just have to 100% be sure that nothing that characters do is changing anything about the ship. I know a little bit of a trick for that if you want. You basically have the collision that is simulating physics, and then you attach another collider to that which is what the characters actually walk on. Then that way the ship is completely unstoppable from the point of view of the character. The character cannot do anything to the physics of the ship

#

Although spaceship implies arbitrary orientation which is a no go for character

mortal mica
#

yeah I was dealing with that yesterday in fact

#

the walls of my ship collide with the player

#

and affect the movement of the ship

#

although I was able to virtually eliminate it by setting a very high mass for the ship vs the player

mortal mica
#

and I also hacked the "Base movement" code in the character, so that it doesn't update the "Base" based on the floor, but I just force it to use the ship as a base all the time

#

so I can jump inside and still get moved like if I never left the floor

#

(there's some camera jerkiness in the video, but that's related to how the axis is updated, which isn't interpolated, im gonna fix that next)

mortal mica
meager raptor
frank birch
#

does the _validate function of an rpc returning false somehow notifies or remembers somewhere why it was false? 🤔
How can I tell which validation failed? 🤔

#

another question... can I make a setter an RPC? If not, should I hide a sneaky call to an RPC inside the setter if not authority? Or should I just make an RPC and not let people get tempted setting the variable?

hollow swallow
#

Trying to setup a turning animation for my character. I have added a bool on my player bp, and set it to replicated. But when i debug the anim bp, the value will change and print for server, but not for the client. Any ideas how to make it both?

dark edge
#

although "turning" should be a derived value

hollow swallow
#

thats on my thirdpersoncharacter bp

#

if i do a print at the end its only printing for server, not client

dark edge
#

Inputs only happen locally

hollow swallow
#

with a print string at the end it says Server: Left or Server: Right

#

and when debugging in my anim bp, it gives me the option to choose client or server, on the server one its transitioning correctly based off that bool, but the client one it doesnt change at all

dark edge
#

because client is getting clobbered from the server side

#

for the client, that replicated bool will never change, or at least not stay changed. This whole setup is a mess.

hollow swallow
#

actually even if i play as stand alone its not working :/

#

i just followed a guide on youtuve for it

#

wanted the player to rotate on the spot if they move the mouse

dark edge
#

Yeah and those are all bad

hollow swallow
#

its all ive got to learn from at the moment haha

dark edge
#

You can do this all from the animBP. You have access to the character/capsule rotation and velocity

#

You'll need some sort of rotation to represent the feet orientation and when capsule rotation hits some limit, you play the animation and reset that foot orientation

#

So the rules are:

Moving? FootRotation = CapsuleRotation
NotMoving? If Delta(CapsuleRotation, FootRotation) exceeds SomeLimit -> Play the TIP animation -> update FootRotation

hollow swallow
#

Thanks mate, i get what you mean, but still dont understand 100% how haha, ill start hunting for a guide that does it that way and go from there. apprectiage the help

#

i have my blocking / two handed blends setup the way ive done this one, and they work fine, although those bools dont change very often at all. i think its firing the bools way too fast and tripping it out for my movement

#

thats how quick it was flickering xD

dark edge
#

which is how you should do it

hollow swallow
#

yep rogey

dark edge
#

you don't play RunAnimation when you press W, you play it when you're moving

#

same idea

hollow swallow
#

and disable use controller desired rotation then calculate the difference between the character and the controller rotation?

#

and use that to toggle my on off for bools

dark edge
hollow swallow
#

rogey

dark edge
#

But you will need 2 rotations total somewhere. You need something to keep track of the feet orientation

#

How are your animations set up, do you rotate mesh and "unrotate" feet when turning in place?

hollow swallow
#

havent messed with the animation too much so far, just slapped in a turn left and turn right one to play when the bools change

#

just rewriting it all in the anim bp atm, also make it stay set and true for turning for a longer time and not repeatedly swapping true / false

dark edge
#

At what point do you play the turn animation, at like 45° or something?

#

Like if you're sitting still and just slowly rotating right, are you constantly playing an animation or do you want to play an animation to basically catch up the feet with the upper body?

hollow swallow
#

okay its my transitions

#

somethings wrong in that

#

i just changed it a bit and it worked, but only once xD but atleast it played, so ive got something wrong in there

#

so i just set it at 90 degrees itll then turn true, and rotate my character

#

thats a bit better, except he turns 90 degrees away fromthe camera with the animation, but its working, so its not something to do with multiplayer, ill swap chats. Thanks for your help though mate, much nicer having it inside the anim bp

jovial charm
#

hey guys I am new to replication and all the networking in Unreal. I am trying to understand how it works by creating a replicated Integer in my player controller, however when I increment the integer on the server, or the client, it doesnt update on the other end. They both seem to have separate copies?

#

I press F on the server a couple of times, then I print it to check if it incremented, and it does increment. Then I print the integer on the client, and the client's is not incremented. And when I increment it on the client, it doesn't increment it on the server.

#

WAIT

#

I am stupid

#

I just realized I am playing on a listenServer which has its own controller, so everytime I incremented the variable it incremented the server's own controller's variable lol it is not related to the other client at all lol

dark edge
jovial charm
dark edge
#

if it's stateful, use a replicated variable

#

if you want to RESPOND to state changes (bool DoorIsOpen etc), then use RepNotify

#

that's a function that is automagically called when the variable changes

jovial charm
#

Whoa thats awesome. If I have an Inventory component on the player controller, which holds an array of items that are in the inventory, if I mark the component and the item array inside it as Replicated, all I would have to ensure is that any updates to the array are made on the server? and all the changes will automatically propagate back to the client?

jovial charm
dark edge
#

Say you wanted to open a door in a multiplayer context, it'd go like:

Pawn:
Input Interact -> Run On Server Event //local
Run On Server Event -> choose what to interact with -> call Interact (Interface call) on it //server

Door:
Interact -> set bDoorIsOpen //server
OnRep_bDoorIsOpen -> do the actual mechanic (rotating the door mesh etc) //this runs everywhere

dark edge
#

although that wouldn't be in player controller usually

#

it'd be in pawn

jovial charm
#

oh, I had it in the playerCharacter but heard somewhere it should go on the playerController in case the controller possesses another character, so I switched it to the controller.

jovial charm
#

one last question. If I have effects like Niagara particles on a character, do I need to have them be replicated for them to show up to all the players? Or could I get away with something like when the client activates its particle effects, it sends a multicast RPC to activate on everyone else's "view" of this client character. Would the Niagara particle emitter even exist on all those other versions of the client since its not replicated?

hollow swallow
#

So i have the character rotating properly now, although after a few spins, the client sees them in a different direction. What would be the best way to debug why this is happening?

#

as soon as they walk forward it will realign

#

once they stop walking forward, the client will see them turn 90 degrees, where as on the players screen they dont turn at all

olive kraken
#

Do I need to copy the name property within the Player State right after seamless travel? Trying to figure out why name is none after travelling. Thanks!

covert igloo
#

does anyone know why this would be happening. this works in single player.
and it worked in dedicated server when this was in the pawn code. but i moved it to the player controller.
but now it fails entirely ever single time. its like its literally refusing to create the widgets. they are returning nulls

LogBlueprintUserMessages: [None] Warning:controls widget =valid - Error= false - -
In Actor=RTT-PlayerController-SHSS_C_1
LogScript: Warning: Accessed None trying to read property CallFunc_Create_ReturnValue_1
RTT-PlayerController-SHSS_C /Game/SphinixHealthSystem/SimpleHealthModule/UEDPIE_0_testroom-SHSS.testroom-SHSS:PersistentLevel.RTT-PlayerController-SHSS_C_1
Function /Game/SphinixHealthSystem/SharedAssets/BluePrints/RTT-Pawn/RTT-PlayerController.RTT-PlayerController_C:ExecuteUbergraph_RTT-PlayerController:0819
PIE: Error: Blueprint Runtime Error: "Accessed None trying to read property CallFunc_Create_ReturnValue_1". Node: Add to Viewport Graph: EventGraph Function: Execute Ubergraph RTT-Player Controller Blueprint: RTT-PlayerController
LogScript: Warning: Accessed None trying to read property CallFunc_Create_ReturnValue_1
RTT-PlayerController-SHSS_C /Game/SphinixHealthSystem/SimpleHealthModule/UEDPIE_0_testroom-SHSS.testroom-SHSS:PersistentLevel.RTT-PlayerController-SHSS_C_1
Function /Game/SphinixHealthSystem/SharedAssets/BluePrints/RTT-Pawn/RTT-PlayerController.RTT-PlayerController_C:ExecuteUbergraph_RTT-PlayerController:0858
PIE: Error: Blueprint Runtime Error: "Accessed None trying to read property CallFunc_Create_ReturnValue_1". Node: Bind Event to Menu Was Entered Graph: EventGraph Function: Execute Ubergraph RTT-Player Controller Blueprint: RTT-PlayerController
LogBlueprintUserMessages: [None] Warning:overlay widget =valid - Error= false - -
In Actor=RTT-PlayerController-SHSS_C_1
LogScript: Warning: Accessed None trying to read property Widget
RTT-PlayerController-SHSS_C /Game/SphinixHealthSystem/SimpleHealthModule/UEDPIE_0_testroom-SHSS.testroom-SHSS:PersistentLevel.RTT-PlayerController-SHSS_C_1
Function /Game/SphinixHealthSystem/SharedAssets/BluePrints/RTT-Pawn/RTT-PlayerController.RTT-PlayerController_C:ExecuteUbergraph_RTT-PlayerController:0958
PIE: Error: Blueprint Runtime Error: "Accessed None trying to read property Widget". Node: Add to Viewport Graph: EventGraph Function: Execute Ubergraph RTT-Player Controller Blueprint: RTT-PlayerController

hollow swallow
#

Any ideas why this is always true for the clients (which its ment to be) but not for the host? for some reason the host never gets the same 0 value when they stop rotating

dark edge
hollow swallow
#

yeah i printed them. the hosts never reachs zero, always a bit over or under. clients it works nicely. What rotation should i use instead that is more reliable?

vague fractal
azure hull
#

Hi. Seamless Travel from Lobby to Gameplay and after game ends, back to Lobby makes UniqueNetID lost. Using Advanced Session, tried to restore it in PostSeamlessTravel, but without success. Any help would be appriciated, probably someone has encountered it.

vague fractal
hollow swallow
#

tried to make my own control variable, and set it on my character with != simulated proxy and it works on the host now but still pretty buggy for the client, and a bit choppy. Is there a simpler way to do this?

jovial charm
#

is OnRepNotify run on server or clients or all?

fossil spoke
jovial charm
fossil spoke
jovial charm
#

I am very new to networking so apologies if what I am saying doesnt make sense 😭

fossil spoke
#

Then only the Clients will have the OnRep called, this happens automatically for Clients.

jovial charm
#

ah okay thank you

fossil spoke
#

The Server will not have the OnRep called, because as i said before, the Server (the one updating the Rep Var) needs to call OnRep itself.

#

It would mostly look like this

#
    bIsFiring = true;
    OnRep_bIsFiring();
#

Modify the rep var, then call the OnRep

#

Clients will receive the OnRep call and be able to check bIsFiring will equal true

jovial charm
#

thank you ❤️

covert igloo
#

or actually not client RPC, but this worked. feels wrong somehow. but i think its a valid way to do server and client work in the same class

near granite
#

The same exe file connects to the same server, but it looks different for each client. For example, if I need to see 100 photos when I connect, I can see all of them on client 1, but only 10 on client 2, and so on. How these things could be happen?

dark edge
hollow swallow
#

Cheers, ended up sorting it by setting my own variable and replicating it and passing it through

dark edge
#

You need 2 rotations here. Don't need to be replicated.
Have some rotation that represents the foot rotation (or offset) that is continually set to the pawn rotation (or zero) when moving, and adjusted on TurnInPlace. The trigger for TurnInPlace is the difference between this rotation and the pawn rotation.

vague fractal
#

Now that i'm getting into dedicated server i'm wondering.
Is a Client build still able to create a session and be the listen server ?

hollow swallow
#

if i didnt replicate it then it was bugging out, as soon as i replicated it and passed it through it started working fine. Not sure why but it was working on all clients but no the host

near granite
#

the same executable file appears differently on different clients. How could it be possible?

covert igloo
#

why is it that when im using dedicated server, i get different behavior out of my first client. and then everyone else works totally fine.
its acting like a server host and i dont understand why. because im not running a listen server.

thin stratus
thin stratus
covert igloo
thin stratus
#

If the first client is the problem then either you do something for the first play that joins somewhere or you are using GerPlayerCharacter or similar in places where you shouldn't

#

Well or something totally else. But without more info that's all I can give you

covert igloo
#

the issue thats plaguing me is my Debug widget. which is being spawned client side in the player controller.
it works on first spawn, but only if i offer a delay long enough to allow the pawn to spawn. ive tried on posses but thats server side so it fails to build the widgets, because the server cant do that.

assuming it works on spawn like it has lately with the delay node. when i kill a pawn with another. it kills it correctly on all screens. but when it respawns, it handles that server side. so the widgets fail again.

i was spawning them in the pawn before. but the same issue with the delay was present.

i really want to do away with the delay and figure out how it wants me to spawn my widget. as its interactable and inputs commands are tied to the pawn functioning

#

@thin stratus

#

i think what im not understanding is how to get the server to run a command on a particular client.
like i need a particular client to spawn his own Widget and dispatch commands to his respective pawn.
and i know its not a multi cast, because only one person needs to do it. but the server to Client RPC doesnt seem to be doing anything. and i think its what i need.

thin stratus
#

@covert igloo BeginPlay of the PlayerController with a IsLocalPlayerController check should work

#

If you do it on BeginPlay of the Character/Pawn, then you get a problem with race conditions cause the Pawn doesn't need to have a Controller and be possessed at that point. Then you'd need to use OnPossess and run a Client RPC to target the owner of the Pawn

#

There are client functions but only in c++

#

BP multiplayer is and will always be a shitshow

twin juniper
#

im in need of help, i made a dedicated server that worked perfectly fine when i hit the join button it opened the ip address and joined. but then i added the steam advanced sessions plugins to the build so i could connect it to steam, and now it wont join at all, do i need to create a session? and then join session? idk what happened

covert igloo
thin stratus
#

It should though :P

thin stratus
twin juniper
twin juniper
old sequoia
#

If I set an actor's NetDormancy to be DORM_DormantAll in the constructor, is it still guaranteed to be created on the client and send the initial bunch if it's relevant?

covert igloo
near granite
twin juniper
#

so now the client is finding the server, but doesnt join it

thin stratus
#

I haven't looked into it or followed it but iirc it had to do with not being able to join sessions

noble sentinel
#

I need my jumpscare blueprint work on only player who seen and caught by monster, so I need to connect the nodes here, right or am I doing it wrong? I cant find a way to connect them.

#

Targeting only seen player make that function only for that player right?

twin juniper
noble sentinel
#

I managed to make it work recently

twin juniper
twin juniper
#

im trying to make a server and client build for when i buy a 3rd party server to install my server build on for clients to connect to.

noble sentinel
twin juniper
noble sentinel
#

Maybe this can help too, its for dedicated ones

twin juniper
#

if im not mistaken

noble sentinel
twin juniper
surreal plaza
#

Is there a way, when PIE, to spawn an addition client to simulate join in progress?

rancid atlas
#

Literally just started testing out multiplayer for the first time

#

I set it so there is two players! The client does not have a playable character. How do I place a character and set it so the client possesses that character?

frail barn
#

Top-Down example movement dont work at Multiplayer

Standalone and Listen Server is working fine.
But, for a Client, there’s a bug.

Move to is stopped immediately, when it starts.
2 days trying to fix it, trying all i can imagine, same results.
Any ideas?

steady cape
#

Quick question. Is AController::OnPossess called on both server and owning client?

meager raptor
thin stratus
#

Only Server

steady cape
#

So, I guess, if I needed both, I, in addition to overriding AController::OnPossess, also need to override AController::AcknowledgePossession, or is there more conventional way to do it?

meager raptor
#

Hi everyone, I'm looking for some recommendation regarding an AWS EC2 instance. I'm currently using a t3.small instance but I think I'm a bit cpu bottleneck. In the Unreal documentation they talk about the G4 family with enabled gpu. Is there any current recommendation on how to approach this? Or should I just pick an overkill server then downgrade from there ?

solar stirrup
#

How's a UObject's outer replicated? As in, if I call UObject::Rename(), how does one replicate that outer change to clients?

solar stirrup
#

seems like they are not

#

Rename() doesn't propagate at all

kindred widget
#

Not sure about the new system. But UObjects are normally replicated via an array that was ran through the ReplicateSubobjects function.

#

I mean. Not really an array so much as any pointer you write to the channel in that.

solar stirrup
#

Outer isn't replicated, i'm using the new system

#

It'll replicate the subobject fine but the Outer won't change on the client

#

It's fine though, I can easily catch a rename clientside and do it manually

#

super useful for this, works fine

ember vine
#

@twin juniper steam is a pain with UE and pretty buggy, would reccomend taking alot of time to research how steam actually works with sessions etc. because it is really complex

#

it's difficult to digest in one day even if you've been a steam gamer for like 15 years

#

there's a few ways to integrate aswell, you can use steam advanced sesssions, roll your own, use the steam OSS or use the new OnlineServices thing aswell

abstract pike
#

Does anyone know what might cause this?

formal solar
#

Eror is fatal

snow temple
#

i have an issue, this bp needs to be replicated to all but not only if its server, i need it replicated to all (if client and server)

abstract pike
#

and then the server will send to all

snow temple
#

ty

snow temple
jovial charm
#

Hey guys what is the best place to put code for a Loot system? Basically I want one central loot manager on the server, and all the items are instantiated via this loot manager.

#

I was thinking of implementing it in GameMode, but then how will clients request items since they dont have access to GameMode?

abstract pike
#

from that event

#

Call a multicast

hushed rain
#

On Component Begin Overlap runs on all clients/server correct?

short arrow
snow temple
#

also now the client message is not appearing at all

#

also also i did try different combinations, tampering with the server sides, all leading to nothing

fossil spoke
#

Its important to understand that something on the Client triggering an Overlap, does not mean that it will automatically trigger that same overlap on the Server.

#

The Servers version of that object must trigger its own overlap.

#

And visa versa

#

For example, a Player Character, due to discrepancies in Accuracy, could end up causing an Overlap on the Client but not on the Server if they were to push into and back out of a Collision Component that would cause the Overlap in a single frame.

#

The Server, because it might be running at a lower tick rate or didnt receive the network update from the Client that had the discrete move that would cause it to simulate the exact same action, might end up missing the Overlap.

#

Generally its safe to assume for the most part that it will happen on both sides.

hushed rain
#

Thank you for the thorough explanation.

jovial charm
dark edge
#

Like, when is the item in the chest? Is it ever in the chest, or does interacting with the chest just directly give the item?

quasi tide
#

Hmm - for some reason, my client side enhanced input is not working. I'm adding it in AcknowledgePossession. Single player and Listen Server does work though. Can confirm that the client sees the debug message.

if (GetNetMode() != NM_DedicatedServer)
    {
        if (auto* System = ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(GetLocalPlayer()))
        {
            auto* ControlledPlayer = CastChecked<APlayerCharacter>(P);
            if (!ControlledPlayer->GetInputMapping().IsNull())
            {
                System->AddMappingContext(ControlledPlayer->GetInputMapping().LoadSynchronous(), 0);
                GEngine->AddOnScreenDebugMessage(-1, 2.0f, FColor::Yellow, "Set up input");
            }
        }
    }
mortal mica
quasi tide
#

Yeah. It shows that the status is Playing

#

I am at a loss here on what is going on.

#

I believe it is registering the server's local player somehow. But I just cannot figure out how.

mortal mica
quasi tide
#

100%

mortal mica
#

should say in yellow text Context: <yourcontextmapping>

quasi tide
#

I even have a debug message that shows

mortal mica
#

I'm doing it a bit different, just sending an RPC from the server's OnPossessedBy

#

but it works fine

quasi tide
#

I even tried overriding OnRep_Pawn

mortal mica
#
void ADerelictCharacter::PossessedBy(AController* NewController)
{
    Super::PossessedBy(NewController);

    ClientOnPossessedBy(NewController);    
}

void ADerelictCharacter::UnPossessed()
{
    ClientOnUnPossessedBy(Controller);

    Super::UnPossessed();
}

void ADerelictCharacter::ClientOnPossessedBy_Implementation(AController* NewController)
{
    if (const APlayerController* PlayerController = Cast<APlayerController>(NewController))
    {
        if (UEnhancedInputLocalPlayerSubsystem* Subsystem = ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(PlayerController->GetLocalPlayer()))
        {
            Subsystem->AddMappingContext(DefaultMappingContext, 0);
        }
    }
}

void ADerelictCharacter::ClientOnUnPossessedBy_Implementation(AController* OldController)
{
    if (const APlayerController* PlayerController = Cast<APlayerController>(OldController))
    {
        if (UEnhancedInputLocalPlayerSubsystem* Subsystem = ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(PlayerController->GetLocalPlayer()))
        {
            Subsystem->RemoveMappingContext(DefaultMappingContext);
        }
    }
}
#

try something like that, it's only gonna take a minute and you can discard something else 🙂

#

maybet GetLocalPlayer() doesnt return the same thing than Controller->GetLocalPlayer()

quasi tide
#

Did you test this in a live networked scenario? Because that's the only time it doesn't work for me.

mortal mica
#

yeah

#

last night i was playtesting with a friend

#

worked just fine

thin stratus
#

Soooo, ReplicationConditions, right? If a Client OWNS an Actor, he's still a SimulatedProxy for that Actor, right? Unless it's the Pawn and potentially random other actors?

#

So if I want a value to not replicate to the Owner, I have to actively use "SkipOwner" and not "SimulatedOnly", right?

#

A Component on the Character would however be able to use SimulatedOnly, cause it probably uses the same Role as the Character, which would be Autonomous when possessed, right?
So on Possessed Pawns, SkipOwner and SimulatedOnly results in the same behavior, or? Just double checking that I'm not losing it over here :D

thin stratus
#

Thanks. Wonder why Owner is not enough and they needed the extra role.

#

Random assumption is that you can't replicate WeakPtrs cause the system wouldn't really be happy about the actor being GCd?

#

Haven't really put much thought into WeakObjPtr replication

prisma snow
#

Or maybe WeakPtrs don't support pointer replication (which requires net ids etc) in the same way as raw UPROPERTY pointers do

tired mortar
#

Hi guys, does exist an event that is fired before a RepNotify function when a new player joins the server?
For example: an int (with RepNotify) is changed in the server, then a new player joins in and the RepNotify is immediately called, does exists an event that fires before this? BeginPlay is not enough, it's fired after that...

ornate crescent
#

hey guys, i have perfomance/use question abount networking packets.
I have TCP socket and listen data from this TCP, right now i have behaviour to split the data array in differents packets.
This packets, are UObject.... my question is... is any problem about to create one UObject per packet? is this a problem about GC and possible memory leak?

#

is this a good approach or is better user UStruct?

latent heart
#

I'm not sure why you'd use the u-system for something that low level at all...?

#

Why are you using uobjects or ustructs in the first place?

ornate crescent
#

because this UObject contain the data array and methods to "read" this data on types (int, string, float,... )

latent heart
#

And why is that a uobject?

#

Or is it an engine class?

#

You could, for instance, use the json object converter to convert to/from ustructs which container your data.

#

Might be a little too much random garbage syntax with json, though, I guess.

ornate crescent
#

so... is a problem right?

#

maybe better use UStruct?

latent heart
#

But using a uobject per packet seems a very bad idea.

ornate crescent
#

i'm creating a Server for a Multiplayer games. So client received packets (array of data) and we have handler for each specify packet id

#

and we want to process the data array on the gamethread, and need to read this packet to convert to variables type like int, fstring, etc

latent heart
#

None of this requires a uobject so far.

#

Or a UStruct, but go on.

ornate crescent
#

but go on? ok, good advice

latent heart
#

I mean, tell us more.

coarse patrol
#

Hlo guys i have simple issue in using SetActorLocation
i set the actor location in playercontroller and run in widget by casting
Server works fyn
but in client it just teleports to origin after i drag

latent heart
#

Don't screenshot code. Copy+paste the text.

coarse patrol
wooden abyss
#

Hello, i have a question regarding PlayerStates. I'm working on implementing an experience/level system in my coop game and I was using the SaveGame to keep track of the experience and the GameInstance holds the SaveGame. Now in a coop game I want other players to know what level the players are. But those are saved in the GameInstance. How would I be able to add this info to the PlayerState when my client joins a lobby? Cause the PlayerState is created on the server and replicated to clients in a multiplayer scenario, right? I'm not quite sure how to deal with that right now

latent heart
#

Just add the experience level to the player state and mark it as replicated.

#

Or is your problem that your clients have their own experience level which they need to tell the server about?

wooden abyss
#

I dont have a server that keeps hold of all the users

latent heart
#

Just send an RPC when you connect. PostLogin or whatever.

#

But this is massively open to hacking.

wooden abyss
#

It's mostly a singleplayer game with coop options and i dont really care about hacking/cheating

#

If this is fun for someone go ahead

latent heart
#

Fair enough!

#

I like that approach.

wooden abyss
#

I know its a problem or might be but thats how i think about that 😄

#

So I would just send an rpc from the client controller to the server telling it experience/level and the server than sets it for the playerstate? sounds easy enough 😅

latent heart
#

Yup

wooden abyss
#

Alright not sure how I could miss that 😂

#

Thanks @latent heart !

latent heart
#

np

vague fractal
#

Can we still use something like UGameplayStatics::OpenLevelBySoftObjectPtr when we'd want to do something like GetWorld()->ServerTravel(...)/GetWorld()->SeamlessTravel(...) ?
I would just want to use the first one due to being able to use a variable of type TSoftObjectPtr<UWorld> to select the world rather than using error prone strings

latent heart
#

SoftPtr.GetName() -> your string

vague fractal
#

That sounds less error prone :D

rancid atlas
#

How do I make each client spawn as a different character?

quasi tide
#

I cannot, for the life of me, figure out why on Earth my clients - in a live networked scenario, input is not being processed. I have tried registering the context mapping in AcknowledgePossession in the player controller. I have tried doing it in OnRep_Pawn in the controller. I have tried doing a reliable client RPC to register it. What in tarnations is happening here.

#

I have confirmed that the local player subsystem has the input mapping context as well. I checked through one of the methods in the local player subsystem.

quasi tide
thin stratus
#

What is your input mode?

#

Set that on tick to game only and see if it fixes it

#

If it does then you gotta get that under control

#

@quasi tide

quasi tide
#

Should be Game only. I can try and force it to be Game when I set the context in AcknowledgePossession

thin stratus
#

I would set it on tick to confirm

#

Cause if anything sets it differently afterwards you would still have the issue

#

There isn't more to EnhancedInput than adding the Mapping to the Local Subsystem and binding the Actions.

quasi tide
#

That was it Cedric. When they were joining, I wasn't returning back to Game

thin stratus
#

If you can see the inputs in ShowDebug EnhancedInput then you should be good on the context side of things

quasi tide
thin stratus
#

Small suggestion

#

In your base PlayerController

#

The one you use for everything

#

Add a HandleInputMode function and call that on tick.

#

Use some conditions to figure out if you need GameOnly or UIOnly

#

You can gate it with a custom enum you have as a member var so it only calls when the input mode is different from current

#

Epic does it that way

#

And it ensures you have only one single place you set it

#

Condition example would be if the Menu is visible

#

Or check if CommonUI handles this for you maybe

#

Worst thing you can do is change input mode in random places

quasi tide
#

I haven't even touched CommonUI yet 😅

rocky kestrel
#

I have call event interact in car after pressing F in player. If I connect "self" to that rpc is it server or client who pressed F?

#

Before that delay 0.2 is Pressed F key event in player

#

This is on car. I want to set that interacting Character to be player who pressed F

quasi tide
placid flame
#

does anyone can help me replicating a nickname, I have the system but it use to fail. Some players get the wrong nickname when joining.

I have a replicated variable and I use two events, one in the server and multicast to replicate the variable, I see that I should use the onlogin event from the game mode and the player state, but I'm not sure how.

winged badger
#

You can just SetPlayerName via GameMode i think

#

And let UE do its thing

quiet fjord
#

guys I have a problem someone how to replicate an animation with root motion that is inside a blend space

thin stratus
thin stratus
#

I know RootMotion based AnimMontages work fine with the character movement component. Same does RootMotionSources for faking it.

#

Animation Graph stuff it think one usually fakes this

#

Basically doing what Epic did for that MOBA game they had

quiet fjord
#

I've already read that's because I'm setting up a motion stop with inertia that carries the animation but it turns out that with the root motion it doesn't get the information

thin stratus
#

I think a lot of the stuff they did on that is by now standard in the Engine

quiet fjord
#

then of course I will have to mount it with a multicast and montage

thin stratus
#

I can't really picture how that would work tbh

#

Epic faked a lot of the start stop Anim stuff with math

winged badger
#

iirc root motion animations ran by gameplay task component run pretty well

thin stratus
#

But that's a montage or not

#

An actual Anim graph setup with e.g. a Walk Blendspace is something else

winged badger
#

montage

thin stratus
#

Yeah montages work fine

quiet fjord
thin stratus
#

I stick with the idea that non-montage anims, so StateMachine AnimBlueprint, Blendspace stuff isn't really working for multiplayer with RootMotion. Since you want the Movement to drive the anims and not other way round