#multiplayer
1 messages · Page 16 of 1
Nope.
damn it
Replication only happens one way. Server -> Client
yes thats what i mean im wording it poorly
Gotcha 😉
i butchered it
lol
but you definitley helped me understand the concept, im gonna test what i think i need to fix
yep it works
thank you
did it here too
completely wrong lol
aw crap u cant replicate a map
im screwed
so quick question, i use maps for my inventory system, I beleive maps cannot be replicated so do i have to start from scratch with a new idea?
well the replication with RPCs work, but I cant set it as replicated in the variable details panel
Correct, maps don't replicate. You might be better off just using individual integer variables for each ammo type. You can still use your enumerator to switch which particular value gets changed/updated.
damn ur rught
got a lot to redo now lol
this works as a work around
i think last i read on a forum article is that its kind of working, because i can successfully replicate it to the server
That looks suspiciously unvalidated.
Why doesn't it change the ammo when you change weapon?
it does, it just gets the current item in hand and gets the stashed ammo
for its type
Yes, but, the weapon change should be done on the srever too...
There would be no reason to "execute on server" if you're already executing the weapon change on the srever.
well im trying to finesse a way around this
so i basically im trying to make a copy of it from the server to a repliicated variable in the bp
jerry rigging it basically
That ends up being that you store it twice on the server though.
And you have to keep it updated in two places.
ya its not ideal
im basically trying to just make it work for now, and when i have more time i have to redo my whole system to not use maps
It should happen something like:
- Player requests weapon change to server
- Server changes weapon if request is valid
- Server changes ammo type
- This change is replicated to the client
- Client responds to the variable changes by changing ui or whatever
i do that here
sort of
but i have the ammo type stored in the base weapon, i just access the item in hand when i want to get the ammo type
So add the ammo change to that function
hmm
oh ya i think there was a reason why i didnt it was causing a problem with my shooting
the only way i can get shooting to work is if i add this owning client to the end
or else Item in hand here returns null when playing online
So fix that issue !
lol now that i know thats an issue and not a solution i will
its hard to debig replication
You shouldn't need to do this, ever. If it's a replicated variable, that means you need to set it on the server first. Once the server has the value, the client will get the value, just like how we were talking about the ammo before. If the player has nothing in the "Item in Hand" variable, that means the server is also unaware of the value if it's a replicated variable.
Say for example, you just spawned in the game. You may not have an "item in hand" as the player doesn't start with anything.
This means that the server would have to appropriately spawn the item that you want in the players hand, set whatever pertinent variables are needed, and then set the "Item in Hand" variable.
If you want something to change when the "Item in Hand" variable changes on the client, then make it a "Replicated W/ Notify" replication type, then you'll get an automatically generated function that will get called when then client receive the new variable value, then you an do whatever you want to do with that new reference (like unattaching any attached actor, and attaching the new one)
i believe i understand what your saying. This is where im setting item in hand on the server, it occurs when you pickup the weapon. When i run a print string, it shows that the server has the variable correctly
Problem is...
Your map find here may be returning false.
So none of the rest of it happens.
would that be true tho if this print string at the end returns the correct result tho
cuz it shows Server: and has the correct name of the actor i want to replicate in it
Is the weapon actor itself marked to replicate?
How is the Inventory map populated?
ahhh
very poorly
i think even tho its showing up on the server its just not replicating properly
its gotta be due to the map
could only be like partially supported or something
yep its the map
honestly idk how im even able to pickup a weapon still everything i did depended on the map
but wait
Same flow as before...
Player presses input > Send RPC to server indicating you want to interact from the actor >
(From this point on, you're only running on the server so no other RPCs necessary)
Interface on a "pick up item" would likely check if player is close by for the interaction to be valid, and if so, proceed with the necessary code to add the item to the inventory and set the actor that should be in their hand to "Item In Hand".
so this is how im going to set item in hand from the server. This is in my base weapon bp
i get a reference to the component and set it
i used this to debug and i see the issue now. Its updating on the server fine. But for some reason client is null.
what i dont understand is that if its valid on the server, then why isnt the server replicating it to the client
i also made sure that my base character is the owner of the base weapon as well
Hi I'm using a random map generator made in this video https://youtu.be/Gy7Z-bukPJQ but when I launch multiplayer each player has a different level how would I fix this
ENDLESS RANDOM WORLD (Marketplace): https://www.unrealengine.com/marketplace/en-US/product/e9b42224d75b4951a53378a67afca7dd
- Setup in a couple of minutes
- Goes forever
- Use your own custom tiles
- Custom seed
- Custom render distance
-
- More
$60 or DM me if you're broke and I can hook you up if you give me credit
- More
Project files (this tut...
You have to generate using a seed that is replicated to clients and then they generate the same map or you have to have the server replicate all the actors that are spawning.
How would I go about doing those things I'm sorry I'm very new
How do you know the Get Valid Owner is valid? Are you sure its the expected inventory component?
Well, replicating an actor is fairly simple. Mark the "Replicates" boolean on the actor in the details on your blueprint. If you spawn such an actor on the server, then it'll spawn it on all clients as well. Just make sure you don't have the clients also generate the map as then you would have 2 different maps overlapping.
For the seed generation, you'll probably want to look up more regarding procedural generation.
shows up good on server
thats all it really is
If I unmark it the map doesn't load
You'd need to turn it on for all of the pieces of your generation that you're spawning. It sounds like you've just turned it off on probably a "generator" actor of some kind.
Really this seems like you don't have replication turned on in your Inventory Component, unless you're using additional replication settings on the Item In Hand variable.
omg i didnt know you could turn on replication for components i thouight it was only fore the owning character
holy shit ur a genius
everything works now
my jawis on the floor rn
You said you checked that already XD #multiplayer message
or at least, I interpreted what you said as you did
At least its working now 😛
LMFAO i thought u meant the character character because I thought the component would inherit the characters replication
ive always been under the impression that was the case.... and iwas so wrong
then i clicked on class defaults and saw component replicates i was like WTF
anyways thank you so much, i thionk my life will be much easier now
Is there a way to make sure all clients have loaded into a level before starting the game? I have a server that starts as a lobby and obviously the server finishes loading first but I don't want actions to start occurring before everyone is loaded in.
I already have a way to pause the server, I just need a way of figuring out when it is ok to unpause
Hello! I'm wondering how to make an unreal game cross-platform -- specifically, how to take my existing desktop app, port it for mobile, but still allow either platform to play together in shared gameplay?
Do you know if there would be a replication issue. For instance, if the mobile map has less foliage instances. Or less textures in the package than the desktop version?
I imagine if assets are being drastically optimized, materials used varied for mobile, and changing where / how often assets are placed through a map... then cross platform may not work?
I believe EOS supports this.
As for the replication issue, it probably isn’t a good idea to have the mobile user be the host of a listen server…
And if you do, then make sure that the optimizations are clientside and won’t have an effect on the actors themselves.
HasClientLoadedCurrentWorld
Asking here as well as It was pointed out this could be a multiplayer issue:
Trying to use UObject::Rename on my item to change the outer seems to give me a net id issue
Non-stably named object BP_Food_Beans_C /Game/ThirdPerson/Maps/UEDPIE_0_ThirdPersonMap.ThirdPersonMap:PersistentLevel.BP_ThirdPersonCharacter_C_1.BP_Food_Beans_C_0 has static NetGUID [19]
I do this:
targetItem->Rename(NULL, originOwner->GetOuter());
so the idea is to change the outer to the actor that contains that item
I added the option to search the contents of an item that serves as a storage, like a shirt that is dropped on ground and it's physically there because it's an actor.
these items have the shirt as the outer ofc, but the moment I pick up the shirt (then removing the actor containing the items, after moving the items data to another container) their outer will point to nothing causing issues with my inventory.
So I figured I needed to update their outer to the inventory these items will reside in.
Also, this begs the question, can't I create an UObject that doesn't have an actor that can be despawned or disconnect as the outer, or not have an outer at all?
Like this is intended to be a MP game so players will come and go but the items they interacted with should persist through the world
I guess the reason for this is that BP_Food_Beans is loaded from package, thus assigned a static net guid, and then when you change its outer it has to stay stably named relative to that outer, meaning that new outer has to be stably named, which seems to be not, thus giving you the error/warning
the inventory component has an array of default items to equip the player with
at component initialization it just adds these items to the inventory items list, assigns an owner, storage container (shirt, pants, etc), then a slot, etc
Yeah those are assigned static net guids
The easiest method to remove that warning is to override IsFullNameStableForNetworking for the outer to return true
Though that is just lying to the engine that it's stably named
You have to name it manually
how can I do that?
confused about logging in: I'm using playfab to login and the login call in GameInstance right now, but I would like to get the login and authentication results as-is to my PlayerState when I join a server. Replication is a bit difficult with the playfab json objects so I've opted to converting them to strings and back to json, but since I want them in their original form I would like to just pass the login call to the server's GameInstance, however if I am not connected to a server I guess there doesn't even exist a GameInstance for a server, but then again I'm thinking, is there any idea in connecting to a server before you authenticate?
There's no need to call ForceNetUpdate after updating Replicated properties that are on an actor that has a NetUpdateRate of 30.0f right?
Running into a physics collision issue.
Client shoots enemy. Enemy dies on server, OnReps a bDead variable. In the OnRep, I change the collision to ignore all, except for the environment (WorldStatic, WorldDynamic). It also changes from Collision Enabled to Physics Only. Server, everything works fine. On clients though, they fall through the floor. When I switch it to Query Only, they no longer fall through the floor, however, they now block line traces, even though all of the trace responses are set to "Ignore". Any ideas?
i have a server list that when i join the server with a max players of 2 , but i press find server on all of the players before i join, then i join on one, the others can join aswell even with a max players of 2
So I was reading up and I guess you can use an interface to make a server rpc on something you’re character doesn’t own?
Interfaces don't support RPC
PlayerController, possessed Pawn, PlayerState are your three choices
That’s what I’m reading from the compendium
Read carefully what the guide says
The PlayerController is used for the RPC
The interface is simply a code organization feature to avoid duplicating the player RPC for every single interactive object type
Ohhhhhhhhhhhh
I see
I thought u had to own the door too
But for some reason the player controller allows u to use it
The PC allows you to pass RPCs to the server
What happens on the server is up to you
I see that makes a lot of sense
I mean I could for example do it from my pawn, but I’d have to set the owner of the door as my pawn. The player controller is a way around.
You can write this exact same code in your pawn that you own and it'd work
The interface method is being called on the server.
The first method being called is the "Run on Server" event
Ohh okay I thought u had to own the door when doing it outside of the player controller
But ur saying as long as I’m running a server rpc on something I own it will work
Yes
Gotcha. The confusing part was I thought I had to own the door.
Right I’m basically just doing the same thing but on the server
Correct.
Instead of opening the door directly, you ask the server to open the door for you.
So am I basically running a non visual copy of the game on the server
Not necessarily. Server could be another player as well.
Ah yes listen server
Server is just the "true" version of the game and has the final authority on things.
Makes sense
If a client doesn't own something, they shouldn't be able to just do w/e they want with it.
So older p2p cods one person would be host and if they had mods they could mess with everyone because they were the server
Well they’re functioning like a regular dedicated server then, and everyone connects to them
I guess it just feels like p2p cuz there’s no dedicated server involved
Yeah, that's what a lot of people look at it as. But technically speaking, it's not right.
Ya cuz p2p is torrents and stuff
But as for the original question, yes. If a player is listen server, they can do w/e they want in the game because their game is the true version of the game that everyone else is playing.
Makes sense, something to keep in mind if I actually do anything with this game lol
That'd be level streaming?
Been in UE for ages.
The world partition stuff, which is kinda like that I guess and more focused on areas of large maps, isn't in ue4, I think.
I'm having trouble with multiplayer in my game. Unreal Engine/Steam related.
Using the appID 480 (default, for Spacewar) we can establish a host but the clients when searching for session is finding a high number of sessions for other projects using 480 as appid. Changing 480 to our own appID, the multiplayer stops working since we can't even get the API to initialize.
LogSteamShared: Steam SDK Loaded!
LogOnline: OSS: Creating online subsystem instance for: Steam
LogSteamShared: Warning: SteamAPI failed to initialize, conditions not met.
LogOnline: Warning: STEAM: Steamworks: SteamUtils() failed!
LogOnline: Warning: STEAM: Steamworks: SteamUser() failed!
LogOnline: Warning: STEAM: Steamworks: SteamFriends() failed!
LogOnline: Warning: STEAM: Steamworks: SteamRemoteStorage() failed!
LogOnline: Warning: STEAM: Steamworks: SteamUserStats() failed!
LogOnline: Warning: STEAM: Steamworks: SteamMatchmakingServers() failed!
LogOnline: Warning: STEAM: Steamworks: SteamApps() failed!
LogOnline: Warning: STEAM: Steamworks: SteamNetworking() failed!
LogOnline: Warning: STEAM: Steamworks: SteamMatchmaking() failed!
LogOnline: STEAM: [AppId: 0] Client API initialized 0
LogOnline: Display: STEAM: OnlineSubsystemSteam::Shutdown()
LogOnline: Warning: STEAM: Steam API failed to initialize!
Can anyone help, please?
I believe steamworks has docs on this actually.
It says you have APP Id set to 0.
LogOnline: STEAM: [AppId: 0] Client API initialized 0
I recall hitting it as well, just forgot what the resolution is.
Bumping this
yes I see that, it is part of the problem anything other than 480 registers as 0
#multiplayer message -- This guy fixed it by making sure the game on steam was added to his library.
the default space war game or the custom app id game?
The custom app ID game I imagine.
okay thank you ill try that
Is it possible to dedicated server save all players and their data to savegame file? Im creating multiplayer survival game and I want every server have own player progress. If you join new server you start from scratch.
Or server database that server saves players there? What would be best way?
I want similar system like Rust
Yes.
So in gamemode -> function to gather all data from players and create savegame? I’m new at this:D
Feels like it would be slow if it updates for example every 5seconds
There are a lot of options honestly. I would go for a LocalPlayer subsystem combined with the seamless travel persistent actors to preserve data upon travels and upon disconnections (if your game supports it). Anyways you might want to look at this:
I haven't wrote the database part yet, but shouldn't be hard to figure it out
Thank you!
I would just make a save file per player in addition to the worlds
just like Minecraft
wouldn't scale crazy well but it'd get you off the ground
Okay thanks!
Are you generating hits / overlaps?
Yes. I don't change that setting at all.
Are you changing the collision of the character's capsule collider? The root?
Yes
Are you implementing rag doll?
No
I wonder if since the change happens during onRep it takes a few frames (due to server lag) to happen which allows them to fall through the floor. Maybe its better changed with a multicast?
or maybe i dont know what im talking about lol
This is a state change, as such, it should be OnRep
So its like when the character dies you want to ignore all collisions with other pawns and maybe some custom collision channels that affect gameplay, but it seems as if everything is being ignored does that sound about right?
That should be our motto
Yeah. Pretty much. Works fine on server/standalone. Collision is out of whack on clients.
Maybe do the onRep AND run the same logic again for that owning client?
Seems like there's a desync happening
So that way you change the collision settings with an onRep but you're also making the same change on the affected client immediately.
Example - how is this actually registering a hit with the capsule?
That's what the onrep does.
OnRep runs when the client receives the updated value.
So for my similar onRep bool to handle death called justDied, I change a few things here and there but then I call a server event which calls a multicast event which changes the collision on the capsule and mesh then enables simulate physics so that the dead character begins to ragdoll. Maybe try to implement a similar pattern using a multicast?
But mines a multicast because I use a timeline for some visual stuff as well
ohhh wait a min, according to your screenshot you are no longer Generating Hit Events.
Correct. Because I don't use the Hit stuff at all. If that box was required, they'd fall through the floor on the server and while walking around.
It simply is never checked
im confused
Then shouldn't it be set to use Physics only, no query. The line trace counts as a query, right?
When it is set to Physics only, that's when they fall through the floor.
Line trace is query, yes. But they are ignoring ALL traces, yet it still registers.
because theres no hit events
Even with the hit events checked, they still fall through the floor on the client
okay so I made a cube, enabled simulate phyiscs and used the same collision settings as your screenshot, it also falls through the floor and gives me a warning.
Invalid Simulate Options: Body (Cube6.StaticMeshComponent0 Cube) is set to simulate physics but Collision Enabled is incompatible
If I change it to use Physics Only (No Query Collision) then it doesn't fall through the ground anymore.
When it is set to Physics Only - they fall through the floor on the client only. Not on the server.
When it is set to Query Only - they don't fall through the floor but they still affect responding to traces DESPITE all trace responses set to ignore.
Yes. Through animation.
I wonder if you're setting it somewhere else and forgot, if you pause the game and inspect is it using the expected value?
That's how I got the screenshot
k
And yes, I make sure it is the correct World
Is simulate physics being accidentally enabled?
No
Registers the line trace, but it is ignoring all line traces.
Only on clients though.
hi! i´m trying to replicate the falling animation of the character and i cant!
can someone help me?
Replicate the is falling var in your character BP. Then in your animBP, just grab that value.
You can you make it an onrep var in your character BP, and in the onrep function, update the value in the anim bp
but, unreal engine dont replicate automatically this?
Well - you could just grab it locally probably.
in an empty project, the isfalling variable is replicated
but in my project don't, and i don't change the character settings
@graceful flame So. Despite this CLEARLY hitting the capsule, it is registering this hit on the mesh....that is laying on the ground. Very strange to me. Still haven't figured out why Physics Only is causing them to drop through the ground mind you.
Oh the mesh has its own collision settings so that makes sense to me
Yeah, but why would it be hitting it when it is on the ground...completely away from the shot
That's the strange part. Not that the mesh has collision settings.
Its like the mesh is standing but visually its on the floor?
Yup.
Maybe you need to use root motion?
That's what I was thinking.
im not sure though
Like, it gets stuck in the last position if you're not using root motion.
probably by design for some reason
its cheaper to just stop working at that point i guess
Well, just changing the mesh to match the deadcharacter profile works as well. Don't need root motion.
Still a bit silly imo.
Yeah. Just not the falling through floor part.
Which isn't a big deal to me. As there is a working solution.
I tried to reproduce these values but I don't get the falling through floor behavior in my tests
idk what to say to be honest.
I used a landscape, but I don't think that plays a role here
is it a standard/default character with a capsule and cmc, or custom implementation?
for cmc, try to call DisableMovement before setting the collision, I think that fixes your problem
in the OnRep / death part
default
Sorry I just read the entire conversation you had with lawlster, you need the death animation and not ragdoll. I guess I can't help then.
but if it works on the server side, something must be out of sync. I'd double-check everything
Hello people!
Very weird and sudden problem that occurs out of nowhere:
i can host an advanced session and people can join the session, but servertravel [mapname]?listen seems to destroy the session, since clients get kicked instantly and the invite option in steam disappears, also Destroy Session returns fail
This didn't happen a few days ago and appeared out of nowhere I am confused.
I'm experiencing " SerializeNewActor failed to find/spawn actor" errors when reloading a map in high packet loss situations. The map reloads fine, but some or all actors are missing from the map on clients when they load in. Any ideas?
is there anyway to check for blueprint performance? like how much an actor taking CPU power
Well theres the profiler
I try to use profiler, it give me the whole blueprints, not specific actor
@hoary spear i kinda want to track how costly is one specific actor
What do you mean? You can track anything you want in the profiler
@woeful ferry okay, I recorded the session with Stat StartFile and Stat StopFile and I used Session Fronted it show the whole blueprint usage
also the Ctrl + Shift + , only show me the GPU Visualizer which more on rendering costs
in PIE i used Stat Unit it also show me the totall CPU cost
You need to check the threads
Pre-physics for most of the BP usage
There you can see down to the function how much stuff costs
Pre-physics Threads? you mean Game Thread?
where do i need to look for it?
this section?
Pre physics in game thread yes
I only see worker
Have you uploaded your file
oh okay, i need to select them in EventName so they show up there
@woeful ferry okay, thanks for the help, i see them now
I have an online multiplayer game. I have a client that created its own BP_Character. I possess that character since I manually spawned it in. I want to know if it is locally controlled. it should return true, but is returning false. how so?
So you're spawning the character locally on the client?
i kinda want it to be replicated so other clients can see this character
i'm kinda new but yes. i am locally spawning it on the client
If you want it replicated, mark the character as replicated and spawn it while running on the server. An example place of where you could potentially do that is OnPostLogin in the Game Mode.
You must also possess the character while running on the server.
i did possess the newly created character but it confuses me since it still says it's not locally controlled
This "possess" is running on the server?
nope
oh. okay. will try it out
hm.. so i should have an event raised from the player to the server stating "hey, create this character and possess it for me"?
Depends on the set up of your game, but normally the server should be able to handle that itself. Again as an example, in the Game Mode "OnPostLogin" fires after a player has connected to the game and you're given a reference to their player controller. From that point you could spawn a character, and tell the joining player controller to possess it.
Game Mode also only exists on the server, so you're guaranteed that the OnPostLogin event is running only on the server.
Just a heads up too, if you see this icon on any other nodes, it means that the node needs to be executed on the server in order for it to work properly.
ooo oki. thanks~
Hi 🙂 I am trying to replicate an TArray<FVector> using the Push Model. The Push model it self and the Replication of the MeshComponent which holds the array seem to be set up correctly (Replicating other, primitive typed, variables using the push model on this component works just fine). But somehow for the TArray the push model does not seem to be wroking. Is there anything that I have to do differently for array variables? Unfortunatly the documentation on the push model is very limited. It might me worth noting that I am not assigning the array, I am just changing the content of already allocated elements.
Pushmodel doesnt support Arrays.
Try looking into FastArrays
They achieve the same thing
Thanks for that info. That really helps to know.
To my understanding FastArrays exist mainly for efficient and having more controll over Delta-Serialization (At least thats what I used them for in the past). When my array replicates I can be almost certain that all elements in the array have changed. So writing my own struct with Serializer functions that efficiently replicate the whole array would be more appropriate for my use case I'd guess?
If a client has a skin, would you replicate that to other clients via replicated FSoftObjectPath variable?
Depends how many skins / players there are in the game, if a small amount you can always replicate the UMaterialInstance* itself, still only like 4 bytes to replicate
It's more of a Prop-hunt clone, so the number of skins is pretty high, as user can transform into any object. On the other hand, the it is basically guaranteed that the skin (aka static or skeletal mesh) will be loaded in memory on client-side.
Well if those props are already loaded then I'd say it's fine to just replicate the info directly
But I'm no expert
But as far as I could tell, only reason to use the soft pointers / load on demand would be if there's loads of stuff that mostly isn't loaded
like fortnite skins
I am not sure what I would replicate in this case. Please correct me if I am wrong, but changing mesh on server side is not replicated to the clients, right?
No you'd have an OnRep variable for the mesh in this case, changing it would trigger the OnRep func where you can set the mesh on the clients locally and on server
Right, that is what I wanted to do in the first place. But what variable do I OnRep?
That is why I was thinking replicating FSoftObjectPath
UStaticMesh*
or skeletal if your props are skeletal meshes
then when the OnRep func triggers
StaticMeshComp->SetStaticMesh(ReplicatedStaticMesh);
Oh I see, thanks.
FastArrays give you specific functions to know when elements have been added, removed or changed. You also have to specifically mark the array as dirty for it to replicate at all (thats the equivalent PushModel part).
GAS is disconnecting me when trying to send EventData. Did I miss something obvious? I've dumbed it down and stopped passing any data and still happening
FGameplayAbilityTargetData_CraftIngredients IngredientData {};
FGameplayEventData EventData;
EventData.TargetData.Add(new FGameplayAbilityTargetData_CraftIngredients(IngredientData));
UAbilitySystemBlueprintLibrary::SendGameplayEventToActor(this, CraftAbilityTag, EventData);
LogAbilitySystem: Error: Could not find GameplayAbilityTargetData_CraftIngredients in ScriptStructCache
LogNetSerialization: Error: FBitReader::SetOverflowed() called! (ReadLen: 8, Remaining: 0, Max: 331)
LogAbilitySystem: Error: Could not script struct at idx 0
LogProperty: Warning: Native NetSerialize StructProperty /Script/GameplayAbilities.GameplayEventData:TargetData (ScriptStruct /Script/GameplayAbilities.GameplayAbilityTargetDataHandle) failed.
LogRep: Error: ReceivedRPC: ReceivePropertiesForRPC - Reader.IsError() == true: Function: ServerTryActivateAbilityWithEventData, Object: AbilitySystemComponentFix /Game/maps/UEDPIE_0_devmap.devmap:PersistentLevel.B_DevCharacter_C_0.ASC
LogNet: Error: UActorChannel::ProcessBunch: Replicator.ReceivedBunch failed. Closing connection. RepObj: AbilitySystemComponentFix /Game/maps/UEDPIE_0_devmap.devmap:PersistentLevel.B_DevCharacter_C_0.ASC, Channel: 3
The key thing it's telling me seems to be NetSerialize [...] failed but I don't know why it would. The struct has NetSerialize but since I've removed all props all it does is bOutSuccess = true; and return true; . And I do have a TStructOpsTypeTraits with WithNetSerializer = true
When testing in singleplayer everything works as expected. I've done it in another project (sending custom payloads via EventData) without an issue just not sure what I missed this time
Got it. Missing call to UAbilitySystemGlobals::Get().InitGlobalData();
Give me a couple months and I'll be back the next time I need to send custom payloads and forgot this again
Hey there.
I am having exactly the same issue as described here:
https://forums.unrealengine.com/t/character-movement-is-stuttering-on-client/412572
when activating "component replication" for the skeletal mesh of a character, the character movement of the owned player is stuttering when playing as a client. for the server it looks fine.
turning the replication off fixes the issue, but i obviously want the skeletal meshes of my characters to replicate as i change their visibility or exchange the skeletal mesh as a whole while the game is running (talking about clothes etc)
anyone else ever had this problem or has an idea what i can do?
ive checked alot of different topics around net for this problem and havent found fix for it. so all clients who connects to listen server over online are getting this weird lag on movement, its annoying and not fun to play. (also on lan but not so bad) characters are parented from “character class”. basic movement setup with replications. nothi...
You could always use RPCs to change skeletal mesh data.
Not a fix, but a workaround!
Not sure what you mean - i already run the function with the change of the skeletal mesh on the server and multicast it to everyone?
It was in response to
but i obviously want the skeletal meshes of my characters to replicate as i change their visibility or exchange the skeletal mesh as a whole
If you've already got that working without replication then ignore my suggestion!
got the replication running, but it only works properly in all directions (server to client, client to server, client to client) when i activate the component replication for the skeletal meshes. and that introduces this strange movement stuttering even when i did not do any change to the meshes and they are all default
It's probably replicating transforms and then there's infighting between what you think it should be and what the server is telling you it should be.
can you help? ;p
hi everyone, how can i run levl streaming only on server?
@latent heart
i want level streaming totally locally
when server overlaping box collision then load/unload level for everyone
Not a clue
You shouldn't be replicating the skeletal mesh component regardless of your needs
Replicating it makes the CMC go brrr
Also you shouldn't be multicasting
Check it out (from pins of this channel)
You can keep yourself busy with #rules (number 2) while waiting for an answer
ok, sorry
please anyone knows why ? dedicated server spamming this when I login, and then the server won't work (I can move around but no server actions work)
hi, did you manage to fix this issue?
hi, did you manage to fix this?
hi, were you able to fix this?
I believe this was a symptom of too much network traffic, but I can't recall. Take a look at the network profiler to make sure you're not getting a terribly large amount of waste/excessive replication
hmhm okay thanks, so if I have too many replicated variables or too many multicasts happening, it might be why?
it also says
"Failed to find an existing connection with a matching cookie. Restarted Handshake failed."
I removed the nginx and used an ucp tunnel between my machine and the facing internet server, I did the connections easier setting up a VPN between them
ahhh that's like 4 words I don't understand. I'm using Steam Subsystem, is this related still?
nope, I was using google cloud to host my server
Are you really just going through everyone and pinging them? lol
I mean,
It seems like the most logical thing to do.
lol
At this point the rest are too old tho.
Hey I was using UE 4.22 which had issues in multiplayer with Oculus Quest. I switched to UE 4.24 and that fixed it for me
ahh okay. :/
I have not used the Steam subsystem so I can't help with your issue, hope you figure it out!
I did get it fixed but that was almost 2 years ago so I have no idea lmao
I don't think I understand the concept of OnReps - btw I am working in Blueprints:
What I have done now is that whenever I add or remove an item from my equipment, i copy that item to an array and I've set that array variable to OnRepNotify - in here I change the skeletal mesh.
It does not work at all on the Server, and for Clients it only works for themselves
replication happens from server -> client
if you are setting your onrep'd variable in the client, that'll have no effect
unreal engine 5 main branch implements server streaming for world partition
although if you want a server authorative system in which only the host is considered a streaming source then you might want to use volume based level streaming in which u filter for ls and authority
it's being set in a function that was called by another function that was initiated by the server, as the whole inventory system is happening on the server already.
so basically
Server: call function "move item" in that specific player's inventory upon drag and drop detected. if it's going to an equipment slot, call a function that handles adding something to the equipment slots. and at the end of that function, i set the onrep'd variable.
since the second function i mention is called by something the server did, I assume thats counts for the onrep as being set on the server still?
well... I'm not sure I understand you, to ensure you are setting something in the server, add a print string right before u set the onrep
and be sure the printstring prints "Server: Hello"
u can do debugging, but I can't explain you debugging here
and you know when it will be ready?
in 5.1?
most likely 😄
you can already grab that by downloading the engine from github using the main branch
5.1 is supposed to solve world hunger with how many things are going into it.
Oh - I'm excited for it. Like everything I see, I'm like 🤤
"hardcore state of the arting"
And there might be a chance that verse sneaks its way in there.
ah yeah, we all saw a boolean swap to true on main 😏
Fortnite Creative 2.0 is supposed to release with verse support. Creative 2.0 is supposed to launch later this year. They flip that flag. Coincidence? I think not.
well... NOw... I think that VErse will Make it whenever epic BEgins to upstReam 5.1 (I hope soon)
damn alt caps is not working too well today
how do you know my birthday? 😄
21th ?
relax ur going too fast, we've just met
anyways, keep it on topic pls XD, don't pretend this is #cpp
Thanks for you rsupport. I eded up writing a struct with custon NetDeltaSerialize function which is efficient in my use case 🙂
Sorry if I can't explain this properly 😕
As I said, I am doing this in blueprints only.
So I made sure that the RepNotify variable is set on the server with that print string, regardless of who puts something into an equipment slot (client or server).
However, the RepNotify function only fires when a client equips something, not when the server does it - since i am changing the skeletal mesh in the RepNotify, the server won't do it when itself equips something.
Now I can of course change the servers skeletal mesh without the repnotify and make sure to check if "has autority" is given, but i don't get how to let the clients see that change other than through multicasting.
I guess it has something to do with what's written in that article:
"
OnReps in C++: When changing an OnRep variable in the Server, the OnRep behavior will only trigger on the clients when the value of the variable changes. The Server won’t trigger the OnRep, meaning that we have to call the OnRep behavior explicitly from the Server if we wish to execute it in the Server.
OnReps in Blueprints: When we set an OnRep variable in the server, the OnRep behaviour will be triggered always on the server (even if the value of the variable didn’t change). However, the OnRep behavior will only be triggered on the clients if the variable of the OnRep has changed. In addition, it is not possible to call explicitly the OnRep functions created by OnRep variables.
"
It actually seems that the above is not true for Blueprints anymore and it's similar to the C++ version now
It would be really weird if they changed that though. That would break many projects for no reason 🤔
it's my article 😄
oh, i just wrote you on twitter then 😄
the rep notify behaviour should be triggered in the server aswell for bp use cases
so you've rep notified what exactly?
an array?
yes
okay, let me do a little test for arrays in BPs ~
i mean i could make it something else if the fact that it's an array is the issue
tarray replication is a bit peculiar, let's say that
but I'm going to do a little test
an array of what?
actors?
in my case an array of structures
you are right, arrays don't trigger the onrep behaviour in the server for BP onrep callbacks
gonna give you a little medal 🏅
so, if you want to fix that
you have to wrap whatever you are doing inside the onrep in a function
and call it after u set the function
set(function with your behaviour) ----> function with your behaviour
the article doesn't cover arrays
but probably I should cover arrays 😄
since its somewhat peculiar
thanks for the info, it's been driving me crazy.
i have this ridiculous system of pieces of equipment that hide certain bodyparts and I am having a lot of trouble replicating that properly.
I am not sure if I got you right though: wrap what i want to do in a function means collapse, right? and that function within the OnRep can than be called by the server?
alternatively just using something else than my array as a variable (a single item instead array would be enough actually) would also make this work?
Yes and yes. For the third question, yes it will work, though it will be set twice on the server, so stick with this approach only for array properties
⬆️
Howdy! I've created a grapple hook with a custom physics constraint (physx,) however when I set the capsule component to simulate physics the Character Movement Component loses a lot of functionality due to it having some specialized logic checking if UpdatedComponent (the capsule component typically) is simulating physics.
Has anyone come across these issues with physics engine based movement of ACharacter before? Anyone have any suggestions to work around this? I've considered overriding the functions that are checking for physics simulation to rework the logic in those checks. And also considered creating a separate capsule to hook up to the grapple constraint to act as a proxy.
My code is having some trouble falling into sync when a player joins an existing server with an existing state, but so far I've only been able to test this when launching a dedicated server after packaging in non-PIE environments. What's a good way to maintain a persistent server and have the client join/disconnect via PIE so I can debug it properly? Every time I launch a client, it launches the server with it from scratch
I still can't get the RepNotify to work as described in your article 😦
So this is happening in my inventory actor component, which is part of my player controller, after I placed an item in an equipment slot. Inventory arrays are also stored on the player controller at the moment.
The last item i added or removed is being handed over to a "RunOnServer" Custom Event called "ServerHideBodyParts".
https://i.postimg.cc/CMrS96VV/grafik.png
This Custom Event is part of another actor component called "EquipmentVisualization" attached to my player character BP, where I originally planned to handle things like hiding meshes, exchanging them and whatever.
It sets the item (type structure) that the event got as a variable called "EquipmentVisSlot", which is set to RepNotify. It's placed on the controller, just like the inventory array.
https://i.postimg.cc/1XFg8xpb/grafik.png
For testing purposes I only do this in the OnRep Function, hiding most of the head:
https://i.postimg.cc/s2CTxy5C/grafik.png
When I equip an item as the player that is server, the following happens - only the server sees the change, although the print string is actually shown for everyone. (server on the very right, clients middle and left)
https://i.postimg.cc/C54RGGQ4/grafik.png
Then, when I equip an item with a client, you can see that the server sees it, the client that equipped the item sees it, but the other client does not.
https://i.postimg.cc/XJRPfFCX/grafik.png
I wonder if there is a general setup on the controller or player character that i missed out on? Then again it partially works. And I already had it working with multicast at some point, but then the "late joiners" issue came up.
And as I was told before, I should not set the skeletal meshes to replicate "WizardCell — today at 15:03 - "You shouldn't be replicating the skeletal mesh component regardless of your needs, replicating it makes the CMC go brrr"
I'll go and grab some food, maybe that bring some new ideas
but hang on im busy now, ill read you in a minute
Okay I'm back
@jade jolt by looking at your logic
I can tell you what is happening
controllers only exists in owning client and server
thereforce from an authority perspective of your controller
when you replicate down variables to the client
only the owning client will get em
so if you want these changes to be received in every end other than the autonomous proxy
you'll need to use another actor channel for replication
for example the pawn
or the playerstate
take a look at cedric's compendium
hey read my article about correct stateful replication
I give a couple of tips about how to test this properly in PIE
TLDR: There's a setting in editor settings that lets you add one extra button to "add" clients to your server, you get a viewport and all the fuss, quite epic tbh
Sweet, thanks for that super helpful reply 😍 e: for future comers: Late joiners: For earlier versions of UE5 this feature can be activated under Editor Preferences > Experimental > PIE > Allow late joining
Couldn't find the button at first, but then I did, the UI is confusingly using the same icon as the simulate play button, I could have easily gone through an entire lifetime without finding out about this feature on my own 😅
When I kill enemy AI I set collision of the capsule to no collision and the mesh I set simulate physics for ragdoll. This works on the server, but on the client the capsule still blocks player movement and the enemy mesh does not ragdoll. It does move to the same position as the server, but on server is simulating physics, on client it is not.
You can't run "Run on Owning Client" events on actors that are not owned by a player. You need to use OnRep variables or multicast if you want clients to do things in regards to an unowned actor.
Additionally, there is no need to have the "Server Kill Enemy" event be set as an RPC. The "AnyDamage" event can only fire when executed by the server, so that event path is already running on the server - just make it call a regular event.
I love you @sinful tree
hi! is there a command line launch option to specify a game mode for the client/server?
yes, it's called game
great ty!
yeah i just didnt know what "gameinfo" is
Yeah the description there is somehow wacky
how to know when the player has finished loading into a server?
so like I want to make it so the player can't take damage until he fully loaded in
cuz it seems like my player is taking damage while in the black loading screen
thanks. I guess c++ only
thats right. you could create a function library in C++ to easily expose it to bp if you wanted
yep
so if i declare a multicast delegate like
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FTestDelegate, const bool, FirstParam, const int32, SecondParam)
and then I create an instance of it, can I bind to it using a function that has a different signature (and by that, I want to use a function with no parameters). I assumed I couldn't do that but it's not giving me compile errors
It's like a unique ID that relates to that specific actor. The client/server relates that ID to the actor that exists on their end. It's not the full details of the actor if that's what you were worried about.
no you need to set the array to itself if you want it to replicate. changing a single element will not replicate
Is there something besides "Destroy Session" I should be using? Sometimes it doesn't fully destroy the session and forces players to try and join the server infinitely
You will not get callbacks per-item in a normal TArray, you will get replication if you add or remove elements (or set the array to a new array). You can use FFastArraySerializer for arrays of structs and get per-item callbacks like you want though if its important.
Sorry to post here again I got the seed to work but it only on the sever and it won't work on clients I'm sorry
Why does my entry map not render on the client (packaged), only the UI shows up. This is before connecting to the dedicated server. Is this expected? I can see some errors related to "Could not open FPipelineCacheFile" could that be the cause? Once connecting to the server everything renders as expected.
Is the map actually packaged?
@latent heart its included in the List of maps to include in project settings
That isn't what I asked.
How to check?
ok will try thanks for the hint
just curious, when using a dedicated server how are you guys dealing with AnimNotifies? do you process them 100% server side or do you process them on the client for the local player and then send a server RPC and do them on the server after?
@latent heart would it not print out an error - eg "cant find level...", i can see in the logs that the entry map gets loaded. Also the UI works.
No idea. Maybe there's some sort of initialisation you don't do when it's locally hosted?
Hi I have a maze, i want to spawn 4 player characters within the maze. How would you go about randomly spawning the players within the maze boundary and not also get stuck on the walls. I assume you border the location using a sort of bounding box? How about not getting stuck on the walls, like also in the path of the ai nav mesh? Thanks
CMC Question (only in Packaged!): When having a runtime spawned Procedural Mesh inside a Runtime spawned Actor. Both not set to replicated and both created the exact same way on Client and Server, standing on it seems to anger the CMC quite a bit.
It prints that it can't resolve the Actor, and that the ServerMoves expire (ClientTimestamp wise).
As well as print on the Client, that it can't resolve the MovementBase.
What's the deal here? Does that Actor need to be replicated?
Does the Component need to be replicated?
That smells to me like MovementBase shenanigans, isn't there some inverse to TearOff that can make both meshes net addressable?
Maybe stabley named or whatever
Yeah it's a bit strange
This also doesn't happen in the Editor
I haven't had much time debugging it yet, cause it's from a tutoring session. So I will have a look at it in two weeks (vacation now).
Will see if I can figure out why exactly this even happens, cause a runtime spawned Cube (Static)Mesh(Component) via an Actor on both ends (even without replication) is not causing it (at least I've never had that issue before).
Sounds more like a specific issue with runtime spawned/created ProcMesh and SplineMeshes, but even that should not really be an issue.
Ah well, future me can suffer through that one.
Had a similar issue with construction script spawned spline mesh components
Had to call SetNetAddressable() on them
Was whining about it not being addressable
Hello, since a dedicated server is in charge of hosting a map, how can I start an instance of the dedicated server and tell it which specific map to load? Thanks.
Thanks!
i cant figure out why my replicated variable being shown in my UMG widget is 1 higher than the actual number
i decrement it on the server, but the umg widget seems to always be 1 ahead
i decrement it on the server
then i set the text on the event
but it always shows 1 higher in the umg
@dim trailWhy u no RepNotify
i will try repnotify
sir, i might steal this.
thanks for sharing, i just wanted to say that i've been doing network stuff after hiatus of a few years and for some reason my brain deleted OnRep, and in my project literally everything was done via rpc's 😄
hi, why is my replicated actor not spawning for the client?
Only in packaged 😭
I am spawning it on the server, the actor is set to replicated. But the client can't see it.
It works perfectly fine in the editor "run as client", but not in packaged on a dedicated server.
It works fine on a packaged listen server.
I am starting to lose my mind cuz I can't imagine what I;m doing wrong, just thinking there is some weird ue bug from soemthing I'm doing and I need to find a workaround, but I don't get what's wrong.
Make sure you own w/e is calling that server event
what's w/e?
you mean wherever I'm calling it from needs to be the server? (Has authority)?
I run this before calling the event
What class is physically calling this server event
actor, what else could it be?
...
Okay. But how does this chain of events get started?
Is your player interacting with the door directly and calling the server event directly
okay,
the building [NOT REPLICATED] which is placed in the level
gets a child actor added to it which is the door
then when the door gets added I destroy it and spawn my actual door again
does this make sense?
lol
I'v been tryng to fix this for a few days.
You have yet to answer my question
not the player
What is actually CALLING this function
Going to have to show more of your setup then. Because if what you say is true, it should be working. If it didn't, a lot of games would be broken right now.
😭 okay give me some time to wrap my head around this in a way that I can explain
a replicated actor that's in the level
I call it a replicated global actor I have a lot of replicated functionality on it
well no one? it's just part of the level
Idk what that means.
Had to hide from mods, lay low for a bit 😈
also just so I'm 100% sure, I can't spawn a replicated from spawnActor on a server actor that's not replicated, correct?
but why does it need a player controller? this is a dedicated server
I literally tested every way possible every option possible
It always worked
The only case it doesn't work is on packaged, with a dedicated server
you mean these?
The idea of using "Execute ON Server" events is that you're allowing clients to call that event, but clients can only do so if they are the owner of the object. It's not necessary to mark an event as "Run On Server" if it's something you intend to only run on the server - you just make sure that you're actually running on the server (usually using the HasAuthority node) before calling it.
oh yea that makes sense, I just enabled 'run on server' because I didn't know what else to do. but whatever is executing that event is the serve already
okay yes let me explain again
What is TRAVEL_Relative vs TRAVEL_Absolute do for seamless travel? The source code just has the comment "/** Relative URL. */" and "/** Absolute URL. */" for both of them which doesnt help much
The server travel function also says "If bAbsolute is true and we are using seemless traveling, we will do an absolute travel (URL will be flushed)." But what does that mean in the context of the game?
- the building that's in the level [not replicated] spawns this child actor, this actor is the door that's set to replicate.
- in the door begin play, if it's client, I deleted the door. if it's server, I spawn a new door in hopes it will be replictaed and delete the old door.
do you get what I mean now? I needed to do this whole thing so it will work, but this doesn't work on packaged.. lol
😅
the asset pack did it

I'm trying to re-package again, I think I my last change might have fixed it but I just moved the wrong files, so Imm try again
ah neat, make sense. Interesting that it says "if true is specified for the bSeamlesss parameter, this value must be TRAVEL_Relative." thanks for the info though!
I explain that a little here: https://wizardcell.com/unreal/persistent-data/#travel-types
: ( still wouldn't work.. I don't even know anymore
This is prefect thanks!
is there a way to temporarily tell the server to stop updating a client's position?
If you mean so the client can't move anymore, then you can SetMovementMode to null
or try StopMovementImmediately
no, I mean so that the client can properly "predict" movement without server correction temporarily
for an autonomous proxy
There's a setting on the CMC IgnoreMovementCorrections iirc
If I wanted to persist just one property across seamless travel would the best aproach be to pass it in as an options string or should I make an AInfo actor to store this one piece of data (maybe more in the future) and persist that?
reading wizards compendium it seems like the options string wouldnt be the best option due to chaining as the server goes to other levels. So persisting an actor would be the best way?
Use game instance?
I suppose but that would run into issues if I ever bothered to go with dedicated servers and It doesnt really feel like the best way to do it
Does the option string get passed to clients when the server travels then?
I wouldnt need to pass it to clients, its just to check how many players where in the game before the switch from lobby to game and the game mode waits to start until all of those players have joined
Then there's really no difference. One just involves converting it to a string and back again.
Well using options strings and relative travel causes the new options to be appended onto whatever you had last time
I saw someone here talk about using SeamlessTravelCount > LastCompletedSeamlessTravelCount for checking if all players have traveled yet but im pretty sure that requires a first seamless travel to have happened begore your next seamless. So wouldnt work for players connecting to a lobby and then traveling to a level
What you need to compare is SeamlessTravelCount >= NumberOfPlayers
I guess i could just use the options string for the initial travel and then use that later
And find a way to detect players failing to travel. Timeout or network disconnection.
yeah, i was just copying what he had written
Lots of people have written many things, you need to convert their wisdom to your use case. 😉
i was just going to do a 20 second time out or something along those lines
haha yeah
thanks for the help
20 isn't long enough, I think.
It's unreal. Loading complex makes will take a long time. You should test it out locally.
that was just a ball park number but yeah, I will do some testing
Can anyone help me with this? My aim offset is automatically replicated when looking Up and down. But the Yaw is not replicated at all. The Server can see both clients looking all directions. But Clientside only the Client can see its self turning left and right and cannot see the server turning at all
can anyone recommend a web hosting tutorial of some kind? i can deploy my server and access it over my local network, but not much success banging my head against aws/google/etc
hi. i'm reusing a level for both the menu and my main game. i have two different sublevels with different lighting maps. what is the best way to load the lighting scenario for each individual game mode? i have a menu game mode and a main game mode, but because the game modes live on the server i'm unsure how to tell the client to load the correct lighting map
Maybe it's not the problem as you show in the picture, Try to check for the character setup. Because mine is the same as yours in the pictures but it works.
Like the Overall Character blueprint? If thats what you mean I have nothing referencing the aim offset in the blueprint.
We have 1 character BP, I'm generating a reference to that clients Player Controller in the character BP so I can access information stored inside the Player Controller BP, I tried 'Get Owner' as the wildcard but it only seems to work on the client, however if I use 'get player controller' and leave the index at 0, it works for both serv and client. Is this right?
Player Controllers only exist on the server and the client that they belong to, so other clients can't access the player controller of other clients.
Ah okay so it's irrelevant that it's index 0, there will only be 1 on each player BP
how do you control which character gets spawned other than in the "default pawn", I want to spawn two different characters but it will only spawn same character twice
You would remove the default pawn under world settings and physically spawn actor selecting which character you want from class and possess
Can anyone answer; in C++ - why do we need to do both a UPROPERTY(Replicated) AND update GetLifetimeReplicatedProps() and add the variable in there?
It seems like double handling? If we declare the variable inside GetLifetimeReplicatedProps() - I dont understand why the UPROPERTY also needs it? Sounds like UE already knows?
(I'm sure there is a reason, just wondering if anyone knows "why")?
I believe the answer is, when you're marking a property as replicated, that's all it is - just a flag to indicate that it can replicate.
GetLifetimeReplicatedProps() then is where you define the details about the replication of those properties, such as if they just replicate, if they're repnotifies, etc.
So one ends up being the "what" as its defined in the .h, then the "how" is defined in .cpp.
yeah - i guess I'm just confused why we need the .h stuff - because Unreall will parse the .cpp and see all the variables there, so why duplicate the declaration? Or why not put the "how" in the UPROPERTY itself?
Just seems like a strange duplication I guess... not very DRY?
U mean to put the flags and conditions in the .h or something like that?
well the getlifetimerepl. has some extra implications
there are loads of DOREP overrides
in which u can play with the behaviour of your repd properties
doing all of this in the H will simply overloead the uprop parenthesis
also order
Hey ! I'm using a SaveGame to make the game spawn the right class choosen from each player before joining the Session.
It "Saves game to slot" before joining, and "Opens game from slot" from the PlayerController (in "Owning client" mode) to reach the right class inside it.
But when i'm testing with my friend, it seems that only the HOST's savegame is used, no matter what class the client choose.
Am I missing something ?
You'd need to replicate the choice from the client to the server.
Sorry my bad in wording it. Replication only goes one way. Server->Client. You'd need to call a Run On Server event to let the client tell the server their choice.
Game Mode only exists on the server.
right
Yes. I mean check to see if the player is replicated right. Because maybe something somehow messed up with player's replication policy or smt. Try to create a brand new project and setup the blueprints and animations exactly as now to see if something is different from your real project
I make it fire in "owning client" :
and here is the "initialize" in the player controller
Where is the OC_StartPlayer event located? What class?
Game Mode only exists on the server. That means clients don't have a copy of it, and there is no "Owning Client", only the server.
So then by the time you're calling initialize, you're still only running on the server, so the server save game is loading whatever it had.
Then how can i transfer it ?
I thought, by calling an event from each player controller, it would work ?
You'd probably have to do a "Run On Owning Client" on the player controller itself rather than in the game mode. Then the player just sends their selected option (hopefully like an enumerator, not an actor class) in a Run On Server event on their player controller, then when running on the server you can proceed with spawning etc.
More simple, where do i have to open game from slot then ?
ok so
Initialize would be in server then owning client
let me try and screen
like so ?
No.
OnPostLogin > Cast "new player" to your player controller > Run On Client event (this needs to be an event on the player controller) > Load file (as you're running on the client) > Run On Server (Inputs the selection) > Spawns the actor and everything else your "initialize" would do
I kind of understand but
im confused
like
in the PC
calling directly an owning client event
triggers me
"Owning Client" is literally the player that owns the object in question. Players own their player controller.
Correct.
then why is my screenshot false ?
Why do you need to call a server event to then call a client event.
latest screenshot is from PC
You're effectively allowing clients to call the S_Initialize.
"Run On server" == Allow clients to tell the server to do something,.
yeah but each PC is not the server
thats why im confused
i feel like i need to make them do a server event to be able to do an owning client event
but it is called by the game Mode, so it would be fine i guess ?
Things can be running on the server or on the client at any time.
Events in Game Mode, are always running on the server.
So calling an "Run On Client" event from the Game Mode ON a Player Controller object, means that you're asking that specific client to do something on their player controller.
Up to that point yes, but I'm not certain on the Load Stream Level bit.
I have no idea, I've never really messed with world composition/level streaming stuff.
well thing is
i tried without
but level being big (from the store, not simplemade)
made UE crash during test, when joining the session
its like its not accepting the loading time if its too big
was working with small level
But when adding a big map (not even with word partition or anything, just big, but in one piece)
and replacing the small map with it
it wouldnt work anymore
Again, I can't comment on that bit... I'm completely unfamiliar.
so i felt like opening the level after joining an empty level would be the solution
alright 🙂
But thx for the tips
i'll try everything that is new
Me and my partner are facing an unusual issue where, his connection is slower than mine, if he hosts a game and we server travel to a larger map, I will load in first somehow, and then it will not spawn me a character so I'm just floating, & if I force spawn a lot of the functionality doesn't work as if I shouldn't be there. Is there a way to stop the clients from loading in before the server has?, the fix seems to be me hosting as I load faster
I imagine this isn't about connections, though I could be wrong
It probably has more to do with processor speed
Maybe his computer is a clunker, struggling to load things up in time
Which causes some of the server's normal setup to not be done on time
Is there a way around it do you think? Otherwise if someone with poor connection hosts a game things aren't going to work correctly
How are you spawning pawns? Sounds like a non default implementation
Player controller begin play gets game mode casts to it through authority and then spawns and possesses inside of the game mode
Why not use the game mode's default spawning functions?
Is there any way to get smooth movement on a platform that moves up and down? Things are fine when other player are still but when they move there is a lot of jitter up and down.
Good morning everybody
Ah I will look into, thanks for the suggestion
Do multicast delegate broadcast events work on the client? For some reason they only will fire on the server
Delegates of any kind are not networked.
Yes but is it possible to call .broadcast() on the client? I have a match state that i use an on rep function to drive logic. For now it just broadcasts a delegate (So each client is broadcasting their own). The broadcast fires but for some reasons the events bound never get called. But if im on the server it works fine.
Also i did check to make sure the broadcast and binding of delegates were actually getting called on the client
does no one here have the manners to say good morning back?
Ah wait, ive forgotten to add the rep notify to my getlifetime replicated props. my fault, ive been up all night :(
morning :)
It's a good morning, not just a morning!
@past totem I think you got lost. #lounge is over there three doors down the hall on the left.
I am just mentally preparing myself for this day of multiplayer fixes
I'm thinking if to ask my question
If there is any point
Because I think no one will know because I think unreal is broken
It's been days
No, it's been weeks
Some would say months
But I still don't know how to fix this issue
hi, how do you carry over information from the playerstate when creating / joining a session and or loading a new map?
If I'm not mistaken, you cannot. You would need to do that by storing it somewhere, GameInstance or SaveGame file and reload it. As far as I know, the only way to persist data on PlayerState is to do it in CopyProperties, but that only runs when you're already connected and server travelling.
Ok thank you
Would you care to elaborate on server travelling
not sure how to do that
For instance when the host picks a map, have all the connected players follow the host
Should be as easy as calling it. Are you Blueprint or C++? I think the game also needs to be set up for persistent level and such too, not 100% on the full implementation requirements.
blueprint
I think you can console it, at least for testing. I don't know if that's been exposed in 5.0. Also don't know if console BP calls work in shipping versions, have never tested that personally.
alright thank you
I think the console is something like "ServerTravel MyMapNameHere?Listen" if memory serves.
does a bp node exist for that?
ExecuteConsoleCommand
ahh gotcha
This also won't work in PIE, forewarning. You can only test servertravel in a Standalone, or packaged game.
would running the game like this suffice?
or do you need to select standalone game as well
That's fine. I don't know if you can test locally. I'm used to running through Steam, which only supports one application at a time of the same type. Can't see my own sessions for example.
Null Subsystem might support it though, unsure.
Ok, thank you :)
How do I get the controller when doing multiplayer games?
You can get the controller of each local player on their machine (via GetController() on pawns or GetOwner() on playerstates) @wooden cypress
Controllers exist for all players on the server so using the PlayerControllerIterator in the Gamemode will work
Is there a simple function I could create so I wouldnt have to fill up my bluepritns with repeated code?
Get controller into a cast is pretty simple code?
You can cache the controller pointer when the pawn spawns if you really want but it may become out of date if you change possession
Is this what you mean?
No, the GameMode doesn't have a controller
What controller are you trying to get here?
Also you are casting from a controller to a controller which doesn't make sense, you only need to cast if you are casting to something more specific like your custom controller blueprint class
Where is this being called, the pawn?
The blueprint of the character
Yeah in that case there's no need to replace it, it'll work without any casting
The GetController node is enough
I get errors after starting though
what errors
Right so if you are calling this on tick or something, there may be a while before the controller is actually available on the character
So do an IsValid check on the Controller blue pin before using it
isValid returns a boolean
There is an IsValid macro alternative
Which has a valid or invalid output
You can alternatively do a branch from the boolean IsValid node
So this is the full code
You are right it is being called every tick
Im not sure there is room for a valid check in this though
This is a weird way to handle input, have you referenced the example third person or first person BP projects to see how it's usually set up?
You can greatly simplify this logic to not have duplicated nodes
This is a 2D project so I started from blank
Well yes anyway the IsValid nodes can go right before the SetControlRotation nodes
That worked ty
And sorry I misread your graph, I see that you are rotating based on speed and not handling input directly so this is fine
Can you explain what th ewproblem was
The controller isn't valid for a few frames right when the character is created
It is possessed after the fact
Ahhh
Joining sessions is hard travel so you don't get the juicy seamless travel benefits, e.g. APlayerState::CopyProperties. Though loading a new map can be a seamless travel ofc, and you can use that function. More info here: https://wizardcell.com/unreal/persistent-data/
friends, I downloaded the source and compiled it. When I right click on the upproject, the switch does not show the unreal engine version, what could be the reasons?
Looking over the lyra project, there is one thing I don't understand about its setup. The experience manager will replicate the experience to the newly connected player and then the experience manager on the client will start to load the assets. Wouldn't you want to do all of that before having the client connect to the dedicated server session?
otherwise the client won't have everything loaded when they join the world and things could break right?
well "break" was poor way to state it, because that all depends on how you program the game, but it just seems odd I guess that they wouldn't load most assets upfront before the client actually calls join session
Hello. Thanks for your compendium, I learned a lot. But I have a question, just to be sure.
If my game is divided into several maps managed by independent dedicated servers, knowing that there is no notion of lobby in my game, seamless travel is impossible in this case, right? A seamless travel is only possible when the dedicated server travels via ServerTravel and brings the clients with it?
Are there different assets to load depending on the experience? Maybe the idea was to save memory, but not sure.
With the current state of the engine you're 100% right.
Would be interesting if it was possible, but probably not many would use it.
Although if it would be really nice for VR if connecting wasn't a hard travel.
But again, not the main target group of Unreal I suppose 😛
Their FAQs say that they would like to do it. But I don't think that will be done any time soon.
Epic would "like to do" a lot lets be fair 🤣
Thanks again Wizard. So I guess I'll have to save the general players' data (like their names or their customizations, the data they will have for each maps no matter which one they are on) into their GameInstance. But it makes me wonder about safety, can't they manipulate the data inside their GameInstances with Cheat Engine or so?
They absolutely can.
The one golden rule with multiplayer regarding authority is: Never trust a client.
Always validate
And if you read my compendium to the fullest you will change your mind probably and opt for Subsystems
If you want a cheat proof system you will need a backend system that keeps track of player's their data that can be dynamically saved and loaded from your dedicated servers whenever someone leaves/joins. Which is quite the hassle honestly.
Haha yeah. So in this case I'll probably need a super server above the game servers that knows everything about the players that are currently connected, since the game servers can't interact and share data with each others I guess
I mention the validation part at some point too
Game servers could share data directly with each other in theory. But I would say it's a really bad idea to have dedicated servers track player data and not some standalone system. Imagine if someone leaves your game then only the last dedicated server they connected to has their data.
If something then happens to that server you have a big problem.
True.
Net disconnections laughs at the corner
Not even just that. It's just a big big mess.
For example: How do you keep track of where the data is?
Backups are also going to be complete chaos.
On disconnects? It's always the server they were connected to.
But lets say you have multiple dedicated servers, how do you know where to connect to make sure that the data is there?
And what if that server is full?
Just soooo many scenarios.
Either that or "trust" the client and validate when they back
You can totally have persistent data be secure, but just don't store it directly on the server you host the dedicated server.
It should just be a separate system or database.
And that does make it a whole lot more complicated though.
The database part is kinda crucial I agree. That's how you validate at least.
Assuming we're still talking about the multiple dedicated servers stuff of course btw. If you're making the next Minecraft no one will care about something like this 😛
I haven't covered that one yet. It's notated as coming soon™️
xD
Wizard going to make a popular tutorial, then make one security mistake in there and ruin everyone's life 😂
❤️
I'm working on a backend for my game, how would I verify that their request is valid? I was thinking of adding a jwt to each item to match with but I'm not sure if thats a good solution.
I already have an API that does the authentication/authorization stuff with a dabatase, I'll extend it to keep track of the connected players' data (hopefully there is not that much data xD). Thanks again!
Yeah I'm repeating the ShooterGame scenario
Verify who's request? Also to be clear, I don't think asking security advice from some random people in a Discord is the best idea honestly.
What scenario?
Say a client sends a request to move an item from their stash to the player inventory. How do I verify that the item is valid/unaltered?
I don't know where else to ask, google has not been helpful with the keywords I've given it
By either storing it on your own backend and verifying they actually own that item or if stored / trusted by a client not being sure.
Like I said before, if you let a client decide whether or not they own something then you just can't be sure. Clients can't be trusted if you care about cheating.
I'm spawning a replicated actor but when I try to spawn it at a specific location (at the building's entrance) it won't spawn it for the client (spawned for the server and blocking me from passing but invisible). This issue only happens in packaged with a dedicated server, it does not occur with a 'play as client' in the editor.
Why ? : (
Spawning at other locations works fine, it's just sojmething wrong with that building entrance, any building, not just that one building.
lol
Can you show what you're doing? We can't really guess what the issue is 😛
what should I be showing? the spawnactor node? :(
again, it works in editor but not in packaged
But the client still has to reference the item to send a request, I just give them the unique id to the item and thats what they send to the server?
The relevant info, how you spawn it, actor settings for example 🙂
it's all correct I swear
I don't know what to do
Please tell me you're alright
dunno yet I injured my left eye xD
Something to identify the item yes. Whether that's a unique ID, an index or whatever is up to your game 🙂
might be a pirate soon 🏴☠️
😅
Epic should pay your healthcare fees
What is "InstantConfig" in the code there? Is it server side? Send by a client?
anyways in my case I'd have to use an onrep to add the pirate patch
the insta hit weapon configuration
But how can a client abuse that? I assume that's server side right?
thing is that the CDO default value in the config is 200
Nah multicast 🤙
and peeps didn't take the time to modify the default value probably due to lack of knowledge of what it meant
So for shooter game they properly initialised it but projects that cloned the game had a massive hit detection?
by clamping it programatically or with a meta you are ensuring the config cannot go beyond certain thresholds
no in shootergame is initialised badly
at 200
well yeah and lyra doesn't have any preemptivr measure
the followup is probably more interesting
I might implement the shooter game server shot validation to Lyra fire ability and share it
If I get the time to
a simple distance check to enable scalability might be sufficient depending the use case
Yaw check should be sufficient yeah
but if u need accurate detection then you need to do something similar to what valorant did
thats for direction
but you also need to ensure location
accounting for latency
thus thresholding
Might maybe do what Fortnite do, they do another line trace on server to ensure nothing blocked the hit again (a newly spawned wall or someone using magic bullet I guess?)
And yaw if I’m not wrong?
At least that’s what kaos said a few months ago
Oh ok
Anyway, this is the next thing I need to work on, so I might share a few snippet on it when I’ve done it 👍
Well i took a few concepts from him so if you got any questions
One thing to keep in mind with this btw is that you need to give a bit of leniency with this 😛
well.. by "took" i meant inspired x)
I've worked with him on it a bit 😄
thats why leeway is considered
I mean using the bounding box is already enough leniency I would say xD
But if you were to ever make this hitbox specific it would definitely give issues.
Oh so you can maybeeeee help me rn ?
did you work on the weapons ?
i got the same logic, but i'm stuck on smth atm
I havent worked on his weapon code directly just on tiny details
but I cannot read that long text rn
im in the hospital
x'D
argh, didnt know sry
it will but look at valorant 😄
i would not asked if i knew x)
I never played it honestly. Not sure how well/bad that game works.
my example is a hello world
since we are using bounding boxes and an interpolation method
u probably dont need tolerances
the conflicting data resides between timestamps
also, in valorant it works great
and they dont do it based on bounding boxes
they do it based of bones
😄
Do you know how fortnite disable animations on server side ? I mean the whole anim instance
its by default
So it's not specific to them ?
As everyone say
I mean it's not smth they implemented for their game.
no its not specific to them, its a setting in the skel mesh
u can run simulations on montages
or u can run it always
You know its name ?
it's an enum in the skel mesh i believe
I wanna look at how it works in the source code
not by memory
ok ok i'll search by myself
Fortnite supposedly doesn't even use a custom engine version btw.
They do - in that it is ahead of what we have
they do
It's 100% confirmed that they don't
by a dev here
i'll search for the message wait a min
They would be on like, 5.2 while we're on 5.1, for example.
Yeah but it's not a custom engine
Plus of course, they have their own tools they wrote
Having it before others is still not a custom engine version in my eyes though.
Like features exclusive to them
they just test things on Fortnite before we get them
Fortnite is like a test field
if that's what you mean
Is probably the one you mean.
yes, but they do have things they wont release as its too much game-code
Next Unreal version: Set up your own Fortnite 😛
There's no fortnite version of unreal because unreal is made to support fortnite lol
I mean I really don't mind, at least they use their own product all the time.
Hey, is there a way to 'set owner no see' a light component?
Question that I assume it's been asked a million times before: What's the workaround to run a server RPC from a non-owned actor, eg: wanna destroy a crate from an action chosen by my player, and the code runs on this actor
this in C++ mind you
// Crate.cpp which extends from InteractableAssetBase
Actions.Add({
FText::FromString("Destroy Crate"),
[&](ACppProjectCharacter* player, AActor* item)
{
AInteractableAssetBase* itemActor = Cast<AInteractableAssetBase>(item);
itemActor->SetOwner(player); // Note I tried this as a little hack I saw on the forums, didn't work
itemActor->DestroyThisActor();
},
[&](ACppProjectCharacter* player, AActor* item)
{
ACrate* itemActor = Cast<ACrate>(item);
return itemActor->IsCrateEmpty;
},
});
// InteractableAssetBase.cpp
void AInteractableAssetBase::DestroyThisActor() {
DestroyItself();
}
void AInteractableAssetBase::DestroyItself_Implementation() {
Destroy(); // Doesn't run of course
}
RPC from the character or player controller, then let the server-side call further functions on that object
That's what I thought, but then that means I have to make every single RPC call I want from a specific actor or actors to be re-routed through the player controller then back to the actor?
wouldn't that just get messy?
dozens or hundreds of functions from other actors in the player C++ file?
I would've thought there would be some sort of workaround
the workaround is that your design shouldn't lend itself to hundreds of functions like that
for example, a generic "Interact" function on the player controller and pass in some identifier for what option of the menu was selected
maybe that's an option index, maybe it's an FName that specifies which option was selected. On the server you just pass that along to the object you're interacting with and let it decide what to do.
can I pass lambda functions on an RPC call?
no
Again, just have a generic "menu was interacted with" function, pass the object and what option was selected.
server should validate that the player is allowed to interact with that object and then pass the information along
I'm spawning a replicated actor and in the editor on 'play as client' it works great, but on packaged with a dedicated server the actor won't spawn on the client (invisible but has collision)
#multiplayer message
Hello once again. A quick doubt, as my game is online, keeping important information in the Game Instance isn't really good, is it? I mean, it doesn't communicate between sessions, does it? I'm considering leave important player information on the player character instead. Then I just need to load the information between sessions.
game instance should persist between sessions. you can think of game instance as the program itself. it exists when the game launches and is destroyed when the game is exited. if this data is supposed to persist then it could make sense
Depends how important the information is too, what type of info, if you trust the client with it
