#multiplayer
1 messages Β· Page 104 of 1
HandleStartingNewPlayer is best place to put spawn logic in
Hum, cause I wanted the client to spawn it locally (so no lag at all) then be able to to move it as he wants while still being replicated to others but not to the player
it works both for hard and seamless travel
you have to RPC every client local change to server if you want other clients to see it
there is no way around that
except starting from FScoket and implementing p2p
bypassing unreal's replication system entirely
Ok it's clear then I'll simply go with a replicated actor and move that actor, would be way easier, but I loose the cool thing to not have any delay while the player moves the actor, anyway thank you for your help π
you can predict it
Sounds interesting
you can spawn the actor locally, then have the replicated one replace it
when it arrives
as long as local PC is the owner of the Actor on server, Actor will be able to RPC its own stuff
Yeah thats what I tried, but I ended up having a local variable holding the local spawned actor, and another var set as replicated that hold the actor spawned on the server, but the problem is that since this actor is marked as Replicates, then the client was able to see it also
you can try to cheat if you don't mind a minor performance impact
base that Actor on Character, use CMC with client Auth movement
that bit is easy
basically
you Spawn Actor A on client, RPC to Server to spawn Actor A1
server sets the owner of A1 to PlayerController that requested the spawn
when A1 calls PostNetInit ideally, BeginPlay is also kinda fine, it checks if its Owner is a PlayerController and if that PC is locally controlled
then it contacts the PC "hey, replicated version of me arrived", PC destroys A, replaces A references with A1 refereces and pretends its the same Actor instance
(doable from BP, with BeginPlay)
Has anyone recently attempted to remove "lobby" widgets from clients when the host initiates a ServerTravel()? Any call to removing a lobby screen widget seems to break the clients player controllers that are attached to the in-game pawn
Oh yeah I got it, I'll try that, do I need to keep the actor marked as Replicates right ?
A1 yes, A doesn't matter
you can have it as replicated by default, it won't do any harm
Ok, then, make sense, thank yu so much, can't wait to test it !
alternatively
you can have A1 cache the reference to PC that requested it
also set the owner
then use OnlyOwnerSee/NoOwnerSee
the approach used for FPS/TPS meshes in a FPS game
but client will end up having 2 actors, only one will be hidden
i find approach #1 more elegant
use APlayerController::PreClientTravel
Yeha me too, especially for this project I think it don't requires it
@winged badger Thanks anyway, you are the kind of guy who really makes the unreal community greater, really appreciated.
if a have a cooldown float going down each each frame on tick, it should happen both in the server version and client version right?
yes
Tick will execute on both
i have this snipet of code inside "tick"
but if check them inside a server RPC they are never 0
ugh, those should be subobjects
no no, thats just in child class
its a hero shooter so i have a base class for the heroes
and then all heroes are child classes
that doesn't look like it should compile
why?
server RPCs don't like non const& structs in their payloads
or any RPCs for that matter
odd
anyways, thats not why i am here xD
and if you break that
why the heck is my server var not going down
does it run?
yes
and when you break the tick after you hit the server RPC breakpoint?
you want me to put a break in the rpc and the tick?
note that you'll be hitting tick break on both client and server here
you should hit it immediately after continuing
i only see the 0 value
yep thats what i was assuming too
i was also assuming that i would see a 0 and a 6 in the values
F10 your way past the line where the value is assigned in the RPC
verify its 6 in locals
then right click on the variable in locals and select Break when this value changes from the menu
then continue
if has to hit the data breakpoint
but RPC did break?
if i put the break point on it, it will break
i removed them to see if it would break on its own with the "break on value change" thing
im just trying to make a server check on the cooldowns so players dont cheat
NVM im a retard, i was checking the wrong variable
how would I show a dedicated server in a server list?
u can create a session on ur begin play
in ur game instance for example
and then steam is gonna pick it up
if ur not using steam or a subsystem in general ur gonna have to implement ur own solution and talk with a master server somehow
GI doesn't have BeginPlay
you need to configure the DS startup map, use GameMode BeginPlay
ye its not begin play its "Init"
Works like a charm, thanks!
before i shoot myself in the foot
is it a good idea to set cooldowns both in the server and client and hope they are synced enough to not interfere with gameplay?
Generally speaking, yes. You at least want the Server to have authority over a cooldown.
Otherwise Clients could potentially just cheat it.
ye thats why im giving it authority
i was just wondering if it was a good thing to do
If you arent making some hyper competitive shooter or something, desync on the Client side should be fine.
basicly i have a "callSpell" function that will set the client cooldown and call the RPC, in the RPC i check the cooldown and set the server cooldown
well, it is a competitive shooter....
Then maybe you need to be concerned about it being synced.
i will see how it goes in playtest
and go from there
i didnt want to replicate cooldowns cause the var update is a bit choppy, so i would need to make dummy variables
so it wouldnt look bad
If you have a synced clock you can always send the timestamp and adjust the Cooldown to account for some latency.
i will keep this in mind
If you are using GAS i believe cooldowns are pretty well managed for you.
im not using gas
i've been on this project for like 3 years
gas wasnt a thing when i started
Yes I more meant available to the public
It has been.
π
It just wasn't all that well documented
well i wasnt aware of it when i started
i think
and even if i was i probably thought it would be overkill
iirc they don't as they started on valorant too early. They did build something similar.
I'd have to dig up where they said that though
ah, found it - https://www.youtube.com/watch?v=GO6MIboHDiY&t=4053s
I can't replicate attach. SpawnActor it's replicated because if i put another location i'll see it
How did you find that?
by knowing about that video already?
Ah fair
I forgot like... A lot of stuff I watch, or if I don't forget it, I forget the video it's from
I tried this too and nothing happen
How server hosting works? I have currently hosted my own dedicated server locally with port forwarding. But I would like to upload my server to some cloud service. I have zero experience of that.
Hi, Any member of FFastArraySerializerItem is serialized ?
If your serializeritem overrides NetSerialze then no.
Otherwise any UPROPERTY member will be automatically serialized.
If you override NetSerialize you must serialize each member you need manually.
Mhh ok thanks ! Will try to understand how they did with mass
Attach actor return me false on sv but true on client
Is there any sort of event or OnRep to know when a runtime spawned component has replicated to a client?
I'm considering adding an event to the owning actor and having runtime spawned components broadcast through that event during BeginPlay if they are on the client. This has a code smell to me though.
I'm using the GameFeature plugin from Lyra to runtime spawn some components, but now I client UMG widgets to initialize based on the state of the replicated component.
this article is pretty old now but might be useful
void AActor::OnSubobjectCreatedFromReplication(UObject *NewSubobject)
why isnt this replicating
Get rid of all that Multicast event. Set a replicated bool from the Server event, use an OnRep callback to set the visibility
thanks !
Hi, I'm having a slight issue with my decal spawning, it mostly works however clients don't see the decals that are spawned on walls but everything else is replicated properly.. I suspect its the rotation not replicating properly, any ideas how i can get it to replicate the rotation correctly?
Why would decals be replicated at all?
Decals are visual effects and should generally be spawned locally. Also on a dedicated server, particles don't exist.
I spawn a replicated actor using multicast. On the creation i pass some variables to it. Why is it, that on the server these values are set correct, but on the client they have the default values, unless i turn on replication for those variables? I didnt expect that replication would be needed for those variables, since i create it on client with the same values
I know that usually visual stuff doesn't need to be replicated and im not even entirely sure exactly how mine are replicating cause im not doing any RPC's for the decal spawning, however regardless of them being replicated or not, clients still dont see decals spawn on walls
You shouldn't spawn a replicated actor from a multicast at all. The server should spawn it.
Presumably you've marked the Blueprint as replicated - but if you haven't, then the decals aren't replicating at all.
But even if you do mark them replicated, nothing about decal actors is actually replicated by default.
So you'll have a decal actor with a position and orientation but nothing else.
1-i have random anim montages for 1 movement like slide in the video. when one of them plays anim1 other one can see anim2 sometimes. Both gets random anims
2- idk why they teleport sometimes
Okay so maybe im doing this whole thing wrong.. if i dont have the decal actor replicated then the clients dont see them spawn at all, i imagine thats because im doing the IsServer check when getting the collision data from the particle system, however if i dont do the IsServer check then the client see's like double the amount of decals spawning compared to the server player which isn't ideal
How should i be setting this up so decals spawn, doesn't matter if they're in the same location for everyone, but they are able to spawn on all surfaces?
The TL;DR is none of this should be replicated or care about networking at all. That Server check shouldn't be there and it implies something else is going wrong
EventReceiveParticleData would only ever be called locally
Start by disabling replication of the decal actor completely, and removing the IsServer check. 'BloodSpurt' shouldn't be replicated either.
Niagara/Particle Components don't have any network functionality
Ahhh nice one that's done it, I think it was BP_BloodSpurt still causing the issue with it also being replicated, now ive removed it on all of them its working properly, thanks mate!
ok 1 cause to 2 happen π
ahh i see. Could you please explain something? I saw network corrections in some tutorial: As i understand they happen when some local actor falls out of sync with the server version
- If i spawn a replicated actor on the server, it means that i dont have the local version on the client - only the replication, so there wont be any network corrections, right?
- I thought that if i multicast a replicated version, i would receive a local and server copy, and the server would apply corrections to the local if it goes out of sync.
- In general i am trying to figure out the best way to deal with projectiles - do i just multicast an unreplicated version. Because spawning a replicated version on the server seems to create jerky effect
If you spawn a replicated actor on the server, clients will create a copy of that actor locally when they receive it and replicated properties will be sent from the server version to the client version. If you spawn via a multicast, you will have two actors on the clients. One will be the Servers' replicated one, other other will be an extra one you spawn locally that the server has no idea about.
RE projectiles, hard to say. If you are spawning it as a replicated actor, with replicated movement, and the client also simulates movement locally, then most of the time it should be "fairly" smooth - but it won't be perfect.
The problem is that if a client spawns an actor locally, the server has no idea about it, so it can't do anything to/with it
Thanks for the explanation! I think i get it now!
If this is Steam, it's because doesn't report ping to lobby sessions.
At least, Epic's default implementation of it doesn't, you have to do it yourself in code.
oof
This is perfect!
Any help?
How to test if an event is too heavy on bandwidth or CPU π€
Use the netprofiler to check bandwidth and unreal insights or session frontend to check CPU
jesus i just spent forever on a crazy bug, it seems that if you have a replicated actor with a child actor component and the child class is not replicated, the child blueprint will execute as both server and client and furthermore when it executes the "has authority" node will give both the server and the client authority
with a child actor component
Gross
is it ok to check things like islocallycontrolled or has authority in beginplay or is there a better place?
Yes
You check where it is needed for the logic following
I think on rep only runs on clients, but not 100%
so from my understanding, you are setting the item to attach as a replicated variable, and then that is running onrep on all the clients, the server never runs the attach event. I think
I dont really know what is required to do this as ive not tried to attach anything like this yet. But what I can say is that before you were only attaching on clients and now you are only attaching on server.
OnRep calls on everyone (that have an instance of the actor) however the attach should be replicated
Bigger questions are: Is that actor replicated and where is the RPC in?
I found the issue
Player was not valid
Idk why
Because a made a initialization function who is called on bp_maincharacter beginplay
I sinned and fiddled with one today 
There is better, use notifyrestarted
And if you're a blueprint guy, there is oncontrollerchanged i guess
if I play the game with two clients, both are forced to look at the right or left, no one is looking straight forward.
is it possible to fix it
only the head is rotating by itself π
if antoher client has a rep notified list of worn items, how do i retrieve them
they are set to a structure variable
I was not taking into account that this is blueprints, I heard that repnotify in blueprints actually does run on the server aswell but in c++ it only runs on clients ?
That is correct
@latent heart
how do i RPC scene capture
Hello, I'm trying to replicate my UObject, but for some reason it doesn't call the OnRep whenever I change the value server-side. I'm following this https://jambax.co.uk/replicating-uobjects/, but it still doesn't work.
My UObject that I want to replicate:
Header: https://pastebin.com/ajCvkJC8
Source: https://pastebin.com/ttULH3Qc
The actor owning the UObject is the PlayerState:
Header: https://pastebin.com/qk9nWsQKr
Source: https://pastebin.com/9PQDzwQr
I call the AMTD_PlayerState ::SetHero() client-side, and it gets there, but the OnRep is only called server-side because I do it myself to run the same logic server-side as well.
Does anyone know why it may not be replicating the object?
EDIT: AActor::ReplicateSubobjects() says the following:
/**
* Method that allows an actor to replicate subobjects on its actor channel.
* Must return true if any data was serialized into the bunch.
* This method is used only when bReplicateUsingRegisteredSubObjectList is false.
* Otherwise this function is not called and only the ReplicatedSubObjects list is used.
*/
Hence it requires bReplicateUsingRegisteredSubObjectList to be set to true.
When you have ClientAuthorativePosition=true does anyone know which part of the character movement component actually sets the location of the simulated clients on the listen server?
each player has a rep notified structure variable that contains what items they are wearing, what they equip or unequip is replicated but i need to retrieve another clients scene capture from their inventory and also replicate the equipped and unequipped items there too
You want to replicate a picture of what items somebody has in their inventory?
or get their rep notified item array and attach it to the default scene capture every player has
honestly whatevers easier
Why are you using a scene capture?
to show equipped items when you open a players inventory
owning player already has it set up
idk how to retrieve other clients
is this in kilo bits or kilo bytes?
is it easier for me to just get a rep notified array of worn items from another client and equip them to the player in scene capture component? cause i have that rpc'd already
Upper case b stands for Byte, while lower case is Bit
if i use this "Get Game Time Since Creation" then for multiplayer game, everyone will have same time?
or i need put this time to replicated float?
Why player return me not valid?
The "Set" of your Player variable in "Initialization" is not the same variable as the one you're accessing in OnRepItemToAttach. Are you setting the Player variable in the blueprint that has OnRepItemToAttach?
It's the same
The second picture
It's replicated because it was an attempt to make it work
Hey everyone, this might be a silly question but I am fairly new to multiplayer systems and don't know much about cheating.
If I store variables on a blueprint actor, is that something that a cheating player could access and modify the variables on their client?
Opposite to this, if I store those same variables on the server instead and call them from the bp actor, could they still modify the values?
How OnRep is supposed to work? I'm trying to replicate a UObject, but client-side the OnRep is called twice. The first time the argument is not nullptr (it has the old object value), while the replicated object is nullptr, and the second time it's vice-versa -- the argument is nullptr, and the object is valid, and has the server value.
Should it be working this way or I'm getting it wrong?
ClientNetSendMoveDeltaTime is only the tick rate for each human player in a game right? No AI characters replicating down will be affected?
HEllo guys I have question I cant solve one of my problems even I am debugging It, I have function which is called when I crash or my plane is killed it is called via ma controller and then its called to my game mode , it is working perfectly always just when I die with someone else at same time just one of us is respawned, in all other cases its working good,any ideas ?
and its called from my pawn
What are other methods of voice chat, that work on dedicated server beside EOS?
Vivox
My FFastArraySerializer subclass's void PostReplicatedAdd(const TArrayView<int32> AddedIndices, int32 FinalSize); isn't being called, I don't know where to start debugging π
An item is added to the array, MarkItemDirty is called on the item.
@faint parcel Does your FastArray ::NetDeltaSerialize function call FFastArraySerializer::FastArrayDeltaSerialize?
Are there any free solutions?
You helped me look in the right place.
I was missing this:
template<>
struct TStructOpsTypeTraits<FInventoryArray> : public TStructOpsTypeTraitsBase2<FInventoryArray>
{
enum { WithNetDeltaSerializer = true };
};
Don't know how it works but it looks like it enables NetDeltaSerializer. How does it do it?
Also, I don't see it upgraded to UE5 https://www.unrealengine.com/marketplace/en-US/product/d4d29cc6d06f484b9e02caa32b1acf8f
Nvm. they said its deprecated
ODIN is free I believe
Ive integrated it before.
Its pretty good.
Lacks some features.
I havent used it in a while.
So that might have changed.
Ty, I will take a look for sure
It does it by magic.
It seems like it has both purchase and free version
Yeah well you are unlikely to find an entirely free VC solution that has everything you want.
Say I want to have a rank system in my Listen server hosted game but dont want people to be able to print wins, is there some way to create a "consensus" between players to validate a match's results?
Or does steam have a built in system for this?
No sensible way really.
Each instance could report the game and you could just accept the majority or w/e
To some backend server that is.
But for ranking stuff, you really should plan for dedicated servers.
Not a single soul likes ranking systems and it not being on a dedicated server.
Yeah that's understandable but a lot of old games without dedicated had some sort of rank system I'm wondering how that worked
Very shittily
Maybe they just said fuck it who cares if people cheat lol
Thats more the case yeah.
You have to remember to that older games would have had such a small percentage of people that would have even known or cared about cheating
Than todays games do
Yeah that's true
You don't want to have this event marked as Run On Server otherwise a client will be able to call it and feed it whatever data they want and at any time (if they're manipulating their client)
Your issue is because you're using the game mode event and a delay. When you trigger the event there is only ever 1 copy of it running, so the next time the event is called, the data from the previous one is no longer present so when the delay does finally finish, it's reading the second one's data. Perhaps it would be best to delay in the player controller before calling your respawn event in the game mode.
Has anyone had issues with clients (sometimes) not connecting to host when using FindSessionById(), then calling JoinSession() after the completion delegate passes? It seems to be inconsistent where sometimes the client joins host without issue, and other times the client gets a Timed out connection error.
Even JoinSession() will return back true but the client will still time out. Thought this method approach would be the ideal way for clients to connect along with their host, but it seems something wrong is amidst
I'm on UE5.1.1 if that matters
Is it possible to have a component set the rep condition COND_OwnerOnly on itself? I'm using GameFeatures to spawn components on actors, and you can't set LifetimeReplicatedProps on those types of components.
component replication isn't controlled by LifetimeReplicatedProps. At best that controls the replication of a reference to a component, but not the object itself.
You can either call AActor::SetReplicatedComponentCondition or override UActorComponent::GetReplicationCondition on the component itself.
Oh really? Wow I misunderstood how that worked. Thanks for the clarification!
How does that work for structs (IE Fast Arrays) or non-component UObjects?
structs aren't components
and UObjects aren't replicated via properties referencing them, period
they're replicated via either the ReplicateSubobjects method on an actor or the newer replicated subobject list (also on actors).
Thanks for the clarification!
Actors aren't guaranteed to replicate to all relevant connections at once right?
Is there a way to make sure a property gets replicated to all connections at the same time?
there are zero guarantees possible about when something will be replicated
There is no way to guarantee they will arrive at the same time.
even if you managed to get unreal to send a change out at the same time you can't guarantee anything about when someone would receive it anyway
Figured
Trying to think of a way to replicate something viably
I have states that may succeed each other
Or just like run super fast on the server
Which means with normal property replication that the client might never know about it
Trying to figure out a way to replicate those reliably without using RPCs
Because some those do need to run on the client heh
Open level is totally a client action, right? If it is the server, something I remember is like you need to move the whole session to a new location(level) and bring clients to it.
For anyone interested in testing Gamelift Anywhere, I've created a script that automates the process of connecting a local server to AWS Fleet. You can find the script on my GitHub repository:
https://github.com/zorigoo0128/GameliftAnywhereManager.git
Open Level can be executed on the server, but it'll disconnect all clients in the process. ServerTravel will bring along clients with the server.
Yeah, that's it. Usually you don't want to open level on server, if your client quit the session, sure, just open level on your client side.
delay is there because of respawn Time every time I die I will respawn after +2 sec
so how to fix it I don't fully understand sorry , when I was debugging yea spawn in game mode was called only once
Exactly. There is only one game mode and you're trying to execute a delay on it twice from the same event. You cant do that if you want a delay for each player as the delay prevents the execution of the first player spawning and then when you call that event again the data from the first player that is stored in the event is overridden by the second call of the event for the second player.
If you want to delay per player, then make the delay in their controller, and when that delay is finished you can call into your game mode if so desired to spawn them.
What kind of network emulation settings do you guys consider βrealisticβ to test for. For example, my custom root motion stuff works great at 200ms but at 1% packet loss on top of that I will occasionally get net corrections or doubling of certain moves. Is this normal or should things still be running smoothly? At what % packet loss and how much latency should I be able to play without net corrections
Imo, package loss is redundant to fix. You can check if your game collapses due to it but despite that you can ignore it
200ms is most likely the upper limit. 100 to 150 is already enough though.
Everyone with that or a higher ping won't be enjoying the game anyway :D
They should consider change the physical server area or check their network condition.
I won't complain any weird things happened if I've got 200ms lag.
Yeah I figured above 200 probably wasnβt really worth designing around, but wasnβt really sure with packet loss as I donβt know how much packet loss the average player has
Noob dev. Can't even fix 500ms ping. It's just half a second bro. Ai could fix it.
ChatGPT how do I fix 500ms lag???
You should check how google fix it for stadia using negative latency tech
Which I don't understand how
I recall enough games for a while actually kicked you
If you had a high ping for too long
Wonder if that practice is still a thing
i get it there is only one game mode so it also wont work when I Will play with my friend joined my dedicated server ye?
i think I get your answer
thanks"
how do i rpc a scene capture
log says like this when openning the packaged server. I don't understand what it means
Is it possible to make a RPC non-sequential, or property replicate from client to server. I need to update positional information in a system where the client is trusted? (The data is positional information from an assisted outside-in tracking solution for a proprietary VR setup)
What is a non-sequential RPC?
@sinful tree it fixed my problem! thanks I did not realize that this is problem
hi! i have another question about replication. I spawn a replicated actor on the server with replicate_movement=true. It moves based on tick. When i change the movement speed for it on the client (switch_has_authority=remote) i expected it to be laggy due to network corrections (p.NetShowCorrections 1), but in reality the server and client versions just go out of sync with no corrections.
When i try the same in clean 3rd person template for 3rd person character (changing max walk speed locally), i see the server corrections.
Do there corrections happen out of the box only for character/projectile movement components?
Sublevel set visible also should be done from server to multicast ?
Usually you don't replicate movement
By default RPC is sequential, but I need it to function like UDP datagram- the messages should be processed when they arive, not sequentially :)
Not sure if this is a property of Unreliable?
no one knows how to replicate a scene capture eh
It's not. If an unreliable arrives at all, it's still processed in call-order. Nothing you can do about that
Not really sure why the sequence matters, you can send Unreliables to the Server from a Client without problems. Not sure why you would want them to be called out-of-sequence...
This is happening in gameInstance
And this game mode
Should I put delay to beginplay so server would be created first? Or should I put create advanced session to game mode?
Or is this okay?
It's a bit of a special case, but we have a lot of user on the same wireless network- so package drop is high and synchronisation does not help.
As Jambax stated, I guess making them unreliable is only optimization, with vanilla engine at least, you can have here
You don't make any difference on sequence part, but at least you don't need to force the packets to arrive since there will be another update sooner or later
If net mode is guaranteed to set on the GameInstance::Init (I'm not sure if it is or not) I don't see any problem here unless you need to save file part to work exactly after session is creation. If you need to though, then I would put the save file part on the OnSuccess pin of CreateSession node, whether they all be on GameMode or GameInstance
Does create advanced session work properly in game mode? and save stuff basicly loades all player made buildings and players data so I think sessions should always be created before?
i am looking at my server, i see it listening on tcp ports and udp, should i open up all these ports?
Just mark them unreliable. That should be enough. You can't force RPC's to execute out of sequence either way.
Unreliables will not be resent anyway
They're either received and processed or they aren't
It can work from anywhere as far as I know
Also if you're not working with listen server and have a different logic for that, you don't need to check if you're on dedicated server for GameMode
GameMode won't exist on any other machines executables anyway
I am creating Rust like game so only dedicated servers
If I want to keep create session on instance init. Would it be okay if I cast to gamemode and call custom beginplay event from success?
If you mean a custom function/event by custom beginplay event, sure that would be fine as well
i see. But what about network corrections, when does it kick it? Lets say i have an actor out of sync, can i somehow force it to be corrected? And why doesnt it happen automatically only for 3rd person character for example?
I think the second answer you're looking for (why Character makes it automatically) is because CharacterMovementComponent, that should be the one handles validness and corrections for the movement
does advanced sessions work rn on 5.1.1
Working on me atleast!
so you have to working not using lan?
I have working dedicated server and it works. I can even see my server on steam public server browser
.
In this quick reference guide I explain how to get Steam Dedicated Servers working with Unreal Engine 5.
Join my discord for additional support: https://discord.gg/qassP7Y
Here are the important bits you need to know that I talked about:
AdvancedSessions Plugin: https://vreue4.com/advanced-sessions-binaries
UnrealEngine Source Releases: https:...
Where is the correct place to populate GameState properties that resides in the GameInstance on map load?
It need to be replicated before client pawn spawn, and set before server pawn spawns.
Is InitGame too early?
Earliest possible place is AGameMode::InitGameState, or you can just override gamestates PostInit / PreInit functions
Zero garauntee it'll replicate before the client pawn is received
Is InitGameState before or after InitGame?
Don't know, InitGameState is called from PreInitComponents
Think that's before
You have no garauntee the gamestate will be valid when your pawn is received on a client though either way
Replication order between actors is never garaunteed
How is default map classes replicated then?
Right, but it's a property on the GameState
Unfortunately on the Server, that's before InitGameState. Utter genius design from Epic
The only thing you do know for certain is that BeginPlay() isn't called until the Game State is received
But I don't like initialization in BeginPlay so π€·
Yeah, I don't ether.
But InitGameState + OnRep seems to solve my issue :)
Thanks
hello, other than opening up udp/7777 should i open the tcp port that my server seems to be listening on?
Depends on the online subsystem you're using.
If using NULL then just the port you're listening on is fine.
I am using redpoints eos plugin
I don't know about EOS. Maybe the docs list other ports?
oh i was just asking here as i had been reading and i saw the server listening on tcp ports
you might want to ask the #epic-online-services channel
vivox is deprecated?
if (GetRemoteRole() == ROLE_AutonomousProxy) Can never be anything but human players right?
As in can't be AI controlled characters
how can I make my 1st person character have a visual representation for other players like a 3rd person character?
I've got one humdinger of a replication problem here. Preface: UE 5.2 BLUEPRINT PROJECT (except for an extended character movement component). I suspect the answer will be "swap to C++", but that's no obstacle.
Players pick up and put down objects in this game, which are physics-enabled on the server (yeah I know.) The replication of object parenting and referencing works flawlessly, this is a purely visual bug.
When a client player "drops" an item (which clears its ownership and detaches it from the actor, no other network related effects) sometimes a bug will occur where, on the LOCAL CLIENT ONLY, the object snaps back to it's original position it had before being picked up. From that position any local effects will be applied to it, such as force impulses. After the client receives fresh data from the server, the item will "snap" to where it should be and play continues without issue. Note that on the server, everything looks fine - the player releases the item without issue from where they are standing.
This bug is not consistent. I can pick up-drop items for 60 seconds straight without the bug happening, and then it will occur again.
I've tried Net Relevancy, Net Dormancy, disabling Replicate Movement on the client on pickup, on drop, everything in between, and nothing will fix it. It happens on 500ms ping, 250, 50, editor-launched windows, packaged builds, everything.
Anyone have any ideas?
Sounds to me like the client is changing the attachment state locally. They then receive an interim update from the server, so it snaps back.
The Server is the one which should manage attachments and whether physics is enabled or not. That info will replicate to clients automatically so long as replicates movement is enabled.
Interesting, I wonder why that update would cause it to snap to the position it had before being picked up?
Because the client is manipulating something locally that is server-controlled
They get an interim update from the Server, which breaks the client-predicted change, then a short time later it resolves
The server does the item attachment as well, like I mentioned the server has the object where it "should" be the entire time
All attachment/physics should be set by server, client shouldn't do anything
Just attach/replicate and make sure Replicates Movement is checked on the object.
I can't say for certain, but it sounds to me like the client is changing it as well
When a client player "drops" an item (which clears its ownership and detaches it from the actor, no other network related effects) - to me this reads as the client detaching it, not the client telling the server they've dropped it, and the server detatching it
It happens on both, the client runs the "drop item" for local responsiveness and the server does it when it gets the RPC
That's why it breaks
You drop it locally, you receive an interim packet from the server which reattaches it breifly, the server receives the RPC, sends the new update which then detaches it again
Higher latency will make it more noticeable
So I should do the local item drop with a dummy item for responsiveness
Don't do it at all IMO
If anyone is playing the game with 500ms lag and complaining about responsiveness that's their problem
That's somewhat my thought process as well
Interesting
I still don't get why the server's interim packet causes the item to go to the pre-pickup position, but I'll give it a shot
Why pre-pickup IDK, but it just sounds like server/client fighting over stuff overall
That's what I thought it was as well
Am I incorrect in assuming that disabling Replicate Movement on a client tells the object to stop listening to updates from the server?
Meh.. it's complicated. Replicate Movement is itself a replicated property, so realistically it shouldn't be modified by a client. If you disable it, the client will not do anything when it receives non-attached replicated movement, but it DOES apply attachment replication.
Server is still sending updates regardless
The real problem however, is when you enable it again, the client won't update to whatever last replicated movement state was replicated, so that client will be out of sync.
Until it moves again on the Server, that is
if you were in C++ you could apply it, since you still have the data - but not in BP
That makes sense. I think what tripped me up was the separation between attachment state replication and movement replication. Makes a lot more sense now, thank you
To my knowledge, and with a bit of looking around in Cedric's guide and the Unreal source I only see it being used for actual players yeah. Not AI. I also wouldn't quite see why AI needs it anyway as it can never be directly controlled by anything else than the server if we are talking replicated pawns.
Sure you can influence decisions it makes through RPCs but ultimately the behaviour tree and all that stuff are not available on the client π
I believe the common way is to have two (skeletal) meshes. One for first person and one for third person. The ones you don't need you can just make invisible locally on a device. So for the character you're controlling you can just hide the 'third person mesh' and and for other clients you hide the 'first person' mesh. Not exactly the most clean thing but whatever I guess. You can if you're really worried about the components existing just dynamically add / remove the components as well.
Maybe that you can also use a single component (assuming both your first person and third person meshes are for example skeletal meshes) and just locally change the mesh on it but I'm not quite sure how well that works I'll have to say.
Thanks! It's more for movement interpolation stuff, I want to make sure only clients are interpolating and these changes won't affect server controlled characters
That would make sense yea
Tho yeah idk changing the mesh hmmm
The biggest problem that popped up in my head with only having a single component is when you're for example using a listen server. Maybe your game in specific requires hitboxes for your character, then you get the problem that the listen server doesn't have a 'third person' mesh any more and then things can definitely get messy.
Maybe that in specific doesn't matter. Not sure, but then again I don't know your game. I listed it anyway π
Depends on a lot of stuff, but it mostly boils down to detecting whether you're the local character or not (is locally controlled), and changing stuff based on that
swapping out meshes, making 1 mesh visible, 1 not, whatever
how do i rpc a scene capture
no info on the internet
im leaning towards getting item info struct of equipped items on a player i click on
and showing those on the scene capture player mesh
I'm not exactly sure what you're trying to do. But I don't think you would RPC that.
You'd RPC what it is you wanted to screen capture
just replicate it in general
you don't rpc the scene capture
you rpc the data required to do the scene capture
ok since my equipped and unequipped items are rpc'd
they should be replicated but yeah
can i line trace on a client or something and get theyre equipped items?
sure
is that possible with one click?
line trace -> hit a character? -> get their items
assuming their items are replicated data then sure they'll be there
ok cool,
im pretty overwhelmed with this task cause idk to what extent it will work without a server
if they're not replicated data it'd be more like:
line trace -> hit a character? -> hey mr server, i'd like to see this characters items plz (this is an rpc)
later........
OK client, here's the items you wanted to see (this is an rpc) -> ???? -> profit
how are you doing multiplayer without a server?
just using 2 clients in editor
so whatever is happening with 2 clients in editor is the equivalent to a real server?
are you launching the play in editor session as multiplayer with 2 clients?
yea
then yeah there's a server in the background they are connecting to
if i dont use run as server but i use 2 clients instead. is that still a server or no
show your PIE settings
you're either running as multiplayer with the 2 clients connecting to a background server or you're just launching 2 instances of the game which are each effectively single player, depends on how much you fucked with the settings lol
yeah that's doing server, client, client
phew
both clients connected to server
i mean can you see the other character running around?
it is
basically you pretty much have 4 modes a game can be in
standalone (local player, not open for connections)
listen server (local player, open for connections)
dedicated server (no local player, open for connections)
client (connected to listen or dedicated)
oh ok thanks
speaking on that line trace method mentioned above, i know this isnt the right channel to ask but im in top down game mode with one universal camera for all players and i was curious what location settings apply to that situation for the line trace
nevermind, i think i can just use get hit result under cursor node instead
well the hitbox (capsule component) remains the same
so I guess I need two meshes? But now what about animations, when I want to play a montage, do I do "if IsLocallyControlled() -> Play First Person Montage else PlayThirdPersonMontage?"
As in plenty of games use hitboxes specific to their character. In for example shooter games it's a pretty common thing to do. But besides that they still have the capsule purely for movement based collisions.
oooooh so that's how I can get accurate hitboxes
To my knowledge that's the most common way games do it yeah. I believe all they do is attach colliders to their characters. So if you for example want your arms to have collision you can attach a capsule collider to something that moves along with the arm, which often are the bones of a skeletal mesh so that if you have different animations they still move along with the animation.
This is what CS:GO for example does. And obviously it doesn't have to be as accurate as they do it here. But you get the general idea of how this can be useful.
Player return invalid idk why
daaamn feels so cool to see the hitboxes
What is invalid? In general if you're asking questions on servers like these I would suggest providing more information if you have a problem. Things like errors, explaining what exactly doesn't work etc. π
So by the looks of it shooting at the groin should mean inflicting the most damage because your bullet penetrates multiple hitboxes....hmm interesting.
As someone who played CS:GO for some bit. I don't think that's how they do it. Pretty sure it's just "you hit a player" as long as you hit one of the colliders. You do have bullets that can penetrate through objects like doors etc. though. But it mostly depends on what kind of weapon you use.
Player it's not valid. I wanna replicate attach actor
Although I would find it pretty funny if that would be a thing though, Lawlster x)
Where did you Set the Player variable?
I made a function to set it and i called it on begin play main character
this worn items variable is replicated, if i click on another client using the get hit result under cursor node, is it able to detect the variable from that specific actor i click?
Protip you don't want to attach colliders to your skeleton at the BP level. Skeletons can just have simple collision like that. Physics asset.
If you add a breakpoint on the initialization node does it reach it?
Yes
doesnt seem to be working
Replicated just means that yhe variable on the client will be kept in sync with the servers version
Yep
Debug then. Figure out where in the logic chain it doesn't look right.
how did i get this pass reference in message form? cause i cant get it anymore ?
what
okay then if you step through you can pinpoint where the issue occurs
skeletons can just have simple collision like that? What do you mean?
Physics asset?
The skeleton itself can have colliders for the bones. That's what you want to hit test against , and is also what does the physics for ragdolling.
That's an interface message.
ya but if i get the same node it doesnt come in message form anymore
Does that matter?
i thought it might
Idk what the difference is anyway, is that node from pre-5.0?
no
srry i don't understand
if i continue with execution breakpoint don't call anymore
does anyone have a good explainer about Iris that breaks down exactly what it is? all of the docs are like, "it's multiplayer but better" but I'd like to understand architecture/goals/etc.
You can mouse over the output pin variables to see the state as you step through (F10) the nodes one by one. Check the variable after the node was executed or while its stopped on the node not before.
Yea so then the problem is something to do with setting the player variable. Try changing how or where you set that variable.
Is it necessary to mark input functions like MoveForward in a character as Server to better security?
I called it from event tick on main character
And it works
uh oh....at least use a DoOnce node
When using the Push Model is NetUpdateFrequency taken into account at all or can I just set my NetUpdateFrequency to the lowest value and have all of my variables send updates manually.
Yeah ofc it is taken into account. Push model only saves you the comparison done to evaluate if a property needs to replicate
Lowering net update frequency with ForceNetUpdate works
Using dormancy along with flushnetdormancy also works and is far more performant than the prevoius two
Is there a quick TL;DR about how it does that?
The only one I know of is in PushModel.h I guess?
Also an important note is that even when using push model there are still things that don't use it I'm pretty sure. Maybe that it has meanwhile become a lot better, not entirely sure. But a quick search result on Github in the 5.2 branch still shows me variables that don't support it.
so when you mark a property dirty, its not immediately replicated? its only going to be replicated on the next net broadcast tick?
Indeed
oh interesting, TIL
Unreal still has a priority system to prevent overflowing the network or specific client connections. Push model doesn't change that.
Not even the next broadcast tick. It'll only update if it's that actor's turn to replicate.
Or whatever the correcte phrasing it.
Even "Force net update" doesn't actually force a net update.
It just sets the last update time to zero.
Damn, typical unity work
Indeed, not next tick but next tick the actor is taken into account @clear island
I missread
yea thats what I meant
I may have also misinterpetted, but I wanted to make it claer!
I used the wrong phrasing
well yea, but when I said "Immediately" I was thinking in similar fashion to RPCs
but I guess not, it still follows the whole replicated property lifecycle
RPCs take a different path, well at least those that are not unreliable multicasts
yea reliable ones
And yeah they are indeed fast, at least from my experiments
you mean RPCs or push model props?
Do unreliables not get pushed out straight away as well?
Even if they aren't checked for delivery.
Unreliables that are multicats are queued for the next net update
RPCs
I see!
Honestly I don't really know if push model is even worth it. I thought I read at some point that Epic them selves said there was basically no improvement to performance with it enabled?
ah, yea I thought so
yea its stated on the header file
however it really does depend
for valorant that was like their number 2 heaviest thing server side
but they also wanted to host multiple games on one single core
so for them, it mattered alot
they replaced all replicated props with RPCs, even stateful stuff
just to avoid the long delta times when comparing props
(this was before the push model existed in UE)
Nah not yet tbh, we're still back in 5.1 with a few changes from 5.2
Maybe in the next project I'll do π
Right. But Valorant in specific is already a lot different in that regard than most games. I would imagine they have very high tick servers because of the genre of the game right? Which I would assume indeed starts adding up to constantly check all their replicated properties. But I honesltly doubt that if even Epic says it barely did anything for their own use cases that most games will gain any benefit from it.
Wizard is slacking off at work π₯
Confirmed
Yeah gotta crunch hard you know
again, it depends, for valorant yea they have 128 tick servers to it really matters alot for them but even if your game is not valorant it may also be important if you are using dedicated servers and dont have the funds to buy super powerful machines like epic
idk need read about it idk what is iris 
Don't worry about iris until Fortnite is actually using it
If you have the funds to support that high tick rates AND dedicated servers honestly I can't imagine your team isn't able to put it together them selves if it's such a bottleneck.
in my experience these past few months from profiling dedis, the heaviest stuff is, in this order:
1 - animation
2- CMC
3- delta time comparisons for replicated properties
Epic got you covered, you will barely find anything about it π
animation means niagarra?
yea, for example my game uses dedis and runs at 66ticks and after optimizing alot on animations I'm able to run it smoothly on cheap servers (like 12usd cheap)
Yeah CMC is the bottleneck
Animation montages from the ASC as well 
no, skeletal mesh ticking
because I used niagarra instead actors meshes to make bullets and all effects when shooting or doing anything like this in game thinking that I will make better performance
Is that "Taken Into Account" the net update frequency?
Yes
Just don't use animations. Easy solution ^^
π
Hi, I am trying to transition out of spectating, I am using gamemode the code worked in gamemodebase so something is getting in the way
yea in my experience skeletal mesh ticking is much much heavier than CMC, I havent had to change anything with the CMC yet but will probably have to happen at some point because I'm aiming for max 100 players π
Use animation materials you mean to fake your animations, I like it
can you give me tip how I can spectate game or my exe version of game and find which parts of game causes FPS drops or lags or takes performance?
Totally what I meant yeah! Glad I was able to provide so much help π
RIP
I recommend using Unreal's profiling tools and use the Unreal Insights tool
Although without joking if you're using something like mass those material animation techniques can actually save you a TON of performance. But maybe not the best topic for #multiplayer π
no joke I literally did this, in my game, server side (dedi) there's no animations
Seconded. Pls no net profiler but net insights, pls
I only tick the animation poses when necessary
NewK β Today at 22:20
yea, for example my game uses dedis and runs at 66ticks and after optimizing alot on animations I'm able to run it smoothly on cheap servers
π€£
For most games, the biggest CPU bottleneck is animation
yea it really was a pain to get right, especially with lag compensation doing the rewind back to a time where the animation wasn't ticking
but it was worth it
previously just 2 players on server caused the cpu to load at 80%
now its at 18% to 20%
That sounds like a rather odd jump to me for only 2 players π€
Not saying it couldn't be the case but again that sounds like a very extreme performance change for just two players.
the map also had alot of vehicles which are skeletal meshes and were also constantly ticking
I disabled the animations there too
That seems like an important detail to mention in this scenario no? π€£
sure, but my point is that before, with all the vehicles + 2 players, the CPU was 80% load
but even on the profiling tools, the vehicle ticks didnt really show up alot tbh
it was mostly the players
because they have alot of child components attached to the skeleton bones
and constantly ticking that animation would update transforms on all those child components too
Do you happen to know what the load was with no players before changing all the animations?
that I dont know because I already had code in place that just disabled the vehicle ticking when there were no players on the server
all I know is from the profiling I did, with players inside the server is that the player animation ticking was always the top offender
That's probably why they're investing so much into animation performance
which kinda makes sense, valorant devs also reported the same issue for them
the heaviest thing was animation ticking
2nd was the replicated properties
Pitch works correctly
but Yaw
not
Client doesn't see Server Yaw
on Client always is 0.0
why?
Get Base Aim Rotation is replicated
Iirc BaseAimRotation is just the Pawn's Yaw.
If you expect a different one it might be due to that
Best to check the C++ code behind it
im setting the specific controller of the client i click so i can use it as object input when i cast to my pawn bp in my scene capture bp cause if i have the object input on the pawn cast as 'get player character 0' it only shows one players equipped items but i have to cast to my player controller bp to get the variable in the picture with object input as 'get player controller 0' so what should i do
you don't have other player's controllers on your machine
even if im getting hit result under cursor and using get controller node?
when i click on another client
on a client, the only playercontroller that exists is your own
oh ok
i don't understand C++ ;/
so how do i identify the player i click using get hit result under cursor
im sending the worn items variable off the client i click to the scene capture
PlayerState represents the person
Pawn represents their character/other thing in the world.
What actor holds Worn Items?
main pawn character
idk, i was tryin dif things
BaseAimRotation only contains Pitch.
yes and yes
So is pitch the only component of control rotation which explicitly makes it to other clients and not indirectly by driving things like capsule rotation of character?
just need a way to identify which client i click using the get hit result under cursor that casts to my character bp
thats it right there
you clicked a thing
you check if it's a topdowncharacter
if it is, then get its WornItems
in mmy scene capture bp i have to cast to my character BP
so im getting character 0
so do i promote this cast in the pic to a variable and use it as input object for the cast in the scene capture?
don't get character 0 ever
why are you doing so much casting
do you know what casting means
yea
you sure?
yea
Show the part of your code that takes in a character and shows their inventory
I'm guessing OpenMyInventory just shows inventory for self, and OpenOtherInventory shows inventory for any TopDownCharacter, right?
right
so just pass the result of the cast after the hit into OpenOtherInventory
show the internals of OpenOtherInventory
its a disaster
I think you're making this way more spaghet than it needs to be
i grew up on spaghet
what do you mean by this
specifically
I want to see what OpenOtherInventory does with the passed in character ref.
cause i have rep notify's for showing items on players
This is to inspect some other character right?
im getting open other inventory from the character bp cast
its not a ref pas
pass
it just opens a widget that is different from the owning player inventory widget
To be honest, I'm not sure XD
I was just looking over the code, and it looks like it actually uses the actor rotation if there's no controller, and if there is no pitch, then it uses BlendedReplayViewPitch or RemoteViewPitch.
What bit of code spawns the widget?
where does that code live
all im trying to do right now is make the scene capture know which client i click on
cause im getting worn items array from the character cast off the hit result of get hit result udner cursor node
You're trying to set a replicated variable clientside
we need to see what OpenOtherInventory and TryEquippingOtherPlayersItems do
but anyway, those should not be separate from your own versions, doing it on self should just be
OpenInventory(self)
make the function once, call it with a parameter of self for the self case
self inventory and other inventory are 2 dif widgets
this is try equipping other players recorder items bp
this is scene capture bp
as you can see since its on player 0 it can show only one clients equipped items
open inventory events just create inventory widgets, thats it. the main target is just the image within the inventory widgets which is bound to the scene capture material
so my main problem here is just identifying which client i click on and send the scene capture that player info
@dark edge
i put this in the scene capture BP but doesnt work
Is it necessary to mark input functions like MoveForward in a character as Server to better security?
If you mean marking a function as an RPC to run on server, then no. Marking as Server indicates you want to allow a client to be able to call that function to then run on the server, which in some cases, you don't necessarily want clients to be able to run those functions directly.
Eg. Marking a "Defeat" function as run on server could allow a client to call that function when you don't even intend for a client to be able to make such a call.
Then this talk of the wiki:
βInstead of letting a player tell the server their position explicitly, consider having the PlayerController send player commands (like move left, up, down) and simulate that state on both client and server and let the server update the player's position as a replicated property. This avoids an entire class of cheats (like speed hacks etc).β
What does it refer?
I'm talking mroe about your general question as to whether or not to mark something as Server to better security. The answer is no, that's not what it does. Marking a function as "Server" indicates you are opening a means for a client to send the server an instruction and you can pass along data in that function. If that function gets called, then the server will be executing it.
SO... If you need to have the client tell the server to do something, then you must mark the function as Server in order for the client to be able to call such a function, however, you do not need to mark a function as "Server" to have the server execute the function nor does it increase the security of it (the opposite actually) - the function can still be called at any time while you are running on the server.
In terms of what your wiki is talking about, imagine a situation where you are calling a function called "MoveForward" and you mark it as server but it has no inputs. This means you are asking the server to execute whatever "MoveServer" is but is not relying on any further input from the client. The server would end up determining what needs to happen and where to.
If you added a vector input named "DesiredLocation" to "MoveForward" and had it marked to run on server, then you're passing that DesiredLocation from the client to the server in that function call. If you set it up so the server then uses "DesiredLocation" and moves the client to that location without performing any checks, you're now trusting the value that the client sent, which may not necessarily be what should happen and could result in a player teleporting themselves anywhere on the map.
Can i call a playerstate's server RPC from a widget?
If the local client is the owner of that playerstate, yes.
awesome, thank you!
Thank you a lot for the deep explanation.
Then, my questions are:
- Character class requires this sort of RPC method to prevent the client moving forward to another location?
- By doing such crucial, high speed things like moving forward or rotating, as RPC doesnβt slow everything up? Is it recommended to execute a βlocallyβ move forward while the servers respond the result?
The character class does not require an RPC to move as the Character Movement Component handles the RPCs for you. There is client-side prediction of movement in it that smooths out the movement for you, and if the server doesn't like how you've tried to move, it'll correct the client's view to the correct place. So then it's just Input > Add Movement Input and that's all you need.
When you call an RPC, the code doesnβt await for it right? Jump straight to the next line?
Correct
And my last question, does Pawn class also handle RPC for AddMovementInput and similar?
No. AddMovementInput while part of the Pawn class has no implementation of it.
Thank you so much!! Appreciate it!
anyone know: #ue5-general message
how do I create a dedicated server browser?
Generally you'd add it to your main menu map somewhere.
Interface with steam or eos or whatever online subsystem you're using to query the available servers.
And display them.
okay, and how would I set a server port?
The server details will be available from whatever online subsystem you are using
@latent heart are query port and multihome commands in ue5?
yeah I know it's spaghetti, I'll get it sorted soon lol @sinful tree
Not much you can do with maps if ya need to check if the values are there... It is what it is XD
they are on a command line
I use a shortcut
so how can i get Yaw? Need I create replicated Yaw in Character?
I have 60 players "MMO" game and I have been using local dedicated server. Can I use playfab server just to upload my server there? Without any other integration with playfab. I would use steamcore for server browser and session.
I have no idea, sorry!
They mention you can try out their service if you're interested in it: https://learn.microsoft.com/en-us/gaming/playfab/features/multiplayer/servers/
If Playfab seems interesting for your game you could try looking at that I suppose.
As a PlayFab customer, you can access our service and use a limited, free quota of multiplayer servers for product evaluation and testing.
That is great!
What am i doing wrong? why is the gamepad not controlling the second player`?
im working on tracing / overlap detection for the purposes of dealing 'damage' in my project but somehow the tracing is not quite working when running client / dedicated as opposed to standalone or listen server
the trace is based on two sockets on a static mesh
but its meant to look more like this
as if the static mesh, the sword, is stuck in the air and the only reason the tracing moves at all is cause the anim montage is using root motion, driving the character forward
after hours of digging looks like i needed to enable this on the character skeletal mesh, otherwise it seems as if the character is basically tposing as far as the server is concerned or something:
im guessing having this enabled the whole time might not be a good idea? would it be beneficial to have it only enabled when its needed
do PossesedBy only called on Server?
it is yeah if memory serves
There is option to not tick animbp too, I think those are options for optimisation
In my case, I was woundering why my anim notify never get called π¦
turns out when not rendered the anim bp doesn't play the montage because of the option
i set it to always tick then it plays
There will be a new visibility based anim tick option in future versions of the engine for this π
hopefully!
oh okay. i suppose just enabling disabling refresh bones on dedicated seems to be a decent workaround, no?
dedi servers by default dont refresh bones
its a hugeeeee optimization
refreshing bones will add some considerable cpu time to your dedi server
another workaround is placing collision boxes by hand inside each anim montage, i think thats how the one triple A unreal game does it, i think...
well... there are several techniques
that can go from doing a sphere trace on the frame of the hit in front of the player
to more complicated solutions based on how arcadey your game is
i wanted to try go for as much accuracy as possible sort of
doing the hit on authority relying on bone positions will.... not be accurate at all
as soon as you have some lag, I mean
hmm.
you can maybe go for a client side approach that you later verify... when it reaches the server
well the problem is
i was detecting hit clientside until i added ai
thats when i suddenly had to rethink stuff
ah I see π u want AI to be accurate
i suppose i dont mind if the ai isnt super accurate but
i want to make sure i dont get my wires compeltely jumbled by having too many exceptions just cause the ai or something else
well you can have players to do client sided hits, and let the AI do its thing on the server
yeah, that was the plan, i will separate them again
Does AActor::PreReplication() get called server-side as well?
just remember to think of some verification on the server for the client side hits if you are going to do some form of pvp
im aiming for coop/single first but im building for the possibility of allowing dedicated down the line
which might have pvp i guess but even coop might
based
π π π
it is actually called server side
XD
(unless im not recalling it correctly now)
iirc it gets called on the client too
or maybe im confused
anyway mostly needed it server-side so it's fine hehehe
Called on the actor right before replication occurs. Only called on Server, and for autonomous proxies if recording a Client Replay.
@solar stirrup from docu
I'm keeping history of states on the server to ensure they all get replicated to clients
regardless of if they happened for a split second server-side
so like if a state starts and ends in between replication intervals
ah, i see yeah
I just wanna clean up states that are X seconds old in pre-rep
I really didn't wanna use RPCs for this heh
but this will probably work fine 
!! gl erlite!
tyty
I've got this code here. MoveToCooker() runs just fine, but the server function (S_MoveToCooker) never runs. I have a feeling it has something to do with MoveToCooker() being called from a multicast delegate but im not too sure.
second image is the function bound to the delegate
god multiplayer is so confusing, so many different possible combinations of RPCs and owners its so hard to get it right
any tips or general rules of thumb for coding multiplayer would be helpful. Still a bit new to this
Client->Server RPCs can only be called on client owned actors.
Events like overlaps can trigger on client and server. That means you usually don't need a client telling the server that the overlap occured as the server will know about it already.
how come client 2 gets correct values from worn items variable but not client 1
You have to check how you set your variables and what data you're feeding in. The code here has nothing to do with what values are set in your variables.
i just realized its getting correct values but its not updating the scene capture on client 1
What always helps me is just thinking about which machine the code is going to be executing on and then switching my brain into that context.
Just making sure that I'm going about this in a some what correct way. When I have a listen server and I make a call from a client, like a basic attack, in real time that takes a second for the client to call that from the server and the server replicate that back to the client that it is attacking.
This feels awful as a client, especially while using less then average connections. Is it a better option to have the client play out that code while the server also does?
Purely cosmetic from client and actual coding, like damage etc. From server
Yeah, pretty much.
Okay so to make the client actually feel good to play is a pain in the ass lol
Also yes.
WHY IS CLIENT 1 SAYING I HAVE 2 ITEMS ATTACHED IF THERES ONLY 1 AND IM USING GET HIT RESULT UNDER CURSOR, makes no fuckin sense
Did you try printing the items to see what is coming up?
WHY IS SERVER SAYING I HAVE NO COMMIT WHEN I HAD THE CONSENT OF THE QUORUM
<_<
Hello guys I have weird problem I am trying to let my AI shoot at me but I am getting failed cast on event for damage but very strange is that on the start of event I can cast check first photo when I cast there to my plane its successful but when I am trying to give damage after linetrace hit my plane here (photo 2) it fails and I See on my monitor printed cast failed...
any suggestions?
its in same line
There is no cast happening in the second photo.
If this is an AI controlled actor, you shouldn't need to call Run On Server RPCs in it, and if it can be client controlled, you don't want to allow a client to tell the server how much damage to deal and who the damage causer is.
Is the idea here that as soon as the AI sesnse a PFCPawn it does that linetrace and applies damage?
i know but my server apply damage is printing that cast is failed ,werid
weird
ye yea
So this bit is normally connected?
ye I was just debugging π
it continues to line trace sorry for confusion
I am trying find problem why is damage not taken I have like 20 guns one AI turret in game and all works fine
same system here and it is not working lol
but on turret I am using ai perception here I am using pawn sensing
Maybe it's failing for the pawn type? It looks like you have the print here saying playerstate.
or am I just being somewhat dyslexic XD
I am trying again , line trace works good I am getting casted print from the start
but this one still not workinng lol
print is wrong my retarded ccolleague .... wrote mistake
π
good point
Well, again, maybe don't mark that as a run on server event? If it's AI controlled it shouldn't need to be run on server, as it should already be running on server.
will try too
no wtf why its printing cant cast to player I dont have anywhere this Print
its saying when server damage is applied
Perhaps you have some casting going on in the AnyDamage implementation in your DFCPawn class?
Should take a look
yea bro thx found where is mistake coming from now fix it
D:
lol I did not get this idea
its in my plane
its like its getting wrong player reference
otherwise it would cast
but god why
bro I fixed it thx thank to you π
I was casting on any damage only to my players but damage causer was sentinel ( defense system) lol so it could not cast lol I Should refactor this
I Dont event cast there anywhere
idk why I did this
@whole pineStop... there is no excuse for calling people idiots
Also @icy jetty that wasn't very nice of you either
really cause people been passive aggresively doing it for a long time
guess thats the loop hole
i dont report, thats whats funny about this
Throwing back insults at someone who insulted you instead of backing off or reporting them doesn't make you look any better than them
It's a childish thing to do
And I won't discus this any further
i can argue its childish to report someone for something you do to someone else
Does NumPublicConnections not include the host?
As in if NumPublicConnections is set to 3, it will allow for a 4 player game (the listen server host being the 4th player)?
Correct, the host isn't really "connected" in a listen server as their instance of the game is the server itself, so it doesn't really count as a public, nor a private connection.
Thanks!
That would truly be something if you could disallow the host from "joining" because NumPublicConnections and the private one might have both been set to 0 haha.
Mb, will do
Hey all! First time posting, I apologize if it's the wrong channel for it. Anyone have any idea how to enable the on-character gameplay tags debug visualization? I've stumbled into it by accident several times, but there's a debug option SOMEWHERE that lets you see active gameplay tags as a GUI that hovers in roughly center-mass over each character during PIE. I can't find it on purpose for the life of me, but it was super useful to have on
It looked roughly like this where the active tag was hovering over each player
Edit: nevermind. I rubber duckied my way into finding it π€¦ββοΈ
If anyone's wondering, it's the console command: AbilitySystem.DebugAbilityTags
@twilit radish it seems on Steam it does actually count the listen server host as a public connection (subtracting 1 from NumOpenPublicConnections when the host creates a session) but not on the NULL subsystem
I never really had to use it for anything so far so I'm not sure. But that would honestly be rather silly..
But that's many parts of Unreal in a nutshell though xD
exactly π
Does anyone know why LogOnlineSession: STEAM: Updating lobby joinability to false. gets called when the first player joins a lobby even if NumPublicConnections is set to something crazy like 50?
The only way around it is by setting SessionSettings->bAllowJoinInProgress = false; but in this case I would like it to work without doing that (as that causes other issues)
Sorry for the ping, did you ever solve this? I'm running into the same issue. I'm guessing that in the Steam code, the MaxLobbyMemebers is forever at 2 for some reason
make skin an OnRep var
Player Wants to Change Skin > Server RPC > Server sets skin value in OnRep > OnRep function called on clients > Have whatever needs to be done with the skin value done
Yes! Late joining players will automatically call the OnRep for each other player so they'll all have their correct skins
You can do this wherever you like
Generally the player state is good to hold vars becuase your character may not always be valid, so the OnRep in the player state would then call the "equip skin" func in the character
if the character Actor replicated by then π
a big assumption during loading in the world for the first time
Right so you'd have both a begin play call in the char to update skin (via a PS getter) and then also the OnRep from the PS (when skins update in game if a player decides to change one)
if 2 clients are joining a level, why does this spawn 4 of the actor if this is coming off event begin play
one for each player on both clients?
because whatever this is, it has 2 instances on both clients
always catch the BP name in the screenshot btw
BeginPlay runs on every instance of every Actor on every client and server
regardless of who the owner is
how come its not adjusting spawn location of the actor when it spawns, it just overlaps both
no colisions, or replicated actor lands ontop of locally spawned one
i turned off replication and on collision but still on top of each other
im trying to use one scene capture for all players now and add to the capture whatever variables i get from the player i click on. the issue is, client 2 is last player to join the level so it is giving ownership of the scene capture to them. so whatever client 2 sees is what client 1 sees when they look at the screen capture
if im playing in standalone, why are both windows seeing the same scene capture result
scene capture should be done locally
im trying to but idk how
gpt's saying set ownership off the spawn actor of class node
actor doing scene capture is spawned by player controller, only if IsLocalPlayerController
that way each PC will spawn its own on a local machine and nowhere else
this applies if im spawning it into a level?
where else would you spawn it?
?
theres no error i just didnt compile
idk, its still just only working for one client
Hey! I'm having some trouble receiving data back through RPC calls. I'm punching way above my weight here, dabbling way beyond my skill level when coding to be honest, so hoping someone has the patience to help me understand how to work around this.
Basically what I'm trying to achieve is this: Server has a list of data related to players. On login, clients request that data, server sends it back, then the client presents some relevant info in the UI with said data. Other attempts at retrieving data has been successful (thanks to other posts in this channel I've stumbled upon), but turns out it's even more complicated when dealing with collections of sort. TSet and TMap is not supported, and TArray only works with certain setups (as far as I've understood even if it's a bit beyond my knowledge level is that it needs to be a const reference), so as a workaround for now I'm just turning the sets and maps into arrays server-side before passing it back to the client.
Code compiles, but when I hook it up to my UI the event I hook up my delegate to throws an error, twice, once for each parameter.
No value will be returned by reference.
So, blueprints can't work with const references it seems. What would be a simple but functional way to get the data I want from the server to the client?
Give me a moment and I'll fetch the code I'm using to make it easier to see where I could improve it.
void ABattlestruckGameState::RequestAllPlayerData(FReceivedAllPlayerData Callback)
{
FGuid RequestID = FGuid::NewGuid();
OnReceivedAllPlayerDataCallbacks.Add(RequestID, Callback);
ProcessRequestAllPlayerData(RequestID);
}
void ABattlestruckGameState::ProcessRequestAllPlayerData_Implementation(FGuid RequestID)
{
// PlayerDataList is a TMap<FName, FPlayerListEntry> housed on the server.
TArray<FName> PlayerList;
TArray<FPlayerListEntry> PlayerData;
PlayerDataList.GenerateKeyArray(PlayerList);
PlayerDataList.GenerateValueArray(PlayerData);
ReceiveAllPlayerData(RequestID, PlayerList, PlayerData);
}
void ABattlestruckGameState::ReceiveAllPlayerData_Implementation(FGuid RequestID, const TArray<FName>& PlayerList, const TArray<FPlayerListEntry>& PlayerData)
{
FReceivedAllPlayerData* Callback = OnReceivedAllPlayerDataCallbacks.Find(RequestID);
Callback->ExecuteIfBound(PlayerList, PlayerData);
OnReceivedAllPlayerDataCallbacks.Remove(RequestID);
}```
And even if there turns out to be a better way than to pass TArrays, I'd still like to know how to get arrays and such passed for learning purposes. Might turn out to be useful in the future.
how do you make scene captures local
you are making a copy of the delegate there and putting the copy in your callback list
i'd start with why would you log the player in, wait for its PlayerController/State.. .etc to replicate, then send an RPC from server to client to request the data
you know player just logged on, you know they will request the data, so might as well send it
worse yet, you can't send server or client RPCs through GameState
as the players don't own it
and what is the PlayerList for even?
just put your per player data as replicated data into their own PlayerStates and let it replicate on its own
Does any replication need to be done for multiplayer levels?
If I don't want players to be able to know when other players join/leave a match, would I have to disable PlayerState replication?
@winged badger About to hop off the computer for now so I won't have time to test more right now, but to try and reply to some of the questions on my way out:
- GameState and RPC... hmm, yeah, that's totally an oversight on my end.
- As for the delegate being copied, I'll check back up with the other post here I used as a reference to see if I misunderstood them. I've used almost the exact same code other places in my project but instead of sending through a TArray/TMaps/TSet it send either simple data or structs... and those work flawlessly. If what I'm doing in regards to the delegate itself is a big no-no even if it works (in those other places) I'd like to learn why. This is unchartered territory for me.
- In a lot of cases, even if the data changes mid-game, a client doesn't need to know about the changes. So in general for those things I try to keep it to a "only send when requested" to reduce the traffic. It may be used for other things than login, so I still need the requesting itself to work.
- This system will probably be massively revamped at a later time, but for now I'm just trying to get this revision working so I can focus back on other places of the framework that need attention for now. Although, as said, even if it does get revamped I still don't understand how to send arrays through RPCs in general, and still hoping to understand how to achieve this in case it becomes useful for something else at a later stage.
Having an Issue turning on the ReplicationSystemTestPlugin for Iris, getting a cannot open source file on the includes, all I'm trying to do is run the plugin, haven't modified anything on my end
If I set an actorβs owner on the client and NOT the server, can I execute server RPCs on that actor from the client?
no
what binaries are you building?
NetworkAutomationTest sounds like it shouldn't exist unless there is an Editor in the name
Hey guys i was wondering if using world partition in a multiplayer game is a good idea ive done some research but i was wondering if anyone here would know if using it is a good idea the way im going to do it is use the tool to convert my level to world partition but just curious if its a good idea
would it be possible to use LAN+LogMeInHamachi/Radmin instead of a online subsystem?
No clue what it provides. If you're asking about online connectivity, as long as two PCs can communicate directly with each other then yes. That's all it really takes for that to work. That's in basics also what online subsystems do.
From what I remember being mentioned here is that it had issues because it was still rather new. That was in 5.0.3 or 5.1 though. Not sure how good it works in for example 5.2, but I would highly recommend you just try to give it a go in a test project first before integrating it into a real project only to then find out it doesn't meet your expectations.
I'm going to try that thanks !
Hello, can someone help me implement something in UE5.1? i Would pay for that! I need a basic system where 2 players local can play. 1 is controlled by the keyboard and mouse and 1 by controller. Someone maybe here to help me with that?
@fervent hazel If you have any specific questions you can ask them in here. If you're looking for someone to do it for you there's a job posts section. See #instructions
I asked a specific question, and im looking for someone to do it with me, not for me.
Would anyone be able to help as i'm still stuck on this. I can't figure out how to make the gamemode play widgets on the respective winner/loser playerstate variables
take a look at #volunteer-projects for that.
if I fire an RPC, does UE wait until the world is ticked before it actually sends it?