#multiplayer
1 messages · Page 237 of 1
I used to be on 1060. Make sure to use the scaleability settings. The viewport takes literally all your FPS, you will love the engine once it runs smoothely
@teal flare #ue4-general message
@quick lion
Thank for this dude ! I will try again 😉
I don't know yet how to make plugins, but more "folders" (with basic stuff) can be added into larger project : Resuable UI template, Interaction component, Inventory Component, Shooter logic, ...
Ah, modules are very different then folders in your project solution
Yep, I don't know how to call that ...
(I migrate the whole folder when I need it. It's not convenient : if I have some modifications to make in my "module/folder", I have to do it again in all projects where the folder has been imported)
So does it work now?
Yeah i was saying that Super itself was returning true, thus stopping the function even before the stamina check
Hey guys, I just stumbled upon push model for replication. Do you consider viable to work with this for a survival game with up to 8 people? My inventory has 36 slots and I don't know if it is worth using it or if I am alright with the old method
What do you mean viable?
PushModel just refers to a slight change to how Replicated variables are in need of replication
PushModel is opt-in per property.
Its not something you just enable and magically everything is now PushModel.
The Engine already extensively uses PushModel
AActor uses PushModel
APlayerState uses PushModel
Yeah I know, that is why I am asking, if the performance improve is worth it to change the things to use the push model
Etc etc
for my arrays of USTRUCTS
Do you understand what performance improvements are occuring when you choose to use PushModel?
PushModel does not affect TArrays
I thought that by using the classic way of replicating the entire array is sent over the network while using the PushModel only the changed object that is replicated
I thought, the GameMode handles spawning of joining players, but that is somehow not the case for me. It just spawn the connecting player as a spectator.
Im using a menu as level. Upon joining the host, the host's map gets loaded. It also shows the host synced with movement etc. But I only get to spectate. PlayerStart is set, and the GameMode has Default Pawn Class set (which works at least for the host)
Any ideas?
Thanks a lot, I will look into it
Yuppp
It was for us, but we're making a pretty intensive game
Generally speaking you should make every property PushModel, it can be annoying, but it adds up over time.
though if you enable the cvar for it you can make all BP replicated variables push model
I have yet to try that, Im scared.
Honestly it isn't too bad if you use a proper setter instead of directly setting props
that's pretty much the pattern I've used since its introduction
Yeah, its just a habit for me now anyway so 🤷
I use a setter even without push model
Yeah, I got the concept wrong. I was taking a quick read and now I understand what is the use of it. Makes sense to use it. Thanks again
And doesnt seem that annoying to implement
Got it myself. I was overriding HandleStartingNewPlayer, just to log. Cant seem to find the base implementation to call tho
That makes sense
We don't do that here

Im trying to find a good place to play a 2d sound when the room has enough players to start the game, the sound (a small song) is map specific so i figured the level blueprint would be the best place but it seems that blueprint only exists on the server, where would be a good palce to put this?
Not using setters is a war crime
I was implementing push model. Apparently I need the source version of the engine? That hurts...
For push model? Na
You are right, my bad
Of course they are right. They're insane enough to use slate for a regular ol' GUI program.
You don't argue with crazy
it's enabled in the editor, but your packaged game won't have it
UnrealGame.Build.cs doesn't enable it for the record
oh god
that thing takes just too much space
but ok
tomorrow will be a new day and I do that
well order yourself a 1TB SSD, I could fit 3 source built projects on that at a pinch
and of course, use a native build, don't just build the entire engine and waste over a day on compiling
I use a laptop 
that seems less than ideal to begin with
Is that not just using the value you’ve assigned? Always enabled in editor sure, but if you’re using push model for networking without a source build with listen server’s I’m fairly certain it will be enabled if you’ve enabled it before the package.
bWithPushModel controls the preprocessor definitions that result in it getting compiled in
it also requires a unique build enviroment (which means source built engine)
Doesn’t sound right, I’ll have to do a test later.
posts the evidence that doesn't sound right
https://github.com/EpicGames/UnrealEngine/blob/7e3938b0d8218118f65f0a58c480e728dab593cc/Engine/Source/Programs/UnrealBuildTool/Configuration/UEBuildTarget.cs#L5602 you can see its impact here, all it controls is WITH_PUSH_MODEL
Lmao relax
mileage may vary with Iris
since I believe that has its own push model implementation
If you do, please let me know something, I have to go now
otherwise I would do it
Does bReplicateMovement only work for hosts?
Or is it meant to be used with server auth movement? (As in, the client requests movement on the server and waits for location updates, instead of moving client side and than sending its location, because its learly not sending its location when moving client-side)
It will replicate movement if the server changes any part of Rep Movement. (Sets location, etc)
Client setting the location won't automatically send to the server and replicate
yeah I was expecting, the replic to work from client. But from what Im reading, it sais replc only works when location, etc. is changed on the server, so that wouldnt make sense
thanks for clarifying
Client -> Server isn't replication just as a heads up. It's communication, but replication is replicating the auth world to proxies
.
Hello! A simple question :-
How can I call an RPC on a client from the server to update the state of a non owning client?
For eg. Client 1 gets an rpc about client 2 from the server?
@grand mica that's a strange way to go about it
Replication is server to client
Design it that way
There isn't and there shouldn't be direct client to client coms
Not that you can even do that
That's P2p
Can you give a high overview of the gameplay feature you are trying to implement?
long story short :- I cant for the kind of thing i am making.
I want to send an rpc from the server to a client but about the state of a non owning client
Mark your variable as replicated
It will send data to client every net update
the data will be same for the clients. That's not what i want
Explaining what you’re trying to do specifically will help, it sounds like a fundamental design issue you have going on if you’re trying to go about this in a round about way
it's because the tick rate differs on the client and server. So I am making snapshots relevant to frame numbers on a client. So I would need to update a client about some other client with their specific frame number
So.. you’re trying to rollback
I mean rollback is a lengthy process. But you need the server to track whatever state you want to rollback per frame and then have the client send the server a request with whatever time stamp they’re trying to get data on. It’s not an easy thing to do.
i have already built a system. Right now, I need to figure out how to send an rpc to a client for a non owning client
without replication. Replication would force same state on all clients
Rollback
sorry what?
What do you mean "for" a non owning Client?
The Server would need to do that on their behalf
eg. At frame 50 on server, it has frame 51 for client 1 and frame 48 on client 2
So at frame 50, I would need to tell the Client 1 that it's 51st frame should have the state of Client 2 of 48th frame
?
You’re trying to do something you cant do, and asking for advice on how to do it. That’s why it’s confusing. You need to think of an alternative way
That’s rollback
@fossil spoke this
Ok thats fine, but you have to use the Server to do that
Clients cant send RPCs between themselves
Yeah it's all cool. I want to send it through the server itself.
Server first collects frame data for all the clients
and then updates a frame on a client
Sure, so whats the problem?
Nice way to describe it
Well, wouldn't I need to send this kind of RPC to a manager or something that can check which actor it needs to update?
I am not very sure. Something on Game Instance Subsystem?
Sure? I guess so? GameInstance is not what you would use, but it depends on how you want to manage this
Sounds more like a component on a PlayerController kind of thing if I am understanding what you want correctly.
Since this is like a per connection type deal
Probably need a manager on the Server, that then delegates to the component
🤷
This is your thing lol
Yeah, right now I am sending it from the owning client to the server. Server collects it in its own manager. Now to send updates back to the client, I think it should be done on some manager, so i can update the non controlled actors.
yeah 😛 I just wanted to know if its possible to avoid replication in this case and do it all with RPCs
The manager would be the PlayerController, or a Component on the PlayerController, since you are sending that update directly to a single connection?
I think what you actually want to is run the function on everyone from server except the client that send the data?
yes and I can assign some IDs from the server for remote clients. So server can say like:-
Client 1, for your frame 51, client 2 was at this position, velocity etc
nope.
Or you would just use their PlayerId that is assigned to their PlayerState
Then access their Pawn via the PlayerState (PawnPrivate)
niceeeee
Alternatively you can just send the Pointer to the Pawn in the RPC directly
It will compress down just fine
I think I would need to make a structure of the player's state which would be compressed. I can tell the the unique id of the remote client it needs to update. Ofc, my thing to do 😛
But thanks for the suggestions
You do you man
xD
trying to do something based on first principles on unreal's existing networking system is ofc not very straight forward lol
Does rollback really include server interfering with clients to force them update to a old state of the game rather than the current one? 🤔
if you mean movement yes
because the server doesn't know about the client's newer inputs
so the server tells the client to correct that old movement, and then re-apply newer moves on top
that way it doesn't cascade into more and more corrections
But is that not what cmc already does?
that's what the cmc does yes
Then I don't know what's trying to being achieved on the night's previous topic, still thanks for the information
Hey there, would you please move something like this to #1054845120236757103 ? I would also be very careful with the Download link stuff.
Even if you "promise" it's not a virus, I hope no one downloads it, cause there is no way to ensure that you aren't having any malicious ideas here.
Best would be if you find yourself a proper service to host your game. If you plan on releasing the game, Steam is always the best option.
EGS could also work I guess. Itch.io would probably also be an option, but not sure how safe that is for the downloader.
thanks and you can check if it has virus or not by loading it on a virtual machine or something if you want to check but i gaurantee its not a virus
Yeah no one is gonna do that. You want others to playtest your game, so you gotta make sure it's 100% safe for everyone without anyone having to do any tests.
i am saying its safe
you dont have to do any test i said it because of your message
Can I say I'm a billioner please?
Please just post it to the work in progress channel with some more information and images of your project.
Don't want to derail this channel any further.
ok thanks
guys, I'm going through:
https://wizardcell.com/unreal/persistent-data/#persisting-data-across-disconnects
I'm trying to preserve player pawn during disconnected time. It seems to be working good, but I'm not sure what is the right way of making sure that new controller will posses the old pawn, and won't be creating new pawn at player start.
For that I explicitly call posses on the right pawn(I save information about it during the LogOut and also starting timer for pawn autodestruction there). But later on posses is being called again from restart process(see screenshot).
How to handle it properly? How engine will posses the right pawn if I'm not doing it myself?
There might be a better solution for this but I would recommend overriding RestartPlayer to decide whether to let default implementation spawn a new pawn or put your logic of possessing a previously existing one
currently I posses on Login
what it does in FinishRestartPlayer is:
NewPlayer->Possess(NewPlayer->GetPawn());
I guess it's the right pawn because I call Posses earlier
Well you're right it doesn't seem like changing the pawn if there already is one
I thought RestartPlayer would spawn a new pawn regardless of existance of one
If you want to prevent double possess call, you might want to just call Player->SetPawn(SavedPawn) instead of possess, as finish restart already calls the possess
But still, to me it feels like your spawn/posession logic is split between RestartPlayer and Login. I'd personally prefer them to be in a single function with a check to whether continue with an existing pawn or spawn a new one from scratch, just for the sake of readability and maintainability
Do you have any visible gameplay problems with your current approach? I don't see any possible critical issue other than just having an unnecessary second call
Most of the stuff are checking whether the incoming pawn parameter is different than the one already set to do work
well, I do some delegates binding in posses function, potentially it can lead to something nasty if I double bind it
Possess or OnPossess/ReceivePossess(Or Possessed for BP)?
In OnPosses in my PlayerController implementation
Ah if you directly override it then yes that would work twice
Then I'd suggest either checking if your delegates are bound already or calling SetPawn instead of Possess on GameMode::Login
Well there is one more thing though, if you're keeping your pawn still and visible in world, RestartPlayer might change it's location to a random PlayerStart as well
It's not doing it for some reason, Pawn is where it was
Hmm I'd expect it to find and set a new transform for the pawn 🤔 But if there isn't any problems then nvm
neet to see shipping package first 🙂
PlayerController->ChangeState(NAME_Playing);
PlayerController->SetPawn(OldPawn);
I also had to do this, otherwise it's go funky in spectating more by default :/ not sure if it's safe or correct, but on posses do it inside as well
Hey, I'm having an issue when using serverTravel, When I go from one map to another the characters don't spawn. Any ideas?
see if you forgot to place player starts there
Weirdly it works when I go form my lobby to a gameplay level but from gameplay level to gameplay level the characters beomce un possesed after they spawn I think
I should add this also only seems to affect standalone in pie it works fine
if it unposses then posses them again in the next level
starting at what Actor/Component function is replication ready ?
for eg can i check for authority in postinitcomps
Hey
Anyone here experienced with Replication Graph?
Traying to implement it on a Game in which the camera and the Pawn are not in the same location and the calculations seem to use the camera always as the reference point, but I haven't been able to change it, even by overriding the GatherActorListsForConnection in the UReplicationGraphNode_GridSpatialization2D
I look into IRIS as an alternative, but is not feasible for us since we are not currently using the Source engine and would like to see the results with RG first before trying that approach.
You need to put the pawn into a node that marks it always relevant for the owner
So it's gathered and replicated to that connection
Mmmm, that makes sense! I think I missed that. I'll give it a try. Thanks!
curious to know this as well
CMC only does it for the player you are controlling. Rest of the proxies are interpolated using replication
plus in a real rollback system, all calculations done on server and client are deterministic. So you just need to send the input to the server and then there's no need to worry about getting different results on different machines.
@thin stratus @pallid mesa I think the next community resource I make is going to be actor based TIP [Turn In Place] because I want to kill Epic's mesh based TIP with fire. Its cancer and it pervades every project because Lyra uses it. Its an awful technique that is the TIP equivalent of the newbie programmer thinking their delay on begin play works to get a player controller.
Instead it:
- Fights the sim proxy's mesh smoothing
- Forces you to use inferior linear rotation smoothing
- Forces you to use the inadequate linear translation smoothing that simply isn't good enough because Epic didn't separate them out
- Or, separate them out yourself, which is a lot of work, and the code is one big cobweb that you have to re-learn every time you look at, and adds uncertainty and drastic time for isolation if you have sim proxy issues
- Causes jitter on sim proxies
- Has to be compensated for in every single animation/locomotion system you make
- Causes issues with a lot of procedural systems esp. involving sockets and race conditions with the anim graph's rotate root bone node
- Pervades your anim graph
Whereas actor based TIP:
- Has no issues whatsoever
- Can be tucked away almost entirely in code
I already have the completed solution, you just make a call from FaceRotation and I think PhysicsRotation (haven't looked in a while, it just works)
Once I integrate for actual game I'll make any changes that come from using in production then release under MIT
TIP?
Turn in place
Apologies, someone from work just called that out too 😄
I spent hundreds of hours, literally, developing TIP systems
Mesh based TIP was unfixable, in the end I realized the problem is that I was using Epic's solution without questioning how I'd design a TIP system if I had never seen theirs
Wait Lyra just rotates the mesh and not the actor?
Yeah.
What the fuck
They basically offset the mesh when you rotate the actor, so that it appears to stand still
And then they decay that offset based on the curve from the turn animation, which plays when it reaches a threshold
My solution isn't too dissimilar in essence, I hold the actor's rotation...
Because with theirs, the sim proxy keeps trying to smooth the rotation on the mesh that is a result of their offsetting the mesh, which causes it to jitter
And then because the mesh rotation and actor rotation are unaligned, every procedural system now needs to query the offset and account for it. And exponential rotation smoothing becomes unusable, because it needs to be linear because the actual mesh is offset linearly. Exponential is required for adequate translation results. But Epic didn't separate them out. Now I'm repeating the bullet points tho.
@potent cradle you have lived this problem 😄
Hello everyone,
I’m currently developing a game in Unreal Engine 5.5.2 that will support 12 to 16 players. I have prior experience with offline development, but I lack knowledge when it comes to Unreal's online features, and I haven’t been able to find sufficient resources on the topic.
While conducting tests on a listen server, I’ve encountered issues even with just 8 players. The ping increases significantly, and the character movement appears somewhat erratic. I haven’t experienced such issues with other engines. For instance, when running a similar test in Unity, I was able to optimize and manage it much more smoothly.
However, my project is based in Unreal, and I generally prefer using Unreal Engine. I’m trying to understand the root cause of this difference. Is this issue related to the default Character Movement component? Can it handle my needs with some adjustments, or would I need to create a custom system from scratch?
I’d greatly appreciate any guidance or advice from someone experienced with Unreal's networking system.
Thank you in advance!
Unfortunately you are simply in the learning stage of Unreal
And at the stage you're at learning-wise you don't have the knowledge to make a multiplayer game
Start with Cedric's networking compendium but I assume you have already, its pinned here
For character movement you can look at my PredictedMovement repo which is also pinned here; it is getting a huge update currently. Character movement needs to be predicted, so standard replication is inadequate, you will get latency delay with every input/response and the prediction will fight it, which is what you're experiencing. When I complete the update there will be a blueprint friendly version you can inherit which will give you:
- Sprint
- Walk & Stroll (a slower walk)
- Prone
- Aim Down Sights
- Modifiers: Boost, Slow, SlowFall, Snare w/ partial client auth because its applied by server
Modifiers have multiple levels (e.g. boost level 1, boost level 2, or slow levels based on the type of weapon you have, etc.), and can be local predicted or server initiated w/ partial client auth so that when receiving from the server you won't de-sync horribly. Its seriously robust
And you can reproduce their templates to add other movement abilities.
how are you testing this? all on one machine?
Sorry I edited that quite a bit, I'm still in the process of creating it so don't have info on hand already typed out
Oh thanks, I'm having a lot of trouble finding resources. Do you have a resource hub you can recommend to me?
Just go through the pins on this channel, they are good
You will want to learn #gameplay-ability-system too, the pins there will also help
Between CMC and GAS you can make an entire character based game top to bottom
But I should warn you, I've been in this industry for years, I'm paid reasonably well to make games not unlike yours, and I wouldn't touch your concept as a solo dev in a million years because I've seen what people who have skills I'll never have do to make the stuff I make actually playable for players
Esp. in the devops space
We conducted tests with 8 different computers in different locations, but issues occur even in Unreal's default starter project, and the ping is really high, ranging between 90 and 140.
I think you should do it as a learning experience regardless
Esp. for the purpose of learning CMC/GAS
But if my plan was to release a finished product it would be tiny as hell lol
The more experienced you get the more you learn that
The newbies make MMOs and the veterans make pong (not really)
I only learned what I learned by aiming for the sky tho, so again, go ahead and you'll learn
Just don't put money into your game 🙂
Haha Very true,
But Unity's resources are very clear on this, and I can optimize without experiencing such issues, that's why it felt strange to me.
I haven't used Unity in over a decade and when I did, I was a newbie
So I don't know exactly what Unity offers
I know their networking tools were completely lacking and gave you nothing character-wise
And I don't know if they have net predicted character controllers already written for you
But if they don't then you're likely experiencing 0ms replicated netcode which can't function in production
I didn't even know unity had networking
These are the settings I use during PIE
It gives me ~150ms (use stat net to see)
You can't test anything with 0ms
I'm from NZ and connecting to our US West servers gives me ~180-200ms which is extremely useful as a dev because I get the worst issues in the worst way possible, reliably, which means I go and fix them or complain and get them fixed
Our QA team even has a bit of pkt loss so we see unrecoverable de-sync issues and can fix them so they recover (or write it off as unfixable, but we know it exists and can ask players to run some sort of trace)
You need to test your code in real world conditions or you're going to have players complaining that its unplayable, because it will be
The crux of the issue you're having @odd gulch is that Epic have provided you a frankly amazing net predicted character that you don't understand at all, so their net prediction will fight your replication
You gotta learn CMC
It works in the real world, unlike nothing in Unity 😄
Just kidding, had to do it
Also use p.netshowcorrections 1, it will draw a red debug capsule where the client was located, and a green debug capsule where the server moved it to during a correction
Probably with latency simulation and that command you will see a massive amount of debug capsules drawing that coincide with the jitter you've been experiencing
At least then you can clearly see when it occurs and work on fixing it
As far as I know, they are currently using a more innovative system than Unreal, but I'm not sure if the issue is entirely about that. Unreal uses a lot of unnecessary replicated data outside of my control. For example, it keeps sending the character's scale information even though I've made changes related to this in my game, and this still works as replicated. It uses many things in this way. In Unity, however, since everything is more editable, I can more accurately control and manage what should be replicated, but Unreal requires a bit more effort. But you can be sure that I will check what you said and take a look.
OISADUYGPASDDSF
Unreal has the best networking you'll find anywhere, its extremely unlikely that Unity's is more innovative, but I'll leave that for someone like @fierce birch to answer because I don't use Unity. If he wants to
If the scale isn't changing then it's probably not being sent
It definitely shouldn't be replicating if there's no change
I mean, if you replicate FTransform, you should only get the stuff that actually changes being repped, but when you receive the replicated FTransform due to a different property changing, you'll still see the last value
Maybe there's something dirtying it somewhere?
I don't use Unity, I'm an Unreal user, but the network has been a bit exhausting. If I solve the network issue, I can almost say that my game is ready for packaging.
IDK, I haven't experienced anything like that, I don't think it's part of Unreal at least 😄
Also - keep in mind, Character/CMC is old as heck. You can always write your own stuff. Nothing is stopping you.
Unfortunately I think you're going to find that your netcode requires rewriting a large amount of the game
Hmm Okey ı understand
I want to replicate a struct FMyStruct which contains a few FVectors. Do I have to append the USTRUCT() macro to FMyStruct, for it to work in the replication? The struct is member of a APawn
Another thing to keep in mind - UE is working on a new networking model. Iris.
Nooooooooooooooooooo
And also keep in mind that Character/CMC is phenomenal, battle tested, and the average dev couldn't write something better in a million years
😉
I understand its monolithic which sucks, but it's really not much of an issue once you've learned it
If we solve the issue, we can adjust some parts, it's not a big deal. Thank you for your help.

Oh, I don't mind the CMC personally. (Unless I'm trying to get a bajillion zombies)
Oh yeah I know you have no issue with it, just clarifying for others 🙂
Writing your own character would be a good learning experience but never worthwhile for 99.9% of devs making a game. Also at that point, you'd be better off bringing Mover up to parity like Cedric has been doing for his client, which seems like an astronomical amount of work
yeah I don't really want to 😄
Unity's netcode side is a mess
(and I'm not really expert on the topic)
I've recently looked at unreals physics prediction and.. well.. it seems like a mess too
Yeah unfortunately it is a mess
Its the new NPP plugin that Dave Ratti started but left part way through and I guess someone else picked it up, its very new and probably unfinished
Mover uses it for better or for worse
That means it'll hopefully get cleaned up lol
Or both will be ditched 😛
IDK what Epic's plans are regarding Mover, esp. in the context of Fortnite
also new modular vehicle relies on it
and is probably main reason why it's so glitchy
push^
I feel bad for you focusing so much on vehicle physics
The most neglected side of Unreal since Unreal 😄
I don't really rely on anything Unreal does for vehicles
you can't
it's impossible
but I do check what they do with it
I will stick to rewriting CMC to have boxes instead of capsules
And angular velocity
For my arcadey vehicles 😄
At least Epic finally added arbitrary up vectors
To my knowledge, yes.
they actually have physics programmers now with vehicle experience, but they still don't manage to package it in functional form
They probably suffer from the age old issue of being IGNORED by everyone not involved in vehicles 😄
Which reminds me - @signal lance will your plugin be networked?
Yes, no prediction on launch but it will get it in an update
Because I need it myself 
You'd be the hero of so many people if you made an actual vehicle physics plugin with actual prediction
Sweet. Now I really can make GTA in an hour 🤩
Oh it's getting prediction 100%
I messed with implementing prediction over the years and had a working prototype ages ago on physx, Chaos now makes it a lot more doable
Assuming it ever actually releases that is
is it a problem, to create header files from within visual studio, instead of using the cpp wizard from UE-Editor? I feel I always run into wierd problem, when I do it
No but visual studio will put your new class into a temporary directory by default and it will get deleted or not even built
what im seeing, confirms that, thanks
OnlineServices is "OSSv2"
And for that I believe only EOS is supported and "OnlineServicesOSSAdapter" translates OnlineServices into OSSv1 calls
And then I think the VoiceChat interface exists because Epic used to use Vivox for Fornite before switching to their own system, both implement the same interface
Could use a sanity check:
- What is the difference between Net Load on Clients and Replicates when it comes to Actors? I can turn off Replicates on an actor, but turn on Net Load on Clients, and the Actor will appear on the client's instance. What does that even mean? Am I notifying the client of the existence of the Actor at map load time, but not replicating it ever again from that point on?
- I'm pretty sure this is true, but I want to make sure I didn't hallucinate this: BeginPlay is run on every instance where an Actor is replicated, there's nothing about BeginPlay that is server-only?
- Never looked into it. I only toggle net load on clients off on trigger boxes personally. Haven't wanted to do it for anything else.
- Correct.
Write the docs for me and it might release sooner 🤣
Give me it and I might
You get it for free and in exchange you write the docs 🤝 
"For respect to UE and its ecosystem, this plugin has no docs. Good luck!"
Are there some common issue for ServerRPC not getting invoked on the server (common, as in, beginner mistakes)?
ABunny : APawn
// Bunny.h
UFUNCTION(Server, Unreliable)
void ServerRPC(FBunnyProps InProps);
// Bunny.cpp
void ABunny::ServerRPC_Implementation(FBunnyProps InProps)
{
UE_LOG(LogTemp, Log, TEXT("Executing on server.")) // I do not get this log on the host
}
void ABunny::Tick(float DeltaTime)
{
if (IsLocallyControlled())
{
if (!HasAuthority())
{
UE_LOG(LogTemp, Log, TEXT("Requesting ServerRPC.")) // log is shown on the client
ServerRPC_Implementation(FBunnyProps());
}
}
Super::Tick(DeltaTime);
}
open for other suggestions as well, if you see bad practise anywhere
You're trying to call it on a client that does not have network ownership of it
thanks, looking into it
Are some networks simply never going to work when it comes to player-hosted UE sessions due to the nature of the connection? E.g. even when using the Steam networking layer, is it possible that you won't be able to join or host UE sessions if you're on cell phone network? Not an expert here, but I think there might be something tricky about NAT on these types of networks since you're sharing IP with a big group of people all connecting to the same tower. I think.
Here's what Perplexity thinks on the subject.
Help, RepNotify of variable being ignored if set by server too quickly, even if on different actors.
If the server sets a Replicated variable on an actor, it needs to wait a few milliseconds to set it on any other actor or on the same actor, otherwise the client does not receive the information.
It seems to have a minimum replication rate, but it is very slow.
There is a net update frequency, actors replicate at an interval meaning quick updates on the server won't all make it to the client
What's your scenario in this case?
I think I do have ownership. Im just getting kinda confused by something else. I start up 2 instances of the game in standalone mode.
Then I start a host session on the external instance.
I use the PIE instance to join that host.
Now I see the world in the Outliner (which I would normally expect to see, when I host from the PIE instance. If I do host from the PIE instance the outliner is empty)
I also see the logs in unreal, which come from the host (with the host being the external instance). When the host is PIE, there are no logs I would expect from the host...
this is soo wierd
will not recieve which information?
the last or the first?
I think I do have ownership
Don't think. Confirm.
I spawned multiple actors and assigned a ID, but only the first actor replicated the variable to the clients. I needed to create a mod version of the "For Each Loop" graph to add a delay.
last
setting a replicated variable that never actually gets replicated seems weird
you're sainy you set ID to say, 3, then 4, and the clients ONLY ever see it as 3?
I think I discovered a problem, if the value is 0 it doesn't work, and it was the first actor in the list that is replicating, not the last.
show more of that code
It depends on the logs :c
I do have owner ship, because I never see the log for if (!HasNewOwner()) UE_LOG ...
But I dont know which instance that statement belongs to
What is "ABunny"?
A Pawn which can jump
Or rather, the default value of the variable is 0, as the first item in the list will set it to 0 again, the client does not receive it as it would supposedly be a duplicate set, It's like preventing duplicate replication of value, even if it was the first time.
Does the player control it?
yes
How?
why would that matter? The value is correct
InputActions + AddImpulse (dont see how this is related to logs tho)
just do the onrep logic at begin play to catch that case
So you take possession of it with the player controller?
I did not do that explicitly myself. Maybe the default inplementation of GameMode does that for me?
I'll try leaving the default value as -1 and see what happens when the server sets it to 0.
So it is your default pawn class?
it is
Yes it does
default GameMode will spawn and possess DefaultPawnClass for you
UE_LOG - if it is the standalone - does not write to a log if I recall.
If it does - you need to check the logs of where the game is running. I don't recall where those get stored.
Because I was making sure you did have network ownership of the pawn before trying to call a server rpc
Or just do something more useful than a UE_LOG
Did it work when you were running 2 PIE instances?
I mean, I was not explicitly packaging the game. I do use the PIE with Number of players = 2.
But one instance runs in the editor and one externally
with the NetMode set to standalone
There was on option somewhere, which I enabled. But cant remember where it was.
It said, instead of starting an instance within the UnrealEditor, it will start a seperate Editor for each Player
@dark edge Yes, that was it, As I am using the "Rep Notify" function when the server sets the variable, if the value set is equal to what it already is, the replication does not happen.
found it: https://cedric-neukirchen.net/docs/multiplayer-compendium/start-multiplayer-game#run-under-one-process
it was called run under one process. Its disabled for me, and launch separate server is also disabled
Replaced it with the on screen messages. I do not have owner ship on the client who is invoking ServerRPC
thanks for you time and help
For those interested:
Issue is this line ServerRPC_Implementation(FBunnyProps());
Dont call the implementation, call (i assume auto generated) ServerRPC(args) instead
BTW the repnotify route worked perfectly! Thanks y'all for putting me in the right direction a few days ago.
hello, i have a few replicate actors, that belong to the level, i'm trying to override IsNetRelevantFor, for a few actors i have. But it's not being called.
anyone has any idea what could be the issues?
i have overriden that function successfully on the pawns though.
I've been trying to make inventory systems, found "PyroDev"s inventory tutorial, and it's been flawless, but it's a singleplayer setup, and i'm trying to make it work in multiplayer.
I set components and items to Replicate = true, but when I set the parent item to replicate, it not only doesn't mirror item pickups in multiplayer, but the deleting actor on pickup completely stops working as well. The item is still added to the inventory.
The part that stores picked up items is a String Map Variable, which apparently can't be replicated, so maybe the issue lies here? Or maybe I just don't know enough about making things MP aha. Please let me know if providing pictures of specific functions or components would help identify the issue!
Or maybe I just don't know enough about making things MP aha
This is the reason
Multiplayer is one of the hardest things to do in gamedev.
If you are using a tutorial that wasnt designed for Multiplayer, you are not going to have a great time with it
You dont make a SinglePlayer game and then convert it to Multiplayer, its just not a viable thing to do
Multiplayer almost requires you to start with it in mind
Its not an after the fact thing you just add later.
You either make a SP game or an MP game from the start.
And design/implement features accordingly
And it's a lot easier to make MP centric code work SP if you need both
I've had issues with all of the tuts for MP inventory sytems i've found, I was hoping if I started early into making this invo system, I could build it with MP in mind, but struggling to make that happen
Then you just need more practice on probably less complicated features
Inventories are not an easy feature to get right either
I've been finding this out quickly aha, but I need to do it
You need to crawl before you can walk.
Following tutorials is the best way i've found to learn new systems - it might take a few attempts, but once i've built a working system, I can go through it and learn exactly how and why it works. Unfortunately, most invo tuts are slightly outdated and it's all pear shaped before i'm halfway through, and while this tut is flawless, it's also not geared for MP - If i'm walking here, how do I crawl?
Try to do something fully on your own, or at least from a tiny prompt
just a small mechanic, like "abilities as actors" or "inventory system with an inventorycomponent and the items just being structs"
I actually took that advice 🙂 Got chatgpt to explain the difference between maps and arrays, and now reworking it to use arrays instead 😄
ChatGPT is just as bad at providing guidance as Youtube tutorials.
If not worse.
Use caution
@undone kiln fyi setting replicate to true is just marking the object that it can be used to replicate
It will not replicate anything magically
Spend some time with pinned material in this channel.
Although if you just discover array and maps, diving to multiplayer is too early
Why not work on single player game for your first game. Maybe you can release your first game because they are way easier
imagine if chat gpt was the youtube tutorials all along
🧑🚀 🔫 🧑🚀
Might replicate a whole bunch of useless stuff actually 😄
Has anyone ran into an issue where the object on the server is in the wrong place? My character's weapon is not positioned in the correct place. I'm firing off a red debug line from the weapon on the server, and a green on the client:
If it's dedicated server and weapon is attached to the character, is it possible your character's bones are not updated correctly on the server?
It is dedicated server. I didn't know I had to update the bones on the server. What would that look like?
There is an option on the character to update bone locations in server too (I don't remember the exact name so give me a moment to check). I'm not sure if it's caused by that though, it looks more like some kind of an offset rather than character T-posing in the server
Can you update the value to this on your character and test again?
Thats already the selected value
Well, that was my only bit
No prob, thanks for the suggestion. I'll dig around the spawning/attaching/animation stuff. It has to be something in there somewhere
Hey, am I safe by using network prediction plugin by unreal engine or is it still not recommended to use, and I am better by doing things on my own? I heard fortnite uses it, so that is why I am asking
one sentence horror because I'm sure there are youtuber tutorial creators using chatgpt for their work
Can't recommend it
I also don't think Fortnite is using it at all, they seem to be leaning pretty heavily on the physics based character stuff now
If Mover has some kind of kinematic liason you'd be better off with that IMO
I don't really know what Mover is... going to investigate it
Mover is "ok" but has some questionable decisions of it's own, whereas I would describe NPP as rotten to the core.
If you can do what you want with CMC, just stick with it.
Doing things on my own might just be better no?
Unless you want a great source of technical debt
bold statement to say 

I just wanted to do simple things. My game wont be an fps or physics based. I was just asking out of curiosity
Could you recommend me any article about client side prediction so I can have a read? I just want to eliminate the lag on the client. The game will be a casual coop
The recommendation from me personally is predict as little as you can get away with
Movement is one thing, predicting game state is another entirely
And CMC already deals with movement for you
GAS can (to some extent) deal with gameplay prediction too
Plus it's also pretty quick to work with once you get your head around the core concepts
Yeah, I was looking forward to use GAS but never used it on multiplayer, but as far as I know it doesnt do things entirely for you
If it's a basic casual co-op game that might be more than you even need
GAS is designed for multiplayer
And don't let the name fool you, nothing does things entirely for you, NPP included
eliminate lag is probably the wrong word
client prediction just means, you do the action locally first before you inform the server about it
think about deducting ammo count.. you don't want to wait for server to give you the actual number
Yeah, right now I was doing the inventory system, and I was implementing inventory management and I want the UI to be responsive but I need to replicate everything to avoid dups
if you have 300 ms, you will wait 0.3 second before you see your ammo count changes
Sorry to interject, my inventory system now works in MP, with the caveat that it refuses to destroy actors once they've been added to an inventory, if anyone has any ideas there
so what you can do instead as client, you can just change the ammo count the moment the fire function is called
example of action you gonna predict?
ofc there are a few edge casses you have to addres but it's not complicated
@lethal wraith here's example of client prediction.
Press V -> Play Montage -> Server Play Montage
there you go, client already predict
Yeah, but for example, I call a reload function lets say. I execute on client and immediately call on the server, how do I then compare the states?
how can the server compare with something locally
I don't do FPS but I wouldn't client predict reloading
ammo count is different though.
Client Fire -> UNprocesseseRPC++ -> Change ammo count -> ServerFire
for example a simple drag and drop, I need to sync the position of the item in the item array in the server
yeah, just giving an example, I am not actually doing a FPS
try to understand the concept first
doing it in your inventory system isn't a great way imho
do a small exercise
then move forward from there
why not?
why chose more complicated environment when you don't know how to do it in simpler level?
doesn't really help you understand imo
you mean it because inventory is something that can have bugs that one can't "see"?
Just go client predict changing a material of a box
its alright I will try to play with it on an empty project
if you can't do that, why trouble your self with inventory action where not everything should be predicted
my advice would be to fix these things only if they are actually a problem
how does ordering of items affect other players? If it doesn't then just do Always trust player approach.
Predicting things adds masses of complexity, sometimes needlessly
There is also that angle tbh, if it's casual co-op and you don't care for cheating, client-auth it
I would usually not say something so unspeakable
Imagine I have a chest grid and an inventory grid and I want to swap items between the inventories. That can lead to a desync if I change the position locally but not on theserver
if other players have access to the same chest grid then don't predict it
just accept the lag imho
Also, misspredicting is usually far more noticable than latency
Because then you have to rewind and correct, suddenly the game didn't do what you already thought it did
That's usually MUCH more visible
Yeah, cheating is not the problem, I just dont want to introduce the delay in the user action, but yeah, u guys are right... maybe a small delay wont be an issue in this case
the issue doesn't only lies with cheating
But, in the situtation that I gave before. Isnt updating the position of an item in the array acceptable? I am just saying because I dont want to introduce desyncs
Just trying to avoid bugs, by always having the same array in the server that I have in the client
Right now I am just calling the delegate that updates the required slots on the OnRep function of the inventory array
But that introduces delay in the UI which is not ideal
I've done that kind of prediction but it's not simple tbh
Hi, im well confused.. I'm having an issue with my pre lobby widget, whenever a player joins the session their BeginPlay of their PlayerState calls a dispatcher on the GameState called OnPlayerJoined which is bound to on the pre lobby widget so whenever a player joins the session the pre lobby widget will creates a name card widget and add's it into the players list. This part is working fine, both client and server see's the correct player card widgets created, however the issue arises when a player leaves the session.. their EndPlay event on their PlayerState calls a dispatcher on the GameState called OnPlayerLeave which is bound to on the player name card widget so whenever a player leaves, the name card belonging to that player removes itself. This is working on the clients no problem they see the correct name card widget get removed however this doesn't happen for the server player.
Now the reason i think this is happening is because when a player leaves the session there is a Begin Play event getting called on a player state (somehow???) before the End Play event is called so it only appears that the server doesn't remove the player card widget of the player who's just left because when that Begin Play is called it calls OnPlayerJoined which creates another player name card widget.. I confirmed this by 1. adding a print statement to the PlayerLeft event to confirm the server player is def calling remove from parent which it is and 2. i stopped the 'OnPlayerLeft' call on the EndPlay event so it doesn't try to remove any player card widgets so then when the player leaves it creates another player card with their name on it.. because of this BeginPlay call, but i dont understand how that BeginPlay is getting called when the player leaves the session? Any ideas?
Also on the EndPlay i have tried it a few different ways.. ive tried it with a switch has authority node, but that just makes it not remove the widget for anyone.. ive tried it with a RepNotify called HasLeft which then calls the OnPlayerLeave dispatcher which removes the widgets from the clients not the server, ive tried it with a server rpc which does the same as has authority node and ofc calling the dispatcher directly which works on clients
PlayerStates should be living longer on the server as a reconnection support to give back the old PlayerState, so you can get their previous states to make them continue where they left off, that might be the reason why your EndPlay doesn't get triggered on Server
On server, their replication is turned off (hence they should get deleted from clients and trigger EndPlay) and they're kept in an array called InactivePlayers in GameState, just like the PlayerArray
After looking at the engine, apparently the PlayerState of leaving player is duplicated and the actual PlayerState is being destroyed, instead of directly saving the existing PlayerState
The EndPlay event actually does trigger on the server tho as far as i can tell, it calls that 'Remove from Parent' on the PlayerLeft event on WBP_PlayerNameCard because the print statement prints, but its that extra BeginPlay call causing it to not remove it I think
theres 2 players in that lobby, so how can there be a PS_PreLobby_C_0, C_1 & C_2?
Also not using c++ so cant access that InactivePlayers array
Hmm, GameMode calls PlayerState->Duplicate() to save to the inactive player array. That might be where the BeginPlay is coming from
Can you set this to 0 or something low in your GameMode (it should be inheriting from AGameMode, not AGameModeBase for this) to see if after that time your second created widget is also get destroyed (because I'm not sure whether your problem is actually this or not)? I'm going to check if it's possible to determine whether a PlayerState is for an existing player or an inactive player for BPs
Okay tried that, setting the life span to 0 didn't do anything but setting the max inactive players to 0 makes the widget get removed on the server as well, although it is still calling the BeginPlay of a PS_PreLobby_C_2 despite their only being 2 players in the lobby, but its also now calls PS_PreLobby_C_2's EndPlay event so its removing the widgets, however that is giving me some errors in the editor now because PS_PreLobby_C_2 isn't valid
Still no idea why it makes another player state out of thin air lol
Gonna test it properly over steam to make sure
Ah right, InactivePlayerStateLifeSpan is used as NewPlayerState->SetLifeSpan(InactivePlayerStateLifeSpan); so it would make it stored infinitely if set as 0
Unfortunately they implemented in a way to create and store the duplicate first and then check the MaxInactivePlayers to remove it if exceeds the allowed number
This is going to be a workaround to not touch cpp but maybe you can try to add a check on your PlayerState::BeginPlay to see if it's server (IsServer() or HasAuthority/SwitchAuthority) and GetOwner() is not valid
Something like this
Blueprint Runtime Error: "Accessed None trying to read property CallFunc_GetLocalPlayerSubSystemFromPlayerController_ReturnValue". Node: AddMappingContext Graph: EventGraph Function: Execute Ubergraph CBP Cj Blueprint: CBP_cj
why am i getting this error
Are you doing this on begin play ?
i didnt even touch this nodes
when i unplugged output of receivecontrollerchanged event
there was no error
and no movement
no input*
Just as a note. You could simplify this code insanely if you used a Listview instead of creating and managing widgets manually.
Do a IsValid check on new controller
It should fail the cast if it wasn't valid though
I think CallFunc_GetLocalPlayerSubSystemFromPlayerController_ReturnValue refers to EnhancedInputLocalPlayerSubsystem node's return value rather than the controller itself
i did it is valid
then i check cast failing or not
also cast is successful
Was this a pawn event?
Do a is local controller check
yes bp_thirdpersonchar
Yeah that's what I was going to say, if this is running on server for a client's pawn, it's normal it doesn't have a LocalPlayer Subsystem
how can i do that
its locally controlled
gys theres a problem when i package the game and someone logins and it opens the browser it says to the user application acces is restricted which means only members in the organisation can login. But it shouldnt happen in a published game beacuse then how will people play my game. Please help
Is this somehow related with EOS and EGS?
Anyone else notice that AGameStateBase::GetServerWorldTimeSeconds() actually returns weird af values when scrubbing replays during demo playbacks?
well its related to multiplayer
What I meant was if you're using EOS subsystem and trying to login from Steam to dev sandbox, you need to save steam ids as player group to allow them. It shouldn't ask for it on live sandbox though, just a protection for dev sandbox
ohh sorry
thanks btw i also have another problem
i made a game in which character have a paddle which can go up and down , but when the clients joins in the session the clients character apears to be shaking up and down but the servers character is alright
how can i fix it
Hey, I'm playing around with the Network Profiler, and I'm wondering, are there any "official" benchmarks on what constitutes a good replication performance? Like here in this screenshot, I let 10 AI-controlled characters run around and profiled them for a while. I see my ActorReplicateTimeInMS is ~ 0.15ms, which I assume is... good? bad? expected?
Are there any benchmarks like "If you have ~1000 replicated actors, an average acceptable ReplicateTime is X milliseconds"?
Is 0.15ms for 10 character replication too much to raise an eyebrow? That I don't know.
But personally I'd say the definition of acceptable would depend on your project and target frame time, from what I've seen around here with this kind of questions. Are you below your target frame time even if it eats up 5ms? That's still acceptable. Is your most crucial logic eating up most of the frame time or bandwidth? You build your game around it so let it be, as long as you're still below your targets
Thanks for the advice
I see, yeah that makes sense of course. I'm mostly worried that down the line my ReplicateTime is slow enough to impact performance, and me not knowing this because I don't know what the "normal" ReplicateTime is for a game my size. So let's say I don't hit 60 FPS and don't realize that my replication is a big source of error since it takes up too much time.
But I guess I'll figure it out when I get there.
You can also profile with same amount of empty/without logic AIs to define your base value and see how much more you're putting on top of it to see if there is any room for you to shave it off
Which again can understandably raise the question of "is my stuff adding 0.1ms too much or not". But could at least give you some understanding of it over time to say "hey I've never seen this much of an impact before, let's see if there is anything to optimize"
Yeah, that sounds like a plan to at least have some data to compare performance to, thanks!
Appreciate your help with this mate everything is working properly now 🙂 I would of never of guessed that about the game mode storing the player state for reconnections.. this has been doing my head in for days 😂 if I could pin this I would
Interesting, ive not used those before so will have to look into them
It allows you to effectively update the entire list by just doing this.
No manual widget creation code and whatnot. You make a listview entry widget. And one gets created for you, and you can override it's init event. You'll see an example of it when you look them up. You'll cast the object it gives to PlayerState, and you're good to go.
Hey guys, I have a question - if I have [an online] coop game where both players should always be together, i.e. on the same level and/or sublevel, is there a way to trigger a level switch in Unreal 5 without losing the client's connection?
I tried using OpenLevel but of course the client DC-ed, which is not what I want.
I've seen online some people post about using sublevels; is that really my only option?
You just do a ServerTravel
And make sure the GameMode you are on is marked for SeamlessTravel.
Otherwise the Client will disconnect and then reconnect.
Results somewhat in the same, but SeamlessTravel is "smoother".
ServerTravel in BPs is done via ExecuteConsoleCommand node
With ServerTravel <MapName>
OpenLevel is a ClientTravel, so that is, as you notice, wrong.
Hey awesome, thanks for the help! I'll give this a try.
How do you get the delta of 2 array?
I have a function AddCharacterToParty(actor Inactor)
Team Array.Add(InActor)
How can I get the actor being added on TeamArray onRep?
I can just loop the old and the new and find mismatch but is that the only way?
Kinda yeah, unless you use a FastArray I guess.
^
The OnRep can give you the old value fwiw
if you dont care about order, fast array would work for that
It is, however, really not that bad to just loop the arrays a bit
Epic does that in several places too. I doubt you have that many entries
as long as the array isn't massive i doubt it would matter
Pretty sure I did that too somewhere. That was when I learned that marking some elements of a Struct as NotReplicated can be a real headache
I think I had some custom Cooldown setup for GAS with prediction and buffering etc.
And some properties of the Array containing the Cooldowns were not replicated on purpose.
Turns out, when the Array shrinks due to removing, e.g., Index 0, it doesn't fully move Index 1 to Index 0 on the client, but just fills in the replicated properties and leaves the non-replicated the way they are.
Took me a bit to notice that
oh, so it doesnt even zero out the non replicated properties?
Nope :')
gross
0: { RepString: "Foo", NonRepInt: 30 }
1: { RepString: "Bar", NonRepInt: 42 }
Remove Index 0 on the Server => replicates and becomes
0: { RepString: "Bar", NonRepInt: 30 }
Really yucky
I yeah, now I remember, I think I then wrapped the Array with a Struct, basically a Container.
And in its NetSerialize I handled that myself by serializing the new array into a local one, doing the compare stuff that ColdSummer kinda needs, and then reconstructing the actual array the way I was expecting it.
I love multiplayer.
Is this for any array of structs, or do fast array already deal with this?
I think they both suffer from that, but it's been a really long time since I dealt with this
Would it be correct:
You can own Actors as a client if you keep setting Owner as Player Controller that firstly spawned the actor and so on (possible to call rpc from them).
Actors that are controlled by AIController cannot be owned in that way (so you have to send Request to Player Controller first, so he can call something on server).
Hm yeah, but keep in mind that "stting Owner as PlayerController" has to happen on the Server.
I'm looking to implement a centralized system for managing items in the ARPG I'm developing in my free time. I want it to function as a global subsystem where item and inventory data can be stored efficiently, and the backend server can communicate with my inventory database and trade services asynchronously.
Since the server will handle key decision-making -such as determining when and for whom items drop- I believe it would be impractical to split this system across multiple components, like individual PlayerState/Controller instances. A more unified approach would provide better control and scalability.
I also want to manage communication strictly through Server, Client, and Multicast RPCs to maximize efficiency and ensure robust client prediction. I find it simpler to work, and predict, with in these types of systems compared to replicated UPROPS.
Soo, Is it possible to replicate subsystems or is there something I can do to achieve this kind of architecture?
I guess my central issue is that Server RPCs only works on owned objects.
It seems that no matter how you turn stuff like this, it is always required to proxy stuff though a client owned object.
Easy mode:
WorldSubsystem with an actor proxy. Have the subsystem spawn the actor and then just route stuff through it.
Could also do a component on the game mode or game state.
Obviously you'll still have to respect the typical network rules when it comes to doing server rpcs
Scratch the gamemode actually. Because you want multicast rpcs
Might look into that
It's how some of the other stuff UE does it. Like AWorldSettings and other things that are configuration-y stuff in the world.
Just curious, is there any reason for ownership being inforced so strongly? I (think) I woul absolutly love being able to just send request and handle them manually?
Rules of UE.
So no actual arguments?
Makes sure people can't do server rpcs on things that they shouldn't
I guess that makes a little bit of sense..
Do you know if it is possible to hook into something deeper and bypass it, or is that just stupid and i should obey the Epic gods? <3
I mean, I'm sure you can with enough digging. But I don't know where.
Would make mental motel sooo much easier,
I'd just obey the overlords personally.
I see that. Might look a bit into it though.
It would be fun to play around with. If it can be build on the protocols unreal already has in place effectivly. I think the ownership architecture forces some overcomplicated solutions, that could be drastically simplified in a few situations, like this.
Thanks for tips and helpfulness <3
Hey ppl, i have an actor on the level, and i've overriden IsNetRelevantFor but it's not being called. Anyone has ideas?
I've set multiple replication flags on the actor including SetIsReplicated. it works on the pawn, but not on an actor that's on the level.
What kind of actor?
well, i just created a new empty aactor that's even more barebones, and seems it worked. so maybe the other actor is failing for some extra work. thanks amberleafcotton.
don't bypass that
ownership is a needed concept to prevent easy cheating
Does anyone know if it is safe to access the GameState object (and any actor component attached to it) in the BeginPlay() method of any Actor on the client? Or could it happen that any Actor's BeginPlay() method is called before the GameState has been replicated from the server?
Begin play order isn't guaranteed, see it as random
Also the game state won't be replicated yet for sure
It takes time for server to reach client
This is true for anything on begin play
You always use OnRep to ensure that an entity is receiving the data
Trouble is that there's no OnRep or built in dispatcher to signal that the GameState is ready other than the BeginPlay of the GameState on the client.... You'd basically need to ensure that your gamestate Begin Play calls the logic required on such actors directly since those actors technically couldn't bind to anything to listen for when the gamestate is ready.... Which sounds like a bit of a pain since you somehow need to get those actors within the gamestate so that it can ask them to do something.
The alternative would be use something like the GameplayMessageSystem from Lyra where you can have actor just listen for generic messages, and then have the GameState broadcast using it to anything that may be listening. That means for the actors you can just check on their BeginPlay if the GameState is valid, if not, listen for the message, if so, just read whatever values from the GameState as you need or bind to other dispatchers that you may have on the gamestate.
And how about this? Jambax said the opposite: #multiplayer message
But I still felt the need to ask because I was not entirely sure. Couldn't find any official information about it, neither in the docs or the engine source code.
Also mentioned here: #multiplayer message
Can you explain why? If I where to bypass it, wouldn’t a simple token be enough to ensure people are who they say? That is how i have done it in other projects that use rest apis etc.
I was playing a bit with creating custom UChannel; which seems pretty straight forward.
If I send an RPC to the server through an Actor I don't own, the ownership check basically makes sure that I wouldn't be allowed to do so, both on the client side and on the server side. If someone happens to spoof their client to allow them to attempt to send the server RPC anyway, the server would still end up rejecting it.
So let's say we got rid of ownership entirely and I sent an RPC through another player's character - I could send something like a "Drop my Inventory" RPC on someone else's character - since the server can't validate the RPC came from the client who is supposed to be in control of that character since you've abandoned ownership, it would ultimately mean the server would probably drop the items for that character, even though someone who wasn't in control of that actor requested it. If you make your own system to validate who is requesting it based on a "token", you're basically just reinventing the ownership concept anyway and you would still need to ensure the token is assigned on the server first before allowing a client to make requests on that actor, otherwise you'd run into the same problem.
Can I read data from actor not owned by client, by getting PC, interface get info, there i check team settings of requester and PC, and this gives me player state I need, can I just read info without server rpc from player state?
He knows more than me but as far I'm reading I don't think he is saying the opposite?
Received doesn't mean replicated
You could very well get the gamestate beginplay but that doesn't mean it is already replicated.
Read what wizard says right after the comment
In general you can only be sure that something is already replicated with OnRep
Wdym by getting PC? Beware that client only know their own PC and no one else
As client you have your own world, your own instance. You can read what ever on your instance, there's no need or an ability to ask for permission
You would just be reading what ever data is in your world.
If you need to ask server, their data then you do use server rpc then server answer back with client rpc
Hi there, I'm actually reworking my inventory system and need opinions on something. So atm when a player pick-up an item it gets added to a hotbar/quickbar but it doesnt gets equipped. Internally we are creating the item actor (which is the one displayed in it's hands when equipped), BUT there's scenarios where a player will pick-up an item and NEVER equip it, so I was thinking to move the creation part to when the item gets equipped for the first time, I'm just questioning actually if a player with medium ping would see a difference (even in ms) compared to another player as this could be frustrating while fighting and switching weapons and having a higher delay.
i have a level actor that is replicated. i want to call multicast rpcs from the server. but they aren't being called on any client (only on the server).
can that be fixed or is it impossible?
the actor has a role "None" which seems odd to me. is just an actor placed on the level.
It should work, assuming the server the one calling the multicast
Also do note that client can't call rpc on actor they don't own.
So client getting that actor -> server rpc -> multicast will not work as the server rpc is denied.
yes, i have logs and it its calling on the server. but not on clients.
yups its called from the server itself.
which i find weird, because other things like a rotating movement with replicated setting works. but my rpc doesn't.
Show your code
I hope you don't rotate with multicast though
That do be the wrong way to do it
hmm not sure i can show the exact code.
https://pastebin.com/RKNipsLW this is the actor itself. the base test doesn't even have a movement component.
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
It's only a few nodes? If it's NDA just doddle one in empty project.
the rpc is more complicated. it's on a component that i can't share. i have that component on pawns dynamically spawned and it works. but not here.
Well what shown hasn't got any rpc in it.
Just make a new actor, and have server call multicast functions
Print string
yup that's what i said above, im preparing the code. give me a sec.
See if that work
that's pretty much what the function does.
@ripe lotus I mean u got a bunch of override there that I never touched
Potentially making it not relevant etc would yield unexpected result
If the actor is not relevant then I would guess the rpc will not get called
i didnt had those overrides and sitll didnt work.
and the actor is visible on the other clients, which it wouldnt if it wouldnt be relevant.
I can try after work
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
this is my multicast.
and like i said, i have that component on a pawn, and it has been working perfectly so far.
And how are you calling it?
i tried several ways, by a collider, by a callineditor function. and dynamically with other code.
i know it triggers because it triggers on the server. my log prints if its on the server or client.
and i've seen it print correctly with the pawn.
@ripe lotus sanity check, you omit the _implementation when calling the function right?
yups. good sanity check. have seen that.
void ANetTest::Multi_Implementation() {
UE_LOG(LogTemp, Warning, TEXT("%hs server=%i name=%s"), func, isServer, *GetNameSafe(this));
}
UFUNCTION(BlueprintCallable, CallInEditor)
void Test() {Multi();}
UFUNCTION(NetMulticast, Reliable)
void Multi();
i tried that. still only triggers on the server.
if i call it from a client's world, it's only from the client. so i know i'm triggering it on the right world.
yeah i know. but anyway. just to rule that out.
this on the pawn works, on a level actor doesn't.
i tried searching online but found nothing.
@ripe lotus and the actor already set to replicate?
I think it should work
(by this e mean a reliable multicast)
I will try after work
yup you can see it in the code.
thanks, don't stress too much. but i'd would help me to norrow if it's my mistake or what am i missing.
Hopefully someone else can clarify on the mean time
thakns a lot.
i've also tried setting the owner to the 1st local player controller on the listen server, on beginplay. but no luck.
@ripe lotus you shouldnt need to do anything on the client
Server call MC and everyone should run the function
Just to clarify its server calling the mc right?
I have yet to see the code that calls it.
Your Test() need to be called by the server
yes the server calls the mc. only the server gets the function. none of the clients.
the actor is replicated.
Try remove the line NetDormancy = DORM_DormantPartial; to see it work.
i've done that, still doesn't.
i've tried setting it to dorm_awake; too. both not having it and having it as awake makes no difference.
i tried with a cpp actor and a bp actor.
i trigger iwth a button, whenever i want. it doesn't make a difference.
You are running listen server or server mode?
listen server. why?
its working on the pawn. so i don't think that would be an issue.
Can you test this code to check if it work?
i've stopped working. i'll try tomorrow. thanks.
@chrome bay wanted to notify you of a typo in your burst counter article:
Ar.SerializeBits(&bIsIncrementing, 1);
bIsIncrementing should be bIsFiring from what I see
Does anyone know what would cause this lag in the editor? Network Emulation is off
https://www.loom.com/share/ad2a693e6b524cd49e2d780424da3294?sid=da646ad2-cdf9-4db8-bbb1-186d109127eb
Oh I should probably mention its the Mover plugin, seems to be movement related, but not sure what the deal it
is this due to mover having a buffer of saved moves or because of actual time across the network? you need to compare actual rpcs/properties timing here and not just where they are I guess
FWIW I have no clue how Mover works in detail but I can say for certain that buffering heavily and storing past values is an extremely common way to handle character movement replication
can't be network, cause its local on this machine. Could be buffering though
Looks to be a known issue: https://forums.unrealengine.com/t/mover-plugins-client-side-performance-is-quite-bad/2300283/3
Until they remove the Network Prediction Plugin as the basis for Mover it's not worth using IMO
NPP is a trainwreck
If thats whats causing the lag, it needs a lot of work
A lot of work is an understatement
I thought they had a kinematic liason for mover to treat it more like CMC, maybe that's not a thing yet
Hey, im only having this issue in the shipping server build. The server runs fine in test and development builds. What could be the problem? I tried running it with steam both on and off but the result is the same
Yes, but if you execute normal event, it is gonna execute on every player controller in the game right? and then inside pc is check if team=team, and the rest of code will actually run on server + on exact player state I want (where player 1 = player1 and player2 and 3 will be ignored), and question is if to read data from player state i need server, but i think i dont? event how to structure event (probaly would need to be function) to call rpc to just get variable?
Wait what
Wdym if you execute a normal event it's gonna execute in every pc in the game.
I think you are still thingking the game is one entity for everyone
It is not
We all run our own code with our own instance. It's the job of the game developer to establish communication to give illusion that your world is sync.
It's gonna execute on each local player controller
This isn't making sense sorry
Just out of curiosity, and I fully understand if you can't answer due to NDA, so no pressure. Are vehicles in HLL chaos vehicles with the default server-authority movement or did you create a custom client-side prediction for them?
I'm not on HLL anymore, they were and probably still are just PhysX vehicles with server auth
Thanks
Anyone has a link to the last UE multiplayer session? It was 2 weeks ago and I can't find it
I have another problem with replicated actors. Made the breakable prop actor which has components like static mesh ,geometry collection. Each instance in the level has applied other mesh, other properties etc. With this there is no problem at all until I want to spawn at runtime new actor from the template of another. On the server all properties are set properly from templated actor but client do not have them set properly because they are not replicated. There is a way to make it proper without replicating every property to the clients? It's a lot of data and I am assuming that I am doing something wrong
So I'm not sure if this will help you, but you might leave it as it is for the ''base'', and then inside this actor send request to the Player Controller. After taking Request Player Controller could call back to this actor and set properties only on his own client / only for himself. You would need to hold these properties in Player Controller though. I might be wrong but just helping to rubber duck the problem a bit 😄
do you need to use a seperate template actor? what if you made a blueprint class with the class properties set to what you need? then the server can just spawn in that blueprint
another thing you might be able to do, if the template is net addressable is pass it as a replicated variable and have the client copy the properties itself in an on rep or something
so should I have separate blueprint class for every breakable prop in the game? 😄 that sounds like a terrible idea 😛
What's dormancy is all about? I read the doc but can't quiet grasp it yet. How is it any different then making an actor not relevant?
Apparently it's one of the best optimisation one can do as well
Dormancy actually closes the actor channel, so the actor isn't polled for changes
https://www.youtube.com/watch?v=mT8VUVuk-CY I recently watched this, they talk a lot about dormancy
This week we'll be joined by Ryan Gerleve and Dave Ratti to discuss general server optimization in UE4, as well as techniques and solutions to improve your Actors' performance in a networked environment.
NEWS
Unlocking Breach’s combat with Unreal Engine
https://www.unrealengine.com/en-US/tech-blog/unlocking-breach-s-combat-with-unreal-engine
...
Ty
It's talking about all connections though. But isn't the dormancy set per actor? What is this "all channels" refer to
Dormancy is always for all channels, per-connection dormancy has never worked AFAIK
And yes dormancy is a per-actor setting
Making it dormant basically destroys the replication channel for that actor, destroys the history state etc, and stops it replicating to all clients - but only once all relevant clients have acked the latest state.
There are drawbacks
not for every single breakable prop, just every different type of breakable prop
Opening the channel again is equivalent to just spawning a new actor (as far as networking side is concerned), so all properties are sent again.
Dormancy is usually reserved for actors which very, very rarely change state
🙇♂️
You could argue it only has to exist because the engine doesn't have a true "push model"
Still can't work out if it's any different than marking an actor not relevant
I will try to dechiper what was said and do some practical work
Relevancy still incurs cost
An actor which isn't relevant is destroyed by the client for example, and respawned when it becomes relevant again (unless it was a map startup actor)
I think this is not the best solution for this problem 🤔
Also relevancy is per-connection
And actors might not be relevant to anybody, but will still be polled for changes
i mean its the exact same as using templates and copying properties off them, just with less steps
I know 😄
maybe you are right and this is not worth at all and simpler would be just to make a bp class per level for actors which should be dynamically spawned
I am wondering also about making the custom asset type which would hold all the info as breakable prop and allow me just to "drag n drop" to the level. It should have configured all properties etc. because dragging and dropping the actor class and then setting meshes, all other properties is kinda time consuming. So maybe if I would have something like this then making "spawner" would be easier 🤔
could possibly look into that new dataflow thing for UE 5.5.. from what i understand it can create assets dynamically with programmable inputs.. like you can make a dataflow that takes an array of geometry collection assets and generate a blueprint or data asset for each
i havent used it yet so that might be inaccurate
Interesting, I am wonder what does the final output look like and what can I do with it
I will take a look, thanks
it looks just like "macros" for applying the same workflow to other assets for example to achieve the same fracturing method for geometry collection
Can someone explain to me online service like steam or epic do in multiplayer unreal game?
Like people can open session, join and play without a dedicated server or open port?
They provide an integration layer to interact with the services provided by steam or epic. This includes auth, friends, shop and many other.
Yeah I know that, but do they have anything to do with hosting & joining session?
The player still have to host by themselves or joining a dedicated server right?
Don't quote me on this one, but for example Steam allows people join sessions on non-exposed ports via NAT punching.
It is not a feature all online subsystems provide, such as Facebook.
So the answer is kinda, allowing Steam Online Subsystem should allow players to join non-public instances, but it's more on Steam backend and Steam Client rather than the Steam Online subsystem.
@ripe lotus No problem whatsoever
Create an Actor -> mark it as replicate.
Server Call MC_Functions -> Clients will fire the function
As stated above, store platforms have their own backend services like leaderboards, accounts, inventory etc. But they all provide their own SDK and implementations and expect you to integrate those SDKs into your projects to communicate with their services. The main functionality of the online subsystem (OSS) plugins in UE are to provide a unified interface to use those SDKs, without changing your code from platform to platform. So you can write your code once using the OSS plugins and change which one you want to initialize on your config files, without requiring to rewrite your code for a new store platform.
Most of the tutorials about OSS plugins cover sessions interface hence your question probably. If you develop a multiplayer game with listen server hierarchy, sessions interface of OSSs come very useful. Because in that case you would need to know your friend's or a random players IP and port to connect to their game. But most PCs are behind a NAT, which means IP addresses are not unique per machine but per router (I guess) and machines under the router have another layer of address distribution. You could solve this problem yourself but it requires a dedicated server again to let clients communicate through that server and exchange their local address information so they can establish a connection between them. In summary, OSS plugins that implement the session interface (both Steam and EOS does for example) provide you this functionality for free. So you create a session in their backend, connect other players to that session and get the connection string (using IOnlineSessionPtr::GetResolvedConnectString()) you need to connect to your game host (your listen server)
Sessions are also useful for the advertisement of dedicated servers too (like they are for listen servers). They can register themselves to, again, target platform's backend labeled as a dedicated server. So when players search for sessions you get your server list to select from
can i run 16 player listen server or is it too much
I think it falls under the it depends territory
so i could run in a small game?
It's not impossible. But every bit of overhead you have will decrease the number of players you can have without impacting FPS and latency
Which will be a different number limit for every different player, since they'll have different specs
is it related with host's internet connection
Yes, host machine will be the most resource hungry one, both for bandwidth and CPU, since it'll have connections for each player, while clients will only have connection to server only
can i assign the host before the game starts? if i want to assign host to optimal player
i meant any host can create a lobby when it hits max amount of players before the game starts
i want to change the host to player who has the good hardware build or internet whatever
That might be tricky with listen server, I guess in theory you need to first gather all players under a host, decide who should be the host for the gameplay, decide on a way to let players specifically find each other again (or that host), abandon the current session and create/find the new one with the promised way of finding each other again
can someone tell me when exactly is Replication Graph plugin needed in multiplayer
in logs it tells me that the driver is null, so I enabled the plugin and added extra stuff into the DefaultEngine.ini
but just wondering if that is actually required
it is required yeah
Assuming you actually want to use Replication Graph - but you'll have to create your own implementation to have any real benefit.
i thought it was a fatal error lol
so that can be ignored when using steam subsystem?
it just says it is null. for some reason our server is refusing to even get notified about incoming connections
Replication Graph is just a different replication method, you don't need it
ah
any idea if port 7777 should be listed as open when you open it for the server?
because it shows timed out/closed all time via port checkers
really dont know where the issue is, vps works fine on the other hand
no idea honestly
Keep in mind Steam specifically doesn't allow you to connect back to the same machine via steam
i only noticed that 7777 is being used when steam is not initialized which makes sense from binding pov, but when i use steam subsystem then it changes the port to 27015 which is normal for steam. however our server is not just nonresponsive...
is just not responsive*
would someone love to try my game
over a week spent on this issue, and I can not, for the life of me, figure out how to get the save file created for the client to load for the client. Whenever reconnecting to the server it loads the server's inventory file.
The internet is surprisingly devoid of any and all multiplayer save system tutorials.
A simple way is to just save based on the player's unique id. Then when they connect, check if they have a save file. If they do, load it. Anything that is replicated should replicate once you deserialize.
I thought so as well, but I seem to be Fing that up somewhere.
I'm passing the unique ID from the player state to the game instance and appending it to the save file name
so it is indeed creating a save file per ID
but whenever I test over steam it loads the server's save file. I'm at a loss.
I'm assuming this is the correct set up
why is the client involved in this at all
@dark edge No clue, I haven't a single clue as to how this should even be set up, I've had multiple people tell me multiple things and each one conflicts with the other. All I'm trying to do is have the connecting client's inventory they had upon leaving the game reload if they reconnect to the host.
Hello guys, i think this is an easy question, but i cant get this SIMPLE RPC to work. Quick explanation of what I want to do: The picture is taken in my Characters Event Graph. I want to fire this function (Buy) which is stored in another actor (the shop character) on all clients. But it only works server sided?
so, some context.
a "Client" RPC is the server instructing the client to run a function.
a "Server" RPC is the owning client instructing the server to run a function.
when you are doing "Server_Buy", the Buy function is getting run on the server. but if that function doesnt replicate any data down to the clients, it will appear like nothing happened (unless you are the server)
i also imagine that your first "Client" RPC is redundant and doesnt need to be a RPC at all
what does your Buy function look like?
Client and Server don't mean "only run on the client" (or server, respectively)
(which a lot of people get wrong, not saying you did, plinyvic!)
Hello. I created a crosshair that dynamically changes depending on your current accuracy (Labelled "Bloom"), however, it only properly updates on client 1, and does absolutely nothing on client 2.
Does anyone know a fix?
All of the values that update the bloom run on the server (These are when the weapon fires, when not firing every tick, and when you equip the gun)
your begin play code is running for every char on every machine
gate that by IsLocallyControlled
Added a branch with the is locally controlled at the start of begin play, and it did nothing, same issue
Should I use the literal gate function?
does the widget exist on all machines at least?
Yes, it does
The widget exists everywhere, it's the movement of the crosshair lines that doesn't
show how current bloom is updated
These are 2 of the examples. The firing one is large and also spaghetti code
Haha scam ai
yeah don't do that
just update bloom on tick
no rpc or nothing
No replication
Got it
Sorry, I am still learning Unreal (Rapidly, but still struggling)
Still doesn't replicate the bloom
Trying something different
you need the fact that the shot happens to be where bloom is increased
and tick is where it's decreased
Shot -> bloom go up
Tick -> bloom go down
Nothing of what I am doing is fixing anything, in fact, most of it is making it worse.
show where bloom go up
The only time the code goes up, outside of setting a minimum, is this
The firing code that is a mess
ok so the act of firing the gun is multicast
so CurrentBloom goes up everywhere
Yeah
It's going down on both clients
Not the crosshair
Just the bloom variable
I should rephrase that
The individual bloom per client is properly tracking
The crosshair is what's not updating
Could it be an error in the widget, or how it's created?
IDK anymore
not gonna ping cause I know that's annoying, but where in the unreal code base would I do something like this? Is it in the NetworkedPhysicsSettingsComponent ?
also I'm assuming 'replicates movement' needs to be checked for any of these settings to work right?
Taking a break from this, if anyone has any potential fixes, let me know
thanks. great thing. was that an actor placed on the level or spawned dynamicalyl?
also what about cpp have you tried that?
Placed on the level
I am 110% can do it in cpp too no reason that shouldn't work
What is your requirement for the test?
cpp actor, replicated, has a multicast reliable function, can be called from the server, received by the clients.
also would be good if it triggers IsNetRelevantFor.
placed on the level.
thanks so much for the help man.
I'm trying to replicate some uobjects that I dynamically create at runtime using the documentation here, but for some reason they are always null when the client requests them
Am I missing anything? The actor who's creating them and adding them to its replicated subobjects also has bReplicateUsingRegisteredSubObjectList = true; in its constructor
If I have server done with unreal engine and Its connected to steam do I still have to put some code somewhere in instance or game mode that basically tells it to create a session with has authority node?
What are they being replicated through? Is the actor they're getting replicated through relevant?
Yeah they're being created and managed by this manager actor that exists in the persistent level, I wasn't actualy making sure it was relevant but I just added that bAlwaysRelevant line and looks like the problem's still happening unfortunately
@thin stratus @pallid mesa Here it is. Actor-Based TIP. Not Mesh-Based like Epic's (Lyra, probably Fortnite)
I'm going to release this publicly and try to establish it as the new standard 🙂
Pink shapes = server, blue shapes = sim proxy
Latency ~180ms, replication is only for sim proxies, and its a uint16 with push model
Info for anyone who is curious:
Avoid mesh-based TIP because:
- Fights the sim proxy's mesh smoothing
- Forces you to use inferior linear rotation smoothing
- Forces you to use the inadequate linear translation smoothing that simply isn't good enough because Epic didn't separate them out
- Or, separate them out yourself, which is a lot of work, and the code is one big cobweb that you have to re-learn every time you look at, and adds uncertainty and drastic time for isolation if you have sim proxy issues
- Causes jitter on sim proxies
- Has to be compensated for in every single animation/locomotion system you make
- Causes issues with a lot of procedural systems esp. involving sockets and race conditions with the anim graph's rotate root bone node
- Pervades your anim graph
Use actor-based TIP because:
- Has no issues whatsoever
- Can be tucked away almost entirely in code
this is pretty cool, although i'd say something.. you can do mesh based TIP using the mesh as a reference, rather than the actor and continue using exponential movement and you'll notice it won't have the problems you had when you use the actor as the TIP point of reference.
Regarding your implementation, is this affecting control rotation? Or how does it work?
what does the sent data represent here? the current direction they are TIPing towards or the absolute rotation?
or something else?
I can probably respond better in the morning, on phone about to sleep but..
There is actually nothing being shown on that screen, unlike mesh tip it's not offsetting from the characters rotation, it just stores the actual offset itself
There are two entry points used to rotate a character, ACharacter FaceRotation and CMC PhysicsRotation. Both of those get overridden to make a call to my turn in place component instead with matching functions that apply the offset to the rotation
I'll post video tomorrow with debug arrows
It's not shown here but it can tip with Orient rotation to movement, using last input vector
Not only strafe movement
My system is also vastly more feature rich and can increase turn rate when alternating direction or at max angle and supports multiple step sizes and anim states etc
You can't use exponential with mesh based tip, it has all the issues I just detailed above. The mesh smoothing fights the rotate root bone node which rotates the mesh by applying the root yaw offset
Watch what your sim proxies do when you rotate your control direction insufficiently to trigger a turn, they will wobble, because the root yaw offset is applied linear so if you smooth the rotation exponentially that's the expected outcome
Oh I think I misread what you said
I'll need to look again tomorrow on my PC. You can ignore my response
I will say this, having the actor rotation being the true rotation makes sense
It does seem more simple to not have to fight how smoothing works at first glance... I'll take your word for it
I don't need to factor in any offset in my math, unless I want to know "where would you be facing if you didn't have turn in place"
Once it's finished I'll make it public
(sorry, wasn't trying to ask for the code there lol... you don't need to clean this up if you don't have time etc)
I wanna stop people using epics solution coz it's nasty
Oh I know but you won't have to take my word is what I meant
I'm turning this into a plugin with the intent of releasing it free
So that people will stop using lyra solution
Mine also supports start moving animations by letting you blend out the turn offset based on the rotation curve from the animation so you get really accurate start rotation blending. e.g. start moving 135°, etc
;_; Why do we talk about animations and multiplayer when I have to get MotionMatching working with Mover.
Btw when you guys used motion warping, is it normal to deactivate correction?
If I don't do that, the character keep getting correction.
Like big time correction
Not really.
Server and Client would do MotionWarping at the same time after all. @dark parcel
probably the most embarassing code I've ever written in my life ^^
"we currently story all items client side"
Noice. That's a fun way to make sure the rest of your game has ugly code.
yup
Hmm I play montage with gas and motion warping, I keep seeing correction.
Sometime minuscule but when it's not it cancels my next montage 😦
I need to make it server side fast before the code gets too ugly, it's already super ugly already and I can't afford it getting worse
Depends on what you are doing there. I usually make sure the Montages are played based on Movement code triggering them. E.g. for Vaulting.
Other Montages might be a bit tricky, but you can def make sure that Server and Client play them.
It's combo montages so not linked to movement.
They both playing but client have some correction.
I thought I had bug else where when some of the attack in client keep getting cancelled mid way
I'm probably missing something simple, I've made a local multiplayer game, and I'm trying to get a pause menu to work where the player that presses the pause button is the one that can select options on the menu. However even if I open it using the second players controller, only player 1 can control it.
I have tried passing in the player index into GetPlayerController to then have that as the owning player of the widget as well as setting the input mode to Game And UI. Any other ideas of what I'm likely missing?
Rapid execution of different Montages can be tricky. Disabling corrections during that isn't too bad of an idea.
Idk how you trigger these Montages exactly, but if you aren't using anything specific you could think about routing the input to trigger the attacks through the CMC. Not perfect but that would make sure they are in sync :P
You are also introducing artificial lag with all the RPCs
Setting the correct owner is a good start, but you might want to open your Menu from inside the PlayerController so you can just pass this or self to the Widget. That makes sure you 100% have the Input to open the Menu be hooked up to the right Widget and Owner.
true
Beyond that, "focus" is a huge thing in UE. Native focus handling is a bit wonky, especially with couch coop.
You gotta make sure you assign USER focus and not KEYBOARD focus or such things. Setting the InputMode is also fine, but you might cause it to focus the Widget with Player 0 due to the "WidgetToFocus" pin. That might just use the general Keyboard one, which will always be Player 0 iirc.
Might also want to consider using CommonUI if you aren't already.
That might help a bit with the focus etc.
That could certainly be it. I am assigning keyboard focus
ActivatableWidgets in CommonUI can set the InputMode directly when getting activated (might need a C++ child of the class to expose the DesiredInputConfig though).
I'll start digging down the focus path along with moving it to the player controller
Yeah keyboard focus calls into the GameViewport iirc, and just sets it for all or just player 0. Been a while
I am using CommonUI, who knows if I am correctly or not lol
When using CommonUI, I usually subclass the ActivatableWidget and expose the variables for the GetDesiredInputConfig call.
That way I can set what InputMode is being used per ActivatableWidget. Benefit of that is that you can turn your main HUD and all Menus to ActivatableWidgets and set their InputConfigs to Game or GameUI or UI.
Might need a bit different thinking for CouchCoop, as you might want to set it to GameUI or UI based on how many players have the UI open.
Otherwise, if you aren't doing any of that, make sure you handle the InputMode in a central place.
A lot of people start calling SetInputMode in every place they create widgets, alongside show cursor and what not.
Not realising that they might create code where WidgetA and B both set the input mode to UI, and then WidgetB closes, setting the Mode to Game while WidgetA is still there.
🙋♂️ . Looks like I have some refactoring in my near future
Before common UI I usually had my InputMode logic in the PlayerController.
Wasn't pretty, but I basically checked on Tick (which Epic also does fwiw, and it's not bad to use Tick!) different conditions like "Are any Menus open?" "Are any Dialogs open?" etc. and then changed the InputMode based on that, keeping track of it with an enum. CommonUI has an enum for that already fwiw.
For Couch Coop it might be better to place that code into something else. Maybe the GameState Tick, cause you might need to scan all PlayerControllers for the open Menus to decide what mode you need to set.
That's why opening the Menu(s) in the PlayerController is useful, c ause then you have a reference to it there and the question "Are any Menus open?" is easy to answer.
Sounds like a plan to me. Cheers for the help and direction with it
No worries. :P structuring UE projects becomes more natural over time. Biggest suggestion I can give is to "structure it the way UE wants it". The more you go with the flow of UEs GameFramework, the easier your dev-life will get.
Gotchya ty. The boolean I toggled also said to turn it off when doing something rapid 😔 .
It never occur to me that I would not allow correction at some specific window but since the hint says so, I was content on disabling it until the attack is finished
Yeah the only thing to make sure is that they really end up in the same location when you reenable it.
Otherwise you always get a correction at the end.
That's what happend at the end 
But it's minuscule so not much of a problem
But then again can't tell what happens when game is on production
With many spells and many modifiers
how should i set up the OldValue param for my OnRep function when using a TWeakObject ?
when the OldValue should be a valid ptr, on client its always "unknown"
well nvm im forced to use tweakptr
Same type as the variable usually.
Can make it const fwiw, as that doesn't matter to the caller in theory.
But not 100% sure on that one.
either way the old value is null for client, but it should hold the old ptr instead
idk if its the weakobjectptr fault or something else
Do you need this to be a WeakPtr?
If the Character (OldValue) got destroyed somewhere in this whole process, then it's totally possible that the pointer would be null.
its not destroyed
A normal pointer shouldn't cause any problems with GC for an Actor.
Their Destroy call will cause it to be cleaned up anyway.
well i think yes because the Actor doesnt own anything from the Character
Well the Weak stuff is usually helpful if you don't want the Object to be kept alive due to whatever holds the pointer.
But iirc for Actors this doesn't really matter?
Not sure. I never had a WeakPtr replicated with an OnRep that has the OldValue param
The new value is valid though (HidingActor)?
yup
the only issue i got is when HidingActor gets cleared, the client doesnt have the previous ptr
okay UE is funny
i must have a ref
// broken
UFUNCTION() void OnRep_HidingActor(TWeakObjectPtr<ATFCInGameCharacter> OldVal);
// works
UFUNCTION() void OnRep_HidingActor(TWeakObjectPtr<ATFCInGameCharacter>& OldVal);
That makes.. no sense? haha
I should really check what is even passed into the OnReps
I always though it's something like this:
const Type OldValue = CurrentValue;
CurrentValue = NewValue;
OnRep_Value(OldValue);
In very simple terms
i guess UE is doing some extra dark magic
if you find anything intesting ill be glad to here you
A quick question about Iris. How could I associate extra information with uint32 ConnectionId. For example, I want to include a uint8 indicating the pawn class, which I want to fetch in prioritizer. (I can start with a single TMap<ConnectionId, FExtraInfo> )
I guess it should be in either EngineBridge or ReplicationSystem, but any pointer would be great.
if u need help repro the setup hit me up ;3
I suppose you can add your own prioritizer with some storage, no?
UEngineReplicationBridge is final
I have a custom prioritizer, and when a new connection is added to this prioritizer, I am going to
UReplicationSystem::GetConnectionUserData to get UConnection and getting the Controller and Pawn from there to set the initial Pawn class for that connection inside the prioritizer.
The problem is updating the data when user possesses a new pawn. Absolutely no idea how to propagate the data to the actual prioritizer because at best I can get a prioritizer handler not the actual object.
I am making changes to Iris as I go, but I want to make the least amount of edits before I fully grasp the system.
just listen for when the pawn is set? what's difficult about adding a delegate here?
It might be better to consider the object netrefhandle of the pawn (after you get it of course)
but I'm not sure if you need that at this layer of iris
It breaks the whole idea of UObject separation no? It would bypass the bridge
your prioritizer already knows what a pawn is? What's the point of your prioritizer just looking at ints?
If you want you can just make the pawns write to it when they init and deinit... I don't understand the goal of "separation"
your goal here is type letters into the computer to get a pointer to a thing to make it replicate more... separation is more useful for the overly wraught C array internals of iris
Iris has a lot of annoying things about extending it you have probably already encountered
Yeah, the whole data structure (at least inside prioritizers/filters) is rough to understand (at least for me). But can't argue that vectorizing the data makes it go pretty damn fast.
Extending Iris outside of IrisCore is basically impossible at the moment, since the ReplicationSystemInternal has core functionality that is not exposed.
You are right, I am overthinking it. Since I have a pointer to PC, I can hook into the OnNewPawn delegate to update the Prioritizer.
Thanks for the sanity check
@ripe lotus No issue
.h
UFUNCTION(BlueprintCallable, NetMulticast, Reliable)
void RunSomeFunction();
.cpp
ATestActor::ATestActor()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
SetReplicates(true);
}
// Called when the game starts or when spawned
void ATestActor::BeginPlay()
{
Super::BeginPlay();
if (!HasAuthority())
return;
FTimerHandle TimerHandle;
GetWorld()->GetTimerManager().SetTimer(TimerHandle, this, &ATestActor::RunSomeFunction, 2.f, true);
}
// Called every frame
void ATestActor::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
void ATestActor::RunSomeFunction_Implementation()
{
UKismetSystemLibrary::PrintString(this, FString(" runs this function."));
}
dropped the actor to the level;
Hi, is there a way to detect if a session is no longer available after you've searched for sessions? I'm trying to handle a scenario where player 1 hosts a session, player 2 opens the server browser which calls FindSessions and finds player 1's session, player 1 ends their session, player 2 still has player 1's session listed on screen and tries to join it but of course nothing happens because the session isn't actually there anymore, ideally i'd like to display a 'session no longer available' message or something rather than it just doing nothing
The OnSuccess of the JoinSession node gets called even tho the session doesn't exist anymore and IsValidSession returns true as well so neither of them can detect if a session isn't available anymore
I'm using bp's btw
Reposting this from yesterday because of continued issues:
I made a dynamic crosshair that is meant to display your current "bloom" on the crosshair. It works perfectly fine for client 1, but not for any other clients.
I have been going around different Discords and Subreddits trying to fix this issue, but most of the time, I have the same results.
On all clients, the bloom does update, I have proven that with printing text, but I am still having issues getting it to work with the widget properly.
I feel like I'm hallucinating -- player pawns are NOT consistently named across the clients, correct? I'm running a listen server, and the non-listen-server client's pawn is logging as B_HeroBase_C_O (from their perspective), but the listen server's pawn IS ALSO logging as B_HeroBase_C_0 (from their perspective).
if it's replicated, pretty sure the name will be the same
