#multiplayer
1 messages · Page 223 of 1
Yeah so it's not a multicast in any configuration
This is the bluesky thread about it https://bsky.app/profile/yawlighthouse.bsky.social/post/3larlfhfj3s2d
Okay - so it is a Server/Client RPC, but not executed locally
That is as confusing lol
Simulated proxies that have set owner being called
So actors owned by a client
So no multicast
That last image seems to be the most correct in explaining it
Now we just need a new example of when that is used
The thing overall. Cause the example further up was for a Multicast that doesn't call on the server
And that's then false
Remote RPCs are a unicast RPC
Maybe it was just explained to me incorrectly.
I think they should just format the tables to merge the "does nothing" together into one cell
would be less of a "oh god, time to memorize this sudoku puzzle"
From here, it sounds like it is literally just an RPC call that doesn't get executed locally. But from the client perspective - server RPCs weren't called locally.
And client calls weren't called locally either (from the server)
Sooooooo
It's difficult to think of a situation where you have an even back and forth except for like input ack or timing things
Even that usually has different function bodies tbh
never thought I would be wanting LESS networking features... I guess I'm just dreading the extra trivia
So basically a ClientRPC always calls, even if the client calls it and even if the server calls it on a Server owned actor.
As ServerRPC always calls when called by the server, but only calls when called by the client and they owned the actor.
A RemoteRPC only calls when called on a client owned actor and in that case acts like a ServerRPC or ClientRPC based on who calls it.
"Always calls" as in it's not dropped.
I don't know the use case.
Yeah me neither. Wild haha
Well, I asked for an example/use case in the docs for this. Hopefully we can get something.
Implementation :
And result is : Getting screenshot of Server view mode.
Any suggestions ?
Also tried multiple ways
Result :
What are you trying to achieve? Assuming this is your character class, if you're going want to end up on your owning client, no need to do any networking after key input already
Working on screenshot with cmd. Even tried without replication result is same
Does it work only in standalone mode for multiplayer stuff ?
Hmm, just gave the command a try, I guess at least for the editor it's screenshotting your main editor viewport only
Seems like a shortcut/command for this rather than an actual screenshot tool, but I don't know what's the behavior out of the editor
Ah okay, yes it's getting the "main" viewport (so your PIE clients are ignored). You should be able to test it as standalone game (not standalone network mode). You can still have multiple clients which can take their own screenshots this way
Thank you
But your RPC logic seems still unnecessary if you're just trying to take an SS of your (player's) own screen
what are the best settings to test real sessions ?
for now im launching my PIE sessions using standalone
so far no issues
I've given it some thought and come up with nothing
@lament flax what do u mean by real sessions?
session using the null online subsystem
so LAN sessions
yes, the null OSS
@lament flax not being noisy but what game u working on
currently an endless runner
sweet deal but u do know that online null only do lan sessions
i am no expert but steam have problems and uploading the game to steam will require artwork and etc.
i already used steam tools
and you dont need a published page to use an app ID and the SDK
um u do in fact do need one in order to download your game
if u going thru steam; u need to have a website store page
the app id u can use and the sdk but it'll find other people sessions
is that #if UE_SERVER not real?
i mean i have builded a client build from my game and i found the ServerOnlyFunction inside it in an external debugger like ghidra 🤯
#if UE_SERVER
void ServerOnlyFunction()
{
}
#endif
ghidra isn't a debugger
and UE_SERVER is 1 when it's a dedicated server build and no other configuration
yeah i know it thats why i am using it to only include it in server build not in clients.
but someone told me this is useless becasue it will still be in the .exe file and using ghidra or ida you can find it by some deep research.
i tried it to make sure if they are telling the truth, and i found it in the client build
I'm more curious about how you come up with these crazy hypotheses
how is a single "server" string proof of anything
i get breakpoint in it for testing when ever that server function accessed
seem to me he using some type of code javascript?
to make the test go green for success or what
dont tear down the 4th wall hehe
we need our wall
@everyonedoes anyone knows of a website with none paying freelancers, i really do not want to go through
now i clean build once again the same project and this time that serveronly function disappeared in client build
i guess this is because of cached build artifacts ?
why would anyone do work for you without payment...
@exotic wasp i do not know but waiting on one is a pain
I am trying to set the relative rotation of a spring arm so the flame (of a lighter) points up and rotates depending on the players movement inputs. This works correctly for the host, but the rotation from moving doesn't work for a client. I also tried setting the input forward and right to replicated, but that didn't change anything. The client is able to see the rotation of the flame when I move the camera up and down, just not the change when I move using the inputs. Any idea what I'm missing?
If I call the fire rotation event in the RepNotify function, the client can see the rotation from his inputs when he moves around, but it is not as good as the host.
it seems like the problem is the variables for input forward and right. It's always showing as 0 for the client, even if I set the variables to replicated
you can't guarantee that replicated variables will have the correct value when calling an rpc
How would I set this that it only runs for the client and doesn't go through the server? I'm assuming the client has the values for the inputs, and the server doesn't
Quick question for the gang. I'm told that relying on index 0 to identify the player on the current instance of the game in a multiplayer context may backfire. What alternatives do folks recommend to this sort of check that might be more bullet proof? Is using any of those nodes with indexes a code smell I should unlearn?
does save game work with dedicated servers? if not, what would work for saving stuff to server
In multiplayer 0 refers as Server right
DB's are helpful
of course? it's just a uobject you're saving to disk
My understanding was that 0 is the first instance of that class that spawned on that instance of the game. So on client it would always be the client player, on listen server it would always be that local server player, but I could be wrong.
if somepawn->islocallycontrolled
The way around it is to not think of things as being tied to a specific index of a player. Your logic shouldn't really care if it's player 0 or player 1, but rather some other logical thing you can set on the actor to know if it's the particular one you want, like whether they're on team 1 or team 2, or they're the killer or a survivor. Possessed pawns also have reference to their controller's playerstate which is a better reference to a player vs. trying to know a specific player by an index.
so nobody going to help me or even talk?
wow and here i thought this a community of devs not no butt hurt salty sitting at home wattching boogie woogie
seriouisly wolves are more helpful then this community
think i am going to sit back but here something you guys dont know
bye bunch of inner circle loserz
<@&213101288538374145> ^
The customer requires help finding the exit
Tbh I’m surprised they didn’t get timed out for @-ing everyone
they left themselves
took them a while, didn't want them to feel like no one's helping them
Lmao, wth did I just read? Entitlement at its finest.
No
Clients only know their own controller
Server has everyone controller
If server needs to know a player's controller, get the actor -> get controller
Not the first time he got possessed, the only mystery was why he wasn't ban earlier.
Makes sense, thank you! So it is fair to say that in a peer-to-peer setup player 0 or controller 0 will always refer to the local player, assuming just one player per process? I.e. clients will only see their own controllers, at index 0, and listen servers will also get their own controller at index 0 because the server's controller is alwyas the first one to be instantiated?
Or is that making too many assumptions?
There is no peer to peer out of the box
There is no peer-to-peer in unreal. It is always client-server. Listen Servers are instances of the game where there is a player playing while also being the server.
Sorry, wrong terminlology, I meant "without a dedicated server in the mix"
It will depend on who's calling the node
But if you are client, index 0 will return its controller.
I wouldn't recommend using that node at all though for mp. Just use getLocalPlayerController or something.
The reality is, you really should not rely on using any of the index based getters in online multiplayer. They work fine for local multiplayer (ie. multiple gamepads hooked up to the computer) There is almost always a better way to get the reference that you need in online multiplayer.
@vapid gazelle https://wizardcell.com/unreal/multiplayer-tips-and-tricks/
Good reminder to re-read this one, thank you.
Yeah it cover what node to use
should i attach my game mode and game state to my players since im doing a endless runner ?
im worried about the max distance
So I just read through a portion of this and it addresses what I'm not understanding right now but it doesn't really explain to me how to go about doing this properly with Blueprints. They talk about the C++ solution which is not exposed in BP's unfortunately. In a single player game, from my PlayerCharacter, I can use the static function of GetPlayerController with no problems. What's the correct way in multiplayer to get a reliable reference to each pawn's PlayerController?
I've tried using GetController as the guide suggests but do I have to use an RPC to accomplish this or something? It's confusing
That is the correct way
For some reason it is returning none when I try to access my saved reference.
Why would you need a "saved reference"? Also depends where you initially get it
Like GetController is returning a "saved reference"
BeginPlay is where I'm trying to save a reference. Well I figured I would store it because I use it to access my player HUD and other things. Maybe I should just create my HUD and other widgets from the pawn instead of the player controller?
I very rarely cache things unless I know I need it all the time and it's not trivial to get
But in BeginPlay, it's unlikely to be possessed
That's why there are possession events, that's when the controller changes
I had forgotten about that. And yeah I guess I learned a silly way. Your suggestion would be to just create my Widgets in the Character and leave the Controller alone though
Like people are afraid to use getpawn or get controller cause there is a cast involved and think it will make the game slow
GetController is a trivial getter
Where is this the suggestion
I'm asking if that's what your suggestion would be.
Very well. I am not familiar with AHUD
Where would you recommend creating widgets?
AHUD, PlayerController, LocalPlayer, anything but Character
widgets are local only
we do our widgets through the playercontroller and special managers
making sure they are only created on the local controller
Right. I am using RPC's to create my widgets for all clients on the controller. Therein lies my problem. I am using PlayerController but I can't access it in the same way I'm used to because the GetPlayerController function isn't reliable. So any widget functionality, I supposed should also be handled on the controller rather than referencing it from the character?
It is reliable, it literally returns the possessing controller
i mean without a controller, the player wont exist
Controller must exist
Controller IS the player
not the character
Controller == Player
Character == Visual representation
I'm really curious as what necessitates the RPCs too
Controller is literally the first thing created in GameMode when a client connects to the server
it must exist
Guys. I'm obviously new to multiplayer and not familar with even simple best practices. I thought I had to use a RPC to CLIENT to reliably create a widget in multiplayer
Like in a widget, I know the PC that owns it, and I can bind to a delegate when my pawn changss
well can you show what you have done so far
and what your end goal is, so we can give some pointers
cause MP is not trivial, and i have seen some very bad things done in MP games here, where people are new to MP and do some really questionable things
I surely can do that. 😉 Although I'm sure you're about to gasp at yet more questionable practices from yours truly.
I am just adding my player "HUD" widget to the viewport and it has some values which I change at runtime, like any other player HUD. (progress bars, interaction prompts etc).
Those values in question, are being calculated on the character mostly, which is why I was trying to reference my PlayerController, where the widget exists, to call the functions I need to
Hello. I am running an interface event on server, but the client doesn't do it unless I call the interface event outside of server... But then if I call the event outside of the server and on the server, I believe it runs twice for the host, since I can hear a sound twice.
is an interface event run on server suppose to play for host and clients?
And I suppose this is the danger of self-learning. I have not always picked the right sources apparently.
I have the interface event running on server, but I don't know why the client doesn't do the interface event.
where in these screenshots is the expectation that the client will run anything
The client only seems to do it if I call the interface event outside of run on server
ah, youtube
but the client is the owner of the actor currently held item
nothing here tells the client to run anything
which doesn't mean a whole lot
you don't send anything back
when the client presses the input, it runs on server
yes and where's the other way round?
the server does something
you don't tell the client to do anything from what I can gather here
a client/multicast RPC to tell the client to do something in response
and it works, but I don't think I should be running the event outside of the server and on
What is this meant to be here, swapping items in a container?
First off your timer temporary tick to move the lid should be a timeline probably
I'm just trying to set up an event for when items are swapped in or out
in or out of what?
when the player swaps them in or out for another item
so if I swap to a lighter, the lighter opens the lid
which is what I'm working on now
If I run the interface event outside of the server, the client does it, but then the others don't see it
ok so an "animation" to play when something is equipped, like say you were swapping a gun for a lighter.
Gun goes into holster or otherwise does a thing
lighter gets put into hand and flipped open
ignore server stuff for now, all of this should be local.
but what if I want others to see it?
it'll be local to them too
what is networked is the fact that the thing just went into the hands
OnRep_CurrentlyHeldItem
I know in C++ you can get the previous value (to play the PutAway stuff on the item being put away), not sure if you can in BP
But anyway, if CurrentlyHeldItem is a replicated reference with repnotify, you'd use the OnRep function to call ItemSwapIn
So if I want to just simply add a widget to the viewport and then feed it values at runtime, I should get controller and then cast to my player controller every time instead of getting a reference? I'm just trying to better understand this because my grasp of how this should work in multiplayer is obviously way off.
It'd go like this.
Input -> Run on Server Event
Run on Server Event -> set CurrentlyHeldItem
OnRep_CurrentlyHeldItem -> call ItemSwapIn on CurrentlyHeldItem (in C++ you could call ItemSwapOut on PreviousCurrentlyHeldItem too, but don't think you can in BP)
The logic of the item is in the actor. So in the item actor, I should set a repnotify from the interface event?
the repnotify is in the character, it tells the item that CurrentlyHeldItem got changed to to play its ItemSwapIn "animation"
And this is what my player controller graph looks like now.
get self
this is a playercontroller
why get playercontroller 0 when you can get self
When I get self, it throws an error that this is not a local player controller
That's the serverside version of it freaking out
gate by IsLocalController or whatever
BeginPlay runs on server and client. You only want the local version to do the HUD stuff
BeginPlay -> am I local? -> yes -> ok setup UI
Ah! ok so maybe don't do it on beginplay. do it on Onpossessed
or that
For clarity, the server, on a listen server, is separate from the local client created by the server, so when it checks for local player controllers it's going to find the host controller?
The check is if self (a playercontroller beginning play) is locally controlled. It'll be true for the owning machine on clients and for the host on the listen server. It'll work.
Yes. It definitely worked. I just want to understand why so I can be as cool as you guys at some point. 😉
ok so now rather than trying to access my player controller from my character to update widget values, should I access my character from my controller? I'm using OnAudioEnvelopeValue for instance, which isn't available on the controller or I'd just move all the calculations over to the controller.
So how would you suggest tackling my problem above? I was trying to store a reference to my PC from the Character and call widget functions from that reference.
I'm not sure how you ignore advice and have these weird tangents with them
possession is of pawns
and you can safely detect if a PC is local within BeginPlay
I'm not trying to be dense here man. I just don't understand some of your answers. What might seem straightforward to you isn't clicking yet for me. So I'm not ignoring advice. I must be overlooking it.
Work the other way around. Have your widgets listen to event dispatchers rather than having your game code trying to manipulate your UI. Your UI can then work independently apart from giving it a reference to the things it needs in order to bind its dispatchers, and working this way ensures you don't have code that may be trying to manipulate widgets that don't exist on the particular intance of the game.
Your Character already has a reference to its controller. The controller also has a reference to its controlled pawn.
I actually mentioned that a while back, that the controller has a delegate for the pawn changing and you can react to that appropriately
Ok. I can attempt to work with that. Much appreciated.
🤷🏻♂️ I appreciate you giving advice. I'm just not at the level to recieve it without translation.
I really like things being agnostic, have the pawn do pawn stuff, and the controller and UI can react and modify the pawn, but the pawn doesn't even need to know they exist
It'll require a different mindset but that makes alot more sense.
as a bonus, if every pawn in your game is effectively the same thing, then you can test out enemies and such by just possessing them and driving them around. The player's pawn doesn't need to be a special snowflake that knows about UI and such
And to start out, just use binding for your UI until you see the need for dispatchers and such
binding is basically just checking stuff per frame.
New frame -> ok do we have a dude? -> yes -> ok whats their health and maxhealth -> update HP bar
UMG bindings were a mistake
nope they're fine
binding for stuff that's constantly changing is just fine
well they aren't and that's actually literally true, it's also why there's a project setting to make them error
especially visibility bindings that can get called multiple times per frame
I wonder why UPROPERTY doesn't have an automagic OnChanged dispatcher system
well this is the kinda stuff that ViewModel is supposed to fix
which is event driven with efficient bindings
I mean even outside of UI
seems like half of game programming is doing things when something changes
technically, I think the FieldNotify UPROPERTY specifier works outside of UMG land
i actually did a test with widget bindings
10 widget bindings or 1 single tick function setting the stuff
the single tick (even in BP land) was a LOT faster
problem with bindings is, they are each its own tick
and has to go through a lot of layers
we used them years ago in a prototype HUD
and it was like over 1ms for the widget
changed it to event driven and a single BP tick and was like .2 to .3ms for the same widget
wow. Event driven as mentioned earlier with dispatchers bound to events on the bp?
we never really call into widgets
our widgets pull the stuff it needs
or binds to things it needs
Was it still modular, as in a widget could "bring" its own idea of what it needed? Or did some parent need to know what data to fetch
Like
Tick
For each widget
Go get your data king
it was all indendent, we have some container widgets
Right so if you need to open and close a widget which is looking for direct input, do you call an event dispatcher and bind it since you're not calling the widget directly?
but most of it is indepdent
we make a clear seperation between game and UI
game never needs to know about any UI
it sends events out, etc. Widgets bind/listen to these events to do the work
Roger. I'm tracking that from your earlier comments. I've gotta figure out how to implement that.
Do you prefer to use event dispatchers or like your own custom BPI to make that all happen?
whatever we need to use
for the job/task at hand
we ofc use C++ a lot
and we have a lot of our widgets core in C++
I'm limited to BP's for now
tried viewmodel?
I think there's like 2 people on here that have
@sinful tree @meager spade @lost inlet @dark edge I appreciate your time and patience. I've converted 2 of my widget functions to be event driven and I I'm separating game from widget. I can see why you'd do it and I'll be implementing this workflow from now on.
Guys I have a problem. I am taking a trip on my server with seamless travel. And when my server travels to the destination map, my players before being initiated take the map camera at position 0,0,0, how do I avoid this.
This methodology actually solved several problems I didn't even know I had. Wow.
anyone ever encounter error: no member named 'UActorComponent' in 'AActor' when placnig a replicated actor directly in the editor and launching pie?
looks like I had an old copy of an actor in the editor and it didn't reflect c++ changes
If there is any reason to, can you run RPC's on a component of a player-owned actor? Again I may not be going about this the right way but I'm trying to create an item drop function on my inventory component but it only works on server side so I'm guessing it's an ownership issue.
yeah you can
ownership means the owning player can call a run on server event / Server RPC on it but other players cant
I can send a message saying to drop somethng from MY inventory, but I can't spoof a packet and make you drop your items
Ok. So, if this is on the event graph of my inventory component, which is a component of my player character, shouldn't it fire?
If it's a replicated component
Yeah it's replicated but this only works on the server and not client. Weird.
is the actor you're spawning a replicated actor?
Are you saying that only the server's character can drop an item, or that a client can drop an item but the item only appears in the world on the server's screen?
If the server player drops an item, it spawns in the world for both players. If the client attemps to drop and item, it appears to decrement properly in the inventory but it doesn't spawn an actor for either the client or the server.
show code from input to the run on server rpc calll
Item ID being passed over is probably broken
ok. I will check that. I wonder why that wouldn't break on the server player
show the code for where that id comes from
Print that id on the RPC to see if it's garbage
Trying that now
all that should be happening serverside
All the client should be saying is "I want to drop the item in slot X"
and you do not want multicasts involved here
what items you have is state
use replicated variables and OnReps to respond to them changing
Change your RPC to have the signature of that RemoveFromInventory function
that's what you send the server, what index you want to remove the thing at and other data like whole stack
I'd start with just the index "Hey Mr. Server, make me drop whatever's at slot X"
You can reuse most of what you have, you just don't want the client to decide anything regarding how much of any item they have
they just make requests "Try pick up that thing" "Move this item from my inventory to that inventory" "Drop this thing from my inventory" stuff like that
Right. That's where I'm starting. I'm gonna move the logic from that function, onto the event graph, in a server rpc.
and in OnRep_Content, you can call a dispatcher which your UI can bind to to update itself (the content changed)
Then I'll see about reworking the multicast logic. It's just initiating a refresh where it clears the children of an array of structs and then recreates the widgets. That can probably be bound to an event dispatcher
awesome.
Doesn't seem to be working. Might need to rework this system from scratch to make sure I'm doing things correctly
You're right of course that it's a broken ItemID so I'm not passing it correctly at some point
If I call set array elem from my Contents array variable, and it has a rep notify, will that fire or only if I directly set the Contents variable?
My bad. I'll delete.
Trying to replicate scalar parameter value with no luck
RPC can only be sent to the server on client owned actors.
You also shouldn't be using multicasts in this instance. Use replicated variables with OnReps which can then trigger the OnRep function when the value changes on clients.
Dynamic Material instances also cannot be replicated, there's no point in marking them replicated. You can create and use them locally only.
does anybody know if the replay can be captured on the dedicated server? using "demorec" command..
According to the code there is no limitation if its running on the dedicated server or the client but wanted to see if anybody has experience with this part.
an unreal demo recording is basically just writing replicated values and rpc calls to a giant file (in a special net connection that uses all of those replay replication conditions and calls)
in some ways the server doing it is arguably better as it doesn't have to ignore things that don't get sent to clients
If I'm calling a function using a server RPC, is that function still only being run on the client?
In this example for instance, everything done in the RemoveFromInventory function should execute on the server, correct?
Server rpc literary means, run this function in the server machine.
It's the only way for client to communicate with server
I'm just doing a sanity check. Because I was getting some results that didn't seem right in light of those facts.
Thank you.
Or rather, I thought I was. I was just misreading the situation because this replication thing still isn't my forte.
For example. Input is local, so imagine your character. It exist in the server machine and also in your machine.
It has a ServerRpc function called Test Function.
If you as the client press input and call the Test Function.
What it does is, you tell the server to run Test function in his copy of your character.
Try to do what I said, but make the function change the character color.
You will see that, even if you play as client. When you run the test func, only the character in the server will change color.
Roger. Makes sense. I think I understand
Thanks
hello ...anyone might know this.... :
Why when i creating a custom game instance and i set it ..i start the game and my character is hidden ....on default game instance ofcource no problem works as it should (i need a custom game instance for my multiplayer template) .....mention i try this on 5.5 ...(in the 5,4 engine version there is no problem with the same template /same custom game instance ) ,,,anyone might know this issue?
Revamped my inventory and I'm now getting the functionality I wanted. I'm gonna go through my other systems and alter them to utilize OnRepNotify everywhere it should be.
Now, theoretical question before I start developing another system: I know that widgets are created locally and not replicated. So if I wanted to make a world space widget, lets say a digital clock, which should display the same numbers to all players... would I filter a function using "has authority" to do the value changes on a replicated variable, and then OnRepNotify, call an event dispatcher which that widget is listening for to change the visuals on itself?
is doing a dmg effect indicator in a widget a good idea ?
i know there's a seperate way to do it via post process
but not sure which would be more ideal
Like a blood screen or red flash?
yea exactly
Could work, but even if you do that I highly recommend doing something like setting a scalar parameter in an MPC. Regardless of if you do it in a post process or in a widget, both can use a material that can read the MPC. When taking damage you can simply set to current game time and or animate a different float for a 0-1 alpha value to affect the display.
This way your damage code simply sets values on the MPC, no real multicasts or care about the widget or anything, super cheap and anything that cares can animate based on those values.
A red flash effect for instance can read the current time minus last damaged time to animate a red flash, or read the 0-1 to play a flashing red animation more the closer to 1 it is for like low health, etc.
this is dope to know, yea was essentially asking for the performance / what would be most efficient so this method seems best. if i did this via mpc, wouldn't i still need to do that soley on that local client htat's getting hit ? and that would already be on the server so i'd need to then call a owning client event after the confirmed hit, unless you're suggesting that an MPC will only happen on that client that recieves dmg on that server event. i'd be adjusting this in a widget let's say, and that widget should only be changed on that client getting hit , how would that work. ?
This would strictly be a client only effect yeah. MPCs are purely local to the machine. How you tell the client to handle that would largely be up to you and your systems. For example I use GAS, so it's all part of the same gameplay cue for me. Hit animation on the character, do sparks or blood particles, etc, if locally controlled do stuff that would affect the owning player like the MPCs and whatnot.
ok so on the server dmg event (on the player getting hit), i could do this like on the repnotify for dmg , and then set this mpc in there and add an islocallycontrolled check ?
or i could do this just stright up on that event , still doing a locallycontrolled check ? (not doing it on the notify)
I'm not sure I would do an OnRep here. You'll end up with complex bullshit gating your stuff. For simple example any setting to health would trigger it and you'd have to find a way to decide if it was a valid damage event or just the player equipping something or getting a buff to health, or regen, or etc. etc etc. Realistically I'd just make a multicast or client RPC to handle the on damage visuals that don't persist. Like... Being damaged to a certain percent I'd do from the OnRep, it's based on the state change, but like a blood splatter or hit anim or screen effect I would do from an RPC.
That's all the gameplay cue is in my case when you break it down is just a complex multicast RPC told to run when the player takes damage.
yea that actually makes sense, i do have pretty much all the hit fx on rep , and it is a bit strange at times but i like what you mean on state change / percent going into the on rep, that makes more sense
how to get game state for controllers?
when did you try to access the game state? don't crop it like that
triggerint a function on client
however somehow when I do that on beginplay the client said true too
perhaps I have to set it as a variable on begin play
Begin play is not the right place most of the time for multiplayer
you are most likely just fighting with a race condition
need more context which is missing
following gamedevraw's tutorial, first 2 pic is what he did
next 2 is what I did
however when I tested it it says the game state is not valid
The player state (Game State*) 🙊 should have an array of all players
The container in the game mode feel redundant to me
@cold cipher btw on ControlledSpawned runs on the controller in the server, not the client machine
is this intentional?
I noticed it too, but after I changed it to run on owning client the outcome is still the same
GameState*
and the function that run the check is also ran on owning client
weird thing is when I try to run it form the pawn it worked
got the mpc and post p working and i like this method alot. baffled i didn't realize what mpc's were capable of, thinking of the possibilites already
how do you create dynamic collision channel during runtime? I want players and NPCs of the same team to have no collision with each other but they will have pawn collision with different team.
maybe make collision profiles so they avoid each other
im not even sure how would that even work for x amount of team
you can disable collision with specific actors
or maybe just make a few channels ahead of time
Me neither, probably create a collision profile for each team and assign them based on the team.
should i attach my game mode and game state to my players since im doing a endless runner ?
im worried about the max distance
Game mode and game state don't have physical representations.
the problem is idk how many team
thats why i want it dynamic
basically like battle royale with a team up to 3 players
they have since they are actors, but i guess the max distance squared is relative to the listen server ?
Look at GameStateBase's constructor. It has AlwaysRelevant=true. It can't go out of relevancy for a client. And GameMode only exists on the server so has no replication to care about relevancy.
okay thanks
If its for hits you can just detect everybody and then check from the HitActor which team it is and do nothing if its same team is the easy way. Problem solved.
You can also maybe add to the ActorsToIgnore array when doing the Hit Tracing is another way to filter them. I do not know if you can do dynamic Collision profiles.
I'm not sure what you'd add to the ignorearray actors if you do not know the team so that may not work actually unless you had a list of all the players except your own team like if you have a function to get all enemy actors in the beginning and then put this in ignorearray. Just do the first method, it doesn't matter if they hit a friendly team if it doesn't do anything, it won't happen often anyways.
I think you can do hit based on collision profiles and ignore some profiles, which is probably the proper way. I think LineTraceSingleHitByChannel does this but you need the profiles and I'm not sure how to make them dynamic you'll have to work this out, making many profiles for all possible teams or assigning them to players in real time.
when you change a variable value on the server with set w/notify in BP, does the server itself receive the rep function call?
OnRep no, this only is called on the clients, you would have to call it explicitly on the server
Yes
If it's the Set w/ Notify node then it does call the rep notify in Blueprints
Hey all - is there anybody in here who has experience with C++ coding in the character movement component? Specifically using the Custom Flags to switch things on / off?
anyone know why my client is moving faster than the server?
the replication works, but it seems as though the movement speed is doubled
Are you using the standard character BP?
probably not taking delta time into account
set collision object?
a dumb method
but have collision object team 1 2 3 4
movement without prediction is unbearable
unless it's turn based and moved by A.I
also why are you still using multicast, thought others have pointed out that it's not the way
Thanks for the rep notify Idea I got it working your a life saver lol I would have spent so much time on that simple thing
what's the alternative
you NEED multicast if you're going to have more than 2 players, which I will
No, this is not valid reason
the alternative is just to set incoming data every tick
which was suggested too already
no, you don't need multicast
multiplayer designed for 2 players isn't inherently different from more players
use replicate movement
The rule is simple, if something is stateful (everyone needs to be in sync), don't use multicast
if you have multicast everywhere in your project, then you are doing it wrong
only applicable for fire and forget events. There is even a AAA dev that ship a game with 0 multicast.
has anyone made a custom UChannel class for networking? I'm trying to use UVoiceChannel as an example, but it looks like it's built right into NetConnection.cpp
do I need to somehow make a custom UNetConnection class to initialize my custom UChannel class?
or maybe I use UNetConnection::CreateChannelByName? time to go down the rabbit hole
Good morning smart people. So I'm trying to go through my systems and make corrections from what I learned to do incorrectly and one of those things is my player's flashlight toggle functionality. Right now it uses a server RPC that calls a Multicast RPC which I understand is incorrect because it won't have persistance so players who connect mid game or reconnect won't get the correct values and other player's flashlights will only be on/off correctly when they use it next. So what would be the correct way to do this with a repnotify without players having to refresh all replicated values when connecting to a server?
many ways but 1 simple one is having a flashlight state which could be controlled via an Enum if multiple states, or a bool (flashlight on?)
make it repnotify, and assuming your multicast function/logic was correct you can just put that function / logic into the rep notify, checking whether it is on or off to change the state
something i've noticed, is that if the state hasn't change the rep notify doesn't fire again, so a bool for example would need to be changed for the logic to fire but i find this beneficial more than a limitation
Right. So theoretically, instead of firing of a server rpc which fires a multicast, I can have the flashlight toggle button fire a server RPC that simple changes the replicated bool (or enum) value and then the repnotify will handle the flashlight function
Or should the bool value change on the client.
how would you go replicating a object with a rope physic ?
does the Initial Start Delay add that delay to Each loop ? so effectively that would make this timer fire every "2" seconds, rather than 1?
no yea, it's that simple. client triggers a server rpc (via input etc) , and on the server event you do whatever logic you want the server to do, but yes you would set the bool value on the server RPC
Thank you. It works while everyone is connected but if I reconnect, the client doesn't this the correct value. I guess I need to do a periodic refresh on the client to call that repnotify? Or should there be a function that is called when a player connects that calls all repnotify's to make sure the newly connected client is seeing the correct stuff?
oh. huh. nevermind. I guess it is working now. Thanks!
Newly connected clients get the most updated value from the server. That is why stateful changes are done through onreps.
Yeah I just read that when I was starting to be an idiot to concoct my own update system. 😉
for the record, this works as i hoped. i.e. setting it to loop and an intial start delay does just make that delay only at the beginning and not every subsequent loop after the initial. nice
I am working on an interactive door and I'm trying to disable the tick when the door reaches the desired rotation angle and enable it again when the player interacts with it. The door doesn't start with tick enabled. The first interaction enables the tick for server and client, and gets disabled in event tick when it reaches the angle, each interaction afterword only shows the tick getting enabled on server. I'm confused why because I'm enabling the tick outside of the server
once the tick gets disabled for the first time, it doesn't get enabled again for the client
I think I got it. I ended up setting a repNotify for enabling tick
Trying to create proximity voice chat using this method I found on the net.
The attenuation sound does work for the host but the client doesn't.
That means no matter how far the host is he will be heard.
Anyone have a clue ?
What do you guys do to predict shooting for actor based projectiles? (just looking for a high level description)
In particular my problem is for homing projectiles
Question about PIE mode for games with online platforms / features. How are you setting up PIE play of game levels when your server requires a valid login / session to play the game?
I am looking at some of the GameInstance overrides such as InitializeForPlayInEditor but it does not allow for an async HTTP request to recieve a callback and then continue.
Usually no "outside PIE" stuff during PIE.
Like, non of the online titles I worked on have had support for any of their features outside of packaged builds and maybe standalone.
So what about a game with an inventory / loadout that has to get pulled down?
Maybe I just need to use Standalone w/ Start Separate Server option and a quickstart map.
Begin Play may be the wrong time on a client - the playerstate may not be valid at that point.
Am I misunderstanding variable replication? I know how to work around this, but I'm trying to understand why this doesn't work:
I have a component on my Lyra Character subclass that's keeping a reference to a target ATarget. The component and the variable are set to replicate. When I activate an ability, though, on the server, ATarget is out of scope.
I've solved this by using a Wait TargetData task in my ability and moving everything out of the character, but why doesn't this work?
Oh, it's because I'm misunderstanding replication, isn't it. It's just server -> clients. Is there some builtin magic inside GAS that lets clients replicate to the server, though?
when it comes to dormancy and tick, would dormancy override the tick in this case ? having tick enabled for example would only matter if it wasn't dormant? or does it being set to dormant override any tick enabled thing
You're right, that's why I've added the WaitIsValid node that wait for the player state to be valid. I've thought it might be null but it seems that it does work at that point. but the main problem consist.
Oh sorry, I thought that was just an IsValid node.
I don't think these two are related in such a way. Dormancy handles whether or not network data is transferred. Setting something dormant shouldn't modify whether tick is active or not, and setting something to tick off shouldn't modify whether its dormant.
If you have something on tick that may trigger network a network update, then that could cause it to wake up.
yea that's another thing im trying to figure out , is if i set it's dormancy to inital , does that mean any interaction at all would wake it up ?
From what I understand, anything that causes a network update (like sending a multicast or setting a replicated variable on the server, including doing things that modify replicated properties like location or rotation) should wake it up from dormancy.
It's not suppose to, however it does work that way in blueprints, it's been a bug forever and they marked it as won't fix
If you make the entire class in cpp it does not work this way, and the only way to receive replicated changes from a dormant actor is by forcing a net update or calling flush net dormancy on the actor
Sidenote: not enough people talk about the benefits of setting variables through RPCs instead of having 100 replicated variables that don't change often.
yes, client can send data to the server with target data tasks
but if you set a variable with an RPC, then people joining late wont see it. IMO it's better to condense a bunch of replicated variables into a struct with a custom net serialize function
what about the Rep_Condition Initial only?
like having a variable initial only and rpc changes? that might save a tiny bit of performance but at the cost of more code.. i guess itd depend on the use case
Gunna make those setter functions actually work for a living.
it's really not hard to solve that problem
everything has a trade off, including serialized structs
i never determined definitively, but i dont think that initial only condition will replicate when something becomes relevant again
so VERY first time it will replicate, but if you walk out of range of an actor, then come back, it wont replicate
It should. Relevancy = you're getting a new copy of that actor on the client, thus, the values should be considered "initial" to that client.
thats also what i believed, but it didn't behave in the testing i did
Looks to work on my end....
I was just working on something on my player state for clients on begin play and realized that it's... triggering twice. I'm testing with 2 players on a listen server and using a has authority > remote branch to make sure only the client is triggering, and it seems to be triggering twice.
And when I use a breakpoint it's showing I have a PlayerState0 and a PlayerState1
Am I misunderstanding how this works? Or is something wrong with my multiplayer setup?
What exactly is the issue?
there are 2 PlayerState so each will call begin play
There are 2 Player state in the server machine and there are 2 player state in the client machine
But if I'm using a has authority check and only calling the function on remote... would that still trigger twice?
show what you have
This seems to be adding multiple widgets to the screen. Adding a breakpoint reveals that it's triggering twice. I only have one client and one server player.
It will trigger, twice you said you are playing with 2 players
so there aer 2 player states in the client
I will draw something brb
So the client is triggering the server's player state, and adding a second widget to the client's screen?
Lol yes. I need a diagram, clearly.
@round mist
There are player state for each player in the client machine.
So when PS1 come to existance, it fires begin play, then check if it's remote. Since it's remote then it fires create widget and the rest of the code
PS2come to existance, it fires begin play, then check if it's remote. Since it's remote then it fires create widget and the rest of the code.
so you end up with duplicate
Huh. So how do I prevent this from creating two widgets?
You just call it once?
Right now, your code is. For playerstate that comes to existance create widget
so if u have 8 players, u do be making 8 widgets
For a start I don't recommend creating HUD in playerState
quiet an odd place to put Widget
Second, I suggest to get fammiliar with IsLocallyControlled node
IsLocallyControlled checks if the actor is owned by local player
Yeah... let me back up. I'm doing some janky loading screen stuff. Maybe you've got a better suggestion if you've got a sec.
so u can have 5 characters in the game, with is LocallyControlled, you can filter to fire the code only on the actor that you own.
You can't make loading screen in bp
All widget get destroyed on hard travel
Rider is free, join the church
you can still get away with plugins, but that's just some one doing what the blueprint can't for you.
If you want to unlock the engine potential it's good to migrate and have the best of the both world.
I have an incredibly large game world (open world with dozens of sublevels). Long story short, but level streaming doesn't quite work for us, so most levels are set to always loaded. THis load time is causing Steam connection timeouts and crashing people's games.
I've set most the levels to bp loaded and that cuts the loading times WAY down. I use a C++ loading screen that is only up for a few seconds because of that. Then when the player controller is loaded in, I trigger a blueprint loading screen with a blocking load that updates a progress bar between each sublevel load.
I'm just trying to find the best place to set this up so the player can listen for loading finished and then trigger spawning their pawn, then unhide the widget.
I'm thinking I'll just move it to the player controller instead of the player state. Not sure why I thought that was a good idea.
All this is working perfectly, btw. The only issue is that I built it on the game mode not thinking that clients can't listen for updates on it cuz it's not replicated to clients. So my first thought was "Oh, the player state is replicated. I'll move it all there." lol Which is how I got into this mess.
Game mode only exist in the server
Btw the loading bits, I don't see how that is related to networking?
Yeah. I know that, just spaced it when building this.
is there any data the client and server have to exchange in regards to loading the world?
So an actor that manage the process might do the job
No, I just used the game mode as a place to spawn the widget thinking it was going to trigger for all players. But you're right. It's not network relevant at all, so it can all be handled on the player controller.
This needs to work for dedicated servers as well, so I need to separate the widget from the loading. Probably a loading manager actor I guess.
Glad to hear that you didn't immediately see any giant red flags with the approach though. lol I was half expecting you to be like "that's not gonna work..." lol
I have no idea bro, quiet a newbie in multiplayer as well
might want to ask others for opinion
Mp is a can of worm
Im about to give up yesterday
ended up fixing what I thought unfixable, so going forward for another day
Ha ha that's how it usually works.
I mean, I've been handling all the multiplayer logic in my game solo for the last 2 years or so now after I had to let my lead programmer go. And nothing's really exploded yet.
The only thing I'm iffy on is how the streaming level loading works between server/client. Like.. if the dedicated server loads all these levels in... can the client even join the world without them automatically loading in as well?
Cuz if not, then this was all a waste of time.
that's my worry tbh when it comes to collab. Nice to hear that you are pushing through
Yeah. When I started this was meant to be single player so I knew nothing about networking. After the programmer left I've had to learn everything by just digging through his code.
I'm pretty confident with it now. I feel like I could start a multiplayer game from the beginning now without too many issues. Though our game is entirely client authoratiative since it's super casual and cooperative. I don't think I'd even know where to start with server authority. XD
Well yeah. I understand the logic of it. But in practice I wouldn't know how to do it. lol
Oh thank you for your help by the way @dark parcel Much appreciated!
hi! I'm experimenting with Mutable to make custom characters at runtime, and am now wondering about replication. I don't have much experience with it but know the basics, the common docs etc.
Now if I at runtime want to update one of the customized options (let's say setting an int parameter from 1 to 2, which changes the mesh to a different hair style), would it be better to just call the "SetIntParameter" function on both server and client, or should I do it on the server, then replicate the change in data somehow, and apply it on the client with RepUsing? Not asking specifically about Mutable btw, just the use case where this came up with
I'm not familiar with this sort of best practice
what are some games where one player can grab onto another player, and that grabbing players movement is now dictated by the movement of the grabbed player? Only ones I can think of are
- echo arena (VR game)
- new BO6 lets you use other characters as a meat shield/take them hostage
and to that, how does BO6 handle the collision for that; i.e. what stops the controlling player from forcing the meat shielded player from wall clipping? example here: https://www.youtube.com/watch?v=5aabEkyo13I
Welcome to CDL Clips!
– Your Ultimate Destination for Call of Duty Leauge Clips! 🎮🔥
🚀 Get ready for a rollercoaster of entertainment as we bring you the funniest, most epic, and latest moments from the Call of Duty League.
Subscribe now for your daily dose of adrenaline, laughter, and top-tier Call of Duty content! 🎬🕹️
Don't miss out on the...
heyyy. I have this code on the Pawn:
void ATPawn::OnMouseClick()
{
if (!TGameState)
return;
FHitResult HitResult;
GetWorld()->GetFirstPlayerController()->GetHitResultUnderCursor(ECC_Visibility, false, HitResult);
AActor* HitActor = HitResult.GetActor();
if (HitActor->IsA<ATCard>()) {
ATCard* Card = Cast<ATCard>(HitActor);
if (DrawedCard) {
Hand.Remove(Card);
Hand.Add(DrawedCard);
Card->EnableCardCollision(false);
DrawedCard->EnableCardCollision(true);
FVector HandCardLocation = Card->GetActorLocation();
FRotator HandCardRotation = Card->GetActorRotation();
Card->ServerMoveDiscardedCard(this);
DrawedCard->ServerMoveCard(HandCardLocation, HandCardRotation);
DrawedCard = nullptr;
ServerEndTurn();
}
}
}
That calls this server function ServerMoveDiscardedCard but doesn't call the ServerMoveCard. I don't know why one get's called and the other not
Where are you setting your "DrawedCard" reference? Assuming these are both RPCs, is that "DrawedCard" owned by the client?
You could do this stuff in Gears of War as well. The way I'd do it, is attach the player to the grabbing player and disable movement controls from the local player.
the DrawedCard it's set on each client and it's not replicated
That would be why... If it's not replicated, then you can't call RPCs on it.
OH, I wasn't getting why the Card worked and the DrawedCard not, but it's because I have the hand replicated. but I don't really want to have the DrawedCard replicated, I want every client to have it's own drawed card
even adding replication to the drawed card doesn't call the server rpc
This was my first inclination too. It might be because I'm using General Movement Component, but trying to attach a GMC pawn is basically impossible because of how the networking is set up. It constantly tries to get corrected back to where it was when it attached.
Additionally, a problem with AttachActorToXYZ is that is loses its collision
I'm experimenting with spawning in a new "dummy" character and setting the location on tick so that it keeps its collision
You don't specifically need the DrawedCard variable marked as replicated, so long as the reference that it contains is replicated. You still must assign ownership of that card to a client in order for a client to call a server RPC on it.
so like in this code add the DrawedCard->SetOwner(this);? or how.
because I add the drawed card like this when clicked:
if (HitActor->IsA<ATDeck>()) {
// If it's the player's turn, get a card from the deck and add it to the player's hand
if (TGameState->GetDeckCards().Num() > 0) {
UE_LOG(LogTemp, Warning, TEXT("Drawing a Deck Card"));
DrawedCard = TGameState->GetDeckCards().Pop();
and the GetDeckCards it's from a replicated array and also every card it's set to be replicated
Ownership has to be set on the server, and yes, SetOwner() would be the way to set an owner of something.
You also don't want a client telling the server what card it is they drew. The client can report that they clicked on the deck to the server, and the server should then decide what card to assign to the client.
any ideas why the unique net id of my player controller is null ?
Are you in PIE
so I made this:
void ATPawn::ServerGetDrawedCard_Implementation()
{
if (TGameState->GetDeckCards().Num() > 0) {
DrawedCard = TGameState->GetDeckCards().Pop();
DrawedCard->SetOwner(this);
}
}
// and then in the other code I change it to this:
if (HitActor->IsA<ATDeck>()) {
// If it's the player's turn, get a card from the deck and add it to the player's hand
UE_LOG(LogTemp, Warning, TEXT("Drawing a Deck Card"));
ServerGetDrawedCard();
if (DrawedCard) {
FVector TargetLocation = CalculateDrawnTargetLocation();
FRotator TargetRotation = GetActorRotation();
TargetRotation.Roll = 180.f;
DrawedCard->ServerMoveCard(TargetLocation, TargetRotation);
TargetRotation.Roll = 0.f;
DrawedCard->MoveCard(TargetLocation, TargetRotation);
DrawedCard->GetCardMesh()->SetRenderCustomDepth(false);
}
}
but I don't know if it's what you mean. also it doesn't work well because the drawedcard it's null on clients (I made it replicated also to try but doesn't work)
Your logic is wrong
You can't expect the server to immediately return a value into DrawedCard for you to continue your logic.
^
The RPC will be sent but it is non blocking
The server will eventually receive it but your logic will continue regardless
mmm I get it now
Hey all - I'm looking for some industry advice on how to best handle network corrections on the player capsule when launching a player? I have a launch pad which is server-authorative - I want the server to decide if someone should launch or not. But when the player hits the pad and the server launches them, there's a small correction on that frame.
This kinda makes sense - the client is predicting no launch, then they get launched by the server
What would be the best way to avoid this though?
Allow the client to launch locally and then validate on the server if it's okay for them to do so?
What's the condition for launching a player
Is there a way to manually associate a client object with a server object such that when changes to the server's object replicate they propagate to the client's? Specifically, in 4.27 using the Inline specifier for an array of UObjects, replicating those objects causes the creation of duplicates on the client, since the client has created his own local versions of them.
apparently this just works in 5, but this is for work and we are not planning to upgrade to 5 before release
Basically when they overlap an actor
I could just let the client decide when it overlaps and do the launch, but there would be a few fringe cases where that might not work, like if the server had just destroyed the overlap actor but the client still saw it on their end etc
That's an edge case where a reconciliation is pretty much the norm
I wouldn't worry about it
Have the client launch themselves on their end and the server will do the same when performing the movement
If for whatever reason the server refuses the client will just snap back
I'm using a FFastArraySerializer, yet when I add an item to its array and call MarkItemDirty, the item's PostReplicatedAdd gets called, but not the array's PostReplicatedAdd. What would a common cause be?
You have to call that yourself from inside the Items PostReplicatedXXX functions
Heres a quick example
thank you. Would not have suspected that from the comments 🤔
The comments on FastArrays have a few erroneous claims.
I should clarify, that if you are trying to use the PostReplicatedAdd(const TArrayView<int32>& AddedIndices, int32 FinalSize) version, they should be called automatically.
However, these arent typically used because they are less useful
Its certainly more common and user friendly to call your own from within the Item as mentioned earlier.
I should clarify, that if you are trying to use the PostReplicatedAdd(const TArrayView<int32>& AddedIndices, int32 FinalSize) version, they should be called automatically.
yes, that's the one I'm trying to get called but it's not happening 😬 I would have assumed if the individual item's PostReplicatedAdd gets called, that is indicative that it did work, so I'm not quite understanding why it's not being called
That is correct, if the Items version is being called then the Arrays one should to, its literally 2 lines below the call to the Item lol
How have you set up your ArraySerializer?
Can you share the header?
FastArraySerializer.h::1150
Is where they are called if you are curious
give me a sec. If breakpoints don't make me smarter here I'll send you the header. It's based on lyra
Ewww, Lyra
lol
Sure thing.
Within void FFastArraySerializer::TFastArraySerializeHelper<Type, SerializerType>::PostReceiveCleanup
If the line number isnt exact
I referenced the line number from UE5.5
yes, found it. After setting a breakpoint on the line that calls PostReplicatedAdd on the array, my breakpoints inside the function itself started magically working.. a good old log seems like it would have done the job better 😬
out of curiosity, what's your beef with lyra? 😄
Its overengineered for the most part.
Its a more of, "look what we can do" than a, "this is how you should do it"
In my opinion
oh yes, definitely not a prime example for more regular games, and more for live service games I'd say
I appreciate its complexity but it does come at a cost
The trouble is, as far as I see it, the majority of Devs who will ingest Lyra to make actual use of it, wont be making Live Service games (also unlikely they would even be capable).
Im not entirely sure who its intended audience even was.
I think it's a trove of treasure, but you have to know when to apply bits and pieces
For sure, its certainly more of something to cherry pick from.
Not build off of as a base, which unfortunately is what it seemed it was marketed as.
So people assume thats what they should do
🤷
For newer/less experienced devs, this isnt a good idea.
after working in it for a while I found its architecture quite neat, although it's easy to to get lost.. "where was this component added dynamically again? In the GameFeaturePlugin asset? In the Action Set in the Experience? On the pawn data? Who knows 😄
yes it's absolutely not for newcomers
Thats a major issue yeah.
Minimal direct references make it difficult to actually track down things
for sure. I find it less difficult to understand after wrapping my head around most of it, but I had to get there first. And even then it still suffers from its dynamic nature. Good luck getting a comprehensive look at the UI in UMG
personally I'm obsessed with modular architectures, maybe to a fault, so I like these overengineered solutions, but I see the issues clearly
I think its fine for large teams where there are enough people to just own specific parts of the project. But for small teams, where they have to onboard developers and have them be able to wear many hats, its a steep curve for them to have to come to terms with the project architecture.
But as said before, cherry picking the bits you like and integrating into your own project is the way to go.
Im still stuck on 4.27 at work, but Ive been using 5.4-5.5 on a side project
Took a few things from Lyra and adapted to suit my needs.
ouch. I think in the newer Unreal versions it's starting to come together, with new tools such as Mutable. That's what I'm trying to get implemented right now with networking support (for my hobby project I should clarify, I'm currently not aware what plans for replication for Mutable look like)
The trouble I have is trying to keep up with all the new stuff haha
it's a lot 😄
replication for the mutable options is working now, thanks a bunch! For now it's working just for integer based drop downs, but that's already pretty good. Can swap hair styles and clothes now from walking into a cosmetics spawner
Awesome
I'd just like some docs on it more than anything right now.
Mutable is probably one of the things I'm more excited about.
Also for multiplayer peeps - a gentle reminder, FN is on Iris now (since 5.5). So....soon™️
I just started looking into it myself recently.. I have the privilege of being able to look at some internal stuff. You have things to look forward to :)
But I want it now 😭
😬 I think it's not too far off!
Guess I just have to go back to Deadlock
I hope you're iai slashing people as Yamato
Paradox main. Swap for dayzzzzzzz
one of those... huh
can you do "hitstops" in a multiplayer setup ? not sure how that might impact the sync of the game if you do a hitstop when you hit something on client and it "freezes" for a frame, but ultimately, there would be no stop , so yea assuming it's a no for my case but curious so i aked
Why would you want to freeze something for a single frame?
Whats the purpose of a system like that?
hitstops are incredibly common in character action games and fighting games
they give a sense of impact to the point of a hit
For a single frame?
but it's frankly more of an animation thing? I don't see why could not just have this done locally
If its just a cosmetic thing, then yeah, do it locally.
More for a very short period, for a lot of games this could be measured in frames but in typical unreal terms this would be a fraction of a second
If it has gameplay consequences, frame accuracy will be an issue
Modifying the rate of play for a montage is easily done over the network but because of the time-sensitive nature of this, I would suggest sending the event as a single atomic way of deriving where the hitstop happens
replicating the start/stop separately will be very fuzzy imo
doing one "the hitstop should happen here" somehow will be better than praying the second one shows up in time
juiciness in game is a lottery ticket
maybe not a single frame, i guess i was just referring to a common hitstop, but yes doing locally is what i consdiered but wasn't sure how that would really work given after the event things would be in different places
if quick enough, i suppose it wouldn't be that impactful but yea would have to test it
my animations are also sprite animations , not that i think that matters much
Looking for any recommendations for replicating flying movement. I have been working on custom prediction but it is not as performant as I had hoped.
I'm having a crash when a second player joins the game but not sure what the best way to debug is, I packaged my client as debug game but crash logs still aren't providing any hints as to what is happening. any tips for debugging packaged builds?
I basically know what system is causing it just not the what is null part 😅
Include the debug PDBs with the build. If it crashes it should produce a stack trace in the crash reporter that you can use to help pinpoint the problem code
ok will do, I feel like it's my mini game actor. It's just placed in editor so doesn't have an owner, and just keeps track of players (on the server) that get inside its collider. It adds an onrep element to an array for players in range, oddly enough when a second player enters the game it crashes
what does performant mean in this context? it's too slow? be specific
I am able to make corrections but it is making bold corrections even when I have a low threshold. The client is just very jittery. I am trying to apply what I see in character movement but having a hard time pulling what is relevant and applies.
check out something that actually does predicted movement I guess https://github.com/Vaei/PredictedMovement/
the general idea is to do the same thing on both sides
this must be done from things called from the cmc itself afaik, things outside are not the cmc doing its prediction steps
heyyy, I have this function on the card to be moved to the discarded pile. when some special cards move to the discard pile, they have to execute like an ability.
void ATCard::ServerMoveDiscardedCard_Implementation(ATPawn* Pawn)
{
if (auto GameState = GetWorld()->GetGameState<ATGameState>()) {
GameState->GetDiscardCards().Add(this);
switch (CardValue) {
case EPokerCardValue::CV_Jack:
Pawn->IncreaseJackActivated();
break;
case EPokerCardValue::CV_Queen:
Pawn->IncreaseQueenActivated();
Pawn->ClientStartQueenActivated();
break;
case EPokerCardValue::CV_King:
Pawn->IncreaseKingActivated();
break;
default:
break;
}
MulticastMoveDiscardedCard(Pawn);
}
}
In the queen ability, I call the ClientStartQueenActivated() to only execute this code on the client:
void ATPawn::ClientStartQueenActivated_Implementation()
{
TGameState->DiscardPile->EnableBoxCollision(false);
for (ATPawn* GSPawn : TGameState->GetPawns()) {
if (GSPawn == this) {
for (ATCard* HandCard : GSPawn->GetHand())
HandCard->ClientEnableCardCollision(false);
continue;
}
for (ATCard* HandCard : GSPawn->GetHand())
HandCard->ClientEnableCardCollision(true);
}
}
I only do it in the client because I only want them to be able to click on other cards, etc. It works perfect for the clients but doesn't work well with the server. I added some UE_LOGs on the ClientEnableCardCollision() of the cards and the logs give me the correct values.
The exact problem in the server is that it's not activating the collision of the other players hands.
Anyone knows what I'm doing wrong?
use GetDebugStringForWorld(World) to get the name of each machine for the logging
With my own prediction setup these are the results. I am a bit stumped for the time being how to get it smoother. This is with NetEmulation.PktLag 60.
This should probably be something stateful rather than just a random client RPC.
For example.... Have an array on your cards that defines which pawn is available to interact with it. You can then use the OnRep of that array to then trigger whether the collision is enabled or not on the client (or server! just remember OnReps don't automatically get called on the server in C++)
Thats not a performance issue.
Just looks like you arent smoothing the Mesh.
Yea I am looking at what my threshold is for interpolating the client to the server when it gets the results. I had an idea as well to filter lastmove and not update if it is outside the threshold. I am still thinking and looking for a good way to get it smooth. I feel super close though.
Can you show your current code?
Basically the bits where, per frame, it figures out where the heli is locally
Yea I can send you my github link. One sec
Hey all! Crossposting this --
How do I synchronize the trigger to start movement between client and server?
I have an ability that fires a projectile. When the projectile gets near a target, my player is pushed/pulled (at fairly high speed). Right now I'm having the projectile add a tag (on authority) that my main ability is Wait Gameplay Tag Add for, and then it triggers the movement (using Apply Root Motion Move To Target). This leads to desync -- since the client and server aren't starting the move at the same time.
If I use a delay instead of waiting for the gameplay tag, it works much better. But certainly this must be a common problem, right?
Basically I pretty sure I'm seeing:
"You are on your own for making sure clients and servers are playing the same thing at the same time, and you’ll get corrected if they don’t line up enough. When they get out of sync, you’ll get corrections and the server will force AutonomousProxy to set track position to match the server."
from https://dev.epicgames.com/community/learning/knowledge-base/15El/unreal-engine-a-holistic-look-at-replicated-movement
https://github.com/thepinnacle317/ReplicatedHelicopterMovement Here is the repository. It is not commented the greatest as I have been going crazy trying different methods.
Why are you setting position in the onrep?
you aren't guaranteed to get that onrep at any certain hz, that's probably your jittering
when the onrep comes through, the position just gets set
This is a bit of a confusing mix between server authoritative movement with smoothing and a rewind/reconcile system.
Also how do you rewind if you don't know what time moves are at
Still new to this but I thought that would be a good place so that it was only getting set for relevant players. Smooth was a helper. I had a previous implementation with a struct that would take in time of last move and I would hold that to check against but it completely broke everything so now I am starting back over from my initial commit of having a somewhat workable version.
I would start by attempting to implement a smooth movement system without prediction
I was trying to take in a time before. I will probably just really have to study more on proper workflow of how this all fits together with better placement and order. I was hoping to use the modular chaos system but it was pretty broken (experimental).
I think you are right. Baby steps and work up to a more proper implementation.
Do you know of any other good resources? I am really just working of character movement and the network compendium.
It'd be shaped a bit like this:
Tick:
if local
send input to server (Server RPC)
update velocity/position/rotation/etc based on replicated input vars (all the math)
if authority:
set replicated state variables
if not authority:
Gently correct velocity/position/rotation/etc based on replicated state variables, hard snapping if error is too big.
Server RPC:
set replicated input vars
that'll end up with everyone running the sim, and everyone that's not a server gently correcting the sim towards the servers version of things to keep it in sync. This is pretty much how the built-in physics replication works.
Ok cool. I will work through a refactor. Thank you for taking a look and giving me feedback. Still fairly new to programming. Much appreciated.
Appreciate you. I think this is about the max that I can achieve until I get better. Just need to add in all the tilting and stuff back in.
Hello! I need some advice on relevancy. Is it good practice to adjust net relevancy at runtime? Specifically I want to set bAlwaysRelevant to true once an actor becomes visible (I have an RTS - style vision system) and to false once it becomes invisible. Does this work if I set it on the server only? Or does it need to be managed on the client as well?
https://forums.unrealengine.com/t/net-dormancy-and-net-relevancy/351941/2 Quick search as I saw this before going to bed. May be something helpful.
Hello! Sorry for the delay. For Fortnite’s setup, we have all of our building actors in the world using net dormancy. We set them up in their constructor with: NetDormancy = DORM_Initial; which means that when we load in, each building will initially be dormant. We do not use bAlwaysRelevant, as we have far too many actors in our game for tha...
Not quite what I was looking for unfortunately. I'm asking about adjusting relevancy
How many units we talking about?
Nothing inherently wrong with it, but you will have to keep an eye unit counts. If you have a huge number of objects sharing the same relevancy settings, you might want to look into using Replication Graph.
Valorant does this in 3d right? Probably with some pretty fancy visibility tech I'd think.
Probably not literally with relevency but accomplishing the same result, not knowing about things you shouldn't know about
The server determines if something is relevant and then does what is necessary to replicate it out if it is. The client itself doesn't really play a part in it other than receiving the replicated data and doing what the server tells it to do (like spawn it because it's relevant again etc.). There is a function that is overridable for actors called IsNetRelevantFor that can allow you to implement some custom code per PlayerController that you can return true or false from to determine if the actor should be relevant for that particular PlayerController, but of course, that's based on the data the server has.
I think they do actually use relevancy for it IIRC, they do have a post about it somewhere. Something about pre-computing LOS.
A lot of FPS-bespoke stuff
Yeah that's the one
Hi, anyone know is there a way to change this behaviour - on the Packaged version (PIE/Standalone does not have this issue), only for the Server (Listen Server) widgets are created before GameState even exists, which sets a situation that GameState data is not available for Host in the Widgets. Way to control that in Packaged build widget's are created only after GameState even for Server?
Where do you create the widgets?
Because the only place that would be "safe" on clients is from BeginPlay(), which incidentally the Server would also call at the same time, after GameState creation.
Those widgets are created in the HUD.
At the begin play of the hud
Always thought that begin play for actors is triggered when GameState exists, is the hud exception?
It shouldn't be
GameStateBase::NotifyBeginPlay is what ultimately results in BeginPlay being called.
I would attach the debugger and start looking at the callstack
Okay, I'll try that
Starting at 50, could grow to 200 max let's say
I will eventually, once I move out of prototype stage
Whoever worked on NPP was such a breath of fresh air, the code is so well documented and the examples plugin is awesome. Shame they left with some small issues but over-all I wish more of epics code was like this
small issues
breathes in deeply
like what, I dont doubt it but examples are nice
are UChannel's bi-directional? or is it server to client only
Anyone able to help me with why the clients flashlight isnt showing the exact same location on server?
My first instinct saying that you're not using base aim rotation so your rotation.Pitch value is incorrect
ignore that ^, i found a way to do it but now the flashlight movement is very choppy
I wouldn't use the camera rotation on the server to set the spotlight's rotation, as I said base aim rotation is preferable there as far as I know
when the server is watching the clients light move its laggy but in the right position now
ok ill try that
And if the only reason why your components are replicated due to rotating them, I'd make them not replicated and let every client rotate themselves using the base aim rotation again, so no auth checks and replications
That's probably why they're choppy
I'm having an issue in my game where when I join my host with my client it spawns two player actors like expected but it seems to only spawn 1 player controller?
Is this normal?
Because only one of the players can move
where would I put this base aim rotation node?
Are you spawning characters manually or let the game mode handle that?
Well, tick to make it smooth
its very smooth now but when i look up and down, the flashlight isnt in line with the cameras pitch, feels like its moving faster than the camera
the game mode handles it
Having a single controller on your own world as a client makes sense since controllers aren't replicated to anyone other than owning clients (so you won't have your hosts controller while the host will have all the controllers). If you're not spawning another character by yourself then there might be a problem with your input binding logic
Are you setting the rotation as the relative or the world rotation?
Base aim should give you the world rotation
Well, it demolishes bandwidth and is wildly inefficient. It's a nice concept but in practice, and at scale, it breaks down pretty quick.
has anyone used the GMC ? could it possibly be worth that price tag ? lol
I see, I'll check it through again and see if I missed something
Another problem I have is that there's lots of rubberbanding and lag, which unfortunately also seems to affect collision for the connected clients? My game really only needs players to see each other as "ghosts", so collision and things like that don't need to be synced. Is there a way to disable syncing of collision?
I know a few people have. The most active is probably @verbal ice though.
If you're seeing jumping or jittery/choppy movements your character movement component might be doing corrections due to latency. That's on you to optimize your network related code as far as I know, it shouldn't be that bad by default. (Assuming you're using CMC/AddMovementInput instead of using your own setup like sending input with an RPC and/or setting your location on server)
Collision on the other hand shouldn't be replicated. If you want your characters to pass through each other you might want to set your character's collision response to it's own object type as overlap or ignored by default. If you're setting it on runtime and not on everyone, then that might be also causing the corrections as well. If you can pass through something on server but not on client, you will see you're being pressed against the object on your screen but as you keep adding movement input server will move you forward and eventually you'll jump on your own screen, or vice versa, you'll see yourself passing through something but put back by server if it doesn't actually allow you to pass
Alright, the thing is I haven't done anything in my game code-wise for MP except for the initial connection bit. The player actors don't have any RPC and use default settings for networking. So I'm not sure what could be causing the lag in that case?
Is it possible to have the server not correct for collision checks?
will have to chat, but yea advanced movement is really the main thing i don't have due to my lack of cpp that i'd be willing to either spend to get or get someone else to help with this
and the gmc looks great in theory and price / reviews ratio makes sense, but still would love someone who's used it's take
Well, I do know Cyn praises it and even routes things through its replication model over UE's default one.
Far cheaper than doing it yourself though.
If you pay yourself $15 an hour and can recreate the GMC in one work week - then you'll have saved money.
assuming it solves all the current limitations, it's 100p worth it
lmao good point
curiuos on some of the workings of it too, like how different would my setup become etc
You do have to inherit from their pawn. That's mainly it. (I have the plugin as well, just never used it)
But their pawn isn't rigid like the character is.
hmmmm ok so this would deffinitely be a major switch, assuming i couldn't just change my char's inherted class to the GMC one without breaking pretty much half of whats' in there , but handlable
If you haven't overridden stuff from the character class itself, or called things from it specifically - you should be fine.
It'd just be a change in the parent.
yea im sure there's a few movement component grabs here and there im currently using but the only custom thing in there was a sprint / fly ability done in cpp from someone else, im reading up on the docs right now to see what all changes rn
Oh, you bought it? lol
lmfaoo no not yet, i just wanted to get more familiar, im def thinking about it, but prob won't make a play anytime soon. wanna think about the implications
why are RPC's strict to void only?
trying to do something like this.
i know i need a helper function type of bool that will be called by a void server method, but it will be more code for no reason
would like to directly use a return type of RPC
void AActor::DiscardActor()
{
if (TryServerDiscardActor(PrimaryAttachedActor))
return;
if (TryServerDiscardActor(SecondaryAttachedActor))
return;
if (TryServerDiscardActor(TrimaryAttachedActor))
return;
}
bool AActor::TryServerDiscardActor_Implementation(AActor* ActorToDiscard)
{
if(!IsValid(ActorToDiscard))
return false;
//Do actor spawn method
}
I have actually wondered if it's possible to modify RPCs to run as a coro that does basically an RPC to the server as a value fetch and the server sends back a response for the coro to return
I created an enemy and made an animation blueprint for idle and locomotion. For some reason, the client can see the walking animations, but the host doesn't see the enemy walking...only sliding across the floor. This is confusing me since it's usually the client that doesn't see something. I'm not sure why and what I'm missing. I'm only using character movement component which is automatically replicated. Any ideas what I should check? The enemy bp is set to replicated and there is nothing on the event graph, just the enemy ai controller has a behavior tree with a roam task
try to get familiar with TomLooman he has a free project on his git where he has done advance AI stuff, look at it
how would you expect something async to work like this also "trimary" lol
if this actually worked, you'd be freezing the client until the server responded
hmm, and this freez will be like for 0.0000001 sec ?
well it doesn't work, I was speaking hypothetically
and if it hypothetically worked, it'd be RTT
hmm, i think i need make macro as Snaps mentioned as an idea, and its possible i guess
No I didn't mention that as an idea, don't do that.
not sure why the client is capable of an IsValid check
Listen to what sswires is saying lmao
but still it will be prosessed using a helper non rpc function
he actually knows what he is talking about
when people that know what they are talking about tell you something is a bad idea or doesn't work, listen
I doubt that'll happen
So do I :)
the client has their own attached actor added by server to their inventory when they picup weapon
and?
and server keep track of it, so if client send something valid server is in sync already
if they send fake weapon, server will invalidate since server don't have it in track
FORCEINLINE bool IsValid(const UObject *Test)
{
return Test && FInternalUObjectBaseUtilityIsValidFlagsChecker::CheckObjectValidBasedOnItsFlags(Test) && Test->GetOwnerInventoryServerSide()->Contains(Test);
}
this is how my IsValidCheck works
I wouldn't say it would freeze the client until the server responded. I'd expect it to work just like it does in C#-land personally. In UE, it'd be like doing a UE5Coro co_await with the http stuff. Of course this works because it will return something. But I don't see why we couldn't have a form of RPC operate like that as well. Like, maybe have a specifier or something - idk.
well until there's native coroutine support
Would it be slower? Maybe by a smudge.
But I certainly believe it should be possible.
I figured out where the problem is coming from. For some reason, the character movement component of the enemy is not showing the acceleration on the server. It's only showing on the client.
not sure why velocity from the Enemy CMC shows velocity on the server, but not acceleration
I am attempting to convert a project from a Dedicated Server to a Listen Server setup. I am having some issues with the 'host' player. I had assumed that the host player would act as a client to their own 'locally hosted' server, but it seems like their character is actually the authority itself.
Are there any tips / tricks others would recommend who have done something similar?
this is going to be incredibly game specific
I guess I'll just walk through every feature and rip at it until it works 😂 I 'hope' that because the initial project code is configured towards the concept of client/server then it shouldn't be 'too' tedious, its not like converting a single player to multiplayer project
Is there a node in unreal (or a C++ helper function I can make) that can detect whether the game is using a listen server or dedicated server setup?
GetNetMode
I assume that's a C++ function?
yes?
Ok thanks, I'll go searching
though I can't say I've had to use it too much
there's a blueprint accessible is dedicated server function, probably similar for other netmodes.
It is, what do you want to use it for
i'd like to have more movement capabilities really is all, it's something i've always wanted but have semi avoided due to my lack of cpp abilities and feel it could be a reasonable solution. adding dashes, knockbacks, all kinds of different speed/gravity adjustments, etc, these things are just difficult or nearly impossible w simply just the CMC and bp (to do well*)
Dashes knockback and all you'd have to use GMAS, GMC's community made equivalent to GAS
But both the GMC and GMAS 100% support Blueprints so you'd be able to make your custom movement with no issue whatsoever
Does it support GAS?
Everything supports GAS if you make it
I don't think MAiWORLD would be able to do that hah
Considering they wanted it BP only
I mean mover you can do it all in blueprint
But regarding GAS relation ATM nothing built in. But I'm working on some ability tasks for my plug in that will allow you to do mover related stuff
But yeah prediction systems are just separate that's the issue
As much as I like GAS, I'm preferring GMAS a lot more lately
GMAS?
Since it was built from scratch, and isn't meant to be a 1:1 copy of GAS, they fix some of the issues GAS has
GMC's community made ability system
It also hooks onto the prediction system of the GMC so you're basically golden from the start
Pretty sure it does predicting GE removal, and one of the newest additions (which is still being tinkered with) is latent server applied gameplay effects, that give the client a grace period to apply them in their prediction
That way you can apply stuns to a player on the server and it won't mess with their movement prediction
Issue I see with other systems is maturity
GAS is like 10 years old
Used by triple A games
Yeah that's a downside, but you gotta start somewhere I guess. The community works on fixes pretty fast when a bug is reported at least.
I was looking at able years ago and it just didn't have what I wanted. GAS doesn't have everything but it's generic enough you can literally do anything you want
On the flipside it doesn't have issues that GAS still has because they're anchored in years and years of code
If you're willing to "gamble" with a new system, then I'd go with GMAS, but otherwise yeah probably stick to CMC/GAS
Not saying GAS is th best system, but it's got proven use. And it's modifier / aggregating is really powerful
Pretty sure GMAS has that as well
They're putting a lot of resources into GAS though, their engine GP roles are all for GAS
probably cos Fortnite
Yeah
Although it'd be nice if they updated GAS with Fortnite's frankensteined implementation
I'm very finicky on using systems from third parties.
Likewise, I tend not to, but the GMC has proven itself to me and some other studios and I enjoy it very much
For example we use redpoint eos. But the coding and code style just makes me feel sick. Lol I actually cringe if I have to fix anything
should see more Iris activity now too since Fortnite apparently switched to it
Yeah fortnite is on iris
Hahaha yeah, that icked me a bit when I added support for an event called when you get a synthetic session invite or something similar
But I do like how easy Redpoint makes it
Though mover still not working with iris properly
GMC isn't yet either, GRIM (the dev) was waiting for Iris to become "prod ready" or close
So that he doesn't have to tinker with the Iris stuff in the GMC every update
As a default for the engine, yeah I agree
I literally added dash, etc in about 20mins fully replicated
Will I use Mover over GMC? That's still up for debate, because at this current stage, the GMC is more mature than Mover
That's how powerful mover is
Oh yeah that's about the same for GMC
That's why I love it over the CMC
I can add sprinting within 2 minutes
Same with crouching etc
Don't have to mess around with custom FSavedMove classes and all
Right but from a it's in the engine perspective mover is pretty cool. So is the new gameplay cameras system
Yeah it's definitely nice that Epic's giving its own solution
Cmc is just old, I mean it was made to just work
at least the Mover talk in Prague finally taught us the distinction between "experimental" and "beta"
experimental = we ain't dogfooding this
beta = we are
Lots of good stuff has come in ue5
I'll be keeping an eye on Mover for sure
What would be nice is to kinda rip out core of the gas system and build it around npp
But it won't stop me from recommending GMC depending on what the dev's requirements are
So it can mingle better
though I thought in Mover, it seemed to be going to way of the physics prediction system
which isn't tied to NPP
It uses both
Depends if it physics based or not
You can choose
Though again 2 more prediction systems
Just make one ffs
And share it across systems
ah, the original goal of NPP
On level blueprint begin play, I get all actors of my rooms class in the level and send it to the gamestate. I want to randomly pick 1 room when I load the level. The random room is always different for the server and client. How can I make sure they are the same?
I was under the assumption that gamestate was the server and replicated to the clients, so I figured it would be the same variable if I set a random room
I'll believe it when Fortnite is fully powered by Mover.
I've also heard that thus far, performance is pretty bleh with Mover.
Begin Play fires on both the server and each client. If you want a single source to make the selection, have the server make the choice and replicate it.
And why does your level blueprint do this.... Why not just make the gamestate do it?
you're right. I suppose I can cast to gamestate in the room actor begin play. What if I have a lot of rooms though? That's a lot of casts for each room opposed to 1 cast in level blueprint
If you're doing "Get All Actors Of Class" "Room" on Begin Play of the level and then casting to the GameState, why not just have the GameState "Get All Actors of Class" and do it itself?
I wasn't aware I could get the rooms directly from gamestate. I thought I had to pass on the references to gamestate. I'll do that then.
Hope someone here might have the answer to my problem. Very desperate here 😢
https://forums.unrealengine.com/t/kicked-out-from-server-due-to-access-rights/2133672
Hi everyone, For the past few days I’m struggling with a very odd behavior in UE. This code that I’m sharing here, kicks me out of the server with this error (some times it doesn’t prints that): LogRep: Error: Rejected RPC function due to access rights. Object: InteractManagerComponent /Game/Game/Maps/FirstPersonMap.FirstPersonMap:PersistentL...
Okay so looking at the engine, it looks like it's whining that it's receiving an RPC that it's not expecting to (think a Server RPC but you're the client, or a Client RPC but you're the server)
Considering your code, the only way I see this happening is either you messed around in the engine (I'm assuming you didn't), or you have some sort of corrupted blueprint/intermediate code
I would do a full rebuild of your project (and re-package it as well), after deleting the Binaries, Saved and Intermediate folders of your project.
In the case of a corrupted Blueprint, if it still breaks after doing the above, I would re-create BP_PlayerCharacter from scratch. A bit annoying but worth a try.
For what it's worth, I've seen huge problems with the Listen Server pathway on my multiplayer game, to the point that I've abandoned using it and am now exclusively only using the Dedicated Server path.
I actually spoke with an Epic engineer recently, who told me that Listen Server logic is seriously untested, because the vast majority of professional clients who use UE don't use it.
I was seeing tons of weird multiplayer issues, servers not visible, in-game functions not working properly, replicated data not being passed over properly, defaultEngine variables not being used properly, etc etc
As soon as I switched to Dedicated Server play, the vast majority of my issues vanished
Never had issues with listen servers personally, you just have to account for some of the oddities
Some people have issues, some don't
And the thread says other server RPCs work so I'm really leaning into some sort of corruption somewhere
Dependent on Engine version, actor type, player count, subsystem type, etc etc
I'm just telling you what someone from Epic told me, and they were correct
I'd also make sure you're both running the same version of the game. You're supposed to get a mismatch anyway if that isn't the case but it'd be weird.
That's fair
I was going to say... I think it may be a version mismatch or something
If for some reason they don't get kicked for that right off the bat, which happens sometimes for some reason
But that'd mean the "Server_Interact" RPC was Client/NetMulticast in the past. Doesn't really sound like it would've been.
Can't say I've experienced any of that in the about 5 years of UE I've been doing.
i'm probably missing something here.. but i searched the source code and github for the error "Rejected RPC function due to access rights" and I only see that specific message in the Unreal Tournament repo... the wording is slightly different in UE's source code.. are you using a custom or old version of UE?
if ((Function->FunctionFlags & (bIsServer ? FUNC_NetServer : (FUNC_NetClient | FUNC_NetMulticast))) == 0)
{
UE_LOG(LogRep, Error, TEXT("Rejected RPC function due to access rights. Object: %s, Function: %s"), *Object->GetFullName(), *FunctionName.ToString());
HANDLE_INCOMPATIBLE_RPC
}
DataReplication.cpp:1292
@tardy fossil No, I’m using UE 5.4 didn’t touched the source code at all. That’s very weird 🤔
What sort of games / how many players?
Shooters & up to 4
Thats what I originally thought but I am curious how it could demolish so much bandwidth if we are the ones who define the replicated aux/sync and input structs so we can optimize it down as much as possible? I did hear input cmds are sent in multiples for any reconciliation though.
To be clear I absolutely believe you but i just want to know more if you dont mind
could anyone help with some basic multiplayer stuff? When I make a development build of my project. The clients movement is very jittery, ive removed sprint functionality to see if that was casing it but its not. The base movement is jittery on the client and I dont understand why?
The movement is smooth when I play in standalone
So here is the issue I am having, I am replicating a modular character that I am editing through a character creation UI I made. I am having issues trying to get this to work for the client. I don't know what I am missing, if I have to make a rep notify for every variable so be it, but trying to avoid that lol
-
first image I am storing all the variables to select each modular piece in a game instance to use for later.
-
second image I am running the a get mesh event and updating every player in level to sync the models every time a new player joins.
-
third image is the get mesh event calling the game instance and calling the event to pull information from all the variables we have saved there.
-
fourth image is the game instance saving the variables to the player character, all the character variables are being replicated.
-
fifth image shows that at the end of the update character event it will call an event on the player character to update mesh.
-
sixth image shows the basic replication to activate a function that will update the meshes
-
seventh image shows part of the function setting the meshes and materials
-
eighth image ends the function with setting the master pose for every modular body part
-
ninth image shows end result where the right side (Host) is the only one replicated
dealt with that before make sure none of your components except your movement components are replicated. you also might have to turn collision off for meshes other than your capsule collision
Image 1)
You can't reliably use the getters with an index in multiplayer.
The Game Instance exists on each client and the server but it is not a replicated actor - it only exists locally, so anything being "saved" or "read" from it is only data that the local instance would know about.
Image 2)
Begin Play fires on clients and server for replicated actors. Every client will be attempting to execute the code displayed.
Widgets do not replicate, there is no point in marking them as replicated.
You're again using a getter with an index which isn't great to use in multiplayer.
Because your third part of the sequence is looping through all characters on begin play, you're basically making all players reset the meshes for everyone.
Image 3) Again, Game Instance is not replicated and is separate for instance of the game running. You're effectively asking every client to retrieve whatever value from their own game instance.
Image 4) Look into structures. This can allow you to store multiple values in a neat package.
Image 5 & 6) Your Update Mesh event ends up calling RPCs but this is again executing on all instances of the game, but you're calling it for every single character, so every single player will end up requesting their meshes to be updated, the RPC will only successfully go to the server when a client calls it, but then all clients will still be attempting to call "Set Meshes" anyway since your remote call still goes to it.
Image 7) Can't make out any details.
Image 8 ) No comment.
Normal flow of things for handling replication of things like this:
Client makes a choice > RPCs to Server their values > Server sets values in some replicated variables > OnReps used to execute code to modify what is necessary locally on each client. Any late joiners would also receive the OnRep call and execute the same code.
Are you intending on storing the selections a player has made on the client's game instance or on the servers?
storing selections on client
my GUY do not blueprint with waterfalls lol
put those variables in a struct or array or map or anything but that
yeah I know I was quickly throwing it together to get a working system, was gonna tidy it up with structures afterwards xD
Tidy it up now
then joining a server and sending your data is just:
Load game from slot -> send data struct to server in an RPC
Ok, so when you call the save character data, you should be able to pass the values as an input into the event itself. I'd again maybe think about using a structure to contain the data.
When a player joins the server and you want it to read the character selection, you can use the begin play of the player controller and you can check if it is locally controlled, and if so, have it read the game instance data and send an RPC (Run On Server) with an input that has the data you want others to have. That RPC can then be used by the server to set a replicated OnRep variable on the playerstate - you now have a single location that perists through gameplay including through respawning pawns the configuration the player wants their character to have.
The OnRep of that variable can then attempt to Get the Pawn of the playerstate, and if it is valid, proceed with calling SetMeshes. The SetMeshes function would need to read the PlayerState for the configuration value ---- This will ensure that when a player updates their mesh values, and the playerstate has a valid pawn, it should update the mesh displayed for their character.
Now we also need to work on when the character comes into play. You can again use Begin Play of the character, and check to make sure the PlayerState is valid. When it becomes valid, you can read the stored configuration from the PlayerState, and then call your "SetMeshes" function. ---- This will ensure that even if a pawn goes out and back into relevancy it can reconfigure itself based on what the player originally selected without having to RPC any more data back and forth.
thanks for the reply man, going to be digging into all of this, I appreciate the help
If you allow players to update their values mid-game, then you just need to send the value again to the server in an RPC and set that OnRep, that OnRep will again trigger the SetMeshes function and reconfigure the pawn. 🙂
On that topic, is there any sort of writeup anywhere about what objects are guaranteed to exist and in what order on which machine etc?
Don't think so. :/
I usually rely on all the fun OnReps in C++ that aren't exposed to blueprint.
quite convincing, and the GMAS ability kind of makes it even more beneficial to me as this is also something i've considered using for things for a long time. having something that incoporates both would be mega. but also would probably, again be quite a bit to change. i do feel it would be worth it tho
Are you doing anything to affect character movement, other than the standard built in character movement functions like Add Movement Input?
Just wanted to say - sometimes the IsLocallyControlled events don't work on the first tick / BeginPlay event - you have to wait at least one frame before some of those functions will return the accurate result
How would I create an object on client (loaded from disk) and then send it to the server to be replicated? Currently I'm creating the object in a CLIENT function, which calls a SERVER function that passes in the object. I see via debugging the object is passed into the funciton call to the server but when checking during play it's null
what exactly is it?
a uobject (savegame technically), I defined the IsSupportedForNetworking funciton appropriately
AFAIK, You can not send Uobject create from client to server.
ok I think with this object I can put its data into a struct and send that struct over
then just create the object server side
The main issue is that the aux/sync/input states are constantly spammed even when data isn't really changing, and usually multiple frames' worth at a time. IIRC the default sends the last 6 frames every tick, sync and aux states are resent every tick (the frame is changing, and it's not smart enough to do good delta compression just yet). Fixed Tick is particularly bad at this because it actually sends more RPCs than there are frames to simulate, which is odd.
I would just beware that's all, NPP is so experimental it's kind of bananas to me that Epic are pushing Mover when there are so many flaws, but I assume they plan to rebase mover onto something else at some stage. There's also some issues with most of it's core logic running outside the usual game tick groups (some more general optimisations break etc). We've been using it for several months now but not without a huge amount of changes, and it's still a bottleneck network-wise. Have a look around Cedric's posts too 😄
Mover itself also has some pretty dumb design decisions, in that all movement functions are static. That's great until you want to actually customise the movement logic to add new features (or missing ones), but you can't without modifying the plugin directly or copy-pasting a lot of your own functions. Quite frustrating really.
I don't really understand the benefit of all that static logic either, it's not like anything is running in a huge parallel sim.
wat? why doesn't it just ack the last received frame?
Everything is spammed unreliably
movement functions being static is insanely good to help make random things be able to move and sweep... but yeah it's not like you can just override bits of it
The system isn't mature enough to handle gaps in streams either, so they double-down on making sure you have enough data. The irony is that it spams data so much you end up saturating the connection.
I understand why they did it, but in practice it's awful to work with
We had to change so much to just support basic features, like killing the player when they get stuck in geometry etc.
I like the decision from the standpoint of movement not being married to uobjects
Mover is a great idea, with mid execution IMO
Got a long way to go before it can think about replacing CMC
But I encourage people to just run a basic CMC movement game, then do the same with mover. The difference in time spent replicating actors will genuinelly shock you.
christ... I just want the CMC but not forced to be a giant spaghetti actor that makes it simple to extend movement flags on
oh well... Maybe they will actually have it not waste so much data if they actually need to run it when fortnite is running on console wifi
Yeah, I mean they are at least actively working on it - but I sense Fortnite is going to push harder for the physics route given the nature of the game and all the stuff they've done with physics vehicles lately
Okay wow, that was a lot of info. I really appreciate you taking the time and it sounds like you saved me from a future mistake, I kept hearing it was premature but I just wanted to get examples other than the comments in the plugin itself saying some todo stuff
All I will say is try not to get caught up in Epics own hype about it, it was probably going in a good direction but sadly David left Epic before we could find out for sure.. and NPP itself doesn't seem to be getting much focus atm, judging by ue5_main
I just noticed NPP is in the "runtime" folder not "experimental".. probably doesn't help
Hey I'm looking to send a runtime generated UTexture2D through RPC (256x256 - 256 KB in size), whats the proper way of doing this? I'm trying to do it with Tarray<uint8> but can't seem to figure out how to convert the data properly. Also I believe I also have to compress it since it might go over the rpc byte limit?
if you are willing to pay, there is a plugin that replicates textures
not that pricy iirc
does the compression, async, etc. Might worth to skip implementing your own.
Replicates as in uproerty replication or does it support sending them through rpc?
I never buy the plugin, but for client to send data to server, Server RPC is the only way.
I would assumed, the plugin does what you want. Again, I didn't buy it my self as I have no need for it. You can probably check it out.
65536 elements would indeed hit the TArray network limit IIRC
Assuming this is a grayscale texture anyway
FImageUtils::CompressImageArray() might help a tad
Thanks! Ill check it out. Im thinking of using http requests instead for sending/reading textures
And have a whole api set up for it.
Don't forget there's an entire pixel streaming plugin too
that's out of the scope of unreal replication :S
Not sure it's really made for that mind
Oh apparently CompressImage is the correct function now
To give a bit of context, my client is creating a fpreviewscene and rendering a texture of the scene. Then I need him to send it to the server. Server doesn t have any rendering capabilities otherwise Id have done this on the server, which brings me to the issue of actually sending the texture over.
Not often. Client sends it when he "builds" something special.
Basically a thumbnail
Does fpreviewscene even work outside the editor..
Yeah