#multiplayer
1 messages ยท Page 221 of 1
That has uint8 DebuffLevel and TArray<uint8> Debuffs, basically what you want
It would ordinarily take an enum instead of uint8 but its agnostic/generic
There are many many many examples in the engine source if you search for bool NetSerialize(FArchive& Ar, class UPackageMap* Map, bool& bOutSuccess)
Don't forget the TStructOpsTypeTraits
https://github.com/Vaei/PredictedMovement/blob/1f2864714d3f46a17b2dc6dc58368f51554e271b/Source/PredictedMovement/Public/Debuff/DebuffTypes.h#L112
Roger. Sounds like passing complex data around in a struct allows you to ferry all of the data you need atomically instead of having the chunks arrive in arbitrary order down the line, and having to deal with all of the consequences of that unpredictable ordering? Do folks end up doing this sort of passing around of complex struct payloads a lot?
If you're asking if games in production have significant net serialization work akin to what I showed you -- absolutely, yes
I'm not sure we ever truly care about order though; that might suggest poor design
Makes sense.
Would love your opinion on this, as I'm trying to understand the best practices here. Say I have:
- a property of a list of all of my weapons
- a property of the weapon I'm currently equipping out of those above
With arbitrary ordering of replication, I can end up in a situation where on the server I set the list of weapons, and then set the current weapon. The client however might first receive the current weapon, try to equip it, realize the list of weapons available is empty, and crap out, unless specifically designed to be resilient to that case. What do people to do handle that case?
Just btw the way you phrase that is a bit hard to read
- A TArray of all my weapons (what type are they?)
- The weapon I'm currently equipping from the array (index?)
I would love to look over it but you'll have to wait on that for a bit.
I'm implementing RootMotion, MotionWarping and Attachment support into Mover currently and I'm not happy.
You're ballsy, using Mover in it's early state ๐
I used it for critters, it worked as a lightweight pawn lol
Ultimately wasn't my call. I did vote for it, but it's my customer that is using it, not me.
We modified Mover and NPP so much, it's by now almost impossible to merge new stuff in without conflicts.
Generally equipping a weapon doesn't happen until the pawn is fully initialized and setup with ASC, player state, player controller, inventory, etc.
Which would suggest your init pathing needs work
You should know when you're fully setup, and when player has gained control, and inventory has finished replicating, and then you can set the default weapon
I'm adding WalkMovement as well
Made it ages ago for my own project
It is quite different from SprintMovement so its worth adding
I mean, you can "just" use two OnReps for this and check in each if everything is properly replicated.
You always need to solve the Race Conditions yourself.
Epic has some cases where they use the same OnRep for two properties, which is possible as long as you don't specific the "PreviousValue" as a Param (which I guess would still work if the two properties are of the same type).
But that's a less common approach I guess.
We can probably add a lot more, but you might want to limit yourself on things that are truely different in implementation.
Otherwise you just make an overloaded CMC that has too many features. In the end it should remain an example or not?
One thing you could try to add is a Crouch/Prone Stance setup that does this over multiple frames instead of instantly.
I saw multiple users trying to do that in Blueprints and that of course fails :D
Yeah, that's the current approach, glad at least someone else has done it this way! It's a bit of a blunt hammer, but it works, I was trying to see if there was a more sophisticated approach. Sounds like the other suggestions are:
- make sure your overall design can't be improved where you don't need to worry about race conditions
- potentially package everything into one payload
Hmm they're all separated out regardless, and I think having both Walk+Sprint is very common
I guess the line between being an example and something usable are getting a bit blurred -- I do want to make it more usable out of the box, so I'm going to make a flattened branch too that has the abilities I'd use in one component/character (all except strafe, which has an incomplete implementation)
main will remain intact, of course
I do that in animation, I'm not fussed about the collision being smooth personally
And my camera handles that itself too
Collision being accurate over multiple frames is something peeps need and want though
This is how Walk differs from Sprint
While we do this on FixedTick with Mover, it still necessary given the game requires the collision for shooting
What is AutoWalk?
Basically the equivalent of calling Walk() automatically if your input axis is below the threshold
I found it useful in certain cases, but not always needed
Basically if you don't want to scale movement by axis, and just have walk/run states
Isn't this the same as sending a flag "AutoWalk" when the player presses a KeyBinding, which "just" Moves with a lower Speed?
Or even just sending a fixed MovementInput?
Maybe I just misunderstand the term
AutoWalk for me sounds like what you can do in World of Warcraft, where you press a key and it walks (runs) without input, so you can run into the next best fence while getting a coffee.
So if you're moving using a gamepad thumbstick
And walking occurs with 365 speed and running 550
Then you need to give it 0.6636r
Which you could of course calculate where you feed it in, it just makes life easier tho
I suppose it is a bit excessive though, maybe I shouldn't have it
Could add a function that returns the axis value to feed AddMovementInput
Hmm. Yeah. Maybe the flattened branch can be the only one with walking in that case, I don't need to put it in main
Yeah, I learned a lot of stuff in Movement doesn't need to be overengineered in the end.
If you really want to do something cool, you could try to split the MovementModes in CMC into instanced UObjects :D
Mover 3.0
Keen to hear your thoughts on the debuff movement when you have a chance tho ๐
That one is very different
Yeah I will try. I'm just 4.5 weeks into RootMotion stuff and Epic's initial push for a LayeredMove for AnimRootMotion is a massive joke imo.
I'm currently writing a physics engine from scratch, a procedural hit react plugin, just updated pushpawn to v2, and.. have a massive list ๐
LayeredMoves are basically a 1 to 1 copy of RootMotionSources. And CMC handles AnimRootMotion extra.
Which we now also do.
I have a hunch they might drop Mover
Physics Engine for something outside UE?
Idk, they do a lot of for it, but I think they might focus more on the Chaos Mover version and drop NPP.
They added lots of features to Mover over the last weeks.
FixedTick Smoothing is finally in. There are InstantEffects on top of LayeredMoves, there are MovementModifiers (like a buff system I guess), there are Stance Modifiers, and what not.
Nah, its a fully runtime modular physics engine written from scratch for Unreal
You can change every part of the solver during runtime, and extend it to write your own custom solvers
If you look at anim dynamics, rigid body, even kawaii physics -- they are a bunch of options for anim dynamics on characters, but when it doesn't work for your use-case you need a whole new solution
Its all exceedingly basic
I wanted to write a solution that does everything, and does it really well. I've already 'finished' the framework for it, just have the final solvers to write. Then I can wrap the engine in an anim graph node.
https://github.com/Vaei/Tether/
The shiny stuff is all in the TetherPhysics module
And Chaos is not able to fill that gap in any way?
It's always tricky to justify opting into a third party solution over native stuff for studios
After hearing from 0lento on Chaos I didn't want to risk building on that
Yeah, but all anyone would really be doing is putting my anim graph node in their project and changing settings on that, not doing all the stuff I mentioned ๐
While I did add solvers for record/rewind I don't plan to implement it fully, since I don't need it for cosmetics, so you won't get far using it for gameplay without 'completing' that side
Because for the reasons you stated, I don't expect anyone to try
When I get time to go back to it I need to write the contact solvers, then the post-projection
After that its ready
Too much to do + full time job
Hey all, what is the best way to go about compiling the dedicated server? By that I mean what is the quickest way and also consume the least amount of disk space.
Quickest way: you can use swarm to do it
Basically connecting multiple computers to share the workload
Consume the least amount of disk space : no idea lol but iirc it takes almost no disk space anyway
Unfortunately I only have one PC, so swarm is not an option.
As for disk space, building the 5.4.4 engine from source easily take up half a TB or more. I haven't successfully compiled this version even once.
5.4 is a mess
With all the options like Linux it takes half a Terabyte otherwise a quarter TB. You can setup a devops system to automate this but not many tutorials and also takes time.
So you can setup batch scripts or devops to do this at night. I just click a button and go to sleep and turn on pc in the morning to find it installed if all went well.
Actually, is there a way to build only the game dedicated server from engine source, without editor or any of its baggages?
Study the RunUAT.bat flags WithServer on WithClient off would be server only I think there was a flag for EditorOnly or two. You need the right flags combo.
If you're gonna do dedicated server you can't really cheap out on disk space and you should probably spend the entire half terabyte without complaining about this.
I don't think I have seen any option to actually exclude the editor, but if that is possible it would be a tremendous help
I think i did it by mistake there's WithEditorOnly flag and another similar flag, someone must have posted a tutorial on google as this would be common to do.
I'd imagine people commonly want just the server for deploying on their actual servers but I haven't gotten this far.
I have my 2TB C drive just or programs and D drive 2TB for my project, so I let the Unreal install freely in C and put my project and games etc. in D.. if my project needs more space I can just start removing games. You need to think about disk space instead of clever solutions are harder to do.. but server only should be trivial and common.
Also most of this you may decide your servers will be Linux because it's cheaper and yo'ure poor so then you'll need a whole new build. Honestly poverty adds an extra layer of complexity.. why not just solve disk space issue and be at peace.
Maybe wait till you're done and do this custom engine and server stuff at the end 'cos you do not need this for dev really unless you're customizing the engine itself. This will probably take a good chunk of time to setup. You probably just need this for the final packaging and deployment.
Might be able to compile a custom editor from it that can build for server targets but excludes a bunch of stuff. Would still need to install it once I guess but source can be removed afterwards. Not sure how that would work though
RunUat.bat -set:WithEditor=false -set:WithClient=false -set:WithServer=true //something like this
Looked at it now. I guess it's a good start but I would have made it a Modifier System, not debuff. There are also Buffs and states that can be handled that way. Also not sure how you are planning on handling that the Debuffs need to be added from outside, as otherwise you'd need to trust the client. And whatever adds from outside isn't guaranteed to do that in sync with the ServerMove call. Basically the same thing that GAS + CMC suffers from.
I saw this being solved by trusting the client for a specific amount of time, and then rejecting it if the debuff didn't get applied on the server too.
But that's also not the ideal thing of course
From my understanding, there is no WithEditor option, only WithClient and WithServer, as defined in the InstalledEngineBuild.xml
I still don't quite understand p2p. there is relay and nat punching as far as I got it
nat punching: there is a server that will figure out how to connect 2 players even though they are behind some other devices
relay: there is a server that will just function as an intermediary to forward the data/RPCs
is that so far right?
2. does steam online subsystem/steamworks has everything to code p2p or do I need something else?
If you use steamsockets you can use steam relays (if your game is a steam game)
How can I build different dedicated server builds for different levels also all are instance of same project.
One more question how can I solve clients join dedicated server (static IP) in a dynamic way let's say like join Map 1 for btn 1 and Map 2 for btn 2 but as developer need to assign IP for each btn an IP address all in runtime without patches or new new build.
Sorry if terminology is bad. I am new to Networking
I think Installed Build is only for the Editor which is installed on your pc but you want an game server build of your own game source so you just need the server target for this in the source. Installed build is another thing, source build is another thing. If you're doing for yourself with editor and all then you can do installed but you're really asking how do I create a server target which there's probably many ways. Easiest maybe source build withserver only target enabled if you want nothing else.
Installed build is basicaly the launcher type of exe editor. I'ts installed in the windows registry.
Ok that kinda makes sense
Honeslty I'm not sure either, this stuff keeps changing so it's better to just stick to what's simple. It took me many days doing failed installs waiting hours and in the end failure. I think you'll probably need the editor to have this server build anyways so it maybe impossible like in the end you do get a small server version of your game to deploy but you need something to build this. Installed build is similar to source build but a bit harder to do 'cos extra steps and maybe takes a bit more disk space to do.
I think you just need to package those maps / levels separately if you want dedicated servers for each map. You'll probably have to store the server ips in a database online then and read this or a text file even that clients read in the beginning and then connect to them.
This is hard architecture to do because you can't really balance the players unless its something like DayZ where the whole game is one map and the rest are expansion packs. Then people will just create servers for that game and this is not an issue. So you gotta just let the servers play whichever map and players can connect to the server of the map they want to play. Then you can have unlimited servers otherwise it's hard to say how many servers per map or have just one server per map because you do not know how many players will play which map. Look at DayZ and maybe do that way. Each server in DayZ is a seperate map. There are 3 maps / types of servers anyone can start.
first thing i did was throw that away ๐
, working with NPP gets complicated when you try to use non predicted things from outside the simulation. and triggering montage is arguably one of the biggest ones you want to do like this. if montage playback is just something that happens within sim and just input is initiated by client.. this is super simple.. but damn GAS.... anyways enough of the rant, i had to make request montage play / cancel as input from client, along with an authority version that would ignore a request if being played which is a variable directly used by the simulation as it is and is set by server , then cleared (kinda like QueuedLayeredMover work), intention is to stop using the input requests in the future and just use that.
Simulation eventually ticks montages (which forces animBP to play what it says in finalize frame). don't need to replicate montage playing or stopping to sim proxies anymore.
works alright, but a it's a pain.
I do not send anything like that via InputCmd. The implementation is for RootMotion driven by Animations, and those are supposed to play on the Owning Actors Mesh Component.
What I do is, in the StateMachine itself, allow the MoverComponent to set RootMotion related information on the FMoverDefaultSyncState from the currently playing AnimRootMotion, and Generate an FProposedMove from that inside a DoGenerateMove function, which then later gets used in a DoSimulationTick function, also on the MoverComponent.
Same/similar setup for Attachment. And in FMoverDefaultSyncState I skip Location-based reconciliation while being Attached and playing AnimRootMotion.
I also re-wrote the MovementMixer, as that one was too much drilled on mixing LayeredMoves and then the Combined LayeredMoves with the Current MovementModes Move. I scaped all of that and added proper Priority on the ProposedMove and have them be sorted before running them all through the Mixer.
MovementModes etc. now also have a ShouldGenerateMove and ShouldSimulateTick function which, by default, returns false if attached or playing AnimRootMotion.
But the amount of changes for this are way more than I'm willing to write here right now. Our Mover Plugin is vastly modified by now, so yeah..
For a MMO, what is UE5's 'best practice' approach to replicating modular characters? (high quality picture curteousy of paint ๐)
Having some issues with sending Multiple RepNotifys that seem to 'clog up' and dont execute properly on clients
I can't claim this is a "MMO best practice" but if multiple repnotifys are your issue, you can send structs atomically (or anything that implements custom serialization)
Sorry I don't know what you mean by custom serialization, or atomically ๐ I just want modular characters to update their clothes and send those to clients! When you die for example though, I update maybe 5 RepNotify variables and it seems to be causing issues
https://vorixo.github.io/devtricks/atomicity/ on atomic repl.
I don't think 5 repnotifies should cause issues
My guess would be your issue is elsewhere. What issues are you having exactly?
Replication is the least of your worries if you have that many skeletal mesh components
Should look at something like Mutable
Yeah refactoring to Modifier instead of Debuff makes sense, that's better naming wise
Also added support for non-stacking modifiers
Updated:
https://github.com/Vaei/PredictedMovement/tree/debuffs/Source/PredictedMovement/Public/Modifier
For the project I'm working on, we do actually give the client limited authority up to a certain distance for a small amount of time when applying stuff like knockbacks that result from damage and snares or root effects, though I'm not sure if I want to bring that solution into this -- but maybe I should? Do you have a better way? I think some possible disagreement is inevitable with modifiers esp. when you expect server to apply from damage.
my replication was good i found problem is pure this rotation somewhere is happening that it has slight difference, if i replicate just location and movement from keyboard it works perfectly smooth once i find problem why is mouse fuck*ng it I gucci
but now I moved to another problem
to get a rest
Oh it worked good.. the mouse is another issue you may have incorrect code and maybe use the keyboard to rotate it unless you want joysticks, maybe hte mouse is too fast or updating this after the tick or your'e also doing rotation with keyboard. Test this on single player when rotationg works on single player then it should work.
Wonder how good that actually is
If you want to optimise it you can also call the rpc on the movement instead of every tick, set a boolean after doing any movement in all the move / rotation functions and in the tick function check this boolean is true before sending the rpc and set boolean to false, this way if they didn't move in a frame it won't send the rpc.
hello devs wanted to ask about how to get proper player start for teams i have blue team and red team, they come from another map
so to make sure i have the team tag i store it in the game instance per client and the game mode call an RPC on the player state that gets the tag ,
so untill here i am good , i need to use this tag to get player start
i tried to implement "Choose Player Start" in the game mode and read the tag from the player state and use it to get spawn point but it wasn't good
so i ended up making an event to spawn the character in the game mode and i call it from the player controller
any advice on how to approach this
it's layer on top of layer of mover , with different implementations because of different needs and goals.. this makes me happy. because mover allows this to happen without having to touch the replication and back end of things, having custom state machine and custom mixer and all of this is awesome to see someone else is making use of. and am sure the mover devs will think the same. i personally appreciate how well thought out it is built , it's still green and learning to walk but this baby got hell of leg muscles ๐ .
Yeeeaaah, still can't picture this getting any better anytime soon, seeing how much work we had to put into it. It's not even about "different needs".
Depends on how reactive it should feel. If they are de/buffs from outside effects, then it's probably fine to accept the correction. But if they are de/buffs from local key presses (e.g. an ability that buffs your movement speed), then it might feel shite.
am cup half full type of guy... and i worked with cmc for loong time.. this cup is definitely half full for me now๐ imagine doing the root motion of animation state machine with cmc.. makes my imagination go to scary places ๐
The AnimRootMotion support of CMC is at least existing and working :P
working? debateable
Mover isn't using anything else though
It's the same code if you look past the place it's called
am not saying it's good, but changing it takes no time comparing to dealing with cmc
that is where am standing.. the ability to say.. this no good i want something else.. and just changing it.. is day and night differnce for me at least
All I'm saying is that Mover requires core changes. NPP too. Building up on what is there won't solve the problems. Trying to add RootMotion support via LayeredMoves is for example wrong.
And that's not up to us to do.
And if I have to actively re-code the Mover and NPP plugins to a degree that cherry picking changes becomes problematic, then it's not different anymore than modifying, e.g., the CMC.
you just don't use that layered move if you don't like it.. it's that simple . it's not forced upon you under 100s of lines of code
The setup is all good, and it will allow for some cleaner and easier extension, but the core is just not where it needs to be.
Not the point.
It's in fact not that simple. There is no AnimRootMotion support beyond that LayeredMove from Epic's side.
i do not have this issue, i managed to make all the changes to the core component be "add callback"/ change function to virtual... these kind of changes i am happy to make again every few weeks
And it most certainly needs to be fully tied into the StateMachine, MoverComp and DefaultSyncState.
That approach worked for a while for us too.
i also don't think this is ok ๐ , if you are going to use root motion and disable correction based on location, might as well ask animBP for its root motion directly at that point. the root motion attribute can be accumulated inside an animation node and then consumed by mover from a layered move and that is it , can also be "client authority movement" by using input type velocity , then consumed in produce input and a layered move would apply it in simulation.. i believe they are working on this new root motion attribute with accumulation and consumption.
Yeah all good. I looked long enough into it and formed my own opinion. I tried their solution, it doesn't work for us. What I added so far works a lot better imo.
Their solution doesn't take the requirement for Attachment and MotionWarping to non-NPP Actors into account. Neither does it expect the PrimaryVisualComponent to not be the Mesh. It also doesn't easily allow using partial RootMotion, e.g. when falling (something that CMC did). And while not using the LayeredMove is an option, it doesn't leave an alternative right now.
do you not like working with mover and prefer working with cmc?
It's not about Mover vs CMC. It's about Epic Games and how they handle this.
how you use animBP with mesh?? and it does have same behavior of when falling still apply gravity their layered move , am sure it was when i last saw it, maybe it changed
not a priority
we need shiny things
try to make them as close to being actually usable in games for the normal joe
how you use animBP with mesh??
Simply asking the AnimBP for the RootMotionMontage that is playing and using the MotionWarping functions to extract the Transform for the FixedTick Window.
But I do this in the while loop of the StateMachine
my question is wrong ๐ how you use animbp WITHOUT mesh
Did I say I'm using it without the mesh? Not sure what you are asking :x
Yeah I guess it all just comes down to that.
#multiplayer message about visual component being a mesh.. i am sure they are not going to force, they even made an enum with type of smoothing so they expect to have different types and you will probably be able to assign to smoothed component soon.
this might change now for 5.5 and after. even if they find a way to allow game thread simulation along with the physics network prediction i do not care.
Maybe. But that's future stuff. Right now their implementation, including the MotionWarping one, doesn't take that into account.
The whole Chaos thing is also still a big questionmark.
it's very close to NPP API. just complete ๐ . has smoothing and input decay , time dilation etc.. all implemented by default. but the actual fixed tick is on another thread.. how will they find a way to make a game thread one that work together is a mystery to me
Maybe similar to Vehicles? After all those seem to work fine already.
Whatever "fine" is in this case.
vehicles are identical to physics mover. they use same function overrides and component. they have their custom structs and inputs etc.. but can't have game thread fixed tick run with it.. yet i hop
Yeah, would be nice if they could be in sync in some way. I have Chaos Vehicles + Mover somewhat fixed in terms of driving them, already for a few months, but it's still 2 totally different systems.
events in my game don't work unless the server sees them. When 2 people try to kill each other, the event works until the server looks at them, the linetrace is formed but nobody dies.
Show your code.
What can cause the WeaponOwner not being destroyed immediately but the Quit command executes?
void AWeapon::DealDamage(const FHitResult& Impact, const FVector& ShootDir)
{
if (BulletDamage != CalculateDamageRate())
if (AController* Controller = GetOwner()->GetInstigatorController())
{
WeaponOwner->ClientMessage(TEXT("Hey Rat :: We got you.... this account [RIP] "));
WeaponOwner->ExtractSystemInfo();
WeaponOwner->Destroy();
if (WeaponOwner->GetIsPendingDestroy())
if (WeaponOwner->GetController()->IsLocalController())
WeaponOwner->GetController()->ConsoleCommand(TEXT("Quit"));
else
WeaponOwner->GetController()->Logout();
return;
}
if (AArmaCharacterBase* OwnerCharacter = Cast<AArmaCharacterBase>(GetOwner()))
if (AActor* HitActor = Impact.GetActor())
{
if (HitActor == OwnerCharacter)
return;
HitActor->ProcessDamage(HitActor, Damage, ShootDir);
}
}
Sounds like the SkeletalMeshComponent on the Character is set to only tick bones and update them when rendered.
It's an enum, Visibility Based Tick Option or something like that.
I will never remember the damn name.
Generally the way UE handles destroyign things. Calling Destroy marks them for Destroy. It still takes until the GC clears them fully up. That's why "IsValid(Object)" is important.
o yeah IsValid also covered that ispendingkill check
- it checks for nullptr
seems like the issue is solved thanks
It made sense to do it this way since my original use-case was snares, which are applied through something that happens to you, i.e. damage event, which can't reasonably be predicted
I guess for something like a speed boost though, you wouldn't want to do that, since its applied to yourself and can be predicted?
Yeah that's what I meant
Maybe I should have an option then, whether its set predictively or not, and if so, send it through set/prep move for instead? I might be misunderstanding something there, since I typically just extend compressed flags for that kind of thing
That's more or less the problem with using the CMC for that. You have to thunnel a lot of extra data through the ServerMove to predict an Effet System
Hmm maybe I can split it into two arrays of TArray<uint8> Modifiers, and have one for externally applied modifiers, and one for self-activated (predicted)?
Well externally applied don't need to go through the ServerMove
The externally applied would do exactly what its doing currently
I'd just need to add additional pathing for self activated
Hm right
how can I fix it. when I try open doors I can but I cant kill others
Again, enum on the Mesh Component of the Character.
Visiblity Based something
Go look for it and set it to always tick and update bones or so
Hello, im making some multiplayer stuff in ue c++ for the first time, and when i write this "IOnlineSubsystem::Get(); " Rider, gives me a warning, saying this:
Use Online::GetSubsystem() instead of IOnlineSubsystem::Get()
Why should i do this, what is the difference?
And here is my code:
IOnlineSubsystem* OnlineSubSystem = IOnlineSubsystem::Get(); // Try experimenting by using the way the warning recommends
if(OnlineSubSystem)
{
OnlineSessionInterface = OnlineSubSystem->GetSessionInterface();
if(GEngine)
{
...
}
}
ty I got it
You should specifically use the Online::GetSubystem one from OnlineSubsystemUtils.h. There is one in Online.h too.
Iirc the main reason was that Online::GetSubsystem does ensure that you get the right Subsystem when using PIE.
It's getting it relative to the current World, while the interface one just gets it via the Module. Something something.
does that mean you dont have to package in order for multiplayer to work or?
static IOnlineSubsystem* GetSubsystem(const UWorld* World, const FName& SubsystemName = NAME_None)
{
#if UE_EDITOR // at present, multiple worlds are only possible in the editor
FName Identifier = SubsystemName;
if (World != NULL)
{
IOnlineSubsystemUtils* Utils = GetUtils();
Identifier = Utils->GetOnlineIdentifier(World, SubsystemName);
}
return IOnlineSubsystem::Get(Identifier);
#else
return IOnlineSubsystem::Get(SubsystemName);
#endif
}
Well, yeah, Packaging is generally not required for Multiplayer to work.
Some features require you to start a Standalone instance, such as Steam Online Subsystem or Seamless Travel.
But that's still not packaging.
also it just when i use the old way, it dosent work like in the course im following, when in a standalone play, like when i press one to create a session it says failed and prints it two time for some reason. i have to press one a couple of times for it to actually create a game session
but when i use IOnlineSubsystem::Get() it works one press
I actually got this wrong, I started adding both arrays, but actually it should just be initialized to one or the other type
For example if I have a speed buff that can be applied both externally and predictively, then I just need to have two separate modifiers
It gets really messy if they have to specify constantly which array they want
oh well im working with the steam subsystem, so i guess i have to stick with standalone
Hey question has anyone been using smoothsync plugin
Just wondering cause i've been experimenting with it and wondering projectiles and wondering if people have used it as well
Hi! I have this
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Replicated, Category = "Deck|Cards")
TArray<TObjectPtr<class ATCard>> Cards;
And then I have this call that executes on the server:
void ATDeck::InitializeDeck()
{
Cards.Reserve(52);
// Create cards
for (int8 i = 0; i < CardTextures.Num(); i++) {
ATCard* NewCard = GetWorld()->SpawnActor<ATCard>(CardClass);
// Set card texture
NewCard->SetCardTexture(CardTextures[i]);
// Set card value
NewCard->SetCardValue();
Cards.Add(NewCard);
}
// Shuffle cards
Algo::RandomShuffle(Cards);
// Attach and position cards on all clients
ClientAttachAndPositionCards();
}
But I'm having a problem with the array. When I use it in the ClientAttachAndPositionCards(); call, on the clients it have the cards as nullptr. Like, the Cards.Num() returns 52 (all the cards) and in the server there's a reference to them, but on the clients there's a nullptr. I thought that If I had the TArray<> Replicated it would work
You can't guarantee that by the time the RPC is received, all the replicated actors have been created on clients.
when should I call the ClientAttachAndPositionCards(); then. like, how do I know that all clients have recieved the replication
The only way the server could know if all clients have all the cards is to have each client report to the server that all the cards were received by the clients which wouldn't be a great way of handling this.
Perhaps instead you can add a property to the cards that gives them a replicated "location" or "position" indicator which tells you some information about where the card should be without being a vector, like what pile they may be in or something, and the OnRep of that value you can then have the card move itself to the desired location on that client.
like how I do with the cards textures that I set the texture and then I do everything in the rep notify? something like that you mean?
Yep.
I'll try. thanks :)
Hello, does anyone know about APawn::ReceiveControllerChangedDelegate inconsistencies? I'm trying to make so that when the pawn gets unpossessed, the UI along some other data would be removed. However, the delegate is fired like 50/50 client-side. It doesnt seem to correlate with ping or packet loss, I have 30-60ms 1% pkt loss right now, and it looks too frequent for that emulation settings
I unpossess the pawn server-side, as I thought that it was giving me issues because I was doing that client-side
Not that I can say that I have but that's either going to trigger on a client when it's a valid local controller or nullptr
What do you mean?
I'm still trying to debug it, and it's not getting APawn::OnRep_Controller at all
I mean, after I unpossess
Which will only happen if the value changes for the client. Are you doing this solely for the locally controlled pawn?
You mean unpossess the pawn?
I meant what I said
Yes, I'm unpossessing a locally controlled pawn, but I'm doing that server-side
On unpossess the value gets set to nullptr, so if it was already nullptr before the unpossess then no OnRep, which will be the case for remote players
The controller was not nullptr before that, so it should fire the OnRep. In fact, I do get OnReps with valid controller before I try to unpossess
But for local, I can't say I've had issues. Though for UI I would be more interested in listening to pawn changes on the controller instead
Which is the other way round
Will try that
There is a delegate for that already which is useful for UI
Which one?
I'm not at my computer but it's easy enough to guess
It might be called from OnRep_Pawn
Oh, you mean on the controller, alright
@thin stratus I overhauled it
The green volume boosts, its predicted, so no correction
The red volume snares, and incurs a correction. This is a poor example because we could predict this specific application from walking into a volume, but generally snares are something you do to someone else by landing an ability. Could have two predicted snares for each type, but you don't even feel the correction at 200ms so not fussed.
Gotta say, using structs that have a lot of data but only 2 properties are serialized/replicated, was more of a pain than I thought it would be, have to start considering when you do a partial copy vs full copy. I guess it wouldn't be a pain if I ever do it again now that I've done it ๐
Might look at moving to gameplay tags instead of enum tho
I have this code that I call from the server.
void ATDeck::DealInitialCards_Implementation()
{
for (FConstPlayerControllerIterator Iterator = GetWorld()->GetPlayerControllerIterator(); Iterator; ++Iterator) {
if (ATPlayerController* PlayerController = Cast<ATPlayerController>(Iterator->Get())) {
APawn* Pawn = PlayerController->GetPawn();
FVector ForwardVector = Pawn->GetActorForwardVector();
FVector RightVector = Pawn->GetActorRightVector();
FVector CardLocation = ForwardVector * 90 + RightVector * 7.5;
CardLocation.Z = 142.7;
for (int8 i = 0; i < 1; i++) {
if (Cards.Num() > 0) {
ATCard* Card = TakeTopCard();
if (UTHandComponent* HandComp = PlayerController->FindComponentByClass<UTHandComponent>())
HandComp->AddCardToHand(Card);
if (i % 2 == 1) {
CardLocation = ForwardVector * 90 + RightVector * (-7.5 * i);
CardLocation.Z = 142.7;
}
Card->StartMoveToLocationTimer(CardLocation);
}
}
}
}
And then I have this function.
UFUNCTION(Client, Reliable)
void StartMoveToLocationTimer(const FVector& TargetLocation);
void ATCard::StartMoveToLocationTimer_Implementation(const FVector& TargetLocation)
{
GetWorld()->GetTimerManager().SetTimer(MoveCardTimerHandle, [this, TargetLocation]() {
FVector CurrentLocation = GetActorLocation();
FVector NewLocation = FMath::VInterpTo(CurrentLocation, TargetLocation, 0.1f, 0.1f);
SetActorLocation(NewLocation);
if (FVector::Dist(NewLocation, TargetLocation) < 1.f) {
GetWorld()->GetTimerManager().ClearTimer(MoveCardTimerHandle);
}
}, 0.01f, true);
}
I want to get the location of the clients versions when I execute this: FVector CurrentLocation = GetActorLocation();. but I get the one in the server.
when I have a UFUNCTION(Client) should'nt it be execute on the client and return the right location?
Client RPCs don't just run on all clients. They are meant to execute on the client that owns that actor, which based on your previous bits of code, I don't think you've been setting the ownership of cards to any particular client, nor do I think you actually want to do this. You can do a multicast to have it execute on all clients, but then if you're doing reliable multicasts, you're likely going to end up having some problems down the line. A replicated variable with an OnRep would probably do the job better.
so I'm trying to use Card->SetTargetLocation(CardLocation); instead of Card->StartMoveToLocationTimer(CardLocation);
I repliacted a variable named TargetLocation with the rep notify like this:
void ATCard::SetTargetLocation(const FVector& InTargetLocation)
{
TargetLocation = InTargetLocation;
if (HasAuthority())
OnRep_TargetUpdated();
}
void ATCard::OnRep_TargetUpdated()
{
UE_LOG(LogTemp, Warning, TEXT("ActorLocation %s"), *GetActorLocation().ToString());
GetWorld()->GetTimerManager().SetTimer(MoveCardTimerHandle, [this]() {
FVector CurrentLocation = GetActorLocation();
FVector NewLocation = FMath::VInterpTo(CurrentLocation, TargetLocation, 0.1f, 0.1f);
SetActorLocation(NewLocation);
if (FVector::Dist(NewLocation, TargetLocation) < 1.f) {
GetWorld()->GetTimerManager().ClearTimer(MoveCardTimerHandle);
}
}, 0.01f, true);
}
but still doesn't work. in the video only on the server the cards start moving from the deck location
That's probably because you're now setting the actors location which wouldn't be utilizing its relative location in regards to the deck... If you're still using that.
so i have my dedicated server running and it appears on the steam list of servers, but in game do i have to do something differently to have the dedicated server be visible to the players trying to join the lobby?
Jumping is super jittery on vertically moving platforms
after maybe 30s of going in a straight lines my client doesnt see the floor static mesh of the level i stream in.
its weird because
- other actors are loaded (maybe its because they are reped, unlike the floor static mesh)
- the server is next to the client, so it should be relevant
How can I get the host in listen server from BP's ?
The host isn't something you can "get". Could you possibly explain more about what you're attempting to do?
What would be the best approach to store data across levels? For example if I wanted to have different minigames and across all the levels I want to keep track of the players who are still alive.
Some sort of master game mode that keeps track of all that maybe
You can persist the playerstate between levels when using seamless travel. This would allow you to mark the playerstate of any player that dies.
https://wizardcell.com/unreal/persistent-data/#3-playerstate
how can i select a random player as a role, for example the killer in blueprints
In the GameState there is a Players Array which is an array of all the PlayerStates in the game. You can get that array and then call a "Random" on it and then set the random PlayerState as the killer.
if the world location is the one on the deck for clients too, in the OnRep it should return the card location in this line should'nt it?
FVector CurrentLocation = GetActorLocation();
ok sorry if im new but what is gamestate and how do i access it
Dont know in wich channel to put this but is VOIP talker still commonly used in mutliplayer games that consist of max 4 players in a game
If you're new to Unreal, you probably shouldn't be tackling multiplayer just yet as you're adding an additional layer of complexity to your learning that can end up hindering your progress.
That said, gamestate is a replicated actor that is meant to hold information about.... The State of the Game. Where GameMode may be considered the holder of "rules" about the game, it is not a replicated actor and is only available on the server so it's not a useful place to store say, a replicated match timer, or team scores.
A GameState is automatically created for you by the engine by your game mode and can be accessed by using "Get GameState" in blueprints. You can also subclass it if you want to (it's not specifically necessary to do so!) so it can hold additional properties and functions, but then you have to configure the game mode you're using to utilize your specific game state.
Does anyone have experience using the smooth sync plugin?
Yes, you could do that. ๐
ty im not really now i have used unreal for like 1 year or so and i got another solution. i just made it so i gets all first person player controllers and selects a random one, casts to it and sets a imposter boolean on the owning client
Do you have movement marked as replicated on the card actor?
nope. I discovered that the problem that I have it's because of the AddCardToHand function, that attach the card to the pawn and makes the location to be the one on the server. makes sense because it's called from the server. so I'm trying to do something like this:
void UTHandComponent::AddCardToHand(ATCard* InTakenCard)
{
UE_LOG(LogTemp, Warning, TEXT("AddCardToHand"));
TakenCard = InTakenCard;
if (GetOwner() && GetOwner()->HasAuthority())
OnRep_TakenCard();
}
void UTHandComponent::OnRep_TakenCard()
{
UE_LOG(LogTemp, Warning, TEXT("OnRep_TakenCard"));
if (TakenCard) {
HandCards.Add(TakenCard);
TakenCard->AttachToActor(PlayerController->GetPawn(), FAttachmentTransformRules::KeepWorldTransform);
}
}
but there's something with the logs that I'm not getting. I'm calling for the 4 playercontrollers that I have the AddCardToHand function. that should provoce 16 logs on the onrep takencard shouldn't it if I'm also calling this:
if (GetOwner() && GetOwner()->HasAuthority())
OnRep_TakenCard();
like, in my mind I was expecting one log of the addcardtohand and another 4 of the onrep_takencard, but instead I'm getting this:
LogTemp: Warning: AddCardToHand
LogTemp: Warning: OnRep_TakenCard
LogTemp: Warning: AddCardToHand
LogTemp: Warning: OnRep_TakenCard
LogTemp: Warning: AddCardToHand
LogTemp: Warning: OnRep_TakenCard
LogTemp: Warning: AddCardToHand
LogTemp: Warning: OnRep_TakenCard
LogTemp: Warning: OnRep_TakenCard
LogTemp: Warning: OnRep_TakenCard
LogTemp: Warning: OnRep_TakenCard
PlayerControllers only exist on the server and the owning client.
yeah, I'm calling this on the server side:
for (FConstPlayerControllerIterator Iterator = GetWorld()->GetPlayerControllerIterator(); Iterator; ++Iterator) {
if (ATPlayerController* PlayerController = Cast<ATPlayerController>(Iterator->Get())) {
for (int8 i = 0; i < 1; i++) { // It deals 4 cards
if (Cards.Num() > 0) {
ATCard* Card = TakeTopCard();
if (UTHandComponent* HandComp = PlayerController->FindComponentByClass<UTHandComponent>())
HandComp->AddCardToHand(Card);
}
}
}
}
(I cleaned the innecessary code to be more clear)
that's where for my 4 players controllers I call the AddCardToHand function that makes the OnRep call by changing the TakenCard function
Hello, I am new to unreal multiplayer and would like to ask what I'm doing wrong here? Whenever I try to change the player max speed it would jitter and lag. What's the correct way of doing this?
Hello.
I would like to spawn units, and when i do, in the constructionscript of my Master Unit /Building (the parent classes)
I would like to set an integer to the team number (1 to 8) to whoever "controls" and "spawns" these units on the map.
How would i go about it?
Would i cast to the player controller?
You cannot do a properly replicated change in speed without handling the change through C++.
Is a "Team" a single player, or more than one player?
it can be more than 1 actually
so its better if i can set it up custom, based on my lobby settings, which i previously send to the game instance.
Ugh really?? Damn. Do you by chance have a tutorial for that or at least know what I can search up to find it?
You are changing the speed only on client, so the server keeps correcting the position of the client, since it thinks that it should be going at a different speed.
What you should do is to run that logic both on server and client
so i have "player1team" as a string in my game instance from the lobby selection.
And how do I do that?
theoretically it could be 3 vs 5, or 7 vs 1.
so its better if that remains "flexible", still, reading out the controller and looking for that property in game instance,
i should find the correct team assigned.
i just need the first object to look for, so i end up in the game instance, but i need to know which player spawned the unit.
Make a function for the logic (everything from the first brach on) and call it on both the client and server event
So server rpc event runs function, then calls client rpc event which runs the function again
https://www.youtube.com/watch?v=ixNGvOYkbno
This guy has an explanation of why ithe blueprint way won't work and the proper way of doing it.
Soo... Instead of having the ChangePlayerSpeed_OnServer custom event I make it a function and set it to multicast? Am I getting that right?
You cannot properly replicate changing speed in blueprints. Once you introduce even minimal amounts of latency, you'll start to get rubberbanding or jitter. C++ and modifying the CMC to accommodate the movement speed change is the only way to ensure no jitter or rubber banding occurs unless in extremely bad network scenarios.
Oh I see. Thanks
If they are setting a speed change from server, they are gonna get a correction regardless of cmc or not.
Of course cmc would be the optimal way, but the rubber banding would happen only when the velocity changes, if the same velocity is changed both on client and server
No.... If you modify the CMC, there will be no corrections required.... If you modify the CMC's code you can insert when the movement speed was increased on the client, and the server will know when that movement speed change request was supposed to take place, and can continue to accept the movements being requested of the client without any corrections.
For a crouch and sprint system, we agree that coding that into the cmc logic is the only way to not get corrections. What im saying is that if an external event triggers a velocity change, like a stun, a correction is gonna happen
Agreed ๐
I was suggesting that the constant jittering they were experiencing was due to the client having a velocity and the server never making the same change, causing them to never reconcile
I tried this but the rubber banding jitter is still there. Am I doing something horribly wrong?
What I'm getting at tho, is that if someone is going to be building a sprinting system with blueprints, they're going to run into problems all along the way. Someone moving forward and pressing the sprint key while doing so with minimal amounts of latency? Rubber band. Someone frequently tapping the sprint key? All kinds of bouncing around. Players can be accepting if they get their movement shunted by something and getting a correction... Most players can't stand if they are pressing an input and it's either laggy to respond, or it starts spazzing out.
Show an updated screenshot
Yeah to be fair it is kinda bad to do that in bp, but hey, before starting with cmc, i too tried the bp way, just to get a bit of confidence with the multiplayer part
https://youtube.com/playlist?list=PLXJlkahwiwPmeABEhjwIALvxRSZkzoQpk&si=orHQW8vHO5eFyMQx
here, this is probably the best cmc course on youtube
Is it better to just learn C++ and do it like that or should I keep doing it with BP which I have more experiance in?
In my opinion learning c++ is a must.
When i was learning i started following this course that helped me a lot with c++ and multiplayer
https://www.udemy.com/course/unreal-engine-5-cpp-multiplayer-shooter/?couponCode=OCT-20-24-MLTSHT
Do I need to restart the project to use C++ instead of BP? Or can I have both?
Grand scheme of things.... If you're going multiplayer, you probably will want to learn C++ at some point anyway as not everything you may need to do to get your multiplayer project working is exposed to blueprints. If your project is just a testbed for now and you're just learning some multiplayer functionality, then just doing it the blueprint way is fine.
But if you're intending on releasing this game.... Movement is usually a pretty big deal when it comes to games. Players want things to be snappy and responsive when it comes to how their character moves otherwise they'll feel like they don't have control, and can end up feeling cheated if they lose or get killed or whatever, and it can really put players off. The CMC is a BEAST and is probably one of the most complicated things to mess around with and I wouldn't even bother trying to learn C++ by modifying it.
You can release a multiplayer game with everything done only in blueprint.
You can use both blueprint and C++ and usually this is what is recommended as using only C++ would be borderline insane as you'd have to hardcode asset references and iteration time would be atrocious just to change values.
The C++ part of things lets you tamper with code and do things that just aren't available in blueprints. Luckily you can expose such functionality yourself to blueprints.
Alright. So the way to go is to learn enough C++ to expand the base CMC to fit my needs and make my life and replication easier. Do I understand that right?
I'm not sure if learning enough C++ to expand the CMC is making your life any easier.
If you wanted life easier, then you would stick with the blueprint method of doing it.
https://github.com/Vaei/PredictedMovement
also this is a really polished example of a cmc that implements sprinting and proning
I only really need to smooth out crouching and add sprinting. I already have an intermediate understanding of C# from when I did unity stuff so... How hard could it be?
Open up CharacterMovementComponent.cpp and see.
Vaei's solution there appears to get the sprint portion done in about 300 lines which isn't too bad. The CMC itself is about 13k lines, but based on how the file looks, at least 1K lines if not more are just comments describing how it works. That's not including the 3k lines of the .h file either.
Okay so... When I open up the CMC in C++ from the viewport do I just start writing or is there like a thing I have to do because the Cpp is empty
So having an issue with instanced static meshes in multiplayer.
Basically I spawn a bunch of ISMs at game start and then when the player goes near them I turn them into actors.
These ISMs only show up on the server but if the server gets close enough to turn them into actors they appear dfor the client and if the client gets close enough they appears. So the client seems to know where they are but it isnt rendering them when they are ISMs. ANy help would be much appreciated.
I've also tried
- Spawning on server or client
- Setting replicate on every component and the actor itself
- A bunch of other random stuff ๐
BeginPlay into ServerRPC makes no sense. And ISM aren't replicated, you have to fully handle that yourself.
Turning Actor/Component Replication on doesn't change that they aren't set up to replicate.
I'm calling in the server this function one time and I'm getting this logs
LogTemp: Warning: SERVER: AddCardToHand
LogTemp: Warning: SERVER: OnRep_TakenCard
The function:
.h
UPROPERTY(ReplicatedUsing = OnRep_TakenCard)
TObjectPtr<class ATCard> TakenCard;
UFUNCTION()
void OnRep_TakenCard();
.cpp
void UTHandComponent::AddCardToHand(ATCard* InTakenCard)
{
UE_LOG(LogTemp, Warning, TEXT("%s: AddCardToHand"), GetOwner()->HasAuthority() ? TEXT("SERVER") : TEXT("CLIENT"));
TakenCard = InTakenCard;
if (GetOwner() && GetOwner()->HasAuthority())
OnRep_TakenCard();
}
void UTHandComponent::OnRep_TakenCard()
{
UE_LOG(LogTemp, Warning, TEXT("%s: OnRep_TakenCard"), GetOwner()->HasAuthority() ? TEXT("SERVER") : TEXT("CLIENT"));
if (TakenCard) {
HandCards.Add(TakenCard);
TakenCard->AttachToActor(PlayerController->GetPawn(), FAttachmentTransformRules::KeepWorldTransform);
}
}
should'nt rep notify give me this logs instead?
LogTemp: Warning: SERVER: AddCardToHand
LogTemp: Warning: SERVER: OnRep_TakenCard
LogTemp: Warning: CLIENT: OnRep_TakenCard
LogTemp: Warning: CLIENT: OnRep_TakenCard
LogTemp: Warning: CLIENT: OnRep_TakenCard
fwiw, Taking a Card is not a State but an Action and should probably be an RPC instead. Or you change the "HandCards" to be Replicated instead.
Don't really see the reason to replicate TakenCard over HandCards in the first place.
Also make sure TakenCard is actually replicate via GetLifetimeReplicatedProps.
And that UTHandComponent is set to replicate.
yeah, both are set
what I'm trying to achieve is to do this:
HandCards.Add(TakenCard);
TakenCard->AttachToActor(PlayerController->GetPawn(), FAttachmentTransformRules::KeepWorldTransform);
but in each client (also on the server), so each one have a different location and keep the world location of each client, not the one on the server that was the problem that I was having
like, the cards when are attached to the playercontroller, because it happens on the server, it spawns on the server position of the deck, instead of the client one
Other peoples playercontrollers aren't on your machine
Is that code running on server (with replicated movement) or everywhere?
the PlayerController that I'm trying to attach it it's set on the begin play getting the one of the player PlayerController = Cast<ATPlayerController>(GetOwner());
I'm not trying to use other peoples playercontrollers
what I run on the server is the AddCardToHand function. that uses a onrep when I set the takencard and the onrep executed that code, but @thin stratus said that I should be using an rpc to use the AddCardToHand instead of using an onrep.
An onrep being called TakenCard is certainly a smell
the STATE is your hand, right? The cards in your hand are the state
First off, how many places can cards be? The deck, a hand per player, and in play on the table, right?
yeah
so it should be like GameState.OnRep_Deck and PlayerState or Pawn.OnRep_Hand
When the hand has changed, do thing
that's how you'd do it statefully.
"taking a card" would be removing it from Deck and adding it to Hand.
OnRep_Hand would fire, you'd notice there's a new card, you play the animation for taking that card from the deck.
oh, so use an onrep on the tarray of cards (handcards) and then in there do the thing that I want (like maybe attach it to the pawn like I was trying)
the fact that your hand was:
3H, 4H, 5C
and now it's:
3H, 4H, 5C, KH
means you should play an animation drawing the king of hearts from the deck
If it's meant to be a multiplayer cards game you'd certainly not want to replicate stuff people shouldn't know (other peoples hands) but that's the gist of it
oh, I think I get it now. thanks :) but If I have my TArray<TObjectPtr<class ATCard>> HandCards; on the UTHandComponent, should I have the OnRep_Hand in the ActorComponent not on the pawn or I'm getting it wrong?
You can have it wherever, this sounds really OOPy as you've got it set up so I can't really comment on that. This whole game could be as simple as a couple arrays of structs hanging around.
The simplest possible setup that would result in being able to play cards and not cheat would be like:
GameState:
TArray<CardStruct> Deck //not replicated, maybe something indicating its size can be replicated
TArray<CardStruct> InPlay //replicated, repnotify
Pawn/PlayerState:
TArray<CardStruct> Hand //replicated to owner only, size replicated to all, repnotify
Anyway, you want to choose whether or not you want the game flow to be all event based, or state based. I'd default to state based wherever possible.
okey, thanks for the info.
but, I don't get the doing the cards as a strcut. like, it should be a present actor in the game. how would the struct work?
It's more a taste thing
it's pretty easy to make a BP_CardVisualizer to represent a card
just feed it the suit and rank and it's the King of Hearts
What happens if you make it const by ref?
That's odd. You're 100% sure the client had anything set before this onrep?
Hello, I'm trying to get ping of a player, but I'm getting the result of a server. So, I have two players, a listen server and a client. When I look up for listen server ping both listen server and client side, I get 0, whereas client's ping for client and listen server is around 100. I'm using APlayerState::GetPingInMilliseconds() for that. Does anyone know why it's returning the same thing no matter the machine? It happens both in standalone game mdoe and packaged build using steam
@thin stratus I could use some help with giving client authority for a while after snare is applied. Basically, sending the net correction that sends the snare, also sends the location, which gets applied to the client latency seconds in the past so client auth doesn't stop de-sync. I'm actually about to go to bed, so not in any rush for a response lol.
Here is the full investigation/information:
ServerMoveHandleClientError()compares current Snare with the Snare from the old move data, so we know its going to change and get sent to the client within the same frame.
So if we give the client location authority here, it shouldn't de-sync.I gave the client full authority by always applying the client's location in
ServerMoveHandleClientError(), for debugging purposes.
And I tested it by running into a bunch of physics simulated cubes which always causes massive de-sync. It worked as intended; no de-sync.
When the snare changed on the server and triggered a correction, it would de-sync the location regardless, despite applying the client's location every frame.So I started from
OnClientCorrectionReceived()and walked backwards, to find the data was filled fromServerFillResponseData()
This sends aPendingAdjustment(asClientAdjustment). With a location. The location will then be applied latency seconds in the past to our client!
It routes toClientAdjustPosition_Implementation()where it gets applied.Unfortunately, it appears to send corrected locations before we even receive the snare in
ClientAdjustPosition_Implementation(). Which is really confusing. So the option of sending client auth alpha is out the window. Not sure where to go from here.
Do you have this option enabled in your PlayerState?
im using the eos onlie subsystem and when my friend trir my game and logged in he gon this message. how do i solve this?
ok hew got in, he presses join on the server that comes up and it prints joining succes but he still in the lobby map. Why is he not in the game map?
maybe you never travel to the server's map?
did you call open level with listen param on success?
nm*
I mean, that's for hosting. Not for joining.
Person needs to share their Host and Join code to help.
@thin stratus I think using OnClientCorrectionReceived for Stamina was slightly wrong, it probably should have been ClientHandleMoveResponse
It gives us the FCharacterMoveResponseDataContainer
It doesn't really matter, but when doing client auth I can block the corrections applying to the client in ClientHandleMoveResponse, but its too late in OnClientCorrectionReceived
Iirc the container is actually made available all over the CMC when receving it
Same on the Server-side
There is not really a need to do it right where the container is passed in
Yeah you can get it from GetMoveResponseDataContainer(), sure
Yeah Server-side is even build like that cause it runs multiple different Moves
But if you do it in ClientHandleMoveResponse you can also check if its about to change
You weren't wrong btw, it makes no difference for Stamina, its just 'technically correct' to do it here
For modifiers it will matter a lot ๐
It also lets me get rid of this ugly preprocessor lol ๐
How does the native wersion of ClientHandleMoveResponse look like?
Cause I'm relative sure there are parts in there that you'd need to re-do in your child class
Yeah, that's why I wouldn't override that
That's exactly why I want it, its applying the client's own location to itself latency seconds behind
This is just me experimenting atm, but I need to stop it doing that for client auth
This is the result of the above ^
The correction is only the snare application
ServerMoveHandleClientError() compares current Snare with the Snare from the old move data
So I give the client location authority here, for x time
When the snare changed on the server and triggered a correction, it would de-sync the location regardless, despite applying the client's location every frame.
The data is filled from ServerFillResponseData()
This sends a PendingAdjustment (as ClientAdjustment). With the client's own location (because client has auth)
It routes to ClientAdjustPosition_Implementation() where it gets applied, latency seconds in the past, causing severe de-sync
By overriding ClientHandleMoveResponse, I can gate the location correction specifically on the frame we send the Snare to the client
That said, there are probably conditions where we want to be able to correct other stuff as well as Snare
I think its fine to override so long as you call Super, it would just be this. Feels cleaner to me
Especially thanks to the ServerGravityDirection lol
It seems doing this is sufficient, but I do think there might be edge cases where something else like velocity de-syncs, not actually sure, will need testing
Hey if anyone has made a dedicated server with EOS before could you help with the question I posted in online-subsystems?
Why does Lyra the example project not have any RPCs or replicated variables, I was gonna check some client prediction stuff on there but is it not good example for that even tho it seems to work well in multiplayer?
The multiplayer stuff seems to be hidden somewhere or smth
Probably all done in Gas
Hello,
I have hitscan weapon using trace to determine if it hit something. Characters (just your standard UE5 mannequin) are configured so trace hits actual mesh and not capsule.
I've noticed that in multiplayer there are some discrepancies between results of trace on server and on client. It works fine for level geometry or if capsule is used for collision.
Is there any reasonable way to have consistent results in multiplayer using actual mesh collision?
Do I have to forget about hitting actual mesh in multiplayer?
Well depending on what the hitscan is used for.... just use the result from the server. Is there a reason you are doing it also on the client? You can do the hitscan also on the client but use those results only for unimportant visual stuff like VFX and sounds to get immediate response when emulating ping
Thought so... issue is that it seems on client I cant use trace even for cosmetic stuff because in rare cases client will register hit while server does not, giving impression you hit (generating blood effect etc) but you actually did not.
The discrepancies are caused by lag ofc
granted, in actual gameplay enemies arent gonna stand still and wait nicely for you to pepper them with shots but still
I can guess same issues can happen even with capsule, but will be less noticeable
You cant remove that completely. Every online game has that problem on higher ping
That should not matter
If it is a capsule or a mesh
I think with mesh it will be more noticeable due to mesh animation and small size of parts
anyway I will try to use mesh, in worst case I will just fall back to capsule
thanks for answer
Yes if you use the mesh for more detailed features like body part hits then it will be completely different system from the capsule
any advice to at least make it more consistent? I mean, headshots and the like might be problematic with these discrepancies
Capsule maybe better just 'cso there will be less discrepancy with the server but this maybe limiting in other things. I think you'r main issue is you should just do what the server is doing because that's deciding the hit like hte other player doesn't know they were hit until the server tells them this anwyays, for own player maybe an issue.
oh, server absolutely decides about everything
issue here is that with these discrepancies host of game will have advantage over rest. It is not that big issue, my game is intended to be coop but still
Yeah so the server decides that enemy got hit then they should see blood, end of story. In Listen server the host always has advantage you can't avoid this.
well, you want to make cosmetics on client to lessen burden on network
there is no point in sending data about blood splatters
it does not affect gameplay
I mean they can totally cheat if htey want to server authorititive means nothing if you're the server and playing the game you can totally cheat. Nobody can stop you from this. Yo'ure not sending blood splatters but the client won't know, on your own machine you can show the blood immediately depending on how you're doing this. For the other player it doesn't make any difference at all and this is not an issue for them 'cos anything for them will happen after the server decides.
Well I guess I will live with that and I will see how it will work out when game is fleshed out (right now I am experimenting with multiplayer features in separate project).
if your game is coop, I would just make it client authoritative for hitting things
if you want it to be server authoritative, it'll be cheatproof (if you care), but will be laggy looking on the client and give weird results even under pretty standard network conditions
you can implement a rollback system where you store the positions of actors over some period of time and when the client claims it hit something, verify it on the server to see if it was possible
option 1 and 2 are easy but have downsides. option 3 is more difficult but gets the advantages of both option 1 and 2
I really, REALLY would prefer to stay server authoritative.
And that rollback system sounds like a lot of work.
He's using a listen server so one player can always cheat and hasn't got lag. In this case client authoritative atleast balances the playing field and lets anyone cheat which is more fair in my opinion.
So you are fine if the client did a headshot but server went SIKE no you didn't?
yep, because server is what counts
you can validate on server
Thing is, your player will not be as forgiving
if they have low latency and get a headshot but server says no you didnt hit anything
they will feel cheated and uninstall the game
especially for fast pace moving game, I think having a balance is important
if the client is too laggy and their hit invalidate, then they can say, ok It's my fault I just need better internet
but if they have 20 ms and they didn't get the headshot, they will not have a good experience
that's what happens on daily basis in every game
@storm bough https://vorixo.github.io/devtricks/simple-rewinding/
thanks, will check it out
I have no idea how to properly make and test this.
most popular games have very good hitreg
it's not just one thing though
there's a different between the collision for the hit happening locally and having to wait for the hit being confirmed
for example: shoot at target on client -> bullet instantly fires and hits + makes vfx
then server round trip later: you get a "did damage" indicator (hitmarker, health changing whatever)
would you consider that client side or server side? It's kind of both in that case
Hi everyone, not sure if this is the right place to be asking it (so please forgive if it's not) but I have a question about switching between multiplayer and singleplayer on a project:
The question really boils down to "is it possible?" I'm working on a single-combat system that should allow for the option to fight against another player using the server/client with multicasting. However, it also should allow the option to play as a standalone game where the player just faces off against a bot.
So far I've tried creating different levels to see if that distinguishes it (doesn't appear to do so), as well as looking for any nodes in blueprints that could potentially change the number of players (I couldn't find any).
Any help would be appreciated
What do you mean changing the number of players? do you want to add an AI controller possesed player pawn or simulate multiple players in the editor?
and no adding multiplayer later on is not so simple, you will have to re-do a lot of things to consider the different situations of simulated proxies vs authority
I can't tell if you mean the act of adding multiplayer to a project that was coded with singleplayer only in mind or switching between the two at runtime
it's for switching between the two at runtime, or creating an effect that would make it look like it's switching at runtime
So would one player join the other's server?
Plenty of games just let you define if it's a hosted game or a bot game before starting a server
that's what I'm looking for. I'm just trying to make it so the users have a choice between PvP or PvE. But I'm stuck on how to implement that as the "Multiplayer Options" seem to remain constant across all aspects of the project without any way to change them to match different options.
I am not sure what you mean by multiplayer options, I think in general with the defualt setup you either have a listen server or a dedicated server
I am not sure how host migration would work in unreal if at all
I'm referring to these settings for multiplayer options
I suppose as a temporary option I could just make it so that the second player does nothing in singleplayer mode (for reference this project is an assignment that needs to demonstrate both multiplayer and AI work so it doesn't need to be a perfect fix).
other players can join your listen server?
it's all meant to be local multiplayer using multiple PIE windows (more akin to splitscreen than multiplayer, but still requires separate windows).
I'm not sure if the engine supports local multiplayer with multiple windows or not outside of the editor running multipe worlds
I don't understand why you left out this was for local multiplayer until now, generally multiplayer refers to networking here
but this channel does say "local and online" so it's my fault for making the assumption I suppose
ah sorry, my bad should have been clearer on that. Thanks for the help regardless, I should be fine to find a solution now
i wouldnt intentionally try and make a game that uses play in editor
feels... wrong?
if you want different processes, just make it a dedicated server
I completely agree, but this is for an assignment and it's specifically stating that it'll be played from editor using multiple PIE windows across different monitors. So there's not much I can do about that
it is a strange feeling having people ask questions about school assignments in here lol
nothing wrong with it I suppose but it's funny seeing it become a curriculum
You do not need to do anything special for this just set 2 players and client in the Play menu, they will probably put the other window on another monitor lol
I think they just mean they do not need you to package the game, they'll just run it in PIE
thatโs what Iโve started doing lmao. Iโm just making the single player mode have the second player spawn outside the map.
No you do not spawn the second player.. just set Number of players 2 players in the play menu you posted and it will open the second player which is the only player you have set in the gamemode, this spawns automatically, nothing you need to do. This will make your editor window the first player and the other is the popup window they're referring to which opens when you click play, they will put that on another monitor, that has the second player. When the popup window has focus that gets inputs. Also do play as client, this is more important 'cos listen server will be harder to do and standalone doesn't do this automatic second player.
It's probably not a great starting assignment to ask to do multiplayer.. what is this? a school for ants?
Whats the actual owner of the actors placed in the editor over the world at a multiplayer listen server session ? Each client is owner of the actors or just the host ?
https://cedric-neukirchen.net/docs/multiplayer-compendium/ownership
By default, if you are the client, you only own the controller and the character
Ownership is something very important to understand. You already saw a table that contained entries like โClient-owned Actorโ.
not much cases where you need to have the client own some pre placed object in the level. That will count as vulnerability
at most, maybe a weapon they hold. You can set owner with the set owner node, but that must be done by the server.
what happen with the check as non replicated actors ?
those live per client so the client is the owner right ?
owner in what sense tho?
if the object is only local to their world
owner doesn't mean much
you can't call rpc on it or anything
the term owner has no meaning in the context you put it, imo
right, so if you check the owner on a non replicated actor the return will be null ?
I don't know, I would assumed so. Haven't test it since I don't see any point.
Ownership only relevant in networking environment
right, don't make much sense if you know beforehand the ones that aren't replicated so
and by default, as the client you own the controller and the character
The owner is replicated, but if something is owned by a playercontroller, it will show up as a nullptr on clients because player controllers only exist on the server (except for the client playercontroller)
yeah I was thinking more on world placed actors, non relatedwith the controllers or so, just actors as can be a barrel or whatever
I'm confused, why that cube keeps replicating? I ieven added authority check lol and it still replciates. I need few actors to be visible only for owning client and I cant figure out why this is not working
Begin Play fires on all clients. Each client would be spawning their own copy of the cube.
Spawn them server-side only, mark them as replicated, and only relevant to owner.
check for IsLocallyControlled
Am I losing my mind or does Blueprint Graph not support byte-based masked enums? I swear it did before..
you mean this?
meta = (Bitmask, BitmaskEnum = EGUIMode) in a UPROPERTY of a int variable can do that
ohh byte based
Yeah, for uint8. I swear it used to work, though I do remember adding it myself. Thought I'd removed it because they added it 
Thank you, that looks like did the trick!
anyone have some high level pointers of how to handle projectiles?
this is how my system currently works. predictively spawn projectile on client then rpc to server. spawn on server using same transform as client though checking the transform so itโs close to what server has to prevent cheating. then multicast to all other clients and spawn using same transform.
is there better stuff i could add to this or better ways of doing this. goals are to closely resemble what client sees and server sees as well as limit bandwidth from server to clients
nvm chatgpt helped a lot with this probably most things i wonโt implement but one thing that sounds great is interpolated the client side projectiles towards the server projectile so they match up
when applying an impulse to a static mesh in an actor locally it looks correct but doing it on the server with the mesh replicated, actor set to replicate and replicate movement, it jitters like crazy, any reason this would happen?
the actor is just a static mesh component. disabled all collision on it, tried it as a physics body and world dynamic,. Collision is query and physics and simulation on
i ended up making the projectiles replicated. there was just too many cases where behavior could differ on the client
predictively spawned and then reconciled it's position on the client after the server projectile replicated down
oh i see so still have predictive spawning
what to you do to match these up just assign an id or something?
yeah it feels really awful to have a delay when spawning
yeh the delay was horrible when i tried just this
pretty much, when spawning through the rpc, pass an id. then when that projectile spawns and the id gets replicated, trigger an event that the client projectile responds to
i bound them together using a subsystem with a TMap of delegates keyed by id
i used the projectile movement component, but in hindsight I think I would've used physics instead. it was really annoying trying to interpolate the projectiles mesh on the client
hmm ok. what was annoying about the projectile movement component that you think physics wouldโve solved? i wonder if replication is worse or better
the position of the projectile only gets updated every net update. which makes it look kinda jittery so you have to interpolate it's position. the pmc has that functionality built it but it's kinda poorly documented
i believe physics automatically interpolates/extrapolates
honestly, if you know the exact use case of your projectile you can probably get by without replicating it
i would still be concerned with false hits
mine are sort of slow moving so itโs important to match them up since it would be hard to know what it might hit when itโs first shot
so the only thing iโm thinking and iโm not sure if the game will be p2p or server so iโm building for both currently but with doing it as a physics object itโs probably more expensive and less scalable on the server so probably worth dealing with the interp issues on projectile movement component since itโs so much cheaper right?
Yeh this is just one of my goals is to keep the server costs low and bandwidth at a minimum
might be hard to avoid replicating these though
Thoughts?
hey guys, sorry to bother you I have a really weird problem : I'm building a TopDownShooter game and when pressing my ability (which here, just display a GameplayCue) my GameplayCue position is correct on both Server and Client and so on all screens. BUT the GameplayCue ROTATION is correct ONLY on the screen of the player pressing the ability. But on the other screen it's like Z = 0. The print string is correct tho, for both client and server. How can I fix this?
I tried with actor transform, world rotation (mesh) and world rotation (capsule component), and I have the exact same prob
My net mode is set at "Play as Client". If I set it as "Play as Listen Server", the listen server sees the correct rotation, but not the other clients anyway. I don't understand why Location is well replicated but not the Rotation
could be a glitch depends on the version your using
Ue5.3
try with 5.2
i noticed doing retarget and stuff worked better on that engine
kinda wish fab wasnt a thing it breaks alot
Hm Iโm afraid to break other work by doing this, no?
Iโm really surprised that UE3 has prob with such basic things like replicating rotation to other clientsโฆ
Your grievance doesn't seem to be related at all though, just saying.
wait what was ur msg again? U deleted it right? Yes it is GAS but I'm new to it. How do I send data to the server ? (I think u said that in ur precedent msg?). I tried to add "has authority" aswell but didn't work. I'm new to GAS
Gas have built in functions you can use. Look up target data
Though I deleted it because when I look into your code, you are just getting the characters location
If you get the character location on activation, you will end up having the location of the executing machine (which is fine depending on the context)
location is working as I want so it's fine. My problem is rotation always being 0
Try get actor location btw
@edgy yacht I don't think rotation is replicated by default
ohhh that may be the issue then ! Bcs location works perfectly but not rotation. So how I replicate rotation then?
I mean that depends on your movement logic I guess. Like how you want the turn to happend.
There is multiple way of rotating something depending on the style of the game.
One of them is by ticking use controller desired rotation
That will rotate the capsule in respect to the controllers rotation (basically where the player is looking at)
my game is a topdown shooter, and the character is always looking at mouse location
Well perhaps you need to replicate that. The gameplay cue aside, have your character rotation gets replicated successfully?
Test the game with multiple players
Check when client shoot and face a certain direction, does it do the same on server
yes
the character rotation is replicated successfully
Then it shouldn't give you 0
I know xD
Print out the rotation on tick. Observer the value on both server and client.
again, when I'm printing rotation, it is not 0. But the gameplayCue direction is 0, where it should follow the rotation
yeh I did that, the character rotation is correct on both server and client
okok thx still !
Hello. I wanted to ask why I was getting the same widget twice? Am I doing something wrong?
You did something wrong if you don't get the result you desired.
Well... Yeah but I don't know what I did wrong. That's why I'm here.
I can see you have 2 players
Each running create widget on what ever event you have
You need to look at is locally controlled node.
This can be used to filter codes to only run on actor you controlled.
So for player 1 character, run it only for his character. Don't run the create widget on his machine for every character in existence.
I suggest to read exi compendium pinned in this channel.
Knowing how to run codes on which machine is very important for multiplayer.
For now you can just do.
Begin play, is locally controlled, if true, create widget
No need for rpc
Unless you need the server to explicitly call it. But then again if it's just a hud that show hp, you can just display that whenever your character is up
Oh okay. Thanks
Btw begin play is mostly the wrong place to do things in mp, I am just giving a short example
Once you get it working, you should read exi compedium
Hello, is there a way to temporarily skip replication of a level sequence actor during re connection?
or make it skip triggering all the events?
I have a sequence that's very long, and has a ton of events.
when reconnecting i've noticed that it is as if it's sweeping the sequence and replaying all the events, causing serious instability.
hey all not sure if this belong in this channel but doing MP and getting this weird error message, not sure what it means and everything works fine but getting this error, looked online and just said to plug owning player to self
this is inside the player controller
Begin Play can fire on clients and the server.
Since this event will ultimately execute on the server, then it can't create the widget with "Self" going into the create widget node, as the player controller may not be a local player controller if it's a client owned player controller.
for the player controller what was the "begin play" for the MP alternate
i thought it was possess right?
Begin Play = the actor comes into play. There is no alternative that I'm aware of. The issue is not so much that you're using begin play, but that you're trying to create a widget with an owning player == self while executing on the server when self may not be a local controller.
Basically what you're doing here is....
ON SERVER:
When Player Controller starts existing execute SR_DEBUG Event
SR_DEBUG Event > Create a widget with Self (this instance of player controller) as Owning Player
ON CLIENT:
When Player Controller starts existing, request server to execute SR_Debug.
SR_DEBUG ON SERVER > Create a widget with Self (this instance of player controller) as Owning Player
So for a client's Player Controller this code will actually execute twice on the server since that Player Controller will exist on both the client and server, and since it's a client's player controller, the "Self" can't be properly used for creating the widget since it wouln't be locally controlled on the server.
is there any nice way to move a niagara system on a client where you want the location to match a replicated static mesh component? obviously you can't replicate the niagara component and the only other thing I can think of is to constanly multicast the location
I guess I could just keep updating a position vector of the mesh component position with an onrep but not sure if that's any better ๐
you could send the position at greater intervals, and tween on the client.
and only send if moved.
or attach it to the static mesh
it is attached but the mesh is also replicated and the niagara component doesn't exist on the server
i don't think that should matter? you can have non replicated components on something that is replicated
are you moving the mesh itself or it's actor?
the static mesh simulates physics and is replicated, the issue is even if you attach a niagara component to it, it won't spawn on the server so there's no location data for the client to use
hence thinking of a workaround
Is there an industry-accepted amount of packet loss to try to build for? As a player I'm ideally having 0%. Past a few %, fast games like rocket league are unplayable. Is there a certain % of packet loss I don't need to bother testing for?
Even continuous 1% is terribad.
Is packet loss just some TCP connections that failed and need to resend the info?
If someone has that kind of packet loss, that's something they need to fix themselves and not something you can really compensate for. All you can do is code your game in such a way that the server and game doesn't break in case someone is having bad packet loss. It may screw up a single client's experience, but it shouldn't screw up everyone else's, if that makes any sense.
Packet Loss = Packet not received which can happen for a wide variety of reasons, like noise on the line at the time of transmission, overloaded networking hardware, WIFI signal temporarily dropped. Unreal uses UDP which on its own normally doesn't care about packet loss as there is no acknowledgement of packets, it just keeps transmitting, but while Unreal uses UDP, it does have its own acknowledgement systems in place that it uses over UDP which will retransmit things in case there is some problems.
they use UDP, sure but they implemented a custom kind of TCP system so it knows when to resend the data if it hasn't arrived
Hello, what is the proper way of doing client side prediction in blueprints, lets say for example shooting with a gun
pretty sure packet loss isn't something you can mitigate? its usually because of network conditions
Hello!
I have a question about Data Assets.
I'm currently working on a project where I want players to be able to choose a weapon before joining a session.
On Event HandleStartingNewPlayer the server gets the selected weapon from the client and grant the necessary abilities + spawn the adequate mesh to the player.
As a test, I'm trying to set a default Weapon Data Asset from the server to the client.
However, it looks like that when I try to replicate the weapon Data Asset to the client player, it is null.
The component WeaponManager is set to replicate and the Weapon DataAsset set to replicates with RepNotify, but the rep notify never get triggered on the client.
- Is there something I am misunderstanding about the use of Data Asset?
- In the future, from where can I get the selected weapon information from a connecting client?
Are you certain you have a data asset reference set in the "Default Weapon" reference?
Yes, it is not null on the server as well!
Are you sure you've marked your Actor Component to replicate? This should technically work.
Yes, as seen here:
What might be happening though, is you're using handle starting new player to perform this action. Are you certain the pawn is valid by that point?
Maybe not?
I tried a setup where I send a Name WeaponID and get informations from the local DataTable and it seems to work... I puzzled why it doesn't work with the DataAsset though
Client prediction is the same logic in BP or c++, but c++ has more tools for that
And sometimes you want cpp speed
Sure this has a loaded answer but if I wanted to have players be able to go to a different / sub level from the main level , what would be the way to go about that? This would be a solo experience but maybe in the same world / level just a different instance
I guess I could just open a new level and have them leave the level theyโre in
i don't think unreal engine supports instancing
if you want to move everyone, you can just load a new level and either do a seamless transition or normal transition
Yea I was just over thinking it
What is the difference between seamless and normal?
Seamless means players stay connected while travelling. Hard travel disconnects from your current session
Rarely do you want a hard travel unless you are joining a new server
im adding input mapping on begin play to the character class but 'is locally controlled' node returns false for the server's character. It works for the client character tho. How can I solve this? It works when i add a bit of delay before checking is locally controlled but that's still a sketchy solution as the race condition is still there.
you generally wouldn't add/remove IMCs in BeginPlay
thats what i saw in the thirdpersoncharacter example but i dont know any better
how should i do this ideally?
oh you use c++ then
Event receive controller change might be of help in your case. I believe this is what I changed my IMC to be at instead of begin play
Ahh ok cool. If I wanted it to be standalone Iโm assuming this would be hard travel? Although, Iโd like the server to be there to for variables that I have
well you might go insane doing replicated stuff BP only, but you'll have to use a place where you can guarantee that you can catch a valid controller where it matters
and that sounds like it could work
with BeginPlay, you may receive BeginPlay before possession
hi
I have a problem
The problem is that weโre unable to connect through Multi-User Editing in Unreal Engine despite enabling the feature and entering the correct IP address, and weโre using the same version of Unreal Engine. We also disabled firewalls temporarily, but the devices still arenโt connecting or seeing each otherโs sessions.
yup this works thank you!
this is my first unreal engine game so blueprint just seemed easier. even though its multiplayer im keeping the game really simple as its a table game. What kind of obstacles might i face doing replication with blueprint if you have experience?
well at least you don't need movement prediction
but above is a good example since there's no direct equivalent and then you have some advanced stuff like replication conditions
and replicated stuff can be even more spaghetti-like than normal
for sure i think twice before adding every blueprint code to make sure its all organized
Begin play is too early, the problem here is, the pawn isn't possessed yet in the client's machine.
Delay isn't a solution, it's a bandaid that doesn't even work since in real time you won't know the client's ping at the time begin play is called.
Any ideas on this one?
Is there a way to prevent a replicated actor to replicate the attachment?
You want a thing that is supposed to be the same(replicated) on all machines, not to be attached to the same thing on all machines?...
If possible yes lol
I want some of the properties to be replicated, but not the attachment cause im predicting it
Idk if there is a better way to do it
Im getting a join fail as soon as i search, the session is 100% hosting so does anyone have any ideas?
(Posted this in #blueprint but will post here too for visibility)
Hey all, Iโd love some suggestions on something Iโve come across for a board game Iโm working on. Ive been trying to implement rolling dice with impulse, full physics. The issue is that it doesnโt replicate accurately on other clients which means the results are always different than on the server-side. Besides a pre-determined approach where I would simply fake a dice roll with a timeline and some variable that has a result stored in it already, is it possible to get that physical aspect to replicate properly across all clients?
is it okay to stop player movement via a repnotify ?
If it's a one-time stop, no. If it's a State, yes.
perfect ty
So I'm making a game where you play as a observer and a climber. So basically the climber can't see the obstacles in front of him you as the spectator have to guide him by just telling him where and what to do
My question is how would I render something visible for one player but make it invisible for another
But I need the one who can't see the things still be able to interact with it.
Like imagine a platform.
Player 1 can't see it but can stand on it
Player 2 can see it
use the Visible In Game checkbox for player 1 ?
Uhh to make it server authoritative, I'd say have a replicated variable which does uncheck the "Visible In Game" checkbox for the client 1 in the OnRep call
Update the visibility of the meshes on begin play of the actor based on the role of the player.... You can determine which player it is by getting the Player Array from GameState, iterating over the players, and checking if their playercontroller is valid and locally controlled. If that player has the appropriate role, update the visibilty as needed.
Alternatively, make the obstacle actors owned by the player that should be able to see them when spawning them, then click the "Only Owner See" on the meshes in your blueprint.
But that would not make it have collision for the one who can't see it
or am i dumb?
very smart approach, big brain approach but would this make so the player who can't see being able to collide with the invisible platforms?
like stand on them, just not see?
yes, visibility doesn't affect collision .. it still works
ah, i just assumed it turned off collision.. stupid me
you could use the replication graph and only replicate certain actors to one person
or just hide it on one client
they could technically cheat and unhide everything, but do you really care?
If i didn't replicate it to both a moving obstacle wouldn't move on the unreplicated player correct?
so visibility is better i think
I'm tempted to use the Mover or the UNetworkPhysicsComponent to make up my physics movement but unless the Mover has the same input buffering things for prediction as the UNetworkPhysicsComponent .. things won't be straightforward.
I guess I'll have to read both's source code ๐ข
Cheating in a game like this would be akin to cheating in a game like Keep Talking and Nobody Explodes.
thanks for your detailed explanation by the way my friend.
mover 2.0 has networked physics support
^ excited for when this depreaches the normal one
every time I have tried to use it my editor crashes, however
yeah but does it allow me buffering input for prediction .. and apply in on the AsyncPhysicsTick I've yet to find out
That could be the only thing to be break it for me
pretty sure
sounds cool !
just don't use in PIE as mentioned by vori from the vorixo blog
I remember reading somewhere else that it always crashes that way also
it crashes me when I compile my BP unfortunately
is mover 2.0 documented somewhere or not?
not really, pretty much just the comment in its code
unfortunately not any resources online as far as I could really find
I checked how it works,
it not
lol
prediction is so messed up
and this is only "average" network emulation
it wasn't that bad for me. you probably need to configure the project
Spawn locally for the client that's doing the action right away.
OnRep delete the dummy and let the actual attachment logic do its thing.
Does not really work for my use case.
I need this for a weapon equipping system, where you have the weapon actors attached to different holster sockets of you character mesh, then you can put any of them on the hand socket, and put it back at will.
I want to predict the attachment for the local client, but for that to happen i need to avoid the actor's attachment to replicate.
I would like to not use just a locally spawned actor for every client, cause the event from which i'm spawning the actor is called only for server and locally controlled character.
But i guess it is the only way
a lot of networking stuff in mover is unfinished
can you not pass actor object references through RPCs? as in are they local/different for each client? im trying to light a lantern on fire, and it works locally but isnt getting replicated, im doing a run on server and then into multicast, which then casts to my BP_lantern to call an event.
you can as long as the actor is replicated or "stably named"
im not aware of any other free "templates". theres gas companion which is a paid plugin that adds an immediately usable implementation of gas
there actually might be an example pinned in the #gameplay-ability-system channel
Hello, does anyone know whether the controller is always valid on a local client on begin play in case the character/pawn was spawned using restart player?
I'm trying to get my initialization going correctly, but it doesn't work on listen-server character because GM::RestartPlayer first spawns the player, and possess it afterwards. But client-side the controller seems to be valid on begin play. I want to know whether it's always the case
Tried with 500-1000 ping and 50% packet loss, and it's still valid. Gonna assume that it's always the case
The controller kind if IS the connection
In a way, the player controller is more or less the thing that holds the connection to the server
I'm not sure if you can gaurantee this 100% but in general after joining... you should have a player controller that knows about what it's connected to
The pawn will be sent from replication afaik and probably hooked up by delegates, I would recommend just breakpointing things like OnPawnSet etc
Yeah, I know that PC must be present on the server in order to be even connected, but the thing is that a character might be not possessed at the time it's created. However, my little test has shown that it is possessed on begin play time for the local client
When the Pawn does BeginPlay it will be after it arrived from a network packet and set initial data
There are a few cases where inside of an OnRep-called function you could not have the Playerstate<->Pawn<->Controller member properties set but the object could still be there or part of the same packet
Yeah, makes sense. Now that you mentioned that some data might be absent in the same packet that are related to the object that was created, I actually kinda have that issue that I fixed with some delay code. So, I have a struct that's set as RepNotify. The struct is initialised as soon as the game starts, and onrep it's called with the correct value server-side. However, client-side, the onrep has the incorrect value (the default one), but a few frames after it gets replicated, but no onrep is fired
Instead of a delay, you can just delay to the next frame and check for what you want to see and then just delay again if it's not present yet
Delaying is fine as long as you are actually continuing to wait upon them not being there and not just praying it will show up .5seconds later
I have a Do N 10 with a delay of 0.5 on begin play
Okay, so if it has to wait more than that time the game just breaks? Unlikely but well, that's probably not what you want
something like the game feature init state thingy in Lyra basically just has a set of "states" an object can be in
Just about anything being set will pass-through the "is everything ready yet?" code
It's not something really important, so it works for it. It pretty much hides an object if it was consumed. I don't destroy it because it might be reset
So that way there could be 3 things that can happen in any order, but the last of the 3 will see the other 2 are done and go "ready now" and you can actually let the player move etc
In my case I only have one thing, so there's nothing else to instigate the Is Everything Up logic
What is "everything else" in this case?
I refer to this
I mean what is the specific thing you are waiting for
the pawn being set on the playerstate?
So replicated content isn't showing up until later, I see
Correct
why not just have this get triggered in the Onrep for that pickup and also beginplay?
Is the onrep not firing for the second time? (the data showing up)
Also BP's call onreps on the server, in C++ onreps are only called for clients and not authority
Yeah, I know
Is this a replicated property defined in C++ or BP?
which Onrep mode is it in? 
AFAIK this should absolutely be triggering an onrep when the data you want arrives
It's BP only
then... how would it onrep?
ah okay, that's good
I'm confused why this isn't triggering the onrep... can you add a quick print string to print the tag contents every onrep?
Luckily this actor is not that important, but man, I would absolutely hate it if it was something match/game-state specific
Alright
also there's Content and ReplicatedContent
Are they replicated to different clients?
both of them show the replicated visual here
oops, content is not meant to be replicated
My bad
After I started using reset, I had to remember the original state of the content, so I switched to two props
It's hard to live without CDOs ๐ซ
I start the game
LogBlueprintUserMessages: [A_Pickup_Tool_SkeletalMesh_C_3] Server: Gameplay.Tools.Tazer
I pickup the item
No onrep because I remove the item using RemoveGameplayTag
Client joins the server
LogBlueprintUserMessages: [A_Pickup_Tool_SkeletalMesh_C_3] Client 0: Gameplay.Tools.Tazer
I wonder whether it has to do with the fact that it's a gameplay tag container
I tried to do this, and it prints hello on the client that joins the game late
So it works with bools, but not with the gameplay tag container
No onrep because I remove the item using RemoveGameplayTag
So you modify the internals of it without setting it?
I'm confused
I do this, and it doesn't call the OnRep server-side
You know, it's like calling Add on an array, it wouldn't call the OnRep even in BPs
hmm... I think you want to at least mark the property dirty?
How would I do that in BPs
for now you could just set it to itself :U
Good idea
Actually though, now that I look at some FGameplayTagContainer code, there's this FGameplayTagContainerNetSerializerSerializationHelper that does the replication apparently
LogBlueprintUserMessages: [A_Pickup_Tool_SkeletalMesh_C_3] Server: Gameplay.Tools.Tazer
LogBlueprintUserMessages: [A_Pickup_Tool_SkeletalMesh_C_3] Server:
LogBlueprintUserMessages: [A_Pickup_Tool_SkeletalMesh_C_3] Server: Hello
LogBlueprintUserMessages: [A_Pickup_Tool_SkeletalMesh_C_3] Client 0: Hello
Now client didn't even fire the onrep
But in this case it makes sense since ReplicatedContent is empty by default
Yes, the ideal is if nothing changes there's no need to send the onrep
In C++ you can change when OnReps get sent, for example they can always send etc
Would one of these forcibly change it?
could also yell at it to force net update (the object itself)
I don't need it to force net update, it can update anytime it want really ๐
Isn't mark property dirty used for push based replication? Don't you have to tell a specific object that it's push based though? I haven't used it, so I only vaguely remember how it works
Hello! anyone here know there way around gasp or atleast how to fix these 2 issues, number one being my camera zooms slightly when i move and number 2 being when in first person i can spin my head like a drill
You can limit the camera rotation using player camera manager
This has little to do with multiplayer... You should try to anchor the camera to something you can rely upon
The camera "zooms" most likely because you attached it to the head, so when the character leans, the camera follows the movement
Also true ๐
If it's anchored to the head and the head moves quickly, so will the camera
The camera rotation being unlimited is going to depend on what you want, I don't know if you want the head to move independantly or what
You probably want it to be limited by some simple math to not go too far to the left or right based on the direction the chest is in (ideally the chest doesn't diverge much from the pawn rotation?)
About my problem, I might've understood it a bit incorrectly. I switched to this code, and it works like a charm
Technically yes but this hacky thing is exposed to BP just in case... I would just try setting it manually first
Yes it's a pointless BP copy but it's small potatoes imo
I think it might call the onrep now because you set it every time you change something
which calls the onrep for everyone
It will, but that's what I want
The OnRep on begin play is required to setup the initial state (visible/invisible), and the other one is required to change visibility depending on whether the container is empty or not
That's good, this way it's nice because late-joiners will get the correct state too
Yeah, thank you ๐
So i rigged it to every part of the body that would be acceptable and it gets worse, it just wants to zoom everytime i try to move
Any ideas?
Use #ue5-general, this channel is related to multiplayer
I don't think so. I am testing at the same net emulation my character movement component and its smooth af. So I assume if my lag compensation code is ok, what is going on here?
Are modern games still using tactics like giving player input delay to better sync multiplayer?
It depends on the kind of game...
there are games that uses that still .. but not so much new games with the "old P2P architecture" which is probably what you're referring to
Anyone use Web socket to keep track of players status (online / offline)?
Wondering about the estimate cost and if it's worth pursuing in AWS.
Pretty sure fighting games still use input delay along with rollback
I'm working on a TBS, and I'm having problems with getting the client to get units to perform actions. I select an actor & call a function that does local validation and such, then calls a server UFUNCTION. However, the server function never actually seems to do anything. Everything works fine on the server, obviously. My actor is set to replicate. What am I missing?
//UFUNCTION(Blueprtint Callable)
void AFleet::RequestSimpleMultiFleetMove(APlayerController* Requester, TArray<AFleet*> FleetsToMove,
AActor* TargetDestination, bool overridePreviousOrders)
{
UE_LOG(LogTemp, Display, TEXT("Player requests simple move."));
//Do any local validation here
if (Requester == nullptr)
{
UE_LOG(LogTemp, Error, TEXT("Requesting player controller is null."));
return;
}
if (FleetsToMove.IsEmpty())
{
UE_LOG(LogTemp, Error, TEXT("Fleets to move cannot be empty."));
return;
}
if (TargetDestination == nullptr)
{
UE_LOG(LogTemp, Error, TEXT("Target destination is null."));
return;
}
//Do any SFX, etc
//Assuming we've made it past local validation, actually attempt to do something on the server
UE_LOG(LogTemp, Display, TEXT("Local move validation completed."));
HandleSimpleMultiFleetMove(Requester, FleetsToMove, TargetDestination, overridePreviousOrders);
}
//UFUNCTION(Server, Reliable) never occurs if the current player is a client
void AFleet::HandleSimpleMultiFleetMove_Implementation(APlayerController* Requester, const TArray<AFleet*>& FleetsToMove,
AActor* TargetDestination, bool overridePreviousOrders)
{
//Here we should do any checking that the server needs to do
UE_LOG(LogTemp, Display, TEXT("Server recieves simple move request."));
}
The actor you are trying to call the server RPC on needs to be owned by the client trying to call the RPC
but if it cant be that way, you could always call the server RPC through the playercontroller with the selected actor as an argument
i came across this bug where widget interaction component cant interact with 3d widgets when there are more than one players. Its a pretty easy bug to recreate on a new project too. Has anyone dealt with this issue and solved it?
I thought only player controllers and pawns/characters can be owned by a client, this is an actor. I guess that means I have to chuck all of my order related code through the player controller?
I ran into this where the server can interact, but not any clients, I never figured out a fix.
you can set an actor to be owned by a clients player controller, then the client "owns" that actor and can call RPC's on it
if you're going to have multiple clients able to select the same actor then yea you will probably need to pipe it through playercontroller or something
I'm sure this has been asked a bunch of times already, but what could be the reason that, during seamless travel, my PlayerState does not have any data in it when CopyProperties is called?
I set a breakpoint in GetSeamlessTravelActorList, and in there it still has the data, but once I hit the breakpoint in CopyProperties its gone
Figured it out, APlayerController calls APlayerState->Reset() BEFORE calling APlayerState->SeamlessTravelTo(), so before the properties are copied over, and I was resetting my properties in Reset() just out of habit. But that means the data in my PlayerState got cleared right before copying, I guess you're not supposed to handle resetting playerstate properties in the Reset() function
yooo i solved it. When making buttons for 3d widgets, you just have to use events such as onpressed instead of onclick
Can someone help explain what I'm doing wrong here? (Trying to set overlay on a static mesh only for individual client, both meshes have replication disabled, and the application checks islocalplayercontroller before applying overlay)
Client has different Z position for arrow which is spawned with Replicates and Replicates Movement and it's Attached to Socket
It almost looks like Socket position is not replicated????
because it isn't
If it's attached to something, you're relying on whatever you're attached to being moved. Otherwise you'd have constant discrepencies
it's attached to Bow and it's Skeletal mesh.
Bow actor is also set to Replicates and Replicate Movement
If you're doing it that way, it's the arrow that should be replicated and replicating movement. I wouldn't do it that way personally though
and how would you do that? ๐
it's driven by animation and then when player fires it gets socket position as initial location for projectile
Bow wouldn't be replicating movement, attachment would be driven by whether it's equipped or not locally. Arrow would also be completely local and driven by animation
ok, I see.. so basically try to offload everything to local
and then only send location value to server
]LogScript: Warning: Script Msg: Divide by zero: Divide_DoubleDouble
does anyone know what this might mean? i don't have any math where something is dividing by zero (that i can find)
turns out, i was dividing by zero. nice
Hello. I need some advice on a small issue. Since I am a new multiplayer developer, I couldn't come up with a logic and the ones I tried were wrong. The situation is short: there is an actor on the map and we need an item to interact with it. I am trying to set up this with the logic of opening a door with a key, but it is a long and faulty path for multiplayer. What do you suggest about this? Should I keep a boolean variable in the character when the character picks up that object and how can I do this? It will be a 4-player co-op game. thanks all
Keeping state about the world on the character interacting with the world isn't really the best place imo because what happens when you want to keep state but switch characters?
Ideally you'd want to keep the state of the door actor if its opened or locked on the door actor itself so that when the character interacts with something (in this case a door) the interaction event on that particular door actor runs. Then you could compare with variables on the PlayerState to see if the player interacting with the door has a valid keycard or enough exp, or some else like an unlocked attribute or special ability.
Thank you so much. Ill try this way
I am trying to do seamless server travel but my server crashes after travelling, I'm not sure why.
Here is my method for calling the server travel.
I'm using unreal 5.4 and hosting the dedicated server on gamelift, everything is fine until I call server travel.
What are items in your system? What does it mean to have an item?
well other players' controllers don't exist on clients for a start
not sure why you have the dependency on other player controller for spectating
since a pawn is a valid thing to have as a view target
Hi
I am making a flight game , my aircraft is the first person , so i am confused whether should make that aircraft a pawn or Character , keeping in mind about the jittering in multiplayer,
Mostly up to you. Character comes with net stuff done. So if it's flying mode can work for your needs then that'll save you some dev time. If you need something different for whatever reason, that means you'll need to implement a lot of the movement replication and smoothing and such yourself if you go with a basic Pawn class.
means for flying mode also i can use that Character ?
and for movement , i will be moving the aircraft locally and sending RPc for updating the movement in server, is that approach correct
Not entirely. That'll look jittery to other people. You have to locally predict some movement based on velocity and whatnot. If you don't, then you'll end up with a case where someone is running their game at 120fps, and only getting movement updates for 15-30 of those frames. There are other factors such as cheating if you allow the local player to dictate where their vehicle is.
i my case the server is also a player and i am changing both aircrafts tranform at same rate but the server player moves forward with some jitter in other player screen
will that unreal Network Movement helps me with that , or i have to anyhow implement my logic
Hello, does anyone know how to separate VOIP talkers into different channels? I want to have spectator and game channels
i fixed it with is valid node. btw system like take key and open door
I have heard of nakama and that it's very good for multi platform
Haven't tried it out though
lol how very reductive to have a poll though
Now I want to make a game completely dependent on public polls
When you do, do a yt vid about the process and results
that would be fun to watch
I mingled with Nakama a little bit btw. It was easy to setup and use overall. It's mostly open to customization with json based custom payloads (even though I'd prefer to avoid string based data due to performance and type safety concerns) and serverside hooks to correct/respond/prevent events and even define new custom RPCs. Could be better if we were using dedicated servers because we needed to use subsystems anyways to connect players to listen server (or I messed up understanding some concepts). I would summarize Nakama as Firebase for games.
We mostly used Nakama for the matchmaking. If EOS wouldn't require players to link their own provider accounts with EAS with a pop up at the first time startup (or if I could find the way to do it without that requirement) I was intended to use EOS+ over Nakama. But our team decided not to "scare away" players with that
Hi, I'm writing a multiplayer game. For testing I use automated clients.
Is there any mechanism to create EOS test accounts? I'd like 60 or more.
I want my automated clients to test everything, including EOS functionality.
Thanks
Yo hallo guys, I am learning multiplayer and can't really find any normal here. Should everything be Client side predicted? Or do you just make certin Things Client side predicted, thanks for help guys! โค๏ธ
Im making a somewhat simple first person kill zombie game inside a bunker. So only freinds wpuld play together
Thx for your help, I do know how to do prediction but AI wasn't really aware on if everghing should have.
Yep
Will be fun XD
But thank you โค๏ธ
So I will also have turrets, and damage should handeled about Server ig to prevent doffrent versions of the game, I am right with that no?
Alr. Ok
So Shooting most likely also be handle by the Server and then Replikate to clients which enemy to shoot
For the animation (speaking about turret)
Ok but all of These methods are valid?
Ok!
Thx you, just helped so much!:)
You can use game state right
it want to plug a player controller ref
yes and I told you why you can't
since today my steam advance session started to do this :/
works fine with older builds
[2024.11.06-14.55.07:068][146]LogSockets: Warning: SteamSockets: Cannot get information on an invalid socket handle, returning null
[2024.11.06-14.55.07:068][146]LogNet: Warning: Could not create socket for bind address 76561198017849560, got error SteamSockets: setsockopt SO_BROADCAST failed (0)
[2024.11.06-14.55.07:068][146]LogSockets: Warning: SteamSockets: Cannot get information on an invalid socket handle, returning null
[2024.11.06-14.55.07:068][146]LogNet: Warning: Could not create socket for bind address ::, got error SteamSockets: setsockopt SO_BROADCAST failed (0)
[2024.11.06-14.55.07:068][146]LogNet: Warning: Encountered an error while creating sockets for the bind addresses.
[2024.11.06-14.55.07:068][146]LogNet: Error: InitBindSockets failed:
[2024.11.06-14.55.07:068][146]LogNet: Warning: Failed to init net driver ListenURL: /Game/Maps/Lobby/Lobby?Listen:
[2024.11.06-14.55.07:068][146]LogNet: Error: UEngine::BroadcastNetworkFailure: FailureType = NetDriverListenFailure, ErrorString = , Driver = Name:GameNetDriver Def:GameNetDriver IpNetDriver_2147482392
[2024.11.06-14.55.07:068][146]LogNet: Warning: Network Failure: GameNetDriver[NetDriverListenFailure]:
[2024.11.06-14.55.07:068][146]LogNet: NetworkFailure: NetDriverListenFailure, Error: ''
[2024.11.06-14.55.07:068][146]LogWorld: Failed to listen:
[2024.11.06-14.55.07:068][146]LogNet: DestroyNamedNetDriver IpNetDriver_2147482392 [GameNetDriver]
it fixed but still I have a problem
The first time I press input the viewtarget does not change, but every time I click on it after first time it changes without any problem.
Hi, I can't seem to see a specific help channel so if this is the wrong place to ask I'm sorry, but for a project I am currently working on I am attempting to set up LAN multiplayer and am running into uses with RPCs and my movement system. The new max walk speed is set for both of the characters but only the host actually moves the other character jitters in place
https://imgur.com/a/jittery-rpc-OE4axsj
This might be related.
this is not how you handle networked custom movement, you should make own character movement component basing on built-in one
Or not because the CMC is awful if you don't need complex movement.
sorry if this is a very dumb question but at what point would the movement be considered custom? I figured if I was just setting the max walk speed with alternating key presses and just had the character always receiving forward input it would not be custom
Custom movement would be like custom movement modes. You'd just set the different axes for forward and lateral movement and not do anything custom?
It really depends on your requirements.
There is a pretty usable standard replication system for physics but it's a totally different problem if you need prediction
would it still need custom movement modes if input was normal (so left thumbstick makes you go forward, back, left and right) but the character speed is adjusted by triggers
No
You would just multiple the inputs together to set the cmc input.
"Left active or not" (1 or 0) * trigger value -> cmc input
Don't change the max speed value, change the input amount.
Thank you for the advice, gonna go mess around with things to see if I can get it working
I packaged my game with the standard replicated character movement. My friend hosted the server through the steam sub system and I joined as a client. His movement is fine, and mine looks good on his screen, but as the client my move ment is jittery. (First person camera).
Anyone know if this is a simple setting that should be changed, or a plugin?
guys help, i made a simple and basic join and create session using steam subsystem but it only works in the PIE mode. when i try as a standalone game it won't find my session ( lenght of array session result = 0). it's really weird because when i tried it with a friend of mine with a shipped build on steam it works just some times
i would really appreciate some help, im stuck
i change speed as well and to solve the jittering i lerp to the new speed on both client and server
what are you using for character movement?
Hi! Iโm just using the standard third person character. I just switched the actual skeletal mesh.
It was less jittery movement and more like it jitters in place
whats your code for movement?
also did you replicate the character?
maybe try playing with the network smoothing thing in the movement component i forget what itโs called
I posted a few screenshots earlier but I can resend them and also the functions that change movement speed. The only thing not shown is that in the Blueprint for the character MoveForward attached to the Event Tick
are you trying to replicate movement yourself or your using character movement component somewhere?
oh i see your calling moveforeward somewhere
donโt check has authority on move forward call it on client on server the cmc handles this already
client and server
how would I call it on the client and server?
just take it out of the gas authority if statement donโt check for authority
okay gotcha, sorry for the dumb question
no worries iโm looking for help with my dumb question on the gameplay ability system channel lol
I'm still getting a jitter for the client unfortunetly
What's the best API for multi-platform online for a game shipping in 2 years?
0
0
hmm iโm out of ideas lol
haha all good
If I am doing procedural weapon sway, lag, recoil, etc.. does it make sense for proxies to also do the same? Or would it be better to have them just run animations?
The sway, lag, give it a more realistic feel but I don't think that needs to be replicated. I dont think you would really see it on proxies
is there no way to make a replicated actor reliably replicate before a relaible rpc ? so its atomic
Nope, Order of replicate and rpc is not ensure.
Sounds like an OnRep variable would be better suited
I made a system to drop the gun if I shoot an innocent person but there are some problems. first problem is that if someone drops the gun and someone else picks it up there is a replication problem. the other problem is that if I shoot an innocent person and pick up the gun it drops the gun again when I shoot anywhere.
I'm applying an impulse to a static mesh component on the server but when I try to log it GetComponentVelocity() (with authority) it's always showing 0
what is the RPC replicating? What does it mean?
is the mesh moving?
yes, indeed. I'm only applying it and trying to log it on the server
What does get physics linear velocity return?
are you checking it over time or on the same frame you're yeeting it
If the thing is sitting still and you do:
Add Impulse -> get velocity
it'll still be sitting still
It'll be moving next frame
once I apply the impulse I activate tick on the actor (and log it) until it drops below a threshold. At least that how I want it to work.
let me try with linear velocity
I have a spotlight attached to the player, I set it to replicated, but the client can't see their own light or others' lights if I only use Run On Server. The client can see the lights if it is Multicast, but I don't think that is good for turning on a spotlight.
this run on server event is running right after the Flashlight input, and the player using flashlight is set to self
Unles I'm mistaken and spotlights need to be set on Multicast
why not just do this locally? is this something that needs server authority?
how am I suppose to see other players lights if I don't run it on the server?
you might be able to get away with something like everyone setting their light bool in the game state I think
gamestate holds all the player states and can be seen by all clients, maybe just use player state
Ok, I'll look into that
Iโm guessing this is for flashlights?
The easiest way would be to have a replicated bool โisFlashlightOnโ or something. When a player toggles their flashlight, it runs a server function that sets the variable.
Then the variable has an onRep function so whenever it changes, everyone will be able to enable/disable the light locally for that actor
yea it's for flashlights
The light itself does not need to be replicated
ok I'll give that a try
Damn, I need to adjust the colors if that's the B/W version
Color version is on this page btw. https://cedric-neukirchen.net/docs/multiplayer-compendium/framework-and-network
What would be a good architectural implementation for a loot system where each player has their own loot instance?
E.g. Group of 4 players kills a boss. Each player loots the boss's body. Each player rolls randomly and generates different lootable items. None of the other players can see or interact with other player's loot.
My basic implementation of looting so far is that the mob has a 'inventory' variable (an array of structs) which is dynamically generated on enemy death. However, this is an example 'shared' loot instance as all players would only be able to interact with one loot set. I dont want to hardcode 4 different inventory variables...
Ideally the implementation would also respect server-authority e.g. don't generate loot on clients. That was my first idea but that is very exploitable
you could use the replication graph, or just replicate the items to all players but have it hidden if it's on a client other than it's owner
Enemy has a โhasLootedโ array of playerstates.
When a player loots, it creates their loot on the spot, gives it to them, and adds their pstate to the array, so they cant loot it again
might be able to just change the actors relevancy? not sure
Sanity check: is it fair to say that ownership of an AActor is not replicated bundled with the actor to the clients even when set in FActorSpawnParameters passed to SpawnActor? E.g. I'm noticing that my AActor on the client can once in a while return nullptr from the GetOwner node in BeginPlay , occasionally requiring waiting a bit longer for that value to be set.
Related post here.
If the owner is an object that hasn't been replicated to the client, yes, it can be null
So it's less about the owner reference being replicated separately, but the owner itself potentially not having been replicated yet by the time the thing referencing it is?
all actors have an OnRep_Owner I believe
Nice idea. This wouldn't allow for a typical 'loot window' and allow the player to view loot items however, is there another approach that would retain the 'conventional' feel for looting?
E.g. With your proposed approach, if the players inventory is full, what happens then?
Oh I see what youโre planning.
Same idea but Server has a TMap of playerStates or clientIds.
When a player interacts with the enemy, it adds their loot table to the tmap with their pstate or client id
So its generated based on who interacts with it and not beforehand
OH! So a Map variable with a PlayerState (Key) and a Inventory Array (Value) and it generates it dynamically when the player first interacts with the looted entity
That's genius, thanks
(Is it possible to have an array in a map? ๐ค )
Nope. Youll have to make a struct and stick it in there
Also Iโm not 100% sure if the playerstate can be a key, so if not you can use the clientId would be a unique int per player
Is it reasonable to replicate physical animations?
or is there a better solution than this that is simular to physical animations?
What's the best way in a multiplayer context to target a player when working with Enemies? (currently, I'm getting the first player character (0) which is always the same and wrong)
I made a system to drop the gun if I shoot an innocent person but there are some problems. first problem is that if someone drops the gun and someone else picks it up there is a replication problem. the other problem is that if I shoot an innocent person and pick up the gun it drops the gun again when I shoot anywhere.
Yes there is an option to replicate physics and make physics server authoriative, though I woud advise against this if possible as its very intense on the server
I'm confused why this variable is not showing as on. When I pick up an item, I spawn a component, set the component to on if the pickup was on, and then destroy the pickup. But on begin play of the component, it doesn't always show that it is on. Print string for the component shows false
on the child of this component, at the end of its begin play, I add a rep notify.
it shows false for client and true for server
BeginPlay calls after the create and before your setter. Also this variable isn't replicated, so it will remain false on clients I guess. and fyi it's less common to spawn components on actors like that. You'd usually spawn a new actor for your item and attach that to the player
You can have container operations be query based instead of using replicated data
instead of "let's see what replicated items are inside this thing locally" you can "Hey Mr. Server, reply to me with what's in here"
No. How much do you need the results on everyones machine to agree?
not super accurate. just for more interesting animations and variety
Then why replicate it at all? The source state will natureally be replicated, so just let the physics do its thing everywhere locally
A typical character doesn't replicate anything about animation. Animation is driven by replicated state (movement, etc)
What sort of physical animation are you doing?
mostly just arms and head rotation
should generally look like they are grabbing the object. Doesnt need to be perfect, but it would be great if at least the hand point for the arms are replicated
if they are independent of the body/character rotation then that's just 2 rotations to replicate
basically every computer will agree on the body rotation, head rotation, arms rotation, and body location. That's enough to derive the rest locally
well the head is on a swivel. It doesnt follow the body. Its a robot
yeah so replicate a rotation (or just a yaw) and then they can agree
what kind of rotation do you mean regarding the arms?
like the hand rotation and location?
It's spawned by the game mode and nothing in its constructor is showing that it's replicated, so I doubt it.
I don't think it exists at all on clients. The only reference to it being created is in the game mode, and is stored in the game mode, and game mode doesn't exist on clients, so they wouldn't ever have their own copy spawned.
Not VR. I would say the length of the arm and the location of the hand is the most important. the rotation state doesnt matter too much.
Just have no idea how to replicate that with physical animation
no it doesn't
if it exists on any "client", it'll only be the listen server host
?
it doesn't exist at all
it's an actor
how do you change the length of the arm?
it's not instantiated on the client
thats the plan. havnt implemented that yet
player is reaching out for an object that is based on the linetrace hit location to pick up an object
the idea is that the robots arms would extend to that point
im still new to animations so i'll have to figure out a way to make the arms extend with some kind of animation
If your clients are connected to a server, the game mode only exists on the server. If your clients are not yet connected to the server, then they would have their own, non-replicated game mode instance as they would be in standalone mode.
