#multiplayer

1 messages · Page 66 of 1

thin stratus
#

If you only need ListenServers to respond then ClientServersOnly is fine. The time it takes for Clients is more or less a faked duration. It just asked every PC in the LAN via Broadcast IP if they are hosting and it waits a bit for a response. Online sessions would either way take a bit of time due to having to send a package to the masterserver and receiving an answer.

strange apex
#

ahh, I see..
by any chance you know of some good Forums / Tutorials for movement in C++

thin stratus
#

I already said the pinned messages have something

strange apex
dire tusk
#

sorry passed out lol I swear I seen that option but I'm not finding it Actor > Skeletal Mesh Comp > ? or skeletal mesh > ?
Found It: VisibilityBasedAnimTickOption

What would be the opposite of that? for the future. If the thing is left alone wouldn't the tick need to 'refresh' to where it should be?
But I have all that all set already with repNotifiy and setting the anim position to where it should be.

twin juniper
#

hello

#

i have a problem

woeful ferry
twin juniper
#

ok sry

#

this is my blue print but my ai won't stop running

#

plead

#

pleas help me

thin stratus
#
  1. You aren't playing any Montage.
  2. Unless this is a different language, the word is spelled "Death" for the function as well as "bIsDead" for the variable.
  3. StopMovementImmediately only sets the Velocity (and maybe some other stuff) to Zero, so you need to also stop the Behavior Tree.
  4. You should utilize the Boolean you created to block the Damage function from calling your Death event more than once. Or probably best to simply check the boolean at the start of the Death function.
twin juniper
#

oh sry ok

latent heart
#

Also you should probably check if the health is <= zero AFTER it takes damage, not before.

#

(Also 'health')

thin stratus
#

Right, I didn't even register that

#

haha

latent heart
thin stratus
#

That's the inverse "the the"

#

Thanks :P

latent heart
#

🙂

twin juniper
#

#

I do not understand that

shrewd reef
#

Is it permitted to discuss methods for anti-cheat here? I know discord TOS prevents servers from allowing some topics, many of which revolve around cheating or hacking in games. Obviously, any discussion should be limited to not divulge information which could be directly used by someone trying to cheat or hack... but can we discuss methods for preventing things? Or even just discuss the scope of vulnerabilities in certain implementations?

thin stratus
#

I wouldn't see why not at this point

uncut atlas
#

is the oss updatesession call broken for anyone else in v5.1? mines makes sessions disappear. client can find the session when created, but when updated using the exact same settings the client can no longer find the session. i think epic broke updating sessions.

verbal tendon
#

Very crass over-generalization. Don't put me up on the Via Appia 😂

thin stratus
shrewd reef
ebon nimbus
#

Anyone know of good notes/documentation for getting playfab setup in ue5?

primal spoke
ebon nimbus
#

No.

thin stratus
lunar fox
#

When you're doing a hard/absolute travel to a new server for the first time, how on earth can you stop the client from flashing some weird view from 0,0,0 for a split second

I can't even figure out a way to cover it up with a loading screen or something, I guess I don't understand what the client is actually seeing at that point. It seems like they are able to see the level before their PlayerController even fires BeginPlay.

For instance, I thought I'd fade out from my main menu to black, and then fade in after client has connected to server. But I can't figure out somewhere early enough on the client side to hook in and the black screen / fade in starts too late

There's no delay I'm aware of for the GameMode spawning the client, and I have "Start players as spectators" off

thin stratus
#

What you can do to cover this up is to implement your own CameraManager

#

PlayerCameraManager that is

#

And to handle the case where the PlayerController has no Character as ViewTarget

#

by e.g. showing some global camera that shows the map

#

If you don't have such a camera and you just want to hide it then showing a proper Loadingscreen that you only remove once the player has a local character possessed would be an option

lunar fox
#

Thanks I'm glad I'm not crazy 😄 I've had a difficult time trying to figure out what was going on but I figured there must be something like the temp/fake PlayerController. I will look into the PlayerCameraManager (I know there are Camera Fade options also)

How would you suggest go about the latter- triggering a loading screen from the very first moment that temp/fake PlayerController is active though? I guess what class am I sticking this code in to start would be super helpful

thin stratus
#

I usually trigger Loading Screens when leaving the prev level

lunar fox
# thin stratus I usually trigger Loading Screens when leaving the prev level

Is there a class for this or something though that doesn't get destroyed on a hard travel? I've tried adding a full screen widget (fading to black) when leaving main menu and it must just get wiped out on the transition when opening connection to server

There's not a dedicated class for loading screens I'm ignorant of is there? Thanks again

uncut atlas
thin stratus
uncut atlas
#

idk if its because i'm using universal dev app id 480

thin stratus
#

All loading screens I added were done via GameInstance, binding to PreLoadMap or whatever it is called and using the Movie Player module that has a Slate Widget param.

thin stratus
uncut atlas
#

riparoonie. thnx for response!

lunar fox
thin stratus
#

GameInstance doesn't have bindings for it, but GI survives the travel so you can bind to those delegates on init

#

Think they are FCoreDelegates or so

#

Also I don't know if there is something better by now

#

Stuff like this sometimes silently improves

tender gale
#

This could potentially fit in #cpp so let me know and I can move there,

I'm currently looking at replicating an array and being able to see what objects were added/removed since the last rep

Header

UFUNCTION()
void OnRep_ActionSets(TArray<ULyraExperienceActionSet*> oldActionSets);

UPROPERTY(ReplicatedUsing=OnRep_ActionSets)
TArray<ULyraExperienceActionSet*> ActionSets;

Cpp

void UActionSetManagerComponent::OnRep_ActionSets(TArray<ULyraExperienceActionSet*> oldActionSets)
{
    // What is the best method to compare two arrays to figure out what objects were added/removed?
}
#

I can just do multiple for loops to check if one array contains the objects in the other and get a list semi-well that way, but I'm not sure if there are better methods or if I should take a different approach overall

#

To give some context. The server can request to load ActionSets (list of Game Feature Actions), which need to be replicated to the clients and get loaded

fossil spoke
#

@tender gale Look into Fast Arrays, they have convenience functions for just this issue.

#

Second link is probably more digestible.

tender gale
#

Oh perfect! I’ll take a look at it now thanks

#

Can it hold object pointers as well, or just structs?

fossil spoke
#

They can hold anything, they are like a regular Vector. However they only support replication for POD and Unreal types (UObjects, UStructs, etc etc).

#

Just to be clear, for UObjects, that same Object must exist on the Client and it be "Net Addressable" for the pointer to be appropriately resolved on the Client.

#

If you have a bunch of predefined (via an asset container somewhere) things that you want Clients to receive from the Server, instead of trying to address them in a dynamic way, you could instead tell the Client in which asset to find them (since the Server and Client would both have the container asset) and pass along an identifier for which one to use, performing a lookup on that asset.

magic helm
half umbra
#

Hi, can i replicated variables in Widgets? Or better put this variables to Actor Components and then use Rep Notify to update in Widgets?

magic helm
half umbra
#

I use set timer by event, an if i put variables in actor component then I need create many Set Timers by events

tender gale
half umbra
#

I have this widget 20x

magic helm
half umbra
#

Users can add many widgets from array in Actor Component, and in widget are Cooldown (float variables) and there is Timer what have connected Cooldown to Time. Cooldown variable must be replicated. Sorry for English 😁

#

Does anyone have a hint how I can solve this without creating multiple Timers in Actor Component

magic helm
#

Ah gotcha, thought you were forcibly updating the replicated variable with timers. Yeah that's totally fine honestly if it's like 20 timers

#

You could do the timer route or have a management component that handles the replication for all of the start times and just calculates the difference every tick, and if it exceeds a certain amount then remove that value(signalling that timer ended)

half umbra
magic helm
#

So then you'll only have one component ticking but it's still updating the widgets

magic helm
half umbra
#

So, Timer will be still in Widget, and I create reference to Component in this widget and get variable

#

Yes? 😅

magic helm
#

No, I wouldn't even put the timer in the widget. General practice with UI is to have it be REACTIVE, and not driving gameplay features

#

Because UI goes through LOTS of iteration it's easier to decouple that functionality

half umbra
magic helm
# half umbra I guess I don't understand it a bit, from what I know, I would have to create a ...
  1. Create an actor component, this will have the timer and the replicated variables
  2. When the replicated variable changes and you need to update the widget, have the actor component TELL the widget it's new value to use
  3. Timer completes on the actor component and tells the widget to update based on that.

Yes you will have a timer for each widget, your getting hung up on that which is not proven to be a bottleneck

half umbra
magic helm
#

In what way?

half umbra
#

And not automatic

magic helm
#

Your confusing it like there is one component handling ALL of the widgets

#

You would put one component to handle the replication and the timer for one widget.

#

The optimized way is to use one management component to handle the replication and would not use timers and instead tick and update those values for all the widgets(I have already said how to do this btw)

#

So for each actor that you want to have this automatic replicate with, you would add the component(which handle creating the widget for that actor and it's corresponding timer). At this point I have repeated the same thing multiple different ways

half umbra
#

Wait, but each widget has different cooldown

magic helm
#

Different cool down time? If so you can just set that on the component and it will propagate to the widget

half umbra
#

So I need create component for each widget?

#

This is something new for me, sorry if I don't understand 😅

kindred widget
#

@half umbraI think it's worth asking. What is this widget for? Why does it need a cooldown timer?

unborn parcel
#

In the multiplayer programming quick start (https://docs.unrealengine.com/5.0/en-US/multiplayer-programming-quick-start-for-unreal-engine/), the collision delegation AddDynamic for a projectile is wrapped around a check for GetLocalRole() == ROLE_Authority, is there any reason why we do this instead of just using AddUniqueDynamic besides not giving other characters the authority to add delegates? just curious as to whether there's a major multiplayer principle behind this

half umbra
kindred widget
# half umbra I have skills that the player can use, I have created 1 Widget that is created f...

There is a core fundamental to UI practice. UI is meant to display gameplay state and enable input into gameplay state.

Putting a cooldown timer on a widget is storing gameplay state on the UI, not the gameplay object. Your widget should simply by given a pointer to the skill or to the component that has the skill with a tag or some way to look up the skill.

The widget itself should tick, and update itself based on what it can read from that skill or component.

The component itself or the skill itself should have a cooldown set up somehow. I personally prefer just storing a single float at use of the current game time and letting other functions look that up to determine cooldown and whether the ability can be used. Timers are harder to work with for savegame stuff and also cost tick time to update something that can just be a written state.

half umbra
#

What's wrong with setting the replicated Float (Cooldown) variable once in the component and getting that value in the Widget where is also used Timer?

#

Ok timer in widget is bad, right

#

Now, I don't really know how to do it properly, I rather know that I can create a separate Timer and variable (repnotify) for each skill and call functions to update the value that is in the widget

magic helm
half umbra
#

But how to make it so that there is only 1 Timer that supports many skills is no longer possible, you can create a Timer Handle (Array) variable for the Timer, but this Timer will only tick for one widget anyway

dark edge
#

You don't need to replicate a number ticking down

#

Unless you intend skill cooldowns to be chunky and not smooth

half umbra
#

Without a visual example in BP, I will not understand it, I am a visual person. The skill has a timer that shows the time left, it must be updated as long as the timer is active

dark edge
#

What do you intend to see visually, something smoothly updating like WoW?

half umbra
#

What do you think about this?

dark edge
#

You're basically ticking at this point, just tick

#

Where does this code live?

half umbra
#

I know, but if will be False then will be updating widget Counter progress bar etc, if cooldown Array will be empty then will stop ticking

#

i need change smooth progress bar or something

dark edge
#

Then throw that timer out and use tick. This is in the UI right?

half umbra
#

nope, this is in component

dark edge
#

Why do you have an array of cooldowns? You doing some SOA type thing?

half umbra
#

this is example, instead of Cooldown array will structure array, where i have many other things what are should replicated

#

If you have any good suggestions, please write, i like learn

half umbra
red pollen
#

When I launch a dedicated server, is there a node I can find in blueprint to find dedicated servers that are currently running, like you can with sessions?

hollow bridge
#

Is there a way to get a list of relevant players for an actor?

sinful tree
drifting heath
#

Since a dedi doesn't have graphics/animations, how can I reliably get the position a weapon in a player's hand at the time it fires? I can't trust the clients, because clients lie and could fire in any direction they want.

#

Essentially the issue I'm having is firing a projectile from a weapon is going straight into the ground, because the mesh isn't animating on the server, AKA it isn't pointing forward.

dark edge
#

You aren't guaranteed to have the same as clients tho

drifting heath
#

Think I found it; GetMesh()->VisibilityBasedAnimTickOption... Thank you, giving it a ...shot.

drifting heath
#

It works, fault was on my stupidity. I was getting some client/server functions mixed up, and the server version was never being invoked. The VisibilityBasedAnimTickOption worked.

hollow swallow
#

Im on my first project. Is it easier to use root motion or no root motion for a multiplayer game?

dark edge
#

What's the gameplay?

hollow swallow
#

rpg survival sort of game

#

got all my inventory and equipping items working nice. now to start with animations and making attacks etc xD

thin stratus
#

Depends on the style I guess, but I usually recommend a mixture of it. RootMotion for Attacks and one time AnimMontage should be fine and the CMC takes care of them as good as possible.

But for the AnimBP I usually use normal anims and let the CMC handle movement naturally.

If you need start/stop Anim behavior etc. You can have a look at what Paragon did in the past. Lots of that stuff is now simpler to setup in ue5

fluid prawn
#

Does anyone have experience networking Collision Meshes for movement? Is that viable or is it standard to just use multiple primitive components to approximate a Static mesh shape for a vehicle (Plane Tank etc). I'm curious how AAA do it; If you add a moving vehicle with a different mesh shape, if you don't use a collision mesh then you'd have to do a custom set of primitive colliders to best fit then shape and re net code it again?

I think but not sure are collision meshes designed for networking or are they tied only for physics engine to simulate rigid body collision which is a nightmare in networking (Indeterministic). Otherwise for networking the only way is to use a set of primitives with the physics engine to sweep ahead of movement for collision or overlaps then handle/resolve movement in a deterministic way (Slide against wall etc..).

silent valley
fluid prawn
#

Convex hull might be too expensive and I am unsure how good sweeping or if sweeping is even possible with a convex hull. If sweeping does I am curious how to handle Movement Resolution to be net coded later on? So the other option is to wrap the mesh with simple primitives (Capsule, Box sphere etc) Sweep them all together and use some kind of dead reckoning to sweep ahead of movement and then handle the collision resolution and net code it that way.

#

This is why I am a bit curious if anyone has had experience doing custom tight colliders for different shapes and net coding the movement for it.

silent valley
dim sundial
#

I remember there is a learning example talking about bulb switch, loot box in multiplayer, I just can't find it, if you know it, please tell me?

#

I set number of players to 3 with net mode "play as listen server", and two are playing niagara but one is not. do you know why?

fluid prawn
# silent valley Yeah I mean that's a hugely complicated topic, and usually very game specific. R...

Unreal physics allows welding of primitive colliders to get collision resolution done for you, with a little C++ work I think its possible to sync the physics and game thread results to replicate it in a deterministic and perform proper network prediction. That Ideally is a good solution if you wanna just weld primitives and let the engine handle the resolution for you. I might try that later down the road.

unkempt current
#

@kindred widget Thank you for the response, I sort of had a guess that nobody could really help me as I have provided way to limited information for such a large topic. I guess learning about the development tools available would be very helpful, as I can measure the data and basically work with that.

#

Thank you very much! I have seen and know about both performance profiling and also the replication systems, but haven't seen the sever optimizations! Thanks for the links! I really appreciate it! 🙂

high ibex
#

hello, this is a actor and in take damage, i simply put if health is less than zero, destroy .. it's working fine in server and standalone but in client, it wont destroy or it is getting destroyed i presume ( as i can pass through the actor - no collision) but mesh remains in level .. what can i do ? thanks for answers

thin stratus
high ibex
lunar fox
# lunar fox When you're doing a hard/absolute travel to a new server for the first time, how...

Here's some resources for anyone wanting to do this
https://michaeljcole.github.io/wiki.unrealengine.com/Loading_Screen/
https://nerivec.github.io/old-ue4-wiki/pages/global-fade-in-out.html

Was able to get the effect I wanted pretty easily using that fade setup and the bindings on GameInstance. Triggering the fade-out is actually done from PlayerController with a matching delay before calling Open level since PreLoadMap wasn't occuring early enough

silent valley
# fluid prawn Unreal physics allows welding of primitive colliders to get collision resolution...

I admire your optimism and wish you the best of luck!
But please don't think of it as a 'little work' it's a huge huge task and the details of how you handle latency and collision conflicts is where the devil lies. Your game design needs to embrace the limitations.

All depends on your game and desired user experience of course. This is a good talk into the networked physics of Rocket League: https://www.youtube.com/watch?v=ueEmiDM94IE

frank phoenix
#

is there a way to open source code project in the standalone editor without conversion etc. ? I am looking for a better way to collaborate with artists in our Multiplayer / dedicated server setup - so they dont need to download the whole source and compile etc.

silent valley
frank phoenix
#

Thanks for pointing in the right direction, will have a look into both ugs and installed builds

twin juniper
#

I want to load different map when I launch game as a server and client, how can I achieve this?

unborn parcel
graceful viper
#

Anyone here recommend any tutorials for unreal engine multiplayer? (Actual recommendations, not just a random pinned message you've never read)

quasi tide
#

If you haven't read the network compendium - you're doin' it wrong

#

Which is a pinned message

graceful viper
#

I'll give it a try

graceful viper
quasi tide
#

Well you should

#

It's not like pinned messages are pinned because they are fancy wordings.

#

They are typically solid answers to common problems/questions

glad escarp
#

Hey smart people. Any local multiplayer gurus out there know the best practice for retrieving local player controllers? I'm trying to set up my drop in/out multiplayer and HUD but it's acting wonky.

graceful viper
graceful flame
#

Both are pinned messages just hidden away near the bottom of the list.

glad escarp
#

So it seems that no matter which player controller index I use to set input mode and show mouse cursor on, it changes those variables for all of my local player controllers.

red pollen
#

Getting this when attempting to create a session via a dedicated server. I am doing it thru blueprint.
I understand why, but don't know the solution? Dedi server has no player state :/ Anybody created an online session at the start of Dedi turning on? Or this is only done via cpp

#

I'm trying to find a solution, apparently I can create a Dummy Controller but this fails as it doesn't have a Network ID. Would I be able to manually assign a Network ID? The next solution is to create a client game instance that joins the server, which then creates the session. Not sure about this tho...

#

Why is it so hard to create a session that can be found in a server browser hahaha

#

wow

graceful flame
cosmic yew
#

Started next part in this course that jumps into multiplayer, but having trouble producing same results.
https://prnt.sc/YAdHrWJP4Wvq
https://prnt.sc/SwOea40p-tkh
https://prnt.sc/unKhEo5-vpUO
https://prnt.sc/xVOWIif1RJJ9

Double checked if static mesh was replicated as well in the Blueprint. Not sure if that matters.

Lightshot

Captured with Lightshot

Lightshot

Captured with Lightshot

Lightshot

Captured with Lightshot

Lightshot

Captured with Lightshot

glad escarp
# graceful flame

Thanks. I'll try this. I'm not sure it'll fix my issue though. I'm able to retrieve my controllers from an array I made in my GameMode but trying to set input mode to UI only when player join causes all of the local controllers to switch modes. It's wierd

graceful flame
#

GameMode is server only

#

GameState is on both server and client

#

If you ever find yourself not sure if its the server or client executing the blueprint you can always pick a node and place a breakpoint on it (F9), then as you step through the logic (F10) it shows in large yellow text which net mode the process is currently on while debugging in the top right corner of the graph.

glad escarp
graceful flame
#

So you made an array of controllers in the game mode right?

glad escarp
#

They should be using different local controllers because I used CreateLocalPlayer to create additional local players for each joining controller

graceful flame
#

I don't know enough about split screen to help, sorry.

#

It's like multiplayer, but not.

glad escarp
#

No worries. Thanks anyway. This splitscreen stuff is wierd.

peak notch
#

Guys is this a good practice to code like this for setting variables on client and on server and also avoiding the value to be changed by the client on the serverside too?

quasi tide
#

Generally you'd use an OnRep.

#
  1. Client ask server to change a variable
  2. Server changes variable
  3. Unreal replicates this back to the client
#

This is the general flow.

#

For some fairly rudimentary prediction, you can also change it on the client as well. Then ask the server to change it.

dark edge
peak notch
#

i heard that OnRep has a bit delay and that events are instant currently i'm doing it this way

i use sequence set it on client and further code to follow and on the next pin i set it on server

dark edge
#

well

#

that's not the way to think about it

peak notch
quasi tide
#

Onrep is stateful - that is the important piece.

dark edge
#

it should be derived right?

#

if you haven't done anything in a while LOCALLY, you're idle

peak notch
#

the way i am setting my movement i generally need to know if the player is idle or not and to not check the velocity of the character pawn again and again im using onidlevariable

peak notch
#

for example i want the variable of sprint to only be true if the player is moving and not standing idle and pressing the sprint button

peak notch
#

here

#

since i heard that you should never pass values in the on server events

quasi tide
#

Eh - it's fine. Can be a security risk, sure. But it's fine in a lot of scenarios

peak notch
#

i see

quasi tide
#

Is it possible for someone to be jumping and sliding?

#

What about jumping and sprinting?

#

Or any kind of those combinations?

#

Because this is ripe for a state machine.

peak notch
#

thats for jumping

#

basically when a player jumps the idle is false

#

and as soon s he lands and not moving the idle is true again

peak notch
quasi tide
#

Not sure why you can't just do it the way practically every game does it in Unreal, but this approach is a maintenance nightmare.

#

Having each "state" be a bool, then you having to go through and manually turn off other ones is highly prone to error.

#

And absolute garbage when you want to add more states.

quasi tide
#

You're coding like it is 1993

#

And even that's being generous most likely

peak notch
quasi tide
#

I'm not even talkin' about security concerns at this point.

peak notch
quasi tide
#

Just your displayed architecture is quite poor.

quasi tide
#

The way you're doing it, yes, it can work. It's just....poor practice in most cases.

#

Having a bool every once in awhile to represent a simple state is fine.

peak notch
#

i am not talking about anim state machine i am talking about what is the way to do it properly in the character pawn for movement

#

as this code is for movement character pawn

quasi tide
#

Just...move the pawn

#

If you want to do states, create a state machine and separate states.

#

Some people like using something like Logic Driver to help with this.

dark edge
quasi tide
#

(It's a plugin)

thin stratus
#

fwiw ue5 has the state tree too

quasi tide
#

I don't know if the ST would be applicable in this scenario. This looks to be for the player specifically.

thin stratus
#

The boolean sure look strange

#

If at all an enum

peak notch
#

guys guys i think you misunderstood me and especially with the State in the name is misleading let me describe again

quasi tide
#

It is, indeed.

thin stratus
quasi tide
#

Just handling the back n' forth between player and ST might be a bit wonky. Haven't tried in the context of player though.

thin stratus
#

Also the Character (not Pawn) already covers some of those bools

#

Such as Jumping

quasi tide
#

@thin stratus Hmm - after a little thought, I think I might know how to work with ST in the context of a state machine for the player. Still think it is a little wonky, but meh.

peak notch
#

this is my movement code i am using the State word not for animation statemachine stuff its basically me using it for character's state like lets say in which stance the player is idle running, sprinting etc

quasi tide
#

We know.

#

This is a logic state machine

peak notch
#

i am using boolean varaibles so i can set the speed differently for running and sprinting

quasi tide
#

State machines aren't exclusive to animation

thin stratus
#

xD the 3 RPCs

#

Absolute chaos

#

If that works for you, sure go with it

peak notch
peak notch
#

for example that same code decreased to just this with all those rpcs not needed

thin stratus
#

I mean, one thing we've been saying or asking is if there is a need for all the booleans

#

If you want to communicate the "state", and only one of those can be true, then you could use an enum

peak notch
#

yeah i can use enums i tried that months ago but i think i faced an issue somewhere when setting states and never used it so i guess i can use enums as that will be cleaner and efficent

thin stratus
#

On top of that, if this is a Character, then some of those things can be retrieved from the CharacterMovementComponent

#

Overall, 100% correct Movement Code in Multiplayer in UE requires C++ anyway, so if you do it in BPs there is no real right way anyway

peak notch
#

i will use enums sa i will need these states so i can change player speed if the player is running or sprinting etc

peak notch
#

ig whatever works but its good to be cleaner and efficient ig

thin stratus
#

The thing is, the "Idle" part for example is kinda redundant. If you want to know if the player is idling, you can get the Velocity or Acceleration and check if it's 0.0

peak notch
thin stratus
#

fwiw there is also the option for a bitmask

#

Not sure how to create them in BPs

#

Might just be a checkbox in the enum

#

Then you can still select multiple if ever needed, but it's based on an enum

peak notch
#

oh ok thanks for the info

lunar fox
#

Trying to make a GameModeBase where I capture some parameters from the connecting clients FString& Options and use this to adjust some things on the character that gets spawned for them

I see the options available as inputs in InitNewPlayer, PreLogin, and Login

But I'm confused on where best to capture these, and how to store these options for when the player should be spawned. The spawning usually happens on HandleStartingNewPlayer_Implementation, right?

So do I need to cache those optional parameters ? Maybe with a key of UniqueNetID and then look them up again in spawning function? Thanks for any advice 🙂

graceful flame
# peak notch oh ok thanks for the info

An important thing to remember when working with multiplayer is that player inputs (keyboard, mouse, hand held controller...etc) are coming from the client not the server. They must be "uploaded" to the server via RPC (Remote Procedural Call aka run on server event) because the server doesn't know about that event happening because the client is running their own simulation of the game using the server's replicated variables to represent other player characters and updating world actors.

Whereas when you're dealing with an overlap or hit event between two actors then the server and client both run the code (if the actors exist on the server and client). So in other words you wouldn't have to use an RPC because you can just check with Switch Has Authority to separate server and client logic.

peak notch
graceful flame
#

Another thing I find very helpful with multiplayer is to make use of breakpoints. Not only does it help with general debugging variables and logic flow but it also tells you if the current blueprint execution path is server or client side with big yellow text in the top right corner.

peak notch
#

i just realized using Enum i don't have to set the enum for player moving stances idle,running,sprinting etc inside an Rpc i just need the logic of all those stances in an RPC and the code is working as intended and replicated even if when printing the enum values on the server its not what it is on the client however nothing wrong is happening

tender gale
peak notch
#

like i dont need Rpcs for some reason but only for the logic of sprinting aka the set walk speed stuff

spare orbit
#

hello, I need to make a door that only certain players can pass (is a mesh of a door and a box collider that acts as an invisible door that doesn't allow the player to go through). But when I use the "Set Collision Response to Channel" (of the player capsule) on a server RPC (I implement the RPC on the playercharacterBP) only the server gets updated and doesn't replicate with the player client's capsule. Then I see that the capsule can be marked as "Component Replicates" but my client still doesn't update. Any ideas on what it could be? thank you

graceful viper
spare orbit
graceful viper
#

thanks

rugged rune
# spare orbit hello, I need to make a door that only certain players can pass (is a mesh of a ...

Only variables marked for replication will be replicated. In the case of a collider, the collision response is not replicated. 'Component Replicates' is just a switch to enable/disbale replication for the whole component.
You might want to try adding your own replicated variable on the player to represent whether or not they can pass through the door, and in the OnRep function, manually call SetCollisionResponseToChannel on their collider. Then you just change the variable from your server RPC.

spare orbit
fossil stratus
#

I'm noticing some weird behaviour or something i dont quite get about the "Is Locally Controlled" node on ListenServers. In this example i just wanna create some widgets in my character at begin play, In this case since its a listen server the server itself also has a player that he controls locally but for some reason the server will never realize this immediately in my case but eventually not realiable but most of the times after a short delay. since its not reliable (also tried with higher delays still not reliable) and the server will run trough the begin play on every client too i really dont wanna loop trough this or anything till he eventually gets it.

I would enjoy some insights if someone does know what goes on behind the scenes or if theres a another/better way to catch the call from the ListenServers local pawn.

fossil spoke
#

@fossil stratus BeginPlay is called to early for Pawns to be able to resolve their PlayerController (which is what tells them if they are Locally Controlled).

#

You will probably want to use a different setup method.

#

Are you using UE5?

fossil stratus
#

5.1

fossil spoke
#

Pawns have a function you can override in Blueprint that tells you when they were "Restarted"

#

This is what you want to use instead of BeginPlay in most cases.

fossil stratus
#

that sounds awesome , I should look into override functions more often! thank you I will directly give it a try

#

works like a charm, i really hate using delays to fix these things 😄

torpid tree
#

hey guys can anyone tell how to edit skeletal mesh

low niche
#

Ok so an update to help those who will face same issue as me, I narrowed down my problem of server RPC not being fired from client owned actor, it turns out it is world partition related and the same BP won't work in world partition maps only ( tested with 2 maps) unless playing as listen server then everything works.
If I want to make it work in dedicated server setup I need to set the BP 'Is Spatially Loaded' to False , I tried using streaming source component on Characters but couldn't get it to work.
I also have a strange issue in which making RPC Reliable in some area make it not fire!? It should be the other way around.

thin stratus
hollow swallow
#

Where is the best place to have my player stats for a multiplayer game?

agile loom
regal grail
#

Hey, search is failing me. Is the AdvancedSessions AdvancedSteamSessions still a go-to option. Or is using some form of EOS or other EOS plugins(such as EOS Online Subsystem) the recommended path nowadays?
I know a lot has changed in last year and most things I am seeing is older than a year.

lunar fox
ancient adder
#

Can you replicate material ref? or are they like widgets and only exists on client?

round mist
sick egret
#

Hey guys!
What is the proper way for clients to notice that another client has joined the session? AGameStateBase::PlayerArray has no OnRep function that I can bind to.

vivid sonnet
#

Hi guys can anyone share any insight on why this happens:

*On begin play the ball is spawned in the wrong location on the client but correct in server.
*The ball will snap to the position when it's interacted with.

The spawn in wrong location thing doesn't happen if simulate physics is off...

Actor and component replicates, as evidenced by movement after initial contact with the ball.

old sequoia
#

Hi.
I'd like to replicate a property with the condition "COND_InitialOnlyOrSkipOwner".
In other words - I'd like the property to always replicate the initial value and then skip Owner for future updates.
This condition does not exist right now.
Is there any way to add this replication behaviour without modifying the engine?

sick egret
dusky perch
#

Hi, my actor is replicated, but when I execute 'Explode Now', it runs, but 'Explode Server' does not.
What could be the reason?
I am executing it from another non replicated actor.

thin stratus
#

If your Actors sits in the middle of the Map it is usually not Client owned, and also shouldn't (also to make it Client owned you need to be on the Server to begin with).

dusky perch
#

Thank you, I think I understand the solution.

#

Let me try.

thin stratus
#

If you need to perform a ServerRPC, you need a Client owned Actor or tunnel it through one

#

E.g. PlayerController

dusky perch
#

Working now thank you!

quasi tide
dim sundial
#

I am making trails in multiplayer game. I call set active on niagara component, it worked. Now I try to use gameplaycue, how to do that?

#

i have set up the gameplaycue tag, and call execute gameplaycuewithparams on owner, but it didn't work

graceful viper
thin stratus
#

The one that was linked

#

It sits on an ftp. The website just links to it

#

I still would want the blog to be the pinned message for obvious reasons, BUT the new version of the compendium will be a website on its own anyway

#

Whenever I find the time to finish it

graceful viper
#

Progress going decent though (slide 27) hopefully it doesn't just "jump" in complexity too the point where I can't put 2 and 2 together

trim kindle
#

What would you suggest for (FPS) multi seat vehicles like tanks? One player drives the vehicle, the other one controls the turret.

Should the turret be a separate actor, so that its controlling player can be its owner and replicate the input via server RPC within the turret?

#

Alternatively, I could probably set the turrent rotation locally, send to rotation the to the server via PC/Pawn RPC and set it also on the server. But it does not feel very self-contained.

dark edge
trim kindle
#

Just an actor which is not possessed

#

atm the driver char is set as the owner

#

so that the driver can replicate the input easily within the vehicle

#

but as there is only a single owner allowed, the shooter is not able to replicate anything

graceful viper
quasi tide
#

Yeah

#

Wouldn't make much sense to read the compendium for UE and then go off and practice in Flax or something, lol

graceful viper
quasi tide
#

Literally just make extremely small games.

#

Get 2 people connected. Introduce packet loss.

#

Ignore fancy graphics.

#

The advice is always going to be the same. Make very simple games.

#

Note - a wave based shooter is not a "very simple game"

#

Then do this many many times

graceful viper
#

Introduce packet loss?

quasi tide
#

To try and simulate lag

graceful viper
#

Ic

#

I'll keep it in mind

quasi tide
#

Make a super simple collecting game. But networked.

#

Then learn how AI functions on the network.

#

Then learn how to do items.

prisma snow
graceful viper
#

True

prisma snow
#

eventually you'll run into issues and then you'll read the corresponding pages and you will learn for real

#

it's the only way to really learn imho

quasi tide
#

Once you do these pretty small things. Then combine 'em and make a wave based shooter

#

(if you want that is)

#

But seriously, do small things

dark edge
#

Start with a physics based voxel MMO

quasi tide
#

BP only at that!

graceful viper
#

Hmm idk what I wanna make tbh I just want to learn so I can get a job

#

Godot is my hobby coding

quasi tide
#

Yeah - that ain't how the real world works.

hoary spear
#

Without an aim, we get nowhere

dark edge
quasi tide
#

You need to prove that you can do it.

dark edge
#

nobody will give you a job because you can make a pretty single player shooter. Do something new.

quasi tide
#

Doesn't have to be something new

graceful viper
#

Alright

quasi tide
#

But it can't be "trust me bro" either.

#

You just need something tangible

dark edge
#

Yeah maybe not new but that at least demonstrates the ability to do something beyond a dude that can walk around and look and make bullets pop out of a gun

quasi tide
#

Just claiming you can code will get you nowhere

dark edge
#

Think of a hard problem and try to do it in games. My hard problem is graph simulations.

quasi tide
prisma snow
graceful viper
#

I was thinking about making some random indie game, maybe something like muck

quasi tide
#

Especially if it is networked

dark edge
prisma snow
#

ye usually network adds like 50% more work, or even more

dark edge
#

If it was a bunch of asset and feature packs stitched together maybe not so much.

graceful viper
#

Should I try practicing before I read the entire pdf? Or just focus on reading

quasi tide
#

assets are fine if you're trying to demonstrate programming chops.

#

Code plugins not so much

dark edge
#

the part i linked you at

thin stratus
#

The PDF covers the basics more or less. I would suggest you at least read it once

graceful viper
#

Also is anyone able to like send a pdf of the compendium? I can't install it on iOS and my data is pretty bad on the bus

thin stratus
#

Wouldn't that be a problem either way if your data is bad?

#

Website should be fixed again fwiw

#

Freaking Digital Ocean

graceful viper
dark edge
#

Just have something you want to do, then try to do it.

prisma snow
graceful viper
#

Oh I can access it with no internet, cool

quasi tide
dark edge
thin stratus
#

It's fine. but WordPress and its mysql database stuff always breaks on it. And I googled for it and they all have the same issue and no real solution, at least none that sticks.
I even got a stronger droplet

dark edge
#

it was looking like it was gonna take a week on my el cheapo instance so I flexxed it up to max cores and ram and it did it in a few minutes.

thin stratus
#

I will just move it over to hetzner eventually

dark edge
#

but if I had forgotten to flex it back down that woulda been expensive. Ended up costing me like 5 dollars in the end.

quasi tide
#

Don't think I've heard of hetzner

quasi tide
#

Or was this in the before times?

dark edge
thin stratus
#

Hetzer Online is a German company

#

They are doing this for quite some time, 1997 or so

#

And they are quite big by now

#

We have every other server on there by now

#

Just not my private blog

#

Think they have a Wordpress setup for 2€

#

So they are even cheaper in total than DI

#

+- diskspace, but the additional diskspace on DI compared to Hetzner was also cheaper (on Hetzner side)

#

My wife moved all the servers so I have no overview. But that's at least what I see on the bank statements :D

dark edge
#

looks like it's actually Ashburn VA but still close enough

regal grail
livid holly
#

is there a delegate that allow us to react whenever our game net mode changes? As in, if I'm Standalone in a menu and then I join a server and become Client, is there a way to get alerted to that?

hoary spear
#

reading through the docs, I wondered how accurate this was
Does the server really tell clients to do vfx? Can't the client just do the vfx locally based on the bullet being spawned? So its just one server->client event, and not 2 (or more)?

hoary spear
#

but if you do, you can skip step 4, right?

#

and handle it locally

dark edge
#

If you have the bullet being spawned or the gun being fired on all machines then sure handle it locally

hoary spear
#

just seems excessive to send that aswell

dark edge
#

In more milsim games the bullet doesn't exist anywhere but server since you can't exactly see a real bullet

hoary spear
#

but i guess if step 3 doesnt happen, then step 4 must be done from server i guess

#

yeah, ok gotcha

dark edge
#

Projectiles are tricky. Nothing feels worse than hitting on your machine but missing on server

hoary spear
#

True that! Glad i dont have to handle it 😄

gloomy flare
#

Hey quick question guys I set up the new enhanced input system it appears to be working for my client side but not for my host / server anyone run into this issue

kindred widget
#

How are you adding context mappings?

gloomy flare
#

scratch that i think I just had to add a delay

#

and it works fine now

#

seemed to be maybe it was just firing to quickly and didn't give the server a chance to start maybe?

kindred widget
# gloomy flare seemed to be maybe it was just firing to quickly and didn't give the server a ch...

The pawn won't have a controller at spawn on the server, because beginplay is often ran before possession call.

But that isn't the real issue. Your issue is that you're adding context mappings to the controller from a pawn.

Pawn is not a control handling class. It just receives inputs. Your PlayerController should probably be handing this kind of stuff as it is the control handling class housing your input stack.

kindred widget
gloomy flare
gloomy flare
kindred widget
# gloomy flare yeah probably new to BP but to my understanding should be using interfaces for m...

That isn't an optimization. Interface events are actually runtime slower than a cast. The slow part of a blueprint cast is it's validity check, which you are also doing after that interface event.

Casting is effectively free, there is no runtime cost for it. The only cost for casting is that when you have a cast node, you need to have that object loaded into memory when an instance of this class exists.

Unreal runs by loading CDOs. These are Class Default Objects. To spawn an actor or create an actor component, or construct a new UObject, you need a CDO. This is a base class that acts like a template that Unreal can copy to instantiate a new instance of that class. Putting a cast node to a PlayerController in a Pawn class is free. Player controller is 100% always loaded, so there's no downside here.

Generally the reason people avoid casting is because they do not follow basic principals by putting code in correct classes. You should have a layer of code only classes that most of your game can work with. It shouldn't matter if these are always loaded as code only classes are basically nothing in size. But people cast to characters like bosses in their character pawn and that boss has heavy meshes and materials and sounds. And then only use said boss in one level. But now said boss is now loaded in every level that the player's pawn is.

But here's the thing. It isn't the cast node that does this, but hard pointers and hard class references. These are the light blue type variables and purple variables. Any time any of those exist in your blueprint, these cause this memory connection requiring the other thing's CDO to be loaded. This random variables, function arguments and function returns. Both of which also apply to interface functions.

#

Interfaces are largely pointless outside of patching logic you cannot inherit. Interfaces are best used to make different things do majorly different things based on the same thing.

Example of this is a player's input pressing F and expecting a lightswitch to turn on a light, but also expecting it to start dialog with an NPC, to mount a horse, or to pick up an item.

gloomy flare
#

so esentially instead of where I would be using interfaces I can just use Cast system for the most part and save myself the time

kindred widget
#

For a lot of things, casting it pretty standard.

#

Mainly the reason to avoid it is to avoid loading unused assets. But that is just about making a code class layer and avoiding loading assets on that class, but having inheritors from it that inherit functions you'd call on their parent. And this also brings in soft class references to use.

hollow eagle
#

Also worth noting that the whole "loading" bit is completely irrelevant to casts on the C++ side of things because all C++ classes are always loaded. It's only an issue for blueprints casting to blueprint types (and it's not exclusive to casting, it applies to any node where you "hardcode" a class parameter).

quasi tide
#

Do note - in multiplayer, whenever you are "solving" a timing problem with a Delay node, that is a poor solution and ripe for breakage in a real-world situation.

kindred widget
#

Yeah. I mentioned that above. 😄 Any sort of hard pointer or class reference relating to any variable or function parameter or argument. 😄

gloomy flare
#

damn really appreciate all the feedback new to the engine, everything I Was hearing was casting is the devil

#

lol

quasi tide
#

Because someone popularized it and everyone relies on YT tutorials. And then most of those YT tutorials are just regurgitating what some other YT tutorial says. All the while most of them not actually releasing games.

gloomy flare
#

😄

quasi tide
#

Another note - this is true for pretty much every engine.

#

Not unique to UE

kindred widget
#

There's also reddit posts about it. Like one really popular google search is some crier was complaining that he inherited a mess of a project and was now the only person left on it and blamed 100% of it on casting use.

twin juniper
#

(i've looked at the FNetGUIDCache warning and seen that it fires because the mesh isn't replicated, but i do not understand why the player movement warning would only fire when standing on other meshes)

gloomy flare
#

dunno when it goes into account for casting but i feel like maybe i won't hit the threshold

#

and good to know now I need to put my movement in my PC and make the reference the spawned pawn.

kindred widget
#

I think I ran into that problem a while ago locally creating ISM components. Don't remember the fix for it though but it's basically just that your object isn't net addressable. Might just need to replicate the component and then have the client do the generation.

kindred widget
quasi tide
#

I do my mapping context in my PC's possession call.

kindred widget
#

I know Lyra just does them from their experience sets. You just get a blob of mapping contexts at the start of the game.

gloomy flare
kindred widget
#

Pretty much the same way. Just move your Beginplay stuff from the Pawn to the Controller. Same identical call, you just don't need the GetController part cause you'll be in the controller itself.

gloomy flare
#

i'm gonna ask a real noob question here, is it better to keep all your code on one eventgraph, or split it up between each function, and is there any performance impact for that

kindred widget
quasi tide
#

I like to separate my graphs into server/client graphs.

#

So all server events would be in server graph. All client events would be in client graph.

#

Then the default graph is just setup stuff mostly.

#

Only if there are multiple events mind you. So if there are like one or two, meh, I don't care.

prisma snow
torpid whale
#

ITs posible made all replicances in Blueprints or is necesary C++ ?

dark edge
obtuse field
#

I'm trying to call PrintTest from server. UBlock is a component that inherit from UActorComponent. Actor which spawns the component is set to replicate, as well as function that spawns the component is setting it to be replicated. What else might I be doing wrong?

fossil spoke
#

@obtuse field You dont show us where PrintTest is called?

#

.....

#

Show us the code mate... lol

#

Where its called.

#

If its not being called anywhere in code, then of course it wont be called.

obtuse field
#
void UBioProgrammer::BlockTick(const float& DeltaTime, UChunkBuildingComponent* ChunkBuildingComponentReference)
{
    Super::BlockTick(DeltaTime, ChunkBuildingComponentReference);

    if(IsRunningDedicatedServer())
    {
        PrintTest();
    }
    //    UKismetSystemLibrary::PrintString(GetWorld(), "ABC");
}

Its called here

fossil spoke
#

Did you breakpoint that line?

obtuse field
#

Which is called every tick

#

W8

#

For some reason, it started working now...

#

Idk

#

I've been trying to debug it for like 30 mins, and now it decided to work, lol

hushed heart
#

Hello! A bit of a weird question, I'm still a little novice in a few areas, and so I'm not sure if this is related to multiplayer, but I suspect so. I've been in the nightmarish process of trying to make my first test build with my dedicated server model game, and following the steps. I finally have the client and server solutions built and client and server cooked. However hwen trying to run dev client through VS, I've hit a hurdle immediately, in that the UI widget isn't spawning. I have it added to the viewport by the player controller on begin play, and it works in the editor as a Client, so I'm not sure where I might start debugging this. If anyone has a suggestion, that'd be great please. Thank you!

abstract pike
#

@fathom aspen Can I just say thank you so much for your compendium. I had an issue today related to travel that I was stuck on and needed to get it fixed for a looming deadline and it was so easy to find the info I needed in your compendium 😍

fathom aspen
#

Glad to hear that it helped and that info are easy to find 😄

graceful spoke
#

Hi question, so if I wanted to implement a turn based mechanic in a multiplayer game, that logic should be implemented in the game state and not the game mode right because the state of the turns needs to be shared across the clients as well?

dark edge
#

state in gamestate and logic in gamemode is sometimes how its done

low helm
#

Dedicated servers don't have widgets at all

plush crow
#

Hi guys, do you have any tips on how to make my client to be able to interact with 3D UMGs? so far only the server can interact with the 3D UMGs. 😵‍💫

tender gale
latent heart
#

Widget components?

graceful spoke
# dark edge Yeah GameState / GameMode can get a bit blurry

sorry quick follow up question but for example if i had a series of phases for each player like move and action phases, would it be wise to store those as custom variables in a playerstate? or is that unneccesary because i can just keep track of that in the gamestate already?

dark edge
#

It'd look something like

GamePhase:
Player PlayerWhosTurnItIs
E_TurnPhaseEnum TurnPhase

And everyone can locally use this in an OnRep to set state

#

It'd be something like
OnRep_GamePhase -> branch on PlayerWhosTurnItIs (check if local player, etc) -> switch on PhaseEnum -> etc etc

graceful spoke
#

So i guess i had another question regarding like the purpose of usage of playerstate implementation and when to use it aside instead of storing information in the gamestate. Like if my player had stats, i would store that in playerstate right?

dark edge
#

Turn based game for an indie multiplayer game is a good idea. I wish I had a good turn-based game idea

#

it's much much much easier than live action and that's easier than FAST live action

graceful spoke
dark edge
#

Start by sketching out your functions.

The main function for your GameMode / GameState will be GoToNextPhase or whatever. That's where all the logic for what to do next will live.

#

and don't multicast anything rn

#

use OnRep

graceful spoke
#

okay thank you so much!

plush crow
tender gale
#

As in a widget component?

plush crow
#

yeah

#

it's wierd that when running in standalone, the widgets are clickable but function only works well on server side. not on clients. but when running on PIE, I can't even click the widgets both side tho I can hover on them.

pallid mesa
#

is there a simple way to set simulated proxy's character mesh relative location? The cmc keeps overriding it 🙄 I guess I do have to override something in the cmc

deep coral
#

how do you set up a dedicated server on aws? is there a template?

hushed heart
hushed heart
# dark edge show your code

Yep! Just got to my PC again, sorry. This is the entire thing, actually, as it's just the PlayerController for a super barebones frontend, which I intended to be used for connecting to the server. It's probably something really silly I'm missing:

dark edge
#

standalone might pass IsServer

#

i know it passes Authority

hushed heart
#

I should note that this works with the editor set to Client is well! In case that makes a difference

#

I can try it though!

dark edge
#

when you fire up t he game, it's standalone

hushed heart
#

Ah right, I thought you might have meant PIE set to Net Mode Standalone blobsmilesweat I shall try it now. Thanks!

dark edge
#

There's really not much use for IsServer IMO, I use IsDedicatedServer and HasAuthority

hushed heart
#

I'll take that into account, thank you! How do you tend to do your checks in code? Do you use GetNetMode()?

#

And ah unfortunately that didn't seem to change things! But I'll quickly try something.

hushed heart
hushed heart
#

Ah wait, cool, looks like the answer is "with any change in editor" because after cooking content, it works! Thank you!

elfin copper
#

Question in the same topic guys, how do I check if it's the server/client from within another class other than the player character?
I'm trying, and it's not working:
if (PlayerCharacter->GetLocalRole() < ROLE_Authority)
Couldn't get HasAuthority to work either

ionic turret
#

Hello guys, i need someone pretty skillfull with multiplayer systems, i m full of doubts

prisma snow
shy nymph
#

Hey guys, you know when you boot up the game in PIE as a client there is this inital camera thats just at (0,0,0) halfway in the ground before the player posses a pawn

I'm trying to learn how to replace that, I kinda got to the LocalPlayerClass but the documentation is very light, can someone help me on this?

native cave
agile loom
shy nymph
#

the player start only sets where the pawn will spawn but the issue happens before

ruby parrot
#

This is triggering(even on client it spams "Hello" - given i hit a or d ), but the Client cant move, server can. why could that be?! :S

ruby parrot
#

and this is in PlayerController:

ruby parrot
unreal crow
#

Hey. So im trying to use EOS, and everything for these widgets works well, but when I package the project, it no longer sends the player to the designated location. Also online servers hosted without LAN do not show up for other networks. Im using 5.1.1.

#

I made sure to set the list of included maps.

#

Everything works in editor just fine.

agile loom
ruby parrot
agile loom
agile loom
ruby parrot
agile loom
ruby parrot
#

well he told me to do it this way, so i did 😄

#

if youre learning you hope ppl making videos show you best practice etc but obviously its the internet so everyone can make videos..the good ones and the bad ^^

agile loom
agile loom
ruby parrot
kindred widget
ruby parrot
#

Even if it would, it wouldnt be useful for my needs.

I got a main menu->Start server->clients can connect and then once the map is loaded youll get a screen of your characters on that server that you chose from. Aka I dont even have a pawn at that point only the PlayerController showing the UI with the characters and then you chose it->click "join game" and then you get a pawn

agile loom
ruby parrot
#

the thing is this IS triggering on the client, just nothing happens 😄 😄 😄

kindred widget
#

Of course it's replicating. It's spawned in the GameMode, and client has input prints.

ruby parrot
#

Setup_InputSystem is called by a PlayerControlled Run on Owning Client function, is that an issue?! does the server need to do this?!

kindred widget
#

Well, that'll probably be your issue.

#

For starts, I'd recommend not doing this in the Pawn. Pawn doesn't need to care about Context mappings. Move this to your PlayerController's Beginplay behind a IsLocalController.

ruby parrot
#

2m

#

like this eh?

kindred widget
#

Should work well.

ruby parrot
#

unfortunately not 😄

kindred widget
#

Well, no, I derped. Just realized you wouldn't be getting prints if it wasn't working. But this is still a better place for it.

ruby parrot
#

kk, keeping it here, as we get same result 😄

kindred widget
#

The character isn't stuck or anything is it? O.o

ruby parrot
#

nah lol, server can move about

kindred widget
#

What happens if you spawn it high up in the air? Does it drop?

ruby parrot
#

ah,now after the change it doesnt print hello anymore

#

it doesnt

#

server does fall

kindred widget
#

Hmm. Not dropping implies it's not possessed.

#

The CMC doesn't normally update without possession, can't remember the pathing or reason why.

ruby parrot
#

cmc=? 😄

kindred widget
#

CharacterMovementComponent.

ruby parrot
#

ah i c

#

so then we gotta get that possession right 😄

clear gate
#

Hello, does anyone know of a way to make world widget component ui's like these replicate?

kindred widget
ruby parrot
#

You say "you dont repliacte ui", correct is "you cant", correct? as in WBs cant replicate anyway?

#

im not trying to be pedantic, i just heard WBs cant, just wanna confirm 😄

clear gate
quasi tide
#

There is a simple way.

#

Replicate actor
Actor has a variable that has those values
Replicate variable
Widget gets updated based on that variable's OnRep

kindred widget
# ruby parrot You say "you dont repliacte ui", correct is "you cant", correct? as in WBs cant ...

The short answer is that no, they cannot replicate.

The long answer is that yes they could probably replicate if you did some hacky stuff and made them subobjects of an actor, and replicated them, and got around the issues of what that would entail. But even if you pass this "could" phase, you step off the ledge of "Should". It's mostly just a case that UI isn't a part of gameplay. It's a visual like a particle and should be treated as such. You don't replicate particles either, you normally replicate state on an actor and play them locally. UI follows the same ideal.

ruby parrot
#

ye, thought so 🙂 thanks for the explanation ^^

ruby parrot
#

cant be so hard that if i hit a button that i create a character that runs around 😄 😄 😄

ionic turret
clear gate
quasi tide
#

If this ain't simple to you - you've got a pretty steep hill to climb of nothing but complexity.

clear gate
#

Works 👍 I confirm the simplicity of this method

elfin copper
#

Guys:

UFUNCTION(Server, Reliable, WithValidation)
void Server_Fire();
bool Server_Fire_Validate();
void Server_Fire_Implementation();


if (IsNetMode(NM_Client))
{
     UE_LOG(LogTemp, Warning, TEXT("Client request the server to shoot"))
     Server_Fire();
}


void AWeaponBase::Server_Fire_Implementation()
{
    UE_LOG(LogTemp, Warning, TEXT("Shooting from client"))
}```

Anyone with c++ knowledge knows why the implementation is not being called? Just the first log appears
marble gazelle
elfin copper
marble gazelle
# elfin copper Can you elaborate on the fix a bit?

Well I just pointed out the potential issue. Your player is not the owner of the actor, for the rest, I suggest to have a look on the linked posts and get some more idea of the network system from unreal, or google a bit^^

red pollen
#

Hello team.
This code is failing. I get the output Player Pawn found but I do not get the Locally Controlled
I call it in blueprint here
I am running a Switch Has Authority node before this too, so I am sure it is my local player sending the info.
Anybody know what is going on?

For context, I am running a dedicated server and two clients that find and connect to the server. I then attack using one client, hitting the other.
All three are on a single PC.

#

Been stuck on this bad boy for the best part of a day. I have tried passing in a Pawn, a Controller, grabbing the Player State and working from there. I never get past the local check. I've tried with a controller and changed it to PC->isLocalController and PC->isLocalPlayerController

thin stratus
#

Is this called on the server?

red pollen
#

Client

thin stratus
#

Where do you check that?

#

Is locally controlled would only be true for the local client. Any other including the dedi server will return false

red pollen
#

The Hit Detection function calls the Process Hit within.

#

This Switch Has Authority should mean the local player right?

thin stratus
#

No

red pollen
#

ooooo

thin stratus
#

If this is a replicated actor then the server has authority

red pollen
#

No way. I think I have misread smth and taken it out of context.

#

Okay sweet.

thin stratus
#

While authority doesn't equal IsServer in all cases, it does on a replicated actor that is spawned by the server

#

If you spawn an actor locally only it would also be authority for the client but usually no one uses that node on a locally spawned actor

red pollen
#

Ah yeye that makes sense. Okay. I am looking for the client that controls this character then..

#

Nah this actor is spawned by the server for sure.

thin stratus
#

Does the tick have to call locally?

#

If this is a character then just swap the has authority with is locally controlled

#

Then you have it call locally

red pollen
#

Its part of how I am running things.
I am allowing the player to attack using a GAS input system. If they hit something, send the info to the server, rewind to the right tick etc.

#

Brilliant!

civic seal
#

Hey guys! I have neat optimized projectile system that allows for thousands of projectiles to be rendered - but I ran into a problem of networking them neatly. I had a potentially dumb idea of compressing the struct that stores the projectiles with LZ4 and hosing the clients down with it every networked tick. Seeing as LZ4 seems to have crazy compression times it seemed to me like it might work - any idea if this is dumb?

gloomy flare
#

Question, when I set my movement to flying all my collision boxes stop working is there a work around for this to enable them?

prisma snow
#

compression won't solve a badly designed system

rose egret
#

@civic seal make them deterministic and so that instead of replication location you just replicate spawn point and initial velocity

#

you can even optimize further (instead of spawning replicated projectile actor on server) keep datas on one compact struct and replicate it

sly edge
#

I'm testing local multiplayer, and I'm using 1 Keyboard and 1 Gamepad. Both are being assigned to 1st player. I turned "Skip Assigning Gamepad to Player 1" to true, and they're still both assigning to 1st player. How do I get the keyboard or gamepad to assign to player 2? I would prefer a solution using Blueprint, but I will accept any solution

eager jolt
#

how do you restart a session?
I'm tryign this but does nothing

sly edge
#

Is the event being called? If so, is the function on Game Mode being called?

eager jolt
#

yeah its when I press the button its inside of a widget

still path
#

will a display name miss-match cause an issue with replication? I noticed one of my actors fails to replicate a call to the server while being set up like many other systems, only difference is that due to how this is spawned (un-replicated dummy actor spawned locally first) the naming doesnt always match the server. IE - Server sees: Actor_0 while the Client sees: Actor_1.

low helm
#

This is a strange question. You're asking if an unreplicated actor will have trouble with replication? It won't replicate....

#

If you're spawning an actor on the server in the client separately, and you need to be able to reference them as if they're one actor, you'll need some referencing system other than display name because that won't be safe

#

I have used maps for this purpose before, where an integer key on the map points to the actor you want

still path
#

Sorry I didnt explain it very well -

I have a vehicle building editor that spawns an actor (vehicle piece) inside of a widget. The actor itself is replicated but since it is spawned inside of a widget, the event of it being spawned isnt replicated to the server. When the player makes a decision to place a component I spawn the same actor but this time using code inside of an intermediate actor that is replicated. This in turn spawns the final actor that everyone will see and interact with. This system appear to work fine for replicated movement and physical interactions, but when I try to call a server side script (run on server) it fails every time it is from a client. Trying this as the server works as expected and even allows the server to run a multi cast back to clients. Im not sure where the hickup is and I noticed that their names are miss-matched from Server to client because of the pre-spawn actor that is set to replicate but was spawned via widget so it doesnt exist everywhere.

dark edge
#

What's the idea here, visualizing a part locally first, THEN telling server to spawn it?

#

And what do you mean by the actor being spawned inside a widget?

#

Are you trying to do what I'm doing in this clip except "see" the part in 3d in the selector?

still path
#

The player needs to be able to interact with that piece to take control in this scenario

#

playing as the client

dark edge
still path
#

@dark edge Once the piece is placed - the blue piece should not be seen by everyone

limber gyro
#

does the PC exist when the "login" function is called?

#

what about the player state?

fossil spoke
#

Hence why its return type is APlayerController

#

If you are overridding Login then calling APlayerController* NewPlayerController = Super::Login(NewPlayer, InRemoteRole, Portal, Options, UniqueId, ErrorMessage); will give you the PlayerController.

limber gyro
#

i did a bit more digging and im suposed to use InitNewPlayer i belive

#

seems its not available on gamemode, only in gamemodebase

#

ummm

#

guess i will juse use the super like u suggested

#

is there any issue in this case in calling the super before the function ends?

fossil spoke
#

InitNewPlayer is Virtual

#

You can override it wherever you like

fossil spoke
limber gyro
limber gyro
#

or am i just a terrible coder

fossil spoke
#

When i said "where ever you want" I meant more like "In any derived child"

#

So thats my bad

limber gyro
#

ok so, if the function "initNewPlayer" is in gamemodebase and my gamemode is derived from gamemode then i cant override it correct

fossil spoke
#

You can override a virtual function in any child

#

Regardless of depth

#

Assuming its not marked final

limber gyro
#

yes but mygamemode is a child of GameMode not GameModeBase

#

thats my issue with overriding that function

#

i have no idea why it is not a child of gamemodebase tho, i started this project 3 years ago

fossil spoke
#

So if InitNewPlayer is a virtual function of GameModeBase and GameModeBase is the parent of GameMode then its available to be overridden.

limber gyro
#

isnt gamemodebase the child of gamemode?

fossil spoke
#

No

#

The base part of its name kind of gives that away.

limber gyro
#

🤯

fossil spoke
#

Go look at GameMode

#
UCLASS()
class ENGINE_API AGameMode : public AGameModeBase
{
limber gyro
#

ok so thats why i was so confused

#

so its login, initNewPlayer, postLogin

#

in this order?

#

right?

fossil spoke
#

Yes

limber gyro
#

so initNewPlayer returns a FString, what exactly is it returning?

fossil spoke
#

Look at the function implementation.

limber gyro
#

i was hoping u knew so i didnt have to bad_blueprint

#

i will take a look

fossil spoke
#

If everyone always gives you the answer, you wont learn how to find it yourself.

#

Especially when its an easy one to have answered just by reading the code.

#

Which, is a pretty important skill for a programmer to know how to do...

limber gyro
#

so i was taking a look at the code

#

and i found this somewhat amusing comment

#

// This is a bit odd, but there was a complex chunk of code that in the end always resulted in this, so we may as well just
// short cut it down to this. Basically we are saying spawn at 0,0,0 if we didn't find a proper player start

#

"i dont know what that code did but it always returned 0,0,0 so thats what im doing"

civic seal
# prisma snow this is very broad topic, which is the context/gameplay like? how do those proje...

@prisma snow @rose egret Making them deterministic would be difficult as some behaviors rely on randomness. Making the randomness reliably seeded would be problematic in some cases. Not to mention the fact that some behaviors rely on surroundings, which would also have to be precisely replicated. Which at the moment they are not - I try to keep it as slim as possible and a lot of my logic is culled if out of view.

The system isn't too bad, I worked on it pretty hard and I keep all of the projectile data in one place. The projectiles themselves are really complex - the game is about spellcrafting and allows players to put a dozen behavior modifiers on a spell to change how it acts.

In order to optimize rendering and get all this info into Niagara, I've managed to pack it all into arrays, but now I need to get the arrays with positions across the network.

#

During testing I relied on UPROPERTY replication which I was never going to keep - but it actually worked surprisingly well. The issue is that replication of properties tries to sleep as much as it can which is awesome but in my case it causes issues. Instead of hacking around replication I thought I might as well just compress it all and send it off.

#

I'm not opposed to seeding projectiles in principle, the issue is that the game is sandbox and the projectile behavior is impossible to predict outside of some frame inbetweening for networking purposes

thin stratus
limber gyro
#

i want to belive not even unreal devs know how the engine works and everything comes out good because of magic

#

exept u @thin stratus cause you wrote the compendium kappa

rose egret
#

@civic seal you are not supposed to have perfect projectile, anyway its multiplayer and things are different in each client, generally the real projectile in server or owning client calculates hit and damage, those in remote clients are just cosmetic.

civic seal
rose egret
#

200 projectile a frame ?

civic seal
#

Well I'm not going to send every frame obv

#

I'm thinking about maybe 24fps replication

#

the rest is interpolated

rose egret
#

200 is a lot if its replicated actor spawn, even using custom struct replication its still a lot

civic seal
#

It isn't

rose egret
#

maybe just send the fire event to client ?

civic seal
#

It's a batched system, one actor is responsible for rendering every projectile of a certain type

rose egret
#

for instance if you have 100 agents instead of replicating projectile data send RPC and simulate projectile in their client

#

I remember for my own FPS I was just sending a CastFire() RPC nothing extra

civic seal
#

Yeah thats what I'm intending to do. I was just mentioning the possibility of maybe compressing the update before sending it out. My hope was lowkey that somebody would see what I'm trying to do and be like "no you idiot, it's done this way"

#

But it's not an ordinary FPS, that's why I'm dealing with such a high volume of data - I can't really just wing it

dark edge
civic seal
dark edge
#

I mean if you make it as deterministic as possible it should still be doable

rose egret
#

@civic seal did u think of compressing data by sending relative position instead of one lots of FVector ?

#

if you have several projectile spawn, etc from one agent of a manager , you can send one FVector as origin and the rest as in16 or less relative to origin

civic seal
#

Thats some big brain shit right there. I should totally write that later. Have one master projectile responsible for most of the precision and a bunch of others close to it that piggyback off it

#

Could totally just be done as an encoding step before sending the packet out too

#

and THEN wrap it all up in an LZ4 archive kappa

rose egret
#

LZ4 is useless I think

#

UE can do compression over your packet

#

u dont need to compress them like that

civic seal
#

Well LZ4 from what I know uses a dictionary. So it would work drastically better if I hand it a bigger chunk of data

#

And its blazingly fast

#

I use it for my inventories when sending them to the cloud and it crunches some of that shit down from like 39KB to 6-7KB. Though granted it depends on how dense the data is

rose egret
#

this is better than LZ4 I guess

civic seal
#

this looks straight up arcane wtf

#

@rose egret thanks a whole bunch

#

I'm gonna give it a shot because I hate serialization actually and this looks easy to set up

prisma snow
# civic seal <@455025316633772032> <@239986541491912705> Making them deterministic would be d...

thanks for the detailed context. I understand that it's a complex setup to replicate indeed.

I'd do two things (if you haven't already):

  • Consider how necessary is to replicate exact locations of projectiles. As you mentioned on one of the comments, it might be only aesthetic? What is the worse case scenario if it is not replicated?
  • Think how much of the projectile stuff can be "precalculated". This could mean that the server performs the projectile calculations ahead of time in a single frame and sends some compact data results (initial/final position, time to reach...).

In the worse case scenario, the projectile movement is too dependent on external factors (other projectiles for example) to be precalculated and needs a relatively high precision. In that case, need to figure out a way to replicate the positions with "high" frequency. How many projectiles can happen at once?

#

Don't only worry about bandwith (which is a legit concern ofc) - consider also network jitter, dropped packets, ping/lag, etc. Also, do projectiles need to be very precise timing-wise or can you tolerate some delay?

hollow swallow
#

having an issue, every 1 / 5 times my client wont spawn, but its still calling the spawn function in the game mode, any ideas?

hushed heart
#

Hello! Me again, apologies. I have what is probably a stupid question but worth asking. I have a small project that is now seeming to work quite nicely, built on a dedicated server model. I made it initially without any further plans for it at first, mostly to see if could. However, it's quite performant and fun so I want to extend it and release it. To that effect, I just want it to be in a situation where players would be able to host and join games themselves rather than host dedicated servers myself. So my stupid question is if there's a convenient way within code I can have the client launch and connect to a dedicated server build on the machine? Or if it's worth biting the bullet and just switching to a listen-server model? I suspect it's the latter, which I'm a bit reticent to do since it always seemed to give me issues.

Thank you! No rush on this, please feel free to reply whenever, and sorry for interrupting.

hollow swallow
#

How can i trouble shoot it? this is my first project, everything was fine, didnt change anything, then suddenly having the issue today

hushed heart
torpid girder
#

hello, am i right in thinking you can't replicate a pointer

    UPROPERTY(BlueprintReadOnly, Category = ACF)
    class AACFItem* Item;

?

prisma snow
#

not sure about uobject pointers

#

actor pointers will get synced through a net id that is 32 bits iirc

torpid girder
#

LogNet: Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor BP_AI_Guard_01_C_2. Function SetMovesetActions will not be processed. so i see this warning

torpid girder
#

i think the AI doesn't have a PC or something

hollow swallow
#

was occasionally if they spawned at the same place, it wouldnt spawn one, but sometimes it would. just had to move the spawns into the air a bit

torpid girder
#

what could stop an actor from replicating from the server to the client

plush crow
#

hi guys, is there a way to get the actor who is interacting with a widget? just like how the OtherActor node is functioning in the ActorBeginOverlap. I was hoping on how to do this on a widget.

hollow swallow
#

when i kill a player, and respawn them, i was to set all their default stats back. Should i make a function in the player state to do that? that is where the stats are stored

deep shore
hollow swallow
#

I store all their stats, including current and max health. I was trying to reset their current health in there as well. Am i better keeping everything on there, except putting current health on the player?

deep shore
#

i can’t speak for your other variables but it’s hard to imagine not wanting your health variable on the character

hollow swallow
#

just thought itd be easier down the line when trying to get all of a players info at once. such as for inspecting a player, or a party system or something. This is my first project so still learning a lot

deep shore
#

player state is better for stuff like score, player name, and stuff other players might need to know about. character stats and health are better on the character themself

hollow swallow
#

also thinking that might be the go. Because im finding it hard to always access the playerstate

#

thats how im currently handling it

deep shore
#

yeah definitely put it on the character, and health should always be set on the server

hollow swallow
#

Also, what does Reliable do? one of my functions only works if its turned on, not 100% sure what it does

karmic briar
#

how would one generally handle death and respawn? im using GAS for my gameplay framework and i have the events death being called when health attribute <=0,it will called that death event and i have internal event( also blueprintinplementableevent for blueprint implementation) that do whatever like calking tiner in ui if i want a timer based respawn or button based respawn. and when that delegate is called, it will called another event called respawn and it will respawn the character..does this the way to go for this sort of setup?

old sequoia
karmic briar
# karmic briar how would one generally handle death and respawn? im using GAS for my gameplay f...

i doubt that this is the way because i saw how others respawn and death system works but i thought this is the way to do this sort of thing..

im thinking of also in death to also clear any tags event and delegeate related to gameplay effect and clear activatableabilities.items(maybe store this kind of event ina method then call this on death event flow) then in respawn i callback all of those event and initialize back the character with having another bluprintimplementableevent for designer to use....

rocky kestrel
#

I have this type of physics. (Its Helicopter) When playing on client it jitters. how to fix that.

ruby parrot
#

Lets say I have a health variable on the player character.
I am getting healed via a RunOnServer event.
Here comes my confusion/question about best practice:
Would I make the health variable RepNotify and in Health_RepNotify I would update the UI? The issue i ran into with this->Server doesnt have the UI so this currently results in errors.

Should I even RepNotify Health at all? I know about binding my HealthUI to the playerCharacters health variable, but Ive also seen that the bind basically fires once every 0.1 seconds or so?!

high lotus
high lotus
ruby parrot
high lotus
#

yeah

hushed heart
ruby parrot
# high lotus yeah

hm, that would mean i gotta have a branch for every variable of my character i guess?! 😄 like Strength,mana,health,gold,inventoryItems etc? 😄

high lotus
#

writing a networked game basically means writing 2x the code 🙂

ruby parrot
#

Yeye, just seems weird, im watching a video on the topic right now,and he does OnRep_Health as well. imma see what his solution is,but ill keep yours in mind, and if his is better ill let you know 😄

high lotus
#

this is probably node you want

polar wing
#

I've been experimenting with replicating motion warping animations and I've come up with a decent way to go about it, but unsure if this is optimal. Fortunately, the CMC's root motion handling seems to do a commendable job of replicating this decently even while using BP for setup (first time I've ever been able to get decent movement-related network results in BP). If anyone has solved this in a superior way, definitely let me know, but here's a working solution for those experimenting with similar stuff in the meantime. I mention some ways to improve the system to work with Z-axis motion warping , which seems like it needs better local prediction handling via packed movement in the CMC (or a change to allow Z-movement to be applied while walking, but gravity will need to be turned off too, so you're likely going to have to do some packed movement stuff anyway for the move to be set up correctly and avoid corrections).
https://youtu.be/SgNJc7OsZNA

A simple setup to get replicated motion warping working. It seems that local client prediction works quite well, thanks to the CMC's excellent handling of root motion tasks. Some extra notes and experiments are included in the video that touch on possible ways to improve the system, particularly when it comes to Z (vertical) root motion warping,...

▶ Play video
ruby parrot
ruby parrot
#

New "understanding" problem:
Is it correct that lets say I place a Cube in a level and then "play" the game if i would use a RunOnServer Event to destroy said cube, that it would only get destroyed on the server side, as it wasnt spawned by the Server?
In this case, how would I go about lets say chopping down trees /gathering bushes etc? Would I need to "spawn" them on the creation of the level first? that seems to be crazy 😄 😄 😄

nvm, found a tutorial for it... i tried destroying it from the actor that needs to be destroyed, wich is not allowed 🙂

violet citrus
#

hey i wanna to ask does unreal null system support voice chat ????????????/

#

in this window it is showing that unreal is using microphone but i can't hear any voice from another pc

#

i mean another instance of this game as a client

#

any solution for that??

thin stratus
#

Null Subsystem should support voice chat

#

You do have to be in a session though

#

Iirc it locally blocks the packages if you aren't

#

So if you connect via IP it won't work

#

@violet citrus

violet citrus
#

Ohh okay thanks

graceful viper
#

How will I know events are only called via the server?

#

Is the docs my only friend?

#

Oh but event take damage happens on the server and it has an icon?

#

I'm confused now

quasi tide
#

Server only events could probably use the server only icon more frequently, I agree - but really, you just need to learn it as you go.

#

Docs, reading the C++ code, etc...

graceful viper
#

Okay thanks

graceful viper
#

I don't see how this could stop someone from cheating

#

Can't the hacker just execute this event? I understand movement, but this doesn't make much sense to me

quasi tide
#

If they hack the server, sure.

#

But it's just the client telling the server to do something. In an actual game, you'd have additional checks on the server side.

#

It's just small for brevity sake.

graceful viper
#

Alright

snow hatch
#

Anyone have any ideas how to get players to go into another level toghether and wait for x amount of people to join from other servers to join into the game level kinda like a tarkov raid

solar stirrup
#

Has anyone had the pleasure of getting an error like this when replicating a uobject subobject?

LogRep: Error: ReceivedBunch: Invalid replicated field 0 in MyReplicatedSubObject_C?

EDIT: Hey if you ever get this and you so happen to replicate a struct in one of those fields, with WithNetSerializer = true as a type trait, uh, make sure you do the serialization right. Turns out i've been writing too much and not reading enough.

hollow eagle
#

Potentially forgot to register the field in GetLifetimeReplicatedProps? Not entirely sure what kind of error messages you generally get if you forget that.

solar stirrup
#

it's all registered

solar stirrup
#

re-created the blueprint and still got the same issue

#

so it's not just a corrupted blueprint

civic seal
civic seal
#

I've had testers cast spells that duplicate and had a room filled with like 500 bouncing sawblades. ⚰️ Which is exactly the kind of insanity I want to be the attraction.

#

Sorry we're still on this btw, I already know the things I'm going to try out for this based on earlier convo - I spent a couple days working on optimizing beam-based spells :>

dark edge
#

You should just sync control state and add force on tick

#

also you'll need to mess with your physics replication settings. they are very strict out of the box and will result in a lot of hard snaps

#

Client:
Input -> send controls to server, server sets replicated variables.

Everyone:
Tick -> use replicated variables to determine forces -> add forces and torques

#

You should be adding force every frame. Right now you're adding force every time you get an RPC, which is not necessarily every frame

solar stirrup
#

It does replicate the properties fine in the bunch, but then it continues in the function and reads the updated properties again?

low helm
#

Need refresher on getting my control pitch for FPS game sent to other clients

solar stirrup
prisma snow
prisma snow
#

have you read Glenn Fiddler's articles on physics replication? I think it is a good starting point to understand the common solutions and pitfalls that this kind of problems present

rough kernel
#

random question about replication, if i want to use RPC to replicate property change, in the case of join in progress / actors becoming relevant, are those spawned actors for the client using all default class values? if so what would be a good way of getting their current server values to that client? i was thinking of having a client->server RPC with a reference to that newly relevant actor, then sending server->client RPC with the actual values back for the client to set

would this be a decent approach? are there other options? i want to use native property replication as little as possible due to the fairly large datasets i have to replicate

#

so far ive tried that approach and it works at smaller scales (3 clients w/ each 500 member array of stuff to replicate, one member handled per frame) but because all of the RPCs have to be reliable it seems like a recipe for disaster at scale, idk

unreal crow
#

Can anyone provide me with a good walkthrough or text documentation of how to use multiplayer? I need to package and test UE5 projects but currently I'm struggling with figuring out public servers.

keen axle
#

Hi, question, is it possible to spawn AI that is simulated on the client and then from that client replicated to server and then to other clients? Like client behaves as authority?

#

I have several scenarios where this cannot be avoided, therefore i will need to do it in this was. Car AI works similar was for GTA V i believe

low helm
#

Smoothsync will allow the owning client to move the object with authority

hushed heart
#

I haven't tested it, but I remember reading and did a quick search, have you tried setting this in the gettlifetimereplicatedprops?
DOREPLIFETIME_CONDITION_NOTIFY(Class, Array, COND_, REPNOTIFY_Always)
Namely that last bit

#

No worries! Here's hoping.

#

Oh, I have a question myself actually, for anyone that's around. I'm not used to working with Listen Servers, all my experience is with Dedicated Servers, and I'm in the process of switching a small project of mine from Dedicated to Listen. However, I'm finding a couple of issues that occur only on the listen server. The one I can't seem to figure out is that my pawn, which I move only on through a server-only RPC right now (I'll optimise it later I swear) using AddMovementInput moves increeeedibly slowly, to the point of almost not moving at all. Movement is set to replicate. I'm not really sure what or why this might be going on, and regular clients work perfectly. If anyone has any idea as to where to start digging , please give me a poke! Happy to provide more information if needed.

rocky kestrel
#

Is this correct way to do physics (helikopter). I'm making dedicated server game.

dark edge
abstract pike
#

Is there a way to queue repnotify events to happen only after begin play?

hushed heart
dark edge
low helm
abstract pike
#

I keep having replicated variables arrive before begin play and then fail because something wasn't ready and so I'm definitely interested in a robust way to handle these things

low helm
#

I'm sure the C++ nerds have a more performant approach

#

And I'm not exactly sure which type of failure you're having here

#

but this will solve a certain type

#

On clients, the "creation time" would be as soon as the object becomes net relevant, so it's common for poorly written ONREPS to wrongfully fire every time a replicated actor comes into range of a player

abstract pike
#

Ah right, but that doesn't really help for variables than only replicate once because if it is too early then it never gets run

#

Yea I'm just using a retry timer at this point but it seems like a miserable thing to have to do for anything that might replicate before begin play is called on client

short void
#

I am having trouble setting a win condition...

From a local player controller, I cast to the GameState to run an RPC
The RPC is set to run on server
The RPCs only function is to update a Bool variable "game over"

My problem is, the server can call this RPC, but the clients cannot... I cant figure out why

dark edge
#

You need to do your RPC through something the client owns

#

like the PlayerController

#

But then any client can say it's game over whenever they want

#

The server should detect when the game over and set the bool. Not just recieve the bool from a player.

#

What's your win condition?

#

or game over condition?

short void
#

the win condition is doing a set number of laps around a track... which is working perfectly fine right up until the cast, so a random PC cannot win unless they complete the required distance

First screenshot is installed on my Player Controller, 2nd is on my GameState

The RaceEnded? set with notify only works if the server initiates the RPC

#

So essentially, a client owned Player Controller can go through this code, and the "Winner" widget pops up on their screen, but if the Server owned Player Controller does it after, they also get the "Winner" widget...

If the Server owned Player Controller initiates the RPC, the Race Ended? variable gets marked as true, and the client calls the "Race Winner Already Determined" print string.

low helm
#

so whichever occurs second, will just not go

#

Anybody know why this "Camera Shake" node which "does not replicate" is definitely replicating, when the server shoots, it shakes the camera of nearby clients also

#

Guess it needs this one instead

#

solved

stray badger
#

Why cant I spawn a blueprint from the level blueprint and replicate things correctly to the clients. I assume its because the level blueprint doesn't have the correct authority?

low helm
#

post a pic of what you're trying to do

#

but generally speaking the level blueprint is useless for network communication

#

GameState is preferred

vivid egret
#

Hey friends! I have been banging my head against a wall for about 7 hours. Time to see if anyone has a solution.

I have 3 computers connected via LAN. Each computer is assigned a user ID. Each computer is synced via a timer in the Game Instance. Each computer is presented with a test question and stores the answer in an array specific to that player in the Game State (AnswerArrayP1, P2, P3...). However, other computers cannot access the array!? Host can only see host, client can only see host and client, same with client 2. So in other words, host cannot see client entries, and clients can not see eachother.

I have no idea why this is happening and I have tried a billion different things. My only thought is I need to save the arrays in a custom event on the Game State, rather than casting from the interface to the game state. But when I run a custom event in Game State, everything breaks or only the host is visible on all computers. Any suggestions on how to do this? This is practically my last step before I can start collecting data for my experiment, so I am hoping to wrap this up.

prisma snow
#

I assume those are maked as replicated to begin with, right?

vivid egret
# prisma snow I assume those are maked as replicated to begin with, right?

Yeah they are marked as replicated. When the user hits a submit button on the interface, it casts to the game State, and updates the array in the gamestate with the answer they chose in the interface.

Just to be clear, each computer has the answers at the top of the screen to show what other users selected, except they aren’t retrieving values correctly presumably being a replication issue

#

I thought game states could read/write from any client, but maybe I’m wrong there

prisma snow
#

You have to RPC the client input/answer, validate in server, and update the game state array on the server. That will replicate on all clients and you can use onRep to react to the update (to update UI for exmple)

#

The RPC has to be sent by a client-owned actor

#

such as the player controller

vivid egret
hollow swallow
#

So ive made a respawn function, and a function to reset the players health. The respawn works fine, yet the reset players health on runs if its set to reliable. Is it bad to have it set as reliable? and what could cause it to only work with that?

vivid egret
hollow swallow
#

Cheers. Just wanted to check as i have both functions set up very similar and was odd that one works and one doesn't

#

Actually think i fixed it. Just had to add a 0.1 delay from resetting the players health before i respawn them

elfin copper
#

Morning! Any ideas on how to set remote role on a C++ class? Google is not helping

Client is absorbing remote function because RemoteRole is ROLE_None

#

documentation shows how to check the remote role but not set

azure hull
#

Hi. How can I achieve level change for a one player (client or server), while not disconnecting the player from the session. SeamlessTravel seems to travel everyone when server has executed it, while OpenLevel disconnects player even by adding "listen" to options.
Just having a struggle with this atm, because current level is starting to eat performance and I would like to switch game content between levels. Was using level streaming up until this point.

Or is it not possible for server to keep up with multiple levels?

hushed heart
# dark edge Set up correctly, your game should work just fine whether dedicated, listen, cli...

Apologies, I'd fallen asleep! But yes, so I've basically done something cheeky in that I've overridden the tick component in the floating pawn movement and removed the checks for client, and it replicates quite well as a result. In the pawn, I have just a button to move forwards bound to an input action:

void ATankPawn::OnInput_Thrust(const FInputActionInstance& instance)
{
    if (bIsAlive)
    {
        Thrust(instance.GetValue().Get<float>());
    }
}

Which, as a dedicated server obviously only called on the client, but now also calls on the listen-server host now. It then calls Thrust, which is an RPC replicated to the server:

void ATankPawn::Thrust_Implementation(const float amount)
{
    if (PawnMovement && HullMesh)
    {
        AddMovementInput(HullMesh->GetForwardVector(), amount * ThrustSpeed, true);
    }
}

Now, I did realise that there's no point in sending an RPC if I'm already the Authority (I'm not even sure if it matters or if it's just like calling a normal function) and I can change that, but either way the listen-server's authority pawn doesn't move. All the proxy pawns move fine on the client and server.

One thing I'm noticing is that for the authoritative pawn, AddMovementInput is called, the value is non zero, Internal_AddMovementInput gets called on the pawn, and ControlInputVector seems to be added to, but then if I try printing out LastControlInputVector on tick, it's always a zero vector

civic seal
#

So it's just a few arrays + ID array that helps Niagara keep track of whats what

elfin copper
kindred widget
elfin copper
gilded merlin
#

Hi, is there a way to bind event dispatchers before beginplay, so they would be bind before repnotify update?

elfin copper
kindred widget
#

Nice. 😄

kindred widget
faint eagle
#

What are the common events/delegates/virtual function invocations on game modes, states and sessions when server and client seamlessly travelling to a new world after starting hosting or joining a new session? I need to hide widgets when a player starts new sessions but I'm not sure where is the best place to handle this?

solemn coral
#

Hi, I have a question on how the COND_InitialOnly works. I was using it thinking that it only would replicate the component during the initial setup and the component would not replicate after that. However I am still seeing them evaluated every frame in the repgraph on insights. Does anyone know why I would to see these components continuing to be checked for replication despite them only having a single variable set to replicate as COND_InitialOnly?

fathom aspen
jolly delta
#

can we open listen server without reloading level by using open level ? i would like to open listen server on lan and let player join it trough session (like minecraft)

fathom aspen
#

Nope, at least not without a heavy engine modification

faint eagle
jolly delta
fathom aspen
#

If the listen-server is listening to connections, then connections can connect to it just fine...

jolly delta
fathom aspen
#

You go back to a standalone mode if you open level without listening, but if you want to workaround that you can start rejecting clients in PreLogin (so you're still listening to them in real-time) or maybe destroy the beacon host

lapis zinc
#

Anyone know how I can call a server event from inside a widget on a button click? I tried few different things none of them seem to be working, and from my "google research" widgets are client only so i cant call anything to the server. Any help would be much appreciated!

winged badger
#

you access the playercontroller (usually the PlayerOwner of the widget) and send an RPC through it

lapis zinc
latent heart
#

You call it on the PC. Whether you call it from the PC is irrelevant.

elfin copper
#

Guys, I don't need replication or multicast to a reload function, right? aside from the animations of course. I'm having problems updating the ammo for the clients on C++, just want to make sure that is doable without replication

hushed rain
prisma snow
#

without thinking much about it, as long as the server checks ammo when shooting any client-side hacks would be prevented

elfin copper
#

ok guys, thanks!

abstract pike
#

Does anyone happen to know what this error might indicate?

winged badger
#

Your actor was null

hushed rain
#

Is there a way to simulate networked players/characters without running extra client windows?

hollow swallow
#

So i can damage someone if im the host, but not the client. I have my damage as Check the hit, set the damage, then call a "server damage" then a "mc server damage" which takes the actual health. Have i set it up wrong?

low helm
#

Post a pic

kindred widget
low helm
#

You are multicasting damage?

hollow swallow
#

Just out at the moment. Will post some pictures when I'm back

#

I thought I was ment to mc the damage so everyone knows they have lost health

latent heart
#

No

#

That's what regular replication is for.

kindred widget
#

Generally speaking that is replication. You'll find multicasts pretty useless while learning multiplayer. There's extremely few cases where they're actually warranted for use.

hollow swallow
#

Rogey. So set health / levels and anything that changes a lot to a rep notify and scrap the mc all together

limber gyro
#

multicast is usualy usefull for visual effects i think

#

the way i have damage setup in my project is i just have the HP be a replicated var

#

when collision happens on the server from a projectile it just replicates to the client

#

the value that is

dark edge
magic helm
#

Hello, I feel like Im being dumb and forgetting. In C++ does Standalone call OnRep's? I know they wouldn't for listen servers because there is no remote connection but wanted to double check haha

latent heart
#

In BP, yes, in c++, no?

#

I think.

#

I mean, c++ will never call onreps for the "server" anyway.

magic helm
#

Right?! I feel like my memory is flawed lol

tender gale
#

It is...not very intuitive lol

latent heart
#

Sure it is.

#

There's no replication. So no OnRep. What's not intuitive? 😛

tender gale
#

Haha that's fair. I'm not sure how to explain it

Now that I understand the system it makes sense, but something about it is weird. Like it doesn't feel right to have to manually call the OnRep

latent heart
#

You could have a third method, OnChange, which is called by either the server locally or the client remotely by the OnRep... if that makes you feel better lol.

#

Kinda what I had to do in another situation where a change produced by a setter or by PostEditChangeProperties both needed to call the same update function.

magic helm
#

Yeah thats what I usually do, just dealing with memory blockage of if standalone runs the OnReps or not

twin juniper
#

Hey everyone,
trying to figure something out here. How does one go about adding Server Admins for a UE5 Steam Dedicated Server? and adding Kick/Ban commands?

hollow swallow
#

When placing an ocean water body, it sinks my island into the ground and the water is really high up, i cant seem to lower it at all

formal solar
#

Hi guys, I have a little trouble understanding how game mode and game state interact.

I understand game mode is not replicated to clients whereas game state is.

Does this mean I do not need to set replicate flag to variables inside game state? Or do I still need to set this flag? I assume the latter.

I also assume having replicate flag on variables in game mode will do nothing, or possibly cause errors.

Can I change a game state variable in my game mode, using blueprint communication? Or does this technically count as trying to change a replicated variable inside the game mode, and the logic will be ignored? I suspect this is the problem I am running into that is giving me null errors.

#

If this latter point is as I suspect, could I bypass the issue by calling an event/interface/function in my game state from my game mode, and set the variables inside the game state?

latent heart
#

Anything that is replicated will need the Replicated tag if you want those properties to also be replicated.

#

You can change anything on the server and, if that property is replicated and the actor/object it is on is also replicated, then the property will be replicated.

#

It doesn't matter what does the actual changes.

formal solar
#

ok, thank you.

latent heart
#

If you're trying to replicate a reference to an actor, say, that actor has to, itself, be replicated or the the client won't know what the server is referring to.

frail barn
#

i got some bugs on a Client's side, so how to get Player Index correctly?

kindred widget
frail barn
kindred widget
# dark edge Would you do a damage popup as a multicast or catch the hp diminishing in a repn...

GameplayCues are good for the damage popups if you're using GAS. Not sure how that would scale in a massive game though. Without it, I dunno. Initially I like the counting damage tags that if you hit the person again within a certain time it'll stack the damage, so OnRep would work fine for that. If you specifically want individual damage events for every single possible damage source, you'd need multicasts to avoid cases where the same replication span causes overlaps and only sends one event. Also depends on game though. Turn based game has wildly different timing constraints than a fast paced shooter or RTS.