#multiplayer
1 messages Β· Page 98 of 1
Hi, I trying to find out why the server vs client socket transform is different. Any idea ?
LogBlueprintUserMessages: [GA_HB_Class_Sec_Vomit_C_0] Server: Translation: X=6958.290 Y=3619.020 Z=223.899 Rotation: P=0.000062 Y=117.529180 R=179.999896 Scale X=0.150 Y=0.150 Z=0.150```
Location is slightly different, which is "fine"
but pitch is way different
if memory serves isnt there a tolerace? for example with your control rotation, try printing it out client and server side and see if it lines up if thats what your using to move/rotate whatever has the socket on it
well first thing is I don't want tu use Pitch control rotation, so that's why it's not replicated
there might be a tolerance, yep. because even If I get it replicated, it's way off ...
might as well call a RPC to get the right transform ...
Is there anyway to spawn an actor from a client and it gets replicated as well, as if it was spawned on the server ?
or it would be OK to just get the socket transform from the client and still spawn on the server ?
(as you might guess I am still learning replication, multiplayer stuff)
Srry, i can't get it. I have to make an RPC on inventory component and then call it on my OnDrop?
How can I easily put all of these variables within the player character into the player state instead as I have not been replicating to my clients properly
I have referenced each variable within the player character
If the variables have to do with the character itself, then it may be the best place for them. Playerstate is good for replicating variables that are about the player, like the player's name, their selected avatar picture, or other things that may not be directly related to the character they are playing, but others may still need to know about.
Would you be able to show me how I can properly replicate everything?
I know its a lot of work but I would be very grateful
If I can have one ability with replication i'll understand it better
This is for a "Mind Subvert" ability where the enemy gets blinded (a white widget canvas)
The abilities are selected with 4 perk slots
This all works in singleplayer just only some of it doesnt in multiplayer
This is the perk ability select function
I just cannot work out how to replicate the code
The client and the server can both be doing the checks before attempting to execute the ability. Effectively, you can prevent clients from sending the RPC to the server in the first place if they don't have what is required, and then the server should prevent the execution.
You should use replicated variables for those checks as you are doing, making sure they're being set on the server when things are happening.
You don't need to multicast everything, only visual/audio things, like playing the animation montage. Otherwise, if you're trying to trigger an effect on someone like displaying a white screen, especially so if it's something stateful like a confuse, you probably want to use an OnRep variable marked as Owner_Only and in the OnRep check what the state of the effect is and either apply or clear the effect.
You probably want to avoid having casting chains like you've done with Phantom_BP and Light_Drone_BP - this is usually where inheritance or an interface is best used.
You may want "effects" to be a replicated actor that you spawn to cause effects on the actor they are meant to effect. This allows you to build out effects in their own class, have their own lifetime and their own sets of variables and functions.
Generally speaking an ability would work like:
Client Input > Check if requirements are met to execute ability are met > RPC To Server requesting activation of ability > Server validates requirements are met > Set values on actors/send RPCs to affected clients/multicast visuals. Of course, this means no client side replication, so you'll end up having some latency when playing online.
I work with GAS myself, so I've not really had much experience building out abilities and effects using basic networking in Unreal.
I think i'm doing what you said
Based on the code you're showing it's because you can't do a run on server event on to the gamestate as it's not client owned, and to go further with that, death checks shouldn't be done on clients at all.
Even with a normal rpc it doesn't work
Is the function that ends up calling into the PlayerDied event in your gamestate running on the server already?
Yeah
The AnyDamageServer event is redundant. Any Damage will only be executed on the server, so long as ApplyDamage is executed on the server.
Probably not. Are you even causing damage?
Yeah
So at what point is the code failing? Is there a particular node? Have you tried putting breakpoints to see where it stops doing what you want?
anyone know why a collider would exist on the first time a pawn spawns but not on the second time it spawns
What about before that?
Find where it actually does work and the node where it stops working.
It doesnt show anything
Maybe I did the breakpoint wrong?
The saber/sword line trace is on the server within the character
Maybe because I have an apply damage there it ruined the code?
1000 times per second eh
yeah
I need serious help with understanding servers and clients man
lol
I have it f'ed up atm
try removing most everything except what you are trying to test, i.e. all the branches about blocking
It all works though
then what specifically isn't working
Up until the cast to gamestatebase
.
are you using gamestatebase
yes
and it's the cast to gamestatebase that is failing?
So if you put the breakpoint on this node, it does trigger?
Also, you should not be marking everything as running on server. Every time you're marking events like that, it's a means for the client to call it, and they can call it at any time, even if you're not intending them to do so in your code.
You mark only what you intend for clients to be able to tell the server to do something as "Run On Server".
Sometimes I mark run on server even if the server is going to run it. just in case lol
Don't do it.
It's allowing players to potentially "hack" your game and start causing all kinds of havoc.
why am I struggling so much with this, I have some weapon pickups, and I want the pickup event to trigger only on clientside so that I can only replicate what I need to from there. but how I even specify which client to do it on if its not a player actor I dont get it
What is the triggering "Pickup" event?
It's not showing anything?
So when you're testing this in game, and reducing the player's health to 0, it's not getting stopped there?
No
Although the sound of the death plays
"death cue"
Try something else - put a print string immediately after the cue that says "Foo bar". Test it, see if you get the print string on screen.
just the player walking into it
So an OnOverlap event?
yeah
here?
remove disable character movement
Yes
The OnOverlap provides you with a reference "Other Actor" which then gives you a reference to the actor causing the overlap. You can gate the overlap so it only executes on clients using a "Has Authority" node which if you use the "Remote" path will mean it'll only execute on clients, not the server. From the other actor pin, you should be able to cast to your player character class. From that you should be able to trigger any RPCs to ther server you want in the character.
Ideally you would not do it this way however. A client can potentially "spoof" picking up items and your server may have difficulty trying to keep track if the player should be able to pick up the item. Instead, I would recommend using that same "Has Authority" node and use the "Authority" path. You now know the overlap is triggered on the server, and the server can determine what to do and replicate the results by setting whatever values it needs wherever, and you can still use the "Other Actor" pin with a cast to determine the actor that performed the overlap.
So you're seeing
Server: test
Client1: test
?
yes
one test on each screen
Not about which screen.... More do you actually see the lines saying "Server" and "Client1"?
Or do you only see "Server: test" and it's shown on both screens?
You guys see Server and Client desginations in your prints?
but what do I actually do with the actor reference?
no it's only test
That is the reference to the character performing the overlap.
yeah but then what
Do whatever you need to do with that character reference. You can run RPCs, set values, etc.
no like
the pickup event already does everything I need to
but I just need to like
well for a start since the actor has to be replicated, this messes it up so I want most of the event to be clientside
but clientside to the right client
what are you trying to do
If all you are seeing is "test" and not "Server: test" and/or "Client1: test" then you're not running multiplayer.
Wtf
so you want to pick up the item on the client but the item will still be available for other clients
Wut
yeah, because then Ill do another event which multicasts and does only what needs replicating
but wait for every other print text it says this
That's what I'm getting at. That's what you should be seeing.
Ok good π
I don't see that but I'm running in stand alone
Standalone you wouldn't.
scared me
Ok, so move the print string to after the cast when it is valid - just after you're trying to call the event in the gamestate.
also another thing is destroy actor just seems to not work at all
even clientside
Ive checked with print string its running the event but nothings happening
and then I set up a server to multicast event to do it and still nothing
The actor reference on the Overlap, cast to your player character class, check if it is locally controlled, the true path of the branch will only execute on the client that is in control of the actor performing the overlap.
because a WEAPON PICKUP isnt a CLIENT is it oh god I just dont know how to do anything outside of a player blueprint
oh I was already doing that
I think I fixed it though but yeah I cant destroy the actor
You can't do it locally if it is a replicated actor. You need the server to do it.... But again this is why it's better to be doing it on the server to begin with because now you're going to have to give an avenue for a player to tell the server to destroy a particular actor.
Yes it does
Show your code path from overlap to destroy actor
ok then can I just launch it out the map then
Ok, so then by that logic, your gamestate event should absolutely be firing, it's something in that event that isn't working, like perhaps the cast you have to the playerstate.
its a big mess of checking if the player has the weapon, updating his ammo etc before it destroys
Do round wins need to be replicated?
in player state
Sure
It doesn't matter for what you're attempting to do.
It's all on server right?
Im keeping as much of it clientside as I can
Well that there's your problem
If your cast here succeeds, then you should at the very least see this print. If you don't see this print, then you know the cast failed.
You're basically trying to predict weapon pickups, right?
omg. I may have been unpossessing and destroying the actor which is why the overlap sphere was not there on second spawn
whys the cast failing tho
Possibly because the reference isn't valid. You have to check.
I dont know. all Im trying to do is avoid replicating the entire ammo and weapons related scripts when they dont need to be
i can hear datura scream internally
Good luck with that. I would suggest starting with doing it correctly and then later trying to make it responsive instead of the other way around
wouldnt that be so much worse, it shouldnt all be replicated
And "Self" in this context is... What?
and I STILL dont know how server events work on other actors anyway
Im sure I could have this working if I did all these scripts on the player instead but I dont want unnecessary mess
you're going to want to specify which player
Your gamestate event it is checking if the damage causer is a playerstate, is it not?
You should replicate the stuff that the server should care about. The server should care if you have ammo or not
but why? the player knows if he has ammo or not, therefore knows if he can fire his gun, then all that needs replicating is the gun being fired
So you probably want the playerstate of this particular character, which you should be able to do by just doing a "Get Player State" (not the one with an index)
I mean sure, if you want to 100% trust the players.
Because I could be a stinker and set my ammo to 99999.
It's got Actor as the input output
HOW
My ammo is infinite and I fire 60x per second
Because it needs to reference actors and characters
is it just that easy to go and do whatever you want with a game like that
Yes
Yep, if you code it poorly.
I dont see people doing this even with singleplayer games
LOL you see people doing this ALL THE TIME with single player games. That's what most cheat engine/third party cheats are.
If you're new to multiplayer, do pretty much everything serverside and replicate the minimum state required to make everyone agree on what is happening.
ngl I dont think I stand a chance replicating my entire weapons and ammo systems that just doesnt sound realistic
How do you think literally every other game does it
Do you know what casting is
or can i go from actor to character
most multiplayer games tend to have multiple people helping to build it
Cast the actor to character. If it succeeds, it was a character
should I just not bother with pvp and have coop modes only
I mean even if I put in all the time to getting all of this working Im sure itd just lag too much to play against other players anyway
I mean I would never even consider doing PVP where the client says that it shot in the server just shrugs and says okay I guess you shot
Multiplayer is hard as hell.
However hard you think it will be, it will be at least 10 times harder to make an actual game
At least with co-op you can get away with more client-side stuff because you can generally trust that your friends aren't cheaters
yeah and every time I do this I feel like I forget everything I knew because it never seems to work how I did things before
Ok its fixed
Rookie mistake
Could someone show me code of a multiplayer ability that they've got?
are you using GAS
nnope
Input -> MyAbility.DoThing
DoThing -> ServerDoThing
ServerDoThing -> Do the thing
You didn't say it had to be a good ability, just that it had to be an ability. That's kind of the minimum spec of any ability system. Your input does the ability and the fact that you are doing an ability has to get to the server in some way. Beyond that, they are all going to be done in vastly different ways
How important are these settings for my thirdperson character?
I'm having a weird issue where the first time a spectator actor spawns in and is possessed, the collision sphere is there and visible. The second time the spectator pawn is spawned and possessed, there is no collision sphere visible and it doesn't generate overlap events.... but it says it exists and has a location. Any ideas
as in start spectator, spawn player, player dies, spectator is spawned again and drops a particle system but there is no visible collision sphere to trigger revive events
I'm almost to the point of spawning a seperate actor bp and foricing it that way
after I do a seamless travel it does it very fast, how can I make sure my postlogin code gets called? Its not sending my spawns to the correct place after map change
Also witch settings should I have selected?
so this is why I cant get replication events working on anything other than the player

god I hate having to do everything
Be thankful thats all you have to do. Be thankful that UE has a replication system built in at all.
imagine doing all of this without a free-to-use open-source engine with hundreds of pre-built functionalities, like they did it in the olden days
we'd be making much simpler games π
and would eventually pool together a free-to-use-open-source engine with hundreds of pre-built functionalities
then someone would say "god i hate having to do everything"
haha took the words right out of my mouth
technically not open source. it's more like "dont use outside unreal" source really
I meant more like the source code is open to view
yeah, Im aware that I do take unreal for granted sometimes, I wonder if it would have even been possible for me to get into game development maybe a decade ago
just gets frustrating seeing smart people making smart games all the time lol
pfft, I just invented this.
you know, if anyone else said that, I would just laugh, but given it's you, I'm inclined to ask for a free license π
How would I replicate this so it would work for server and client?
π π
π π

idk if this will make you feel better or worse but I may be kind of retarded
can relate, but if you put in enough hard work, you'll get better
and my project is held together via ductape and spite
If this is on a replicated actor, then by the looks of it, you should just need to execute it on the server.
oh yeah trust me all my projects are such a mess, seems impossible not to be once it gets to a certain point in development. I can easily see my improvement by looking at past projects though
still, not a damn thing properly released though
I tried that but it just leaves the client twitching trying to set the rotation but does not work but it works for the server im in a listen server
π π
π π
But if I hover over my screen it works? maybe because of my locomotion and my character movement with my camera or something?
Ok, then create a rotation variable, marked as replicated w/ Notify. Instead of setting the world rotation like you're doing, set the value into the variable.
Mark the variable replication condition as "Skip Owner"
In the OnRep function set the world rotation of the mesh to the variable value.
omg. so the client's collider just isn't visible on the player host for some reason. and I wasn't aware that collision events would only print on the client so I wasn't looking. If I wasn't like this... I'd probably get things done faster.
Does same thing
π π
π π
._.
in testing i found out that players that host the session have way more accurancy than players joining the session, i assume this is caused because the player hosted the server is treated as the server and everything he sees is true while the players that join might be hitting things that in the server are in another place making the hits not register properly. Whats the best solution for this?
Why is half my screen smiley faces now
A dedicated server so that they both have roughly the same latency if theyβre connecting from the same region.
thats not exactly an option
You asked for the best solution though.
how is that the best solution π
that just means hit reg is just going to be bad in all players
Because it would resolve the latency advantage problem more or less without having to write any special code.
With listen the host has 0ms and others have whatever they have.
But at least on dedi they all have some latency depending on how far away they are from the server.
there must be another way like making hit reg client authoritative or something
Also itβs trivial to cheat on listen but harder to cheat on dedi
So unless itβs like a friends only coop type game where cheating isnβt going to matter all that much. Otherwise if itβs competitive you 100% want to go with dedi.
If you want to see what itβs like to play as a cheating client then setup an input keybind and make it change some important value. Then you can just spam that input button to increase character stamina or health or something. Thatβs kind of what itβs like for a cheater when you use client authority they can basically make their own keybinds to change values during runtime.
Is the actor owner a replicated property? I'm having issues having an owning client execute a server side RPC
Not really. It should have the right value if it is set unless the owner is a non-replicated actor or an actor that isn't replicated to everyone (like player controllers)
so I guess when I call SetOwner to change the owner (in this game the player picks up an item they can interact with) it should be multicast then
Do you understand why it does not work?
Like the code works for players the I am not playing
No. Setting the owner needs to happen on the server. It will propegate, but I don't believe it is a replicated property.
Nevermind, it is a replicated property.
UPROPERTY(ReplicatedUsing=OnRep_Owner)
TObjectPtr<AActor> Owner;
But again, it doesn't mean that the value will properly be set on all clients as some clients won't have reference to the owner if it's not something that exists on their end.
Eg. Getting an owner of a pawn usually results in getting the player controller which only exists on the server and the client that player controller belongs to, no other clients.
I have an item which gets its owner set when a player picks it up, I set the owner to the actor of the attach point (component)
the actor is a pawn controlled by a controller then
Not really. You're likely changing something else relating to it or you're executing it on the local client as well.
I think my issue could be that the attachment I made to run server side but its also part of an interface which means I'm calling the _Implementation function directly to make the compiler happy so it isn't really actually running server side?
If you're calling the interface before calling server side, that's where part of the issue could be as you may be trying to send an RPC on an unowned actor.
From the debugger I can see the owner of the item is set to the owned pawn. The item itself tries to call the RPC from within a normal function call
(local) player click button, calls function on item -> (interface) item calls replicated function -> (interface, server, this isn't running it seems) item runs server code, spawns new replicated actor
Are you getting any warnings or errors in regards to the RPC? Like no owning connection?
As far as I can tell nothing in the debug output after runnign PIE
Wait in the save log I see some warnings about not replicating properties but I don't think it has to do with the functions in question
Seems I didn't replicate the pointer reference in GetLifetimeRepProps to the item for the player, this could be the issue
Are these settings bad??
Does anybody have tips for making network smoother? π
Take a look at how you're replicating stuff, minimize RPCs in favor of replicated properties
Also make sure to only modify properties on the server (or rarely only on the owning client, never both), if youre having like jumping issues then there could be a conflict between server and client, or worse you're calling a multicast RPC thats getting reflected twice on the client (for example adding a value could get doubled if that value is replicated)
@sinful tree alright I got somewhere, it seems the issue was that I wasn't replicating the pointer properly. Client side knew what item to run the function off of but server probably had nullptr, thanks forthe help
Wait I might have to take that back...
Always Relevant can be bad, depends on the actor. Usually always relevant is reserved for "manager" type objects that all clients need to know about all the time. PlayerState and GameState are examples of actors that are usually always relevant as at any time a player usually needs to know some information about the other players in the game and about the state of the game itself.
Putting always relevant on actors like characters or even static actors in the level usually shouldn't be done as then you're always receiving updates for these kinds of actors when you don't need to be like when you're really far away from them.
Thank you sooo much it was on my thirdperson character I turned it off sense any of the info they need to know is already relevent and I use repnotifys thank you sooo much! π
π π
π π
Should I check "Use Client Side Level Streaming Volumes" on the Persistence Level? Is it better?
I'm making a multiplayer game but I'm considering selling it on steam for free. Should I charge or should it be free to play?
Ask your investors. π
I'm funding this all myself
Then it's something you should be asking yourself. It can be difficult to judge how much your game may be worth, but you've spent time on it, and if you have a following, you may want to capitalize on it and you have to figure out what the value is that people would be willing to pay. Giving it away for free doesn't mean people will necessarily play it. If you're worried that you don't have much of a playerbase, then you can give away keys to popular video game reviewers/websites/youtubers/streamers and they can both increase the number of players and help build up some awareness of your game which could then lead to sales and drive people to your game. You could always try doing a demo/free trial version too which you can lock players out from playing it beyond a certain amount of time or restrict other aspects of the game, and if they want to continue playing they'll need to buy the game.
No one can really tell you to sell it or give it away as there's difficult choices and work to do in both scenarios, and it all depends on your goals and what you hope your game to become.
Thanks so much! I'm just worried as a multiplayer title it would make more sense to make it free. For example why is Xdefiant for free when it costs millions to develop?
If it costs millions to develop, they're doing something else to make money like microtransactions, and they likely have the marketing to be able to handle getting a large amount of players to be able to support such a game (ie. they can rope in whales that'll dump tons of money on the game). Free to play doesn't translate well with smaller game studios unless they happen to make a huge hit in which case they probably would want to stay with pay-to-play model anyway.
Like... Could you imagine how crappy the Among Us developers would feel if they released their silly little multiplayer game for free?
MILLIONS of dollars lost.
It didn't even do great for the first year or so if I remember correctly, but then streamers all jumped on board and their audiences joined them.
I suppose in some ways, free to play titles hit the small studios pretty hard. It's really easy for players to flock to free games, and players can easily justify not playing a similar game on the basis that they'd have to pay for it. What is good about it for little studios though is if they charge to play the game, then they don't have to work in systems that are anti-player to force them into buying from the microtrasaction shops, reducing the "fun" of the game just so they can make some money.
Thank u bro, I'm thinking around $5-10 is solid
Does the game have to have continuous updates to continue being successful? Or if it's already a solid game I'm thinking it's good to maybe drop 1 or 2 patches but that's it. I want all the content at launch
I wouldn't be able to answer that as you would have to define what "being successful" means. It could be as simple as "The game always has at least 2 matches running that players can drop in to" to "Still selling 5 copies a week" or "There's always been at least 30 players online playing for the last 3 years".
Making updates certainly could help keep players interested especially if you're adding new things to spice up the game some more to break up the monotony of it, and if it's multiplayer and competitive in any way, and does have a good size playerbase, you're going to have players asking for balance changes all the time even if you think it's in a "perfect" state, someone will likely find something that is just downright OP or broken.
I have player "Sleeper body" blueprint and when it spawns I want to set clothes on like this. For loop inventory and then just "set static mesh and skeletal mesh". This doesn't work on dedicated server but How I could do this with repnotify? When this sleeper spawns and init clothes on I want players that connect after that can see it too.
If I do multicast event for set static mesh and call it here doesn't new joined players see it? Only current players on server.
This actor is created in ThirdPersonGameMode after OnLogout
I am getting TOO MANY RECEIVED PACKAGE TO ACK (256) ERROR
any tips to reduce bandwidth of blueprint logic?
SEARCH_PRESENCE not be recognized by the UE5.2 version, what can replace that?
Following on from yesterday, would you be able to show me how to fix the low health widget, as it shows for the server all the time even if the client is the one with low hp
I think the problem is because owning player on the create widget is empty.
Do I put self?
Hm it still shows up for both
multiplayer is a pain man nothing works properly
This is an ownership problem. Checkout #6
https://wizardcell.com/unreal/multiplayer-tips-and-tricks/#6-filter-owning-client-execution-paths
so I do it from player controller?
I don't really understand this at all
How would I do this for the local player with onrep?
5 and 6
Whoβs the Owning Player for the widget supposed to be?
Youβre using dedicated or listen host?
the player who was damaged
Remove the has authority switch because that creates separation between the two and if itβs listen you want both to be capable of showing the widget right? But only the correct player who was damaged at the time shows it.
yeah I want the server and clients to show a widget if they're damaged
but not on both the client and the server only the respective user
This is the character blueprint ya?
yea
How do we send payload with our own costume variable in Gas?
Well then pass in the owning player to the create low health widget
how
this?
Yeah
is this not what local player does?
Get local player 0,1,2,3β¦etc is for split screen multiplayer.
Hence the name local player. Itβs confusing to many people yeah
now im stuck on the owning player lol
Because it needs a controller I think, Iβm just on my phone here without UE running
what kind of controller
PlayerController
Make sure to have use context checkmark on when adding nodes so you donβt get all the extra stuff
You can get it from the player state I believe which is an inherited variable (once again Iβm just on my phone going from memory here lol)
So I might be wrong but yeah I think you can get the player controller as a reference you setup earlier or from the player state directly.
Use the player state that doesnβt have the Get function its the one thatβs just blue already
?
Otherwise youβre getting player state of player whoβs index is 0 in the array of connected players
to me this makes no sense
why is the local player not just the player who was effected
sorry but it makes absolutely 0 sense
Because you have to tell ue which player that was
Because you could have it so when damaged some other player shows the widget if you wanted to
how am I supposed to know what player it is
By studying the documentation, watching videos and lots of trial and error dev testing. I spent like 2 years as an indie dev and I still fumble over this stuff. Thereβs just a lot going on.
On rep player has hp lower than 50 show widget
it makes sense for it to work
but it shows on the other f'ing player lol
even though that player does not have low hp
I managed to connect it but it wont work
i can almost guarantee
Using breakpoints also helps slow things down during testing and lets you visually see the logic of blueprint flow and if itβs running on server or client or not.
lol it shows on both the client and server again
all I want to do is show a widget for when a players low on hp yet it is so annoying to do and nobody actually knows how to do it properly without it breaking because its so complicated
It's probably cause you didn't limit it to the local player
Given the OnRep, if not using a condition, will call on every instance, so for a character on all clients that are in relevancy range, if you just do GetWidget in there, it will call for all
how can I limit it to the local player?
E.g. by checking IsLocallyControlled in your characters health OnRep before accessing the widget
Perfect solution would be having a delegate call from the OnRep and listening to that in the Widget, but that is a bit more annoying in BPs, cause you need a quick setup for notifying the Widget when the Player has a valid pawn/character
Accessing the widget in the OnRep is somewhat okay, but scales poorly
Thank you man
So I can use is locally controlled to do anything for only a certain player from the server?
IsLocallyControlled simply checks if the instance the code is calling on is local or not. Only works on possessed pawns of course
Will only be true for the person controlling the pawn
Nice I have a few more problems aha
Why does the server know who won but the client doesnt?
This is in the gamestatebase
@quartz iris are you using the PlayerController to indicate the Winner?
yes
That doesn't work
but im getting the controller from event damage
It only exists on server and owning client
so I have to convert it?
Use the PlayerState
from player controller?
Yeah
ok
The PlayerController will be null/invalid on other clients
PlayerStates are replicated to everyone
Also these are basics that are explained in the compendium
Either way use the PlayerState
No
You can't have GameWinner be a PlayerController
You were still getting the PlayerController from GameWinner
That is invalid on other clients
Just get the Player name from the PlayerState
When playing the game with advanced steam sessions installed, it doesn't show i'm playing the steam game anymore
This used to happen before I updated the engine to 5.2
I doesn't look like it is able to show the steam name or avatar either via playerstate
I have an actor with an replicated actor component. The component has various varibles along with an TargetLocation. Any client should be able to set this target location through interacting with the actorcomponent. Once the TargetLocation is set, the actor component will apply force to the physics body of the parent. How would i propperly set this up with replication?
Do i need to set the relevant varibles like the FocalPoint to also replicate even tho the component is set to replicate?
anyone?
Only the owner can call a run on server rpv
What is the specific mechanic?
You probably want to route the interaction through playercontroller or pawn
I have an anti gravity gun that can move objects around. and i do a linetrace inside a gameplay ability and check if the hit actor has a actorComponent(logic in the screenshot). If the component is valid i turn of gravity on the component owner (static mesh) and then i apply force on tick for the object to move towards the FocalPoint set by the the ability
Hey
My code for creating/joining a server with the Advanced Steam Sessions plugin works in the editor, but when I package the game and play it, it fails to make a server
Are you using LAN?
Are you testing using two computers on your home network?
I can't even create a server with 1
with two different steam accounts?
yes
it even shows spacewar as the game im playing on steam
it shows my avatar name etc
I think the issue is because everyone uses 480 its hard to find your game session so it fails most of the time. You can test over lan without much difficulty but otherwise you need to register for your own app id with steam.
yes you are supposed to register for your own app id
and pay the $100 or whatever it is
it costs tho right
and you need your business setup first for valid tax info too
it also could be beacuse 480 is region locked
It's a well discussed issue on the UE forums I don't know the specifics though
could also just be some error or warning in the logs which explains the issue
any way to see logs on the packaged game?
which build config?
?
I think it has logs with dev and testing but not shipping
Not sure why you don't appear to have testing as an option on there, but anything but shipping should have logs in the saved/logs folder
Are you sure this is the problem tho?
When teleporting a client using Set Actor Location, Server event set actor location is only needed, no need to use Server event -> multicast set actor location or run on client right?
If you arent using any client authoritative movement then during the next correction from the server the client's location will be updated.
TLDR youre correct c:
Thanks!
Do you know what could be the reason why when the client teleport some actors don't load until the client move
Networked actors or generic objects? Also world partition or regular level? Does the issue fix itself if you locally move the client (offset its location) by a very small distance? I'm just narrowing it down cz I dont have a clear idea for the cause rn c:
Turns out its the cull distance
but not sure why the client needs to move for it to appear.
weird stuff, does manually offsetting the location fix it? Would a workaround for now if it does, sounds quite inconvenient if the player manually had to move for it to work.
Got a noob question, I have a post process effect which has its intensity tied to the vector length of the players velocity. I'm trying to get it to run client side only, but since the game uses listen servers the host always changes the intensity for everyone even when using run on owning client. I'm still pretty new to networking so I'm confuzzled here lmao. How would I go about doing that? Only getting the change to happen client-side for the host
Yep, noob question, figured it out
In what actor is that and why do you check the local role like that
BeginPlay is kinda too early
The pawn might not be possessed at the point
OnControlledChanged or OnPossessed are better events
Well BeginPlay calls for the Actor. You can have multiple dummies in your level that aren't possessed, they should still call BeginPlay
But yeah don't use BeginPlay in Pawns if you need to check for possessed state
Yeah that's server only though
OnControlledChanged should be server + owning client
Simulated Clients probably have no call in BPs. Best guess for them is CPP OnRep_PlayerState maybe
@pallid mesa whats ur netGUID irl?
INDEX_NONE
π
I have FastArray replication system, based on replicated UObjects.
USTRUCT()
struct FEquipmentSlotWrapper : public FFastArraySerializerItem
{
GENERATED_USTRUCT_BODY()
// Your data:
UPROPERTY()
class UEquipmentSlot* EquipmentSlot;
/** Optional functions you can implement for client side notification of changes to items */
void PreReplicatedRemove(const struct FItemList& InArraySerializer);
void PostReplicatedAdd(const struct FItemList& InArraySerializer);
void PostReplicatedChange(const struct FItemList& InArraySerializer);
// void PostReplicatedChange(const TArrayView<int32>& ChangedIndices, int32 FinalSize);
bool operator==(const FEquipmentSlotWrapper& Other) const
{
return this->EquipmentSlot == Other.EquipmentSlot;
}
};
My problem is that EquipmentSlot is replicated with delay. Array's PostReplicatedChange is already called, but EquipmentSlot still holds old value, and new value is assigned (I suppose) tick later
void PostReplicatedChange(const TArrayView<int32>& ChangedIndices, int32 FinalSize)
What visual studious version should I use for unreal engine 4.27 for source build unreal engine
I donβt think it matters much but ask in #cpp
Can I use 2022?
π π
The VS version absolutely does matter (the sub-versions usually don't). 4.27 supports VS2019 and VS2022.
I've changed the location of computer where the server runs to other computer after that My computer can't join to server ..Only computer where server runs can join that server...Who knows why?
Over the internet? Servers need to open 7777 port (if dedicated server and/or join via IP)
Replicate a Rotator variable and mark it as Initial only?
I'm having some net lag issues and looking to optimise in terms of reducing what I replicate and how often, but I'm having trouble understanding the Stat net output. I'm getting issues with a very high 'inrate' (20K+ bytes rate - but what is this rate, is it per frame or per second?) which I assume corresponds to information sent from server to client. I'm getting 'too many received packages to ack since last sent packet' error as well, along with 'server move - time stamp expired'
Inrate actually goes to 0 often which I assume is the network giving up
If im spawning a static building in my game at runtime. Should i do the spawning with mulitcast. or just setting the actor to replicate?
If it's just once/ a few times, probably doesn't matter
With the latter approach you will need to consider stuff like net cull distance
Also if it's genuinely uninteractive+unchanging, set replication rate to like 1
Yeah. il just go with multicast for now since its simpler
thanks
Hello, I try to create system when player joins MMO server. There is my code, do you see any redflags here? Now this works when server is open I can play with my two different steam accounts. Login, disconnect. When I login I get items, level, etc... what I had when last time I played. If I login with new account I start from zero.
Post login
Controller
spawn character function
and check database event
Saving database is also function from beginplay timer 2s looping. Gets data from ThirdPersonCharacter and set it to database with correct key(steamID)
Hi
My friend has this problem where if he downloads my packaged unreal game, it has Ucas files within the folder and doesn't start the game but shows up in task manager.
I have no problems with it on my end though, both in the editor and packaged
depends what you mean by red flag really, but a couple things - you make your own spawn function but one already exists in the gamemode that you could just override the behavior (Look at RestartPlayer)
Secondly - kind of a π€ point to make since you probably know this already, but what you are using is not really a database, but you do have the right general idea, iβd look into SQL
that struct youβre using for player saves is likely going to cause you much pain later if you need to change any of the data structure
especially if itβs a bp struct (assuming it is)
Also not sure what you class as MMO server and I really donβt wanna dissuade you or anything, but hoping to support anything more than about 100 people on an Unreal server is wishful, Itβs sadly not really built for that, but aslong as youβre happy with 100 players ur good to go
Oh okay thanks! And with redflag I mean this works now when I try with couple player but with 70players over 3month server open and hundreds of server joins and disconnects.
why can tear off be called in blueprint but torn off cannot be implemented in blueprint?
That's like asking why is blueprint so limited in terms of multiplayer
Because it is limited
I have a quick question, I have an actor component on my BP_PlayerState that simulates a replicated Team Component with a repnotify variable Team, in the rep notify function I called an event dispatcher OnTeamChanged, now I want to bind this event so it calls a custom event in my ui widget, on the server player it works but not on the client
Is Chaos physics replicated? And, if not, is there a built-in way to make it replicated and deterministic?
Backstory:
I'm making a spaceship building game with kinematic movement. But collisions are not being triggered during movement so the meshes overlap.
I'm hoping to switch back to Chaos with regular physics movement before I delve into complicated collision detection.
Widgets don't exist on the server. You might have to route it through the PlayerController
Or more accurately. Widgets aren't replicated. So a listen server might have them but it doesn't know, or care, if they exist on clients
Hmm
I saw this and I'm wondering if it results in deterministic simulations. Or is #chaos-physics a better channel for this topic?
This doesn't help at all from testing
I'm trying to do this thing where I have a client shoot a trace, and if that trace hits an enemy it would decrease their health then multicast to everyone.
but for some reason i cant get it (the enemy) to call a run on server function when this happens.
Uff. A lot to unpack here
- Client should not deal damage
- Health is a State and should not be multicasted (only the damage effects, like visuals and sound of impact fwiw)
- Clients can only perform Server RPCs on Client owned Actors
Result of that is:
- Have the Server RPC in the Character or similar.
- Perform the line trace on the Server and deal damage there.
- Use a Replicated/RepNotify Health Variable instead of the Multicast.
- You can use the Multicast to tell Clients to spawn sounds and VFX.
Bonus Point: You can run the Line trace on the local Client in addition to the Server RPC, but only for the visuals, and then filter the visuals in the Multicast for that player so it's not played twice
ah so there's no way for like 100% pure client authorative traces, it still has to go through the server?
this is why I decided on coop only
Ideally you'd do whatever it is you're doing on both the server and the client.
im doing a pve game btw
so im not too worried about cheating, i need it to be responsive
The client does a sort of predictive "what will the srever do?" kind of thing. Nothing destructive. The server makes stuff happen. But you don't have to do that if you want people to cheat.
Depends what kind of multiplayer you have.
If it's friends with friends, cheat prevention is absolutely meaningless.
its friends with friends
Then all you need to worry about is sync issues.
so with my first question is it possible to have something like i was trying to do, without the trace having to go through the server?
The only things that need to go through the server are things you want other people to know about.
You can do all the traces you want on the client.
Just tell the server what you want to do with the trace result.
aha i think thats it!
Guys my friend has this problem where if he downloads my packaged unreal game, it has Ucas files within the folder and doesn't start the game but shows up in task manager.
I have no problems with it on my end though, both in the editor and packaged
Please still keep the Multicast/RepNotify stuff in mind though
Aren't ucas those fancy next gen console packaged files?
Is there a way to disable it on package or something?
Idk why the game works for me but not them
Did they have all the prereqs installed?
Actually could you download the game and see if it works for you?
Which prereqs?
Idk
Tbh, no. And please don't link downloads like this :P people can't know if it's legit
I only heard about it on Friday from a client. Pretty sure you'd have had to actively turn it on in the first place
ok
Huh thats odd
Whats the setting called?
I was in some expo, there are actually people asking me to download their game and tested it. I rejected but I found out some other creator have their patreon account compromised after downloading file from people who asked to "test their game"
Ofc im not saying Paradox is doing that, he seems genuine having been around for a while, just saying scammers do actually target creators
is there a recommended max players for listen (player-hosted) servers? usually co-op games have a max of 4. is 16 too many?
So im trying to make kind of a dungeon entrance where if u run against it it opens the dungeon level for only the player who does run against it
the issue is if i do open level it sends them to diff instances and if i do server travel it sends all of them how would i do it only for one and let the other join ?
Unreal by default only runs 1 "world" (ie. level) at a time.
As you've already discovered, Server Travel makes everyone that is connected to the server move to the server's new level, and using Open Level on a client will cause that client to disconnect from the server it is connected to and attempt to open the level or connect to the IP address provided, which indicates that you'd have to have multiple server instances running to facilitate a client being on a different level, which means that the client loses communication with the original server anyway.
There are plugins that can run multiple worlds on a single instance of a server, but they aren't set up for replication, so that means you'd likely have to do a lot of engine reworking if you wanted to try and create a multi-world multiplayer server.
There is one "trick" method you could potentially use if you're doing "dungeons" and that is by placing your dungeon levels underground and ensuring that they don't overlap at all with the above ground world. When your player walks into the entrance, you teleport them to the underground location.
Client authoritative with server doing a double check is fine
yea ig dungeons underground it is then
thx
So what's the current status of IRIS?? I have just checked the 5.3 roadmap, but no mention of it. I didn't find anything in the forum either. I was also wondering, if it has some client prediction stuff. The situation seems a bit messy regarding this currently in UE, at least it is not clear to me what the current systems can or can't do and what future stuff is in development, if there is anything in development at all.
can someone tell me how do i remove that "client 0" and "server" text that keeps popping up?
the "server:" text comes when i host the server and the "client 0" text comes when i join the server
something is printing an empty string to the screen, you have to look through your blueprints which one is printing something, could come from anywhere
but they only come after i've joined, doesn't that mean there's some built in blueprint somewhere?
the prob is, idk where
i've went through my blueprints just in case, but didn't find any empty string
well, depends on your project, what is this?
is it some sample project or template?
Check your Output Log. It should tell you which blueprint is creating those prints.
blank
lemme check
uhh, i don't have any blueprint called Player_B_C_1
nor PLayerB_C_0
what about Player_B
so it's coming from that
add a breakpoint to UKismetSystemLibrary::PrintString?
I still wonder how this is MP related
i thought it's a server thing
sorry i don't really know what that means
How is it a server thing? It's just from the PrintString node
And this is using the debugger from Rider/VS. You add a breakpoint and when it reaches it, it'll pause execution, so you can actually see where it came from
thank you
sorry, im new to this
it worked, thanks man
Ive got this simple ragdoll replication thing set up, just pulls it towards the right location, but is there anything I can do to make it end up the same way around more often? bit annoying when hes the complete other way around https://gyazo.com/f657caee39a17a96b0950de4c86a96c9
or just more accurate in general of course
I imagine it should be a little easier than 3d games since these ragdolls are locked to 2d
hi guys, has anyone used the ability system in a multiplayer game? im having an issue where the ability system (can activate a spell) is working on my client but not the client+server
Is there any event that tells me when object is being replicated for the first time? E.g. its created on the server, then its creation is executed on client via replication, and so event is called
Depends what kind of object it is
In short... yours lol
https://jambax.co.uk/replicating-uobjects/
There's IInterface_ActorSubobject which adds virtual functions. It's experimental though.
Where can I find some info about it? Google seems to not know about it yet
Also that article is a little out of date, I would use the replicated subobject list now
Doubt you can, just look at source code
ok
Works fine 
Been using it for mine
paired with FInstancedStruct for items
super flexible
is there any examples for a C++ multiplayer game that is done well in unreal engine? i'm picking through the unrealtournament source and i wish there was something better
uh, maybe Lyra?
Yo! I have an inventory and i wanna replicate item drop. Any idea?
Thereβs also UE4 ShooterGame made by Epic which Lyra replaced showcasing the most updated UE5 way of doing things.
would you or anyone else be down to sit with me for a few minutes on voice chat and answer some questions about how i should design a game i'm making?
it's a fairly simple use case but typing it out could get a little lengthy
i can keep it super high level, i promise i'm not looking for spoonfed answers, just need to make sure i'm on the right track
Do whatever "Dropping" an item involves on your client > RPC to Server through client owned replicated actor or component what it is you want to drop > Server Spawns copy of item and removes from your inventory.
Does anybody see anything wrong with this?
That is too vague a question. Only glaringly obvious issue is the spaghetti you have everywhere, making it hard for anyone to understand what theyβre looking at, including yourself. Iβd recommend you learn how to βpromote to variableβ and get that variable as needed.
Ya Ik how I was going to do that but they did not bother me to much but Ill do that
Thanks π
π π
Iβm away from my PC and just using my phone so sorry I canβt have UE open at the same time and wouldnβt really want to do something like that anyways. But Iβm happy to answer random questions I see here if I feel like I can help out with pointing someone in the right direction.
Because the server is the authority when it comes to that sort of thing. You donβt need those RPC events you can just go directly from OnComponentHit to Apply Damage and add any sort of checking or filtering in between.
Apply Damage can only be executed by the server. Additionally, you do not want the client to call to the server on overlaps (they happen on the server as well) so you can usually use a Has Authority and use the Authority path to only execute when it is running on the server. You also don't want to multicast setting variables you only want to set the replicated variables on the server.
Big glaring issue is calling Run On Server events and feeding in too much information. Clients can technically call RPCs at any time and spoof the data that you're sending, and by the looks of it, you're allowing a client to say how much base damage they can do which you definitely do not want. There's just far too much data you're sending in general. The server should already know most of this stuff without the client having to tell it and the server should likely be figuring out what it should be doing vs. the client doing it all and telling the server.
These RPCs are terrible too as you're effectively allowing players to tell the server to play sounds and vfx wherever and whenever they want.
You want to minimize the amount of calls into the server and the data that you send it in such a way that a player can still have it do things, but not so far as allowing the client to be in control of everything. Like.. Shooting would be Input > RPC to Server that player wants to shoot (no additional information needed) > Server checks if player can shoot > Server spawns projectile or does damage or whatever else. Some things don't require you to send it all across the network either - some data can just be static like what sound effect to play based on the weapon the player has equipped or the location of where the sound should be spawned can be figured out by the server based on the player's location.
Ye but if you just let the client accidentally have authority noone will need to make cheats for the game 
For binding something like GEngine->OnNetworkFailure() - so I can intercept and act on those, where is the best place to do do the binding?
i.e. in my custom game instance, game mode etc? Everywhere I read says to bind to that function, but I cant see where the "right" place is to do it
the game instance already binds to this via HandleNetworkError
but yes, if you need the extra info on the original callback, then the game instance is a fine place to put it
a subsystem specifically for handing net stuff is what i would do
Yeah, I need the error text, it is not passed along currently. Thanks, Iβll go check out the existing game instance.
Hi all, not sure if this is the best place to ask this but I am trying to use the chunkdownloader to mount downloaded pak files and getting this log message. Would be really nice to know how I can register mount points for different pak files.
does anyone Uses Physics Sub-Stepping with multiplayer games ? when I try my game every thing works fine as long as I am Not joined to a server , when I join to server every thing becomes much faster and the game is no longer frame rate independent (while playing but not joined to server everything is framerate independent ) , I thought may be its because in server Sub-Stepping is NOT supported or may be disabled by default idk , do you have any idea what it might be ? here is my Sub-stepping settings attached below
i know my game is framerate independent because I use Command " t.MaxFPS 30 " and "t.MaxFPS 350" to switch fps and the game and every functionality stays the same (as long as Not Joined to a server ) this happens even when run my game as clients in standalone (but not in editor)
Hey Please can someone help !
@smoky storm I think Its Exactly what I did dude, I Already asked π
No need to bump questions either.
To answer your question "does anyone Uses Physics Sub-Stepping with multiplayer games ?": not me.
hahaha , ok bro. It is Just for clarifying the Question since Enabling Sub-stepping is Fixing the problem but not for multiplayer , anyways I am Sorry for bothering you .
does a pawn have built in client-side prediction and server reconciliation or is it only the CharacterMovementComponent that has more advanced logic for providing a smooth experience?
@pliant moss I use a Pawn with a StaticMeshComponent as body I move it using mesh->AddForce(direction * force); , and yes i use client-side prediction and server reconciliation to move my pawn around (it works perfect in editor and everything is smooth ) but after building for server or running as standalone it just becomes much faster (however the movement is still accurate but somehow lagy(not much) )
so you are replicating the static mesh component and applying force?
yes I do
So basicly its the replicated physics that are driving your pawn movment. I have a bit of differnt setup with a regular movement component
ohh , but i think its not only about the physics since the camera seems to be faster in Build or standalone while everything is framerate independent in Editor regardless of FPS
Yeah i idk about your usecase with sub-stepping. never used it. My questions was a seperate question and not tied to your question π
could you potentially have the code getting somehow double executed by poor rpc logic? Maybe you have an rpc sent by the client that is telling the server to add another set of force?
Only the CMC has this for a character. A basic pawn does not.
cool thanks. then il look into that implementation and see how i can apply it to my custom pawn
That's probably a tough task. That class a thousands of lines big, and tied into the Character.
There is a plugin on the Marketplace that might be worth looking into instead
@sharp yew Only thing I can tell you is that Physics + Multiplayer Movement (not sure about #chaos-physics ) is a shit show to avoid
Okay thanks for the heads up. But i will atleast take a look. Im mostly intressted in if the inputs are beeing replicated or if its the actor position that replicates. and at what frequenzy this is done.
It's much saner to fake it via Velocity
The Client performs the move locally and sends the end location and flags that indicate pressed buttons, as well as some optimized Rotation and Acceleration
Server uses that to redo the move and check against the end location the client send
Then it either acknowledges or sends a correction
But is has to send more updates then just the button press. lets say i hold the button for 10 seconds.
CMC sends an unreliable RPC per frame
Controllers are generally not replicated to simulated clients
If you need info of other players you'll want to use the PlayerState
Really? cool i thought that would really bog down the network. If that is the case i can just build my own simple client side predicton and reconciliation
The PlayerController is replicated between owning Client and Server
Server has all of them, Client only its own
On the Server this works, on Clients you will get nullptrs for other player's Controllers
Also not sure what you need those events for
A ServerRPC to notify that a Player joined?
Why not just use PostLogin in the GameMode of your Lobby
You are also chaining ServerRPCs which is redundant too
I mean
I just told you twice that Clients only have access to their own PlayerController
Replicating an Array of PlayerControllers makes no sense
There will only ever be one valid PlayerController on Client's end, which is their own
If you need info about other players you need to use the PlayerState
in fact , i call move on my pawn and then fire a server RPC to fire a Multicast RPC so it calls move on all clients ( i prevent it from being moved twice by checking its not locally controlled before calling move in multicast_Implementation )
#instructions guys can one tell me what is the exact size of UE 5.2 source code after installation.
i have 250 gb of free space on ssd will this be enough
I can tell you that the 5.0 version from my client that is mostly unchanged is at 230GB
So my suggestion would be clearing up space
Yeah that could work. Your own project comes on top if that isn't counted in yet
π€―
I'm relatively sure that's wrong
- binaries of course
The whole Engine + 2 Projects isn't 640GB for me, so you must be including more than that
All in C:\
That's the wrong folder
I'm at 270GB with Engine + 2 Projects
Or 1 project, can't recall
Pretty sure you scanned your whole C drive there
Dude you blew my mind i just bought a pricy laptop and i was like i have to buy another ssd for just the engine
Do you need the Source Engine?
Yes
Welllll
I can only really advice peeps to have at least a 1 TB m2 or so
On top of the C drive
512 also works, but I wouldn't gamble with the chance have needing more
So my laptop is 1 tb in whole will this be enough for a single project with addition of external 1 tb ssd
Yeah
It's enough, but you might have more stuff on your PC. Marketplace Packs etc.
Learning projects
And what not
Some of this stuff might take another 50+GB
It clutters fast
Noted my men thanks for the help brother appricate it very much
Yes
Where is that code?
Buddy
That doesn't work
You aren't on the Server at that point
While JoinSession will ultimately connect and travel to the Server, this is WAY too early
The RPC runs on the local Client
There is no Server
There is also still no reason to even call that RPC cause GameMode::PostLogin should do this for you
You aren't even really connected at that point
The PlayerController you call that on is still the one from the previous level, I assume MainMenu or so
One option would be in the LobbyPlayerController on BeginPlay
There you can limit it to SwitchHasAuthority
THen you don't need it to be an RPC
But yeah, you are creating a lot of tech debt and problems if you fight UE here
PostLogin should really be preferred
I mean, that's up to your design :p
The rules don't change with that
Lobby's in MainMenu's like Overwatch, Fortnite, etc. aren't done by joining Game Sessions though
They use Beacons (C++)
UObjects are networked by defaults?
so this is not enough to turn that switch on ? IsSupportedForNetworking
Nope
Ok
{
if (HasAuthority())
{
DealDamage(Hit);
}
if (ImpactParticles)
{
UGameplayStatics::SpawnEmitterAtLocation(GetWorld(), ImpactParticles, Hit.ImpactPoint);
}
if (ImpactSound)
{
UGameplayStatics::PlaySoundAtLocation(this, ImpactSound, Hit.ImpactPoint);
}
Destroy();
}```
Destroy is not letting those fx spawn at the correct location for the clients. Any idea how can I overcome this problem?
Is this a Networked Actor?
Cause Destroy should only be called on the Server then
I would also suggest, instead of destroy, to just call SetLifeSpan(3.f) or somilar
And having an OnRep Boolean to deactivate the actor in the meantime
You can also look into TearOff and TornOff, which allow letting the Client deal with the rest (might not work if you need some data along with it)
bReplicates = true;
I believe this is what you are asking right?
Yes
I cant use the repNotify or RunOnOwning client in a gameplay ability?
Not sure about RPCs, but replication could theoretically work.
However I can tell you that I usually have 0 need to do that
None of the Abilities I made in the past are replicated
Right so i might be aproching this in the wrong way.
I Have a gameplay ability that transitions the 3dperson view into a topdown "builder mode" in this mode i spawn a new pawn and do a camera blend to the new pawn. i then want to bind some inputs (on the client) to move the new pawn around. But the pawn is spawn on the server (its a drone i want other players to see). so how would the client get a reference to the pawn so i can setup the bindings localy?
Just do it in the OnControllerChangedEvent function in the Drone Pawn
I am trying to avoid having a server call just for visual or sound effects. I would also prefer to keep the trace happening only on the server. Just couldn't figure out how to do it yet.
Yeah well im not doing an repossession since im building this ontop of lyra which doent really support repossesion
That doesn't really change what I wrote though?
<3 Lyra
:P I know why I would never use that as a base
Not sure then
Maybe set an OnRep variable in that Drone
OwningCharacter
And when that OnRep calls check if that Owning Character is locally controlled
And then do your Input stuff
so i would set the owner to be my character when i spawn the drone on the server?
its so tempting to get so many systems for free ;D
Yeah and so many restrictions from assumptions on their end
And so much dead code that you aren't actually using
And all the bugs they added that you might never find cause it's not your code
Yeah im starting to feel that now. spent like 4 days trying to get repossession to work. seams so silly. but it really means rewriteing 30% of the codebase
Sure, but repossessing here might have been a lot easier
yeah that would just work out of the box
hi, does anything special have to be done on rep notifies to work on custom structs (c++)?
like override == or something?
Yeah I did it like this before but I think I got confused because the weapon/bullets weren't showing up on the server when the client had a weapon shooting
not as far as I know. Your properties have to be UPROPERTY (the ones that should replicate) but despite that it should just work
As long as you aren't expecting to have a repnotify on individual struct members, but on the struct as a whole instead.
thanks, I think my issue was needing to flushnetdormancy
I spawned weapons in the level, all players can pick them up, but if a player pick a weapon and drop it back. That particular weapon can't be picked up by other players
Probably because it's not added back to your "lootable items" array. Why do you even have that array?!
the item added back to the array of pickup loots
and on overlapping the item, it is added to the ready pickup array, I print the items of the loot array and that weapon is there
On the server and all the clients?
yes
even the players can highlight it and see on the ground, but can't pick it
only the player who dropped it, can pick it back
Hello, can someone help me with Rewinding? I am following this Article: https://vorixo.github.io/devtricks/simple-rewinding/
I have everything working (tho I have not implemented the NetworkEventSubsystem) but my main problem is the Rewinding seems to be very off whenever I enable Network Emulation and I honestly can't figure out why...
The Green Box is where the Client Player hit the Server Player, but the server is seeing it as the White Box...
So I removed this, and this fixed everything for me, but I feel like I am making a terrible mistake by removing it..
When I enable network emulation (using the "average" profile) to enable a latency between 30-60, it seems like it adds a lot more. If I check the PlayerState->ExactPing, it seems to vary between 300-500. Am I off by 10 here or am I missing something?
I know some of the ping values are goofy for packing reasons, like 10x etc
Hmm. Strange. So is the actual emulated ping value actually 10x or is it the ExactPing that is wrong?
You'd have to dig around but I'd bet it's either 10x ping packed into an int or 8x ping for binary reasons
ExactPing is probably what's wrong
Thanks! I'll dig into it. Would you happen to know if that's just an issue with the network emulation or should I expect ExactPing to be wrong in normal multiplayer as well?
Is it possible to spawn and controll a pawn using the movement component only localy?. (server and other players wont see or know about it). Seams like the movement component needs a controller to consume the input. and since controllers are owned by the server it all breaks down
Probably not if you at the same time have another pawn properly possessed
yeah okay. il make a workaround. thanks
This is in PIE, and the log message showing the ExactPing is logged when I activate an ability, which requires the window to be in focus, so the numbers should be from when the window is focused
π
anyone know what that last one is by chance? any docs for it or do you just use it like you would for any pushed based object and its kinda auto handled?
is it possible that sometimes client player character still is possessed by the player controller even when the client is disconnected?
whats wrong π¦
Just wanted to add, there's two ways of checking if a boolean is true when writing code.
One is:
if (boolean == true)
the other is:
if (boolean)
In blueprint, you're doing the first way.
Same with checking if something is false.
if (boolean == false)
vs.
if (!boolean)
Does it matter if the RPCs at the right are RPCs or not?
Yes because clients can potentially call any RPC at any time.
Even if you didn't program it in such a way for them to do so, you're opening a door allowing a client to call it.
But in his case his Input Weapon_Primary starts a server firing event isnt this how its supposed to be?
Weapon Primary Server is fine as that starts the chain of executing on the server. The problem is the ones at the end are also run on server events. So instead of allowing the client to have one avenue to execute something on the server (Weapon Primary Server) someone with a little knowhow could skip that RPC which also would skip his conditional checks, and directly call "Start Firing Rifle Server"
Sorry but isn't the only fault having a multicast event? when everything should run on server to avoid skipping conditions?
and it wouldn't matter of those at the end are also ran on server since its already running on server
I as a client have control of my computer, its memory, and what data it sends to the server. I can force my computer to make RPCs at will. That means if you mark an event as an RPC, I can potentially call it whenever I want. If you don't mark it as an RPC, then I can't make the server do it.
In the example code, I just pointed out, I could directly call "Start Firing Rifle Server" skipping all his conditional checks that would normally prevent the player from firing the rifle.
You want to limit the amount of events that you allow a client to call, and even limit what data that they send to the server to prevent players from being able to exploit vulnerabilities.
For example, you wouldn't want the player sending an RPC to the server indicating to the server that they want to buy an item for 1 gold. You would just have them indicate to the server that they want to buy the item, and the server should already know the price. I wouldn't want then to also have a "Run On Server" event like "Add Item to Inventory" which gets called after I call the buying RPC as then I could just skip paying for the item and add whatever items I want into my inventory.
You can only force your computer to call the Start Firing Rifle Server since it was multicasted right? otherwise if his example is fully ran on server from the beginning its impossible to do so right? so the only fault is the multicast event
No. Anything marked as "Run On Server" is something that normally allows a client to call it, so long as the client is the owner of the actor/component it is being executed on. If they don't own it, they can't call it on the server.
so usually only the run on server event should be to start doing an action and not to process things
so instead of him having an event run on server start firing, it should be a normal event or a function even
No.... Run On Server means you are allowing a client to ask the server to do something. It can be an action and process anything you need the server to process, and the server would then replicate the results by setting replicated variables, calling client RPCs or multicasts.
And yes, his "Start Firing X Server" events should just be plain old events or functions.
is there any way at all to replicate Pose Snapshot? I cant see any way thatd work
I assume it wouldnt work for what I want anyway, seems to only be a one-off kinda thing? I need to just send across the literal actors pose and replicate that
That means if you mark an event as an RPC, I can potentially call it whenever I want. If you don't mark it as an RPC, then I can't make the server do it.
If there is a random event on the character set as run on server but is not executed anywhere are you able to call it?
you would only be able to get that rpc if it was run on client or multicasted right?
can animation poses not be variables in any way
do they actually need to reference an existing skeletal mesh in the world
Yes. Any event marked as "Run On Server" that exists on a replicated actor or component that is owned by a client means that client can potentially call that Run On Server event at any time through that actor/component. It doesn't matter what your code says or how you structure it or where you may put it in your code. Simply having it exist in your code makes it an avenue for a client to call the event on the server at any time if the client is the owner of the actor/component.
A "Run On Server" event placed on a non-client owned actor, like gamestate, doesn't really do anything and the call would fail if it was indeed called from a client as the client doesn't own the actor. You'd get a warning in your log that the RPC coudln't be called.

So server events like add item to inventory or add experience should be in game mode/game state and not on the player character itself?
I know that these shouldn't be directly ran on server in the first place but just for explanation purposes
Not necessarily. You can have code in whatever class should be handling it. It's fine to have an "Add Item To Inventory" function in an Inventory Component that is owned by a client, but it's not a great idea to have an RPC marked as Run On Server that would allow them to arbitrarily add an item to their inventory. The idea here is, is that you want the server to be in control, so you limit what you allow the client to call.
Same with picking up items - you don't want the client to tell the server they're picking up an item they walked over - the server should be able to detect that the client walked over it itself, and therefore it could add it to the inventory of the player picking it up without the client telling it to do anything.
But whats wrong with the code tho
Pls tell me π
I already have if you check the image. You're calling a multicast unnecessarily, and you're calling run on server events from within a multicast which is not great, but you also shouldn't necessarily be setting the RPCs at the end as Run On Server anyway as they could allow clients to call them skipping the logic of trying to prevent them from calling them in the first place.
Could you show me how to do it properly tho
I think i'll do it wrong
Look at the image. I've already shown and labelled what you should do.
Basics: Input on Client > Run On Server > Server does stuff > Server sets variables, runs multicasts or Run On Client RPCs as needed to replicate/play out results
You don't want:
Input on Client > Run On Server > Multicast > All clients sets variables and checks if variables are correct, and call events to shoot wepaons
Nor do you want:
Input on Client > Run On Server > Server does stuff to validate the client can execute the event > Run On Server Event that does what you want (if you read the conversation I was having with Miffy it explains why this then allows someone to skip the validation on the previous Run On Server event)
Guys, how can we access Steam data?
For example, we clicked the find server button from the main menu and encountered the server list. There are a lot of names and servers here. Some may use involuntary (blasphemy/terror) names. Or it can create more servers than necessary for spam.
As the game publisher, how can I access this list and data to change them?
If you're not running the servers yourself, you won't have any control over what others may post for their session information. The best you can do is set up a filter and not display results that you don't want shown or filter what is displayed in your game.
I have an event run on server on the player character: Event on Server -> get privilege if admin proceed -> spawn item which is okay.. but if a client can call this event on server then a delay is important to not spam call it right?
Well, technically a client can spam an RPC regardless. You can have a limiter of whether to execute it or not on the server end.
oh in that case no delay is needed since it wont get executed past the admin privilege π
Another good reason to reduce the amount of data a client is allowed to send to the server too so they're not flooding your network with spam RPCs XD
oh yes
MaxClientRate=x
MaxInternetClientRate=x
ConfiguredInternetSpeed=x
I mean you can definitely ignore them but they tell you useful things,
right, I know some of you will just immediately tell me not to do this, but feel free to tell me any other way. Ive set up this horrible system to get 100% accurate ragdolls using animations and spamming the bone locations, but the catch is that if I do it too fast, specifically the arms and legs stop working. so I added a delay on it which fixes it but obviously looks horrible and not really acceptable
https://gyazo.com/fc505a39a8e9dd43021f95b133f6e680
https://gyazo.com/665b47838c735378275680931e2eafd5
so, any advice here? it seems that just spamming these events to the maps simply just messes it up
is there some better way to update the map or something
Ok, so there are a bunch of things wrong without really looking at the logic going on:
First, if these characters are simulated locally (as opposed to being "static" until new positions are received from the server) then you're going to be writing a very complicated system - keywords being prediction and reconciliation. Naively applying changes from the server despite the clients potentially having simulated past the point in time they're receiving is going to result in all kinds of jitteryness. If you are indeed simulating physics locally and applying data from the server without any sort of reconciliation then I suggest turning on network simulation to the "bad" preset and seeing how much more things break down because it's not going to be pretty.
Second, I really hope these aren't reliable multicasts as you're going to absolutely saturate your bandwidth like this (and potentially even overflow the reliable buffer which will result in a sudden disconnect). Even unreliable multicasts aren't ideal here, this should really be done via normal variable replication so that it isn't constantly sending updates.
Third, doing "naive" updates from the server by simply applying the new transforms will give pretty bad results - if clients aren't doing simulation locally then you'll end up with a delayed, jittery mess. At a minimum you'd need to lerp between positions, but ideally clients are doing their own predictive simulation (which then makes things way more complicated again).
oh no dont worry the physics is turned off for the other guy
entirely just sets its position to each limb through its animation
and I havent set the events to reliable
and only runs it while ragdoll
Gotcha, so that at least simplifies things a bit. I'd start by looking at interpolating positions then.
You want to introduce a bit of a delay to all updates from the server to prevent sudden snapping to new positions.
But you need to do so smoothly.
yeah, Ive been playing with interping a little bit but cant get a nice result with how it currently is
Rather than sending an RPC for each bone, why not build up a structure and send all the data at once? Same with the multicast.
because I had to add the delays
That doesn't really make sense
You send transform updates all at once, and then interpolate from the old positions to the new positions. They should be two separate processes
This isn't delayed. You're sending an RPC for each bone and all the RPCs will effectively happen on the same frame.
yeah but even just updating the map with all of the bones at once stopped the arms from working
no I did it in chunks
oh I didnt show the whole thing
yeah its not pretty
When you receive a new update, you store the current positions in an "old" structure and the new positions in a "new" structure. You set a timer for interpolation and every tick interpolate between them. You do not simply delay.
If you receive another update while interpolation is still going, you do the same as above - take whatever the current positions are and store them in the old structure. etc.
The arms not working is almost completely irrelevant to this code, that seems like a simple programming error where you're not updating them for some reason or maybe stomping on later results with some other task.
Actually, they may be due to the order you're updating things in.
Which shouldn't matter if you're setting relative socket positions but I didn't see whether you were
Delaying on the sending side is absolutely not the solution here - it will not solve any problems. The interpolation I'm talking about needs to be done on the receiving end, and applying things in the correct order should not be up to an arbitrary delay that won't actually happen in real networking conditions.
This still doesn't address what I'm saying. You're still sending an RPC for each bone. You could very easily make a structure that contains a "name" and a I suppose two transforms and populate an array of this structure with the desired bone -> values and send the array over in one RPC vs. sending each bone and 2 transforms as an individual RPC.
you mean a struct as in this kinda thing right?
Yep
FTransforms are 48 bytes. Sending 2 over at once = 96 bytes. You have FName there which are 12bytes regardless of size. So ~108 bytes of data for each bone. 10 bones = ~1.8KB of data. 60 times per second (assuming this being sent on tick) = 108KB/s.
I can see why you wanted to chunk it π
yeah Ill still delay/interpolate it some way regardless
luckily theres not a lot else to keep track of especially since most events are turned off while ragdoll
Do you use all the data of the transform? like rotation and location and scale?
no, I only need x and z location, and y rotation, I tried just using the y of the location for the rotation but well I actually do need all 3 rotators because of the gimbal lock thing
uh wouldnt this just be doing the same thing
So why not create a structure that contains only that data.
that's 3 floats which is only 12 bytes. So 24 bytes per bone. 10 bones = 204 bytes of data. 60 times per second = 12.2KB/s.
Im just not sure how to use this struct properly
even though Ive used these a lot already before its just I cant think how to apply it to this
You build up the array in the loop. When loop completed you can send the RPC with the array value.
Hopefully you're using a local variable within a function for the "Bones" array so you don't have to keep resetting it π
On the receiving end, you can read what the bone is, and do what you want with the location and rotation.
oh wow I didnt realise Ive been updating that array on the server. well I did, I just didnt think about doing it before and then sending it across
but I also dont know how Id access the array correctly in the anim bp
And instead of doing this at 60FPS, you can maybe send it at 15FPS and just interpolate? That would result in a bandwidth use of only ~3KB/s if you used 3 floats and your FName (which even that is still kinda high!)
ForEach Bones > You have the Bone Name, you have the location and the rotation
to be honest I dont even know how to set this here
You would keep your loop with the bone names to construct the structure array.
On the receiving end, you loop through the sent bone array and use the bone name and the location/rotation as you need.
So still do this, but instead of calling the RPC, you're adding to the "Bones" array and when the loop is completed, you send the RPC with the structure.
like this?
Yea
but then how am I setting them in the anim bp? cant with just an index
Ok, so then when you receive the RPC, you could break the received bones array down into a map if you want to. Loop through the bones array, add to the map your key (bone) and you can use a transform for your value and feed in your vector and rotation.
Then you can use the bones as you need them from the map.
Im lost
oh, I just did that but isnt that just the same as it was before?
No.
Instead of sending individual RPCs for each bone, you're putting it all into one RPC and reducing the amount of data as you're not sending a full transform.
oh right yeah. but then couldnt I just skip the struct and add to the map, then send the rpc containing the map and just set it?
maps dont replicate :)
maps are wonderful, but in multiplayer related code, pretend they dont exist
It makes me real sad they don't replicate.
oh wow, I thought itd just work like any variable if you sent it from the clients value
also this is where Im at
I was wondering about that, because I always multicast but it only needs to affect the "non controlled" player. like the other guy you see
but I dont know why this isnt working
the variable on the server should probably just replicate, and have an OnRep function
And if you don't care about it being on the player it's happening on, you can set the replication property to Skip_Owner
oh Ive never seen that
ive done a fair about of multiplayer gameplay programming and Multicasts are my least used tool
why no value
Don't worry about that message.
It's basically saying you can't use the bones output of the event into a node that could set its value by reference.
well this is new https://gyazo.com/94d61ddced8abd48eeb635333aa6bdc6
Check your output log. Getting any warnings indicating stuff about network at all?
If you're still sending at 60FPS 12 bones with your structure is going to be ~5.1KB/s of data which may be too much.
I dont know where Im looking
is that different to the usual one that comes up with errors
nothing
there's no inherent way to tell the server to change a property
the best someone can do is change it for their own client
there's no such thing as a message about arbitrary properties
it's not part of unreal's protocol. There's no client > server message for it.
clients can only communicate with the server via RPCs.
might just make 12 variables manually at this point
I guess it'd be more accurate to say that the server simply won't accept a property replication message from a client (because such a message does exist, it's just server > client only)
it might even drop a client for sending a bad message, not sure what the default behavior is. I guess at worst it just does nothing.
definitely!