#multiplayer
1 messages ยท Page 55 of 1
For the most part, at least the fundamentals in a singleplayer context
What about aim offsets? The basic idea is have your animation blueprint read from the base aim rotation since it's already replicated to all relevant clients.
Your base aim rotation would drive your aim offset that updates your players animation to look up/down
Ah okay, that's much more fancy than what's happening here.
I'm just trying to get a camera component and it's children to replicate their rotation.
That Add Controller Yaw/Pitch Input is just rotating the Camera Component of the character, and there's a few components attached to it
The actor's rotation seems to be replicating, but not the camera component transform and it's children
I do have Component Replicates checked for all player character components
That player character is very simple, but the actual use case with another player character is a VR player. And for that, I have to be able to replicate the transforms of many relative components, like the motion controllers, in addition to the camera for head tracking, and all attachments.
The server (if it's a host) looking up / down will be replicated to other clients, but the client control rotation is not sent to the server, it's local to the client. Notice how you're "Adding Controller Yaw / Pitch", that's coming from the Client so it's only happening on the client.
Play as 2 clients and you'll notice that both pitches will be broken.
The aim offset isn't fancy, it's just how this thing is easily done. I'd recommend watching a few videos on how to set it up, it's not hard and might save you a lot of headaches down the road.
Just remember if the video shows them using Get Control Rotation, replace it with Get Base Aim Rotation if you want it to work in a multiplayer environment.
Unfortunately I don't think aim offset is applicable to VR
https://youtu.be/hkv4zIpXA3c?t=111
I can continue researching component transform replication. Given that Motion Controller Components are components, I would assume there has to be a way to replicate the transform of components and child actors
Do any VR fps games actually make you place the weapon to your eye to use sights?
Most?
Nice
Seen in that linked video
There definitely is, you just can't use the control rotation or camera.
Not watching random videos.
I wonder if they replicate how hard it is to get a good focus.
You gotta be pretty accurate or it's blurry as hell.
(with scopes)
Unfortunately current hardware does not. There's depth and proper sight alignment for sure, but the rear and front sight post aren't necessarily blurry like IRL
Okay, yeah this particular test case is likely the issue itself. A red herring
Ill look into other traditional FPS control methods and their replication
There's a good reason control rotation isn't replicated. Your mouse movements would be an enormous amount of useless data being sent to other clients in a multiplayer game.
That was an indirect hint to make sure you don't call an RPC on mouse turn / look ๐
Heh
I would of just assumed every tick the server just requests the transforms of any relevant actors and propagates those to the clients.
What exactly and how those rotations changed not being particularly relevant. But I'm obviously a noob with multiplayer. Each attempt has been pretty much a non-starter so far.
There's no "requesting"
It wouldn't be a problem to send mouse aim data multiple times per second, just not every tick. You can just blend it together to create smooth motion on other clients.
If you wanted that level of replication.
And, of course, the update should be unreliable.
clients reporting their transform, and the server propagating that to each client, and resolving potential conflicts, that conceptually makes sense to me, but of course that doesn't mean that's how it works. I know that would be terrible in a cheating context, if that matters.
It's actually backwards, the server has the authority and tells you where you're position is. That's why you get "server corrections" that snap the client back to the proper position if the client's game instance falls out of sync with the servers.
Even if clients reported their aim rotation every tick (which they shouldn't, but let's assume they do) it wouldn't overwhelm other clients unless you also RPC'd that from the server to other clients instead of using property replication.
Hell, an unreliable client->server RPC every network tick wouldn't even be that bad.
Ye I have a feeling that unless you are still using dial up, you would need a quite a few bad networking practices to ddos your clients
Depends on the number of clients, though.
Some UE games attempt 100+ simultaneous clients. That adds up.
sounds like a challenge
Most games are not doing that, it's not worth talking about until someone actually has that requirement.
That's the point at which you're throwing out most "easy" networking tech and looking at lots of custom workarounds for optimizations.
True, but I'm just saying you have to consider your circumstances as well.
If you have 4 players max, you're got a lot more leeway than, say, a 32 player game.
Are you guys suggesting that I can't make the next big mmo with out of the box networking in unreal?
sorry the truth hurts
Blasphemy
You totally can.
Depends on what you want from your MMO, though, and how much external tech you want to use.
I'm totally unreliable RPCing the direction my client's camera is facing. Because it helps me rotate things easier ๐
๐
I unreliable RPC 200 structs each 100ms, who tops that?
That sounds silly.
I slightly modified how the CMC orientate rotate works - uses the player camera. So when a client is supposed to turn around and walk (because movement is based on camera direction when not ADS), it also does it properly on other clients.
No you can totally do it. You can do absolutely anything. Because you are special ๐
Aw thanks. My mother says I'm special too
๐ซถ
Now dont forget your veggies and go to recruit your fellow future superstars on a forum advertising that you are going to make your first Unreal game, the mega MMO of your dreams!
Hi just curious if anyone can point me in the right direction here. So the idea is that I want to save my character data to a persistent save in the game files. I however want it be a 4 person co op so ideally on login it would load the playerstate that I had saved. My problem lies here, Iโve gotten all these systems working in a multiplayer setting but am unsure of where my character information should be. Should I rebuild these systems in the playerstate and have the gamemode access the playerstate and save the variables I want? What is industry best practice for this kinda of situation? Iโm new to a lot of this so any input os appreciate.
Hey guys I have a problem with replication on my multiplayer game where I pick up my weapon and it goes to my pickup animation on the server but not the client. I already made the code but I don't have any errors so i have no idea. Thanks
If an actor is network culled will it still render?
No, for the Client that its culled it literally does not exist until it comes back into relevancy.
Weird, ok. That's what I thought but was surprised to see that with NetCullDistanceSquared = 500; (which means stuff should cull at 22 units away, right?) stuff was still rendering
The effects are delayed, I believe from memory it waits a few seconds before actually culling, just incase the Actor is sitting on the edge of the distance and might frequently be in and out of relevancy.
Gotcha, ok that might be what I was seeing - I didn't give it long
Felt like at least 30 seconds..
Cant remember what the time is, 5 seconds maybe
Hmm ok, might not be functioning then. But good to know it shouldn't render, makes it easy to test
Well make sure it isnt AlwaysRelevant.
I didn't set it to true, could set it to false manually but seems redundant
Also if you are using ReplicationGraph, the NetRelevancy stuff is basically unused.
No idea what the ReplicationGraph is ๐
Fair enough, its Opt-In, so if you dont know what it is then it wont be enabled.
Does anyone know why my PlayerController class is never set on the server? Is there a special way to set the PlayerController or GameMode for dedicated servers?
You can set the GameMode a number of ways.
Typically its applied directly to the World Settings inside the level.
Hm yes that's what I've been doing, and it works on the client but not on the server
The Maps & Modes in the Project Settings will also allow you to set a default Gamemode
Is it possible to control 2 characters from a single client? AddMovmentInput for a different character doesn't work no matter what I do (I tried to set net owner). Unless I use RPC and do it from the server or possess the second char
A PlayerController can only possess a single Pawn.
Couldn't you technically get the world location of your controlled pawn, offset its location then use that as your input for the pawn youre trying to control, could be used to test things I suppose not in actual practice?
My goal is to control a mount without possess him
Does a dedicated server even have a PlayerController? Like can I do what's in the pic and have it come back with a real object?
ugh. I'm missing something with this network culling. My spawned actors have NetCullDistanceSquared = 10; now, just to really try to force it to work. But the actors stay relevant no matter how far I walk away or how long it's been.
The Server has all connected Players PlayerControllers. That node can return any one of those.
So with no players connected that would be empty?
Dont try such a low value?
Try something thats equivalent to like 10 meters
correct
on a Dedicated Server
On a Listen Server it should always return the Host.
You could have a Pawn that is a Manager and this pawn could redirect the input to every ControlledPawnList
Set it to 100, see no difference.
Are you running a Dedicated Server or Listen Server?
It only works if I do it from the server. From client the movement component blocks me even if I'm the owner
Dedicated
Did you place the Actor in the Level? Or is it dynamically spawned?
Dynamically spawned (by the server)
And you are certain its not AlwaysRelevant?
Ya, I even did bAlwaysRelevant = false; just to be 100% sure
Possibly a PIE issue? 
that was not the thinking face i wanted
And bNetUseOwnerRelevancy is false as well?
https://docs.unrealengine.com/4.26/en-US/InteractiveExperiences/Networking/HowTo/DedicatedServers/ "You must be using a source build of Unreal Engine, which you can download from the Epic Games Github" Does this mean I have to build unreal engine from scratch? (using UE5.1 btw)
How to set up and package a dedicated server for your project.
If you wish to compile out a Dedicated Server executable, yes.
are you 100% sure that the actor was spawned from code and not pre-placed?
10000000%
you need to uncheck net load on client if they are pre placed
I'm watching them spawn in the level outliner
other things to check
check if tearOff is not set to true
and check if you dont have a reference to that actor somewhere in your code that is always relevant
Like PlayerState, I think that one is always relevant
I save no references to the actors and am not currently using always relevant for anything
Not sure what tearOff is, looking into it
getter on the actor: GetTearOff()
should return false
tearOff is false
also I'm not sure what happens if you set a really low net cull distance value, I never tried it, does it ever spawn at all? maybe try higher values
Ultimately I don't need these actors to be relevant unless the player is nearly on top of them. I can try a larger value
also inside that actor are you spawning other actors? maybe check if those are AlwaysRelevant
It is a component attached to my character spawning one actor per second. Spawned actor just has an arrow component and does nothing
and that spawned actor is not spawning other actors?
correct
just in case if I would try unchecking "Net load on client"
also when you spawn those actors you are setting Replicates to true right?
Put net cull squared at 1000 .. still low I guess. Also turned off net load on client. No changes. Yes
this is incredibly frustrating, it's such a simple setup, I must be missing something.
and you spawning these actors on the server right? not the client
Correct
what UE version?
One thing I'm trying now is not setting the owner on the spawned actors. 5.1
hmm
if I don't set the owner.. I don't see the actors at all....
ya I think you're right. This is in unreal units, right?
yea
also.. ooh
So.. this is a top down game. My camera is far above my player. Is it net culling based on distance to the camera?
hmm I actually dont know that
I'm on 5.0.2 and these past 3 days I've been fighting alot with net cull distance issues, was finally able to fix them all just a few moments ago but I did modify the IsRelevantFor() function
I read this on wizard cell's website https://wizardcell.com/unreal/spectating-system/#4-simulated-proxies-invisible-to-spectator-due-to-net-relevancy
I made the change he suggested there on that last return line
Ok so I have no idea why these actors are being flagged as always relevant for the owner, guess it doesn't matter they don't really need an owner anyway. But removing the owner seems to have done it
there is also this
Ya, that was false
So, using a reliable multicast function, which on the server calls Destroy(), the client gets destroyed before running the code in the multicast. In an effort to fix that I tried calling TearOff before the Destroy call but it doesn't TearOff in time and the client is still destroyed.
Is there any way to guarantee that an RPC will run on a client before it's destroyed on the client?
cant you run this code on the client on the Destoyed event?
Does destroyed run when replication stops too or only when explicitly Destroy is called?
I'm trying to use an RPC because while adding replication graph i'm finding client actors are getting destroyed a lot when replication stops due to replication graph rules. I was using EndPlay but it was called all the time on the client even when it wasn't actually destroyed on the server so that's why the RPC.
hmm I haven't used the replication graph myself but I believe the destroyed event will always get called every time an actor is destroyed regardless of it being on the client or server
it will also run the actor goes out of net cull distance since its being destoyed when that happens
not sure how the replication graph does it but I guess its the same
Yea then I think that won't work either as I still need certain logic to run only when it's properly killed
well I guess you could send a client rpc before destroying that sets some boolean that will signal the client that next time the destroyed event is called <certain logic must be called>
It's the same problem though, how do I guarantee that runs because at the moment the Destroy call is destroying the client actor before it can run. I'm just hoping there is something more reliable than just delaying for 3 seconds to call Destroy.
is this actor that you're destroying just for 1 client or all clients? because if its just 1, the client could reply to that client rpc he received with a server rpc, letting the server know it can now be destroyed
All clients
I have thought about the reply and track connections possibility but it seems like there should be an easier way
hmm yea seems tricky
So I havent followed the entire conversation
But it stands to reason that you are doing the wrong thing at the wrong point
simply send an RPC for the real destruction all relevant clients
those clients will execute the logic you currently have OnDestroy
remove the OnDestroy binding
@abstract pike
But does TearOff removes it from NetDriver? because when NetDriver gets destroyed right now, it removes the actor from the client, i have to stop it from doing that.
Good question.
I thought when the netdriver was destroyed, it basically changed level. It was all interlinked.
@fossil veldt looked into this a while ago.
Or, rather, the netdriver was destroyed because you disconnected from the server by navigating to a different map.
(which could be the same map)
I am doing this for beaconNetDriver, so i want to destroy the beaconNetDriver, when Beacon connection is lost, but i want to keep that class available for GameNetDriver of the server Where we started the client Beacon.
when we connect Host beacon and Client beacon, we basically making HostBeacon NetDriver auth of the class, but when we close HostBeacon, the class auth should go back to GameNetDriver.
HostBeacon and ClientBeacon are on Servers, we are trying to connect 2 servers with each other.
2 servers? Hmm! Good luck.
yeah, most of the logic working, i can actually replicate Pawns from HostBeacon to clientBeacon, so people can see pawn from one server in another server, and it behaves like normal Pawn.
Issue is removing these pawns and actors from BeaconNetDriver, so it does not get destroyed.
Let me know if you found out how NetDriver is doing cleanup and destroying the actor.
I'm not sure if I misunderstood or you misunderstood but I am using an RPC at the moment. That's what the question was about.
How to get either a successful TearOff or Destroy on the Server but also have the calling RPC happen on the clients
RPC's will arrive before destroy calls if they are reliable
You can't guarantee they'll arrive before TearOff because TearOff is driven by replicated property
Oh and it goes without saying, but the object has to be relevant to those clients at the time of the call too
Oh really? I could have sworn I saw the opposite earlier. To double check, they arrive and are executed before a server Destroy will propagate and destroy the client actors?
yeah correct, but only if reliable
It's one good use-case for Reliable Multicasts, if you want to send some parameters to control death etc.
Yea I had reliable, or at least I definitely had it at one point but maybe I had something else wrong at the time.
The main thing is the actor has to be relevant at the time it's called
I see, I can probably force that but will have to think about how that will look with Replication Graph
Thank you
Is it possible to have a (blueprint) game with game modes that use listen and/or dedicated servers depending on the mode?
Like Co op uses listen and competitive used dedicated
Need to use the source version of the engine to ship a dedicated server so technically not
But what type of server you join to is up to how you set it up
Yeah I get i would have to convert it to c++ but yeah so then it would be possible? I didn't know if there was any subsystem stuff or whatever
I am implementing Teleportation in a multiplayer context. When using teleportDestination = GetOwner()->GetActorLocation() + GetOwner()->GetActorForwardVector() * 200; everything is working correctly on single player but not working on multiplayer. I am quite sure that I have setup CMC rightly. I am following this video.
Previous Video: https://www.youtube.com/watch?v=DoZyH86n_gs
Source: https://github.com/HarryPearce/JetpackTutorial/tree/TeleportTutorial
Epic's doc on character movement component
https://docs.unrealengine.com/en-US/Gameplay/Networking/CharacterMovementComponent/index.html
youtuber uses some other method to set teleport destination but it is rather cumbersome. Could this be because simple method causes desync?
Correct, UEngine:Browse tears off all actors and then destroys the netdriver
even on an unsuccessful open command, your netdriver is temporarily destroyed
https://www.youtube.com/watch?v=SNNH7uJo40A&ab_channel=HarryPearce
YouTube
HarryPearce
Teleportation using Custom Movement Component in Unreal Engine
Image
At 18:10 he says to call Cast TeleportRay but there is nothing about this in the whole video. Am I missing something?
Previous Video: https://www.youtube.com/watch?v=DoZyH86n_gs
Source: https://github.com/HarryPearce/JetpackTutorial/tree/TeleportTutorial
Epic's doc on character movement component
https://docs.unrealengine.com/en-US/Gameplay/Networking/CharacterMovementComponent/index.html
Anyone know why this AnimationBP automatic rule works client to client, server to client, but NOT client to server? I have several of them and everything works fine except these automatic rules. Works fine for everyone except the host
disconnected and connected repeatedly in server with this log when loading streaming sublevel..
Originally creating instance to load the level doesn't work in multiplayer?
Is there any way to set sublevel trasform after automatically sublevel loaded?
Does anyone know how to replicate Media Players? I'm trying to make it play a video on URL but it only shows on the server and to none of the clients, is there something I could try?
You can probably just send down an event to the clients to play the same thing. Usually you just send over the state you need, so if all you need is a URL to play something just send over that URL to the clients and make them play it as well. A lot of things aren't replicated within Unreal ๐
Oh I never thought of that thank you so much! So would I just use multicast instead of sending it to the server first?
You still need to go to the server first, a multicast can only be called from the server. But you could use a multicast for example yes.
Not that you can use it in Widgets though
RPCs are meaningless in objects that don't support them
Well that too ๐
oh these wont work on widgets? I've been doing them on widget this entire time!
A look at the beginner friendly resources in pinned messages won't hurt @pulsar delta
Widgets don't have any networking code. You do it through actors such as the playercontroller, pawns, regular actors etc. etc.
Oh i'm so sorry I just discovered them, they look like very excellent sources thank you so much!
Ahhh god that sucks but I'm so glad I found out now, I'll defiantly have to do more research before posting stuff here haha but it was a bunch of help โค๏ธ
I mean it makes a lot of sense once you realise how it all works. Makes a lot of things so much easier in the end, but yeah it can definitely be a bit of "Ok? But why?" moment in the beginning ๐
when a variable is set to repnotify, only the server or listenserver can modify the value, right? I mean, a client could modify their local value of that variable, but that is probably a bad idea because it won't be replicated to the other clients or the server, correct?
Correct, you can modify it clientside and only that client will have the change. And if the server updates the value, the clientside version will be overwritten
ok, thanks. just wanted to confirm I understand this ๐
it's a little overwhelming to learn all of this at once
Out of the box networked chaos vehicles aren't great, what are the most obvious things I can do to make the performance better across a network?
If I generate a random number in the constructor of a replicated actor .. the server and all clients will generate their own random numbers right? I can't see why this wouldn't be the case but I need a sanity check
no reason why that number should propagate
yeah there is no way that would be synchronized, even with the same seed the client could invoke the rng any number of times between server invocations unless there was a special rng for this purpose alone
but i can't imagine thats the case
especially because, any call that tells clients to invoke their rng for whatever reason, could just as easily pass a randomly generated number along with it
well, unless you are doing large strings of random numbers
yeah, I just double checked, even if you used the same seed, at least the standard C rand() function can produce different outputs on different machines
but, if you really wanted this, you could generate your own entropy data and just package it as part of the game, and then write your own rand(seed) function that works from that block of entropy
they are not that bad honestly, have you looked at how they batch their processing?
them having no client prediction is whats bad ๐
Any way to force an OnRep to trigger even if the value hasn't changed? Setting an OnRep bool on the server and I need the client to update the actor based on true/false. But obviously if I set it to 'false'.. it's false by default and the OnRep function never executes. I tried
thinking this might "force" it to update but no luck. I guess the smart thing to do would be to use an enum instead with 3 values but I was hoping to make this work
Reading into the comments on CoreNetTypes.h I don't think the above will work. Gonna use an enum instead
An alternative is to wrap it in a Struct with a uint8 that you increment to force it to replicate again, even if the bool hasnt changed value.
do you know why when 2 client are replicated, when the other clients are going too far They disappear, if I go in the range again they reappear. It must something simple /// culling distance or ...
net cull distance
it's better when I put it to max net cull but still persists
setting bAlwaysRelevant=true will disable net cull distance but the solution is not to disable or increase the distance, you should take this into account and create your game to handle such cases
alot of relevant actors is going to be heavy
Is there a certain reason why you need to have them always relevant? The idea being with net culling is to reduce network traffic by restricting replication of actors if they're too far away from the client.
The PlayerState is an Actor that exists in the World, you dont see it, but they are there. They NEED to be AlwaysRelevant, otherwise they would be subject to the same culling effects and thus be destroyed when out of relevancy range.
The GameState is also in the same boat.
Just a few examples of where bAlwaysRelevant is necessary.
could be usefull to have bigger net cull distance let's say for "space" games
We have a large netcull distance for our space ships, however we have other aggressive rules around relevancy for them.
high net cull distance is applicable for sure in some cases, always relevant though not so much imo, apart from playerstate
most of the issues with net cull distance for me has just been distinguishing when an actor was actually destroyed by game logic or by net cull distance, unfortunate that theres no separate client side event for that
if you have any doc to share on that that would be cool... I guess compiling from source helps on this
You dont need to compile the engine source.
Using C++ gives you access to a lot more flexible methods for managing Network utilization.
Can I pass a simple struct to an RPC?
What do you mean "simple struct" specifically?
Just a struct { ... }; with POD members
It must be marked up with USTRUCT
kk, ty
Each member must be a UPROP as well
oh
ok, also good to know ๐
hmm, thinking on this more, I suppose I don't actually need to pass anything to the server and can just calculate everything there once the RPC is invoked. networking is hard
When a client joins the game or gets back into relevancy range, do they get the current server variable values?
I am having hella rubberbanding issues with some movement stuff of mine. Anybody have any suggestions/resources on how to tackle this problem? I'm trying to do a slide that dynamically changes speed depending on a slope angle
Has anyone here developed any melee games that support multiplayer? I have a couple of questions.
yep
although sometimes, when you have references (replicated uproperties) to other actors/properties inside an existing actor, when that "parent" actor replicates, the references to its child actors may not have replicated yet
Does Motion Warping not replicate properly? It runs smooth in Standalone but when I try to replicate it the motion is all choppy
So - I'm thinkin' about using a save game to store what clothes a character has elected to wear. Then when going from map to map, just load that save game. I figure I can hit two birds in one shot, persisting through game sessions and handling data from map to map. Anyone done something similar? Any flaws someone can see?
not flaws
that's fine
savegame system can be a bit heavy but that's not a big deal
if something changes frequently, you don't want to have to be repeatedly running savegame
but otherwise it's good
Oh - it won't be changing frequently. Can only change in the lobby.
I need to make a class to store team data in my multiplayer game mode, stuff like team score, members, objective info, etc. Probably just going to inherit from UObject but I was wondering if maybe there's a more suitable parent class for it
yes, the gamestate
I want to profile a single function for it's network stats, since I think it is slow over the network and I want to know which part of the function makes it slow. I heard about unreal network profiler but I from what I understood it's not made for in editor use. Is there any other way to check this?
Might need more clarification a function will not run "over the network". It will run on one machine or the other. Which you can use Insights or Frontend to profile. Insights allows you to bracket areas of a function with a macro to break down it's areas.
I mean the other case would be that it sends a lot of data very often
Which would qualify for network profiling
The code inside of it could still be cheap
It's a shooting function running on the server, inside there is calculated at which location and rotation the bullet should be spawned. I noticed that the response time on the clients with a pktlag of 30 was a bit slower than the server. It just feels a bit unresponsive
So best first step would be to decrease the replicated properties of the spawned bullet to reduce network lag?
Depends on what we are talking about
A "Fire Weapon" function, at least in the projects I worked on, is mostly empty in terms of properties
By default I never pass anything over. Only when adding some prediction for the Projectile I would pass over some data.
This is the code for my shooting function: ```void AFirearm::Shoot_Implementation()
{
if (RoundsInMag > 0 && bChamber == true)
{
GetWorldTimerManager().SetTimer(RPMHandle, this, &AFirearm::ChamberBullet, FireRate, false);
bChamber = false;
SpawnEffectsGlobally();
ABasePlayer* Player = Cast<ABasePlayer>(GetOwner());
if (Player)
{
FActorSpawnParameters SpawnParams;
SpawnParams.Instigator = Player;
SpawnParams.Owner = this;
FVector Location = Weapon->GetSocketLocation("Muzzle");
FRotator BaseRotation = UKismetMathLibrary::FindLookAtRotation(Location, Player->LookAtLocation);
FRotator ImprecisionRotation = FRotator(FMath::FRandRange(GetImprecision() * -1.f, GetImprecision()), FMath::FRandRange(GetImprecision() * -1.f, GetImprecision()), FMath::FRandRange(GetImprecision() * -1.f, GetImprecision()));
FRotator Rotation = BaseRotation + ImprecisionRotation;
GetWorld()->SpawnActor<AActor>(ProjectileClass, Location, Rotation, SpawnParams);
if (IsUsingBarrel())
{
UAISense_Hearing::ReportNoiseEvent(this, GetActorLocation(), 1.f, GetInstigator(), Barrel->BarrelProps.GetDefaultObject()->NoiseReportDistSuppressed, "Gunshot");
}
else {
UAISense_Hearing::ReportNoiseEvent(this, GetActorLocation(), 1.f, GetInstigator(), NoiseReportDist, "Gunshot");
}
UE_LOG(LogTemp, Warning, TEXT("Bullet Spawned"));
ABasePlayerController* Controller = Cast<ABasePlayerController>(Player->GetController());
if (CameraShake && Controller)
{
Controller->PlayCameraShake(CameraShake);
}
}
}
}
Don't really see why it should behave a bit unresponsive with bad ping especially the logic works all fine and timed but the trigger to shoot time is just a bit slow
And this is all executed on the server
Not sure what you mean with unresponsive
There's a delay after pressing the fire button and the weapon actually firing
But that's kinda normal?
You are telling the Server to spawn a Projectile
So you have the half the Round Trip Time to tell teh Server
And then the other half of the RTT for the Projectile to be replicated back to you
Delay is absolutely expected and will be bigger the higher the ping
hm thats true
tho other games circumvent this, i guess they make firing etc. client only and then simulate a bullet on client and server seperately?
Most shooters don't actually use bullets, what they do is they do a simple line trace / raycast and do some quickly fired particle trails or similar to make it look like it's a bullet and has some kind of trajectory to it. But yes they do predict it on the client side with the exception of actually damaging the enemy.
tho the game im thinking of also has bullet drop
which isnt really good to simulate with a linetrace correct?
It's a million times easier than physically simulating a bullet, just let your line casts curve down over time ๐คทโโ๏ธ
You can do bullet drops with line trace I think there is a spline trace too
All a bullet drop is is a swept component moving each frame with simulation applied for velocity reduction and gravity. You can do the same thing with traces.
Also physical bullets sound a pain in general if it's one actor per bullet, all it takes is an automatic weapon that shoots a million times per second to destroy your network with constantly creating, replicating and destroying actors ๐
true
What are the 3 Predict Projectile Path nodes in Unreal Engine 4? Why don't we watch this video and find out how this nifty node can help you simulate things such as the arc in Angry Birds or a bullet Droop in a shooter.
Source Files: https://github.com/MWadstein/UnrealEngineProjects/tree/WTF-Examples
Note: You will need to be logged into your...
ill keep that in mind, our game is 8 man coop against ai so i dont think ill have to worry about it that much
I'm not going to tell you how to live your life but I would just not do it with actors, the moment your actor has *maybe* had the chance to replicate to a client it's likely to be already destroyed. Besides it's just a performance overhead for no reason over just using some traces that can just as much simulate bullet drop. But that's just my advice ๐
Assuming you would replicate them. If not the case the last part is still valid.
ill definitely keep it in mind thanks!๐
I will change the level 7times, I turned on the seamless travel on game mode and set transition map then I don't need to server travel to transition map?
ok very different question but I cannot understand this for the love of my life. You might know whats going on here @twilit radish. I play as client. As you can see the AI is standing on the right side and its status is idle. But, you can clearly see from my debug options on the left side (that text is always at the location of the ai) that the ai is standing at a complete different location and its status is overt not idle. How can a location of a character component be out of sync??
maybe something interesting for @thin stratustoo. My understanding of AI in multiplayer is that the character exists on server and client and the controller only on server. So if the controller tells the character where to go it should be visible to all clients.
what
when i use simulate in pie and then reposses and play the ai works, if i play directly without simulating first then it doesnt
Is it possible to view the output log from the clients perspective when simulating the client in PIE?
like literally the ai location isnt replicated at all. I have changed nothing except simulating pktlag what is this epic
hi guys i try to add hit reaction my pvp game anyone knows how can i add
What does the server 'see' though? Or are you using a dedicated server?
Maybe that it generates an actual log file in the project folder? I remember something vaguely about that. But not sure if you can see it within the editor.
Hello, Iโm having problems with multiplayer connection. I built my game to test the multiplayer experience in 2 separate computers but for some reason, it isnโt working. When I host a game I canโt find it. If anyone knows why this is happening please help and here is the build for the game so you can test it out as well. Itโs a Google dive link
Build link: https://drive.google.com/file/d/1h6VKexIawOlhYfjJZlYSLuTxFZvHXO-a/view?usp=drivesdk
Could probably use an OnRep for the health I guess? Some more info would be a good idea though ๐
@distant vault I don't think anyone is going to download that for obvious reasons. I would recommend figuring out where the problems occur exactly and if you have any specific questions ask about that. Check for example your log files, debug your code to see where it stops etc.
Check your logs, there's a good chance the map path/name just isn't valid.
[2023.01.24-13.52.34:573][473]LogOnlineSession: OSS: Join session: traveling to steam.76561198062121577:7777 [2023.01.24-13.52.34:573][473]LogBlueprintUserMessages: [WBP_ServerItem_C_0] SUCESS [2023.01.24-13.52.34:573][473]LogNet: Browse: steam.76561198062121577/Game/Features/Lobby/L_Lobby [2023.01.24-13.52.34:574][473]LogNet: Display: SteamNetDriver_0 bound to port 7777 [2023.01.24-13.52.34:574][473]LogNet: SteamNetConnection_0 setting maximum channels to: 32767 [2023.01.24-13.52.34:574][473]PacketHandlerLog: Loaded PacketHandler component: Engine.EngineHandlerComponentFactory (StatelessConnectHandlerComponent) [2023.01.24-13.52.34:576][473]LogHandshake: Stateless Handshake: NetDriverDefinition 'GameNetDriver' CachedClientID: 1 [2023.01.24-13.52.34:576][473]LogOnline: STEAM: Adding user 76561198062121577:7777 from RegisterConnection [2023.01.24-13.52.34:576][473]LogNet: Game client on port 7777, rate 100000
so it doesnt load the Map it reloads the lobby
Is the client already connected to the server when you're changing the map?
Maybe I forgot to say but when I play test it in the editor with 2 player (client) the connection works
If this is on LAN make sure your firewall isn't blocking it, if you're doing this from 2 PCs across different networks make sure the port for the server is open. But again something is likely already telling you in the logs what's wrong. If not the case look at where your code doesn't work any more.
no I Create Session and join the map as "listen" for the host. The client joins afterwards
How does the client join?
find session the join session
So the client hosting the server does actually see the correct map? If so make sure you're looking at the server logs too as I think what you're looking at right now is just the client joining.
yes the host is on the right map
For the server everything is normal, ai moves etc. Everything correct
When my friend joins :
[2023.01.24-14.08.51:541][325]LogOnline: STEAM: Adding P2P connection information with user 76561198062121577 (Name: Helmut [0x110000106123269])
And there's nothing else? If you're doing this from the editor make sure you don't have warnings/errors disabled.
which one of us do you mean?
Max.
But for you, is it a pawn or a character that the AI is controlling?
Pawns by default don't replicate movement.
Character, replicated is set to true
Then that's a really good question why it's out of sync ๐ค
It's not accidentally set to dormant or anything in the settings?
I don't know if this belongs in this channel or #online-subsystems but I'm having the usual problem destroying local sessions on the client when the host quits - should I just stick a DestroySession on begin play inside my menu player controller?
whats dormant?
It's an option the actor class has for network optimization but it cancels out most networking stuff. Look on your character settings for something with that name. (I would open Unreal for you if I wasn't compiling a source build lol).
aight imma look into it
That's basically all I can think of on why it wouldn't specifically update the location but still be there.
i feel like its a bug because i used network emulation
Is it pre-placed in the map?
yes
oh and fyi if i use simulate first and then posses my char in the level it works perfectly fine for client
tho im not sure if simulating actually also simulates server and client
@twilit radishdormancy is set to awake eg. the default, should i put it to never?
Could always try it I guess.
nope didnt change anything, i also found out that simulate option of pie doesnt simulate network
Simulate network doesn't work in every mode yeah.
Can you try standalone and see if that does work?
then even weirder things happen, the gun of the ai isnt even spawned
thanks ill try it
tried in different settings... it's pawn that spawns on player start (no collisions...)
Funny thing, if the server disconnect the client travels to the map
Are you spawning or placing your AI Characters?
placing
are they setup to spawn an AI Controller when placed?
yes
Hm okay, cause that Enum has caused a lot of headache in the past hehe
they do so i know that cuz on the server side the ai is moving and behaving correctly
me too xd
Do you have the same problem in a new project, for sanity?
Characters controlled by AI should just work^tm
im currently downloading an old version of my project(github lifesaver) and ill try there. But ill also try to do it in another project
when loading sublevel, what's the different between function "create instance" and "load stream level"?
I think the top one allows having multiple instances and the bottom one is to load a preplaced sub level
There should also be a create node that has a transform Input
I can't read that console command to join a "session" by steam id
Like A player mobile A can't play with player in mobile B
Something something open steam.1234567890
Not sure about the dot
Too vague. What subsystem are you using and what part doesn't work
Oh I got it thank you very much!๐
@thin stratusso it doesnt work in an older version of my project too
The Matchmaking
That's too vague. Can they not find each others sessions? Can they not join?
Can still be your projects code's fault
ill go back a lot more and see if it works
It's Only like this in the mobile
Were you ever able to find sessions?
Make a fresh project and create a test case
In Unreal engine , It works
No reason to go back that far for now
ok
Are both phones in the same LAN?
Then my original question comes back:
What Subsystem are you using?
Cause by default, SubsystemNULL doesn't support anything but LAN or direct IP connection
Subsystem?
If you never set anything up then you use NULL
Which doesn't support online sessions
More or less depends on the platform you are on. If you are doing android stuff then probably Google and I have no idea how to set that up tbh
I also don't know if that Subsystem supports Sessions
Not all Subsystems support everything
@thin stratusso in the new project it works
but i didnt change anything in my original project and it did work before
Oh
IOnlineSessionPtr FOnlineSubsystemGoogleCommon::GetSessionInterface() const
{
return nullptr;
}
From what I can see in 5.1 (and thus also prior to that), The Google Subsystem has no Session stuff implemented
So with Google alone you won't get this to work
Your only other option is to use EOS ( #epic-online-services ) and authenticate with Google there.
But I can't help with that, you'll have to ask for help in that channel.
Ohk Epic Online Services
And @thin stratus
Does Online Subsystem also affect the In App purchases?
I have players in the same lobby then the lobby host a game server by open a map with listen argument...everyone knows that a game is created with a specific steam id
Then each clients tries to connect with :
open steam.76561198062121577
76561198062121577.. being the host steam id
client log :
[2023.01.24-15.53.41:011][914]LogNet: UPendingNetGame::SendInitialJoin: Sending hello. [UNetConnection] RemoteAddr: 76561198036395131:7777, Name: SteamSocketsNetConnection_0, Driver: PendingNetDriver SteamSocketsNetDriver_0, IsServer: NO, PC: NULL, Owner: NULL, UniqueId: INVALID
server log:
[2023.01.24-15.53.40:870][668]LogNetVersion: SilentWars 1.0.0.0, NetCL: 23058290, EngineNetVer: 30, GameNetVer: 0 (Checksum: 277290289)
[2023.01.24-15.53.40:870][668]LogHandshake: SendConnectChallenge. Timestamp: 6.264920, Cookie: 043100059122178164208061087156241117109219191073174119246127
[2023.01.24-15.53.40:870][668]LogHandshake: Incoming: Rejecting handshake packet with invalid session id (0 vs 0) or connection id (1 vs 0).
[2023.01.24-15.53.40:887][670]LogHandshake: SendChallengeAck. InCookie: 043100059122178164208061087156241117109219191073174119246127
[2023.01.24-15.53.40:887][670]LogNet: SteamSockets: Connectionless handshake complete
[2023.01.24-15.53.40:901][672]LogHandshake: Incoming: Rejecting game packet with invalid session id (0 vs 0) or connection id (1 vs 0).
[2023.01.24-15.53.41:097][695]LogHandshake: Incoming: Rejecting game packet with invalid session id (0 vs 0) or connection id (1 vs 0).
Basically the client never travel to the host/server map that is set in listen. When the host disconnect the client reload the lobby
how are sessions handled when they are empty, are they cleaned automaticly or do u have to clean them somehow? i know u cant make 2 sessions in a row without closing the client
are u sure that ID is correct?
are specifing the correct port 2015 when u ping the steam server?
the ID is not this one
76561198062121577 < this is the ID
I also tried with open steam.76561198062121577:7777
I'm planning on storing a list of these objects in the game state since I want to support a variable number of teams
thought compartmentalizing the data could be convenient
i understood that, how are u getting that ID?
u shouldnt need to use the port when opening a steam server
i have my players connecting through steam so i probably have done what u need
I'm making a lobby then broadcasting to everyone that the game has started and people connect using open steam.
I tried with creating sessions / joining and basically the same thing happens
for now I think I'll just do separate lists in the gamestate for each piece of data, indexed by team, and see if that gets annoying to work with. Right now I don't have a whole lot that of things to consider in terms of team-related info
so ur server is not a separated.exe? is not compiled?
nope
if u make a session i think u have to connect through the sessions node, but im not sure on this
I tried both standalone and packaged
join session node had the same problem
connecting but not travelling to the map
are u messing with the source code or just BP's
ok so the players can connect but they cant travel?
yes
On the host
`[OnlineSubsystemSteam]
SteamDevAppId=480
SteamAppId=480
bVACEnabled=True
bEnabled=True
bUseSteamNetworking=True
[OnlineSubsystem]
DefaultPlatformService=Steam
[/Script/OnlineSubsystemUtils.IpNetDriver]
MaxClientRate=1000000000
MaxInternetClientRate=1000000000
InitialConnectTimeout=120.0
[/Script/OnlineSubsystemSteam.SteamNetDriver]
NetConnectionClassName="SteamSockets.SteamSocketsNetConnection"`
I have an actor with a (relatively) large amount of subobjects that require replicating. Each subobject just holds 1 variable that updates very infrequently and only one or two at a time. When my client loads into the game theres a noticable delay between PostLogin and when all the Server-Client communication has finished (which i see because my players sprite needs to get initialized on server side). Do you have any advice for how i could improve the performance of my game?
actually i think i might have just found one myself. I have a "grid" actor that holds a number of "tile" subobjects, and those "tiles" keep a record of which actor occupies them. But instead i could just have the grid remember which actor occupies which tiles, which is way less data to save
i think u need to use server travel, isnt there a node for that on bp's?
@fierce grove you can try the following console command in the editor when running as the host, it seems like something is invalid but I'm not sure what. Can at least try to see if that's the issue:
net.VerifyNetClientID 0
also that function, setLobbyGameServer, i have absolutely no idea what it does
How do I get Sequencer to play simultaneously on all clients? Since the clients will be in the same space, the music must be in sync with each other.
That's not the issue. The server is actively rejecting the connection, sonicphi. As per their logs they just shared:
[2023.01.24-15.53.41:097][695]LogHandshake: Incoming: Rejecting game packet with invalid session id (0 vs 0) or connection id (1 vs 0).
ye i saw that, but he said he can connect he just cant travel
so im assuming hes traveling incorrectly
i dont know about the internals when u open a new map, maybe ids are being reset
also hes doing it on sessions
Could for example use this: https://vorixo.github.io/devtricks/non-destructive-synced-net-clock/
To agree on a certain moment to play the sequence I guess.
Thanks!!I'll take a look at it๐
if a USTRUCT member is replicated does it replicate all member values of that struct?
@eternal pagoda try to print ur session ID everytime you call a function
you will see where it is changing
then u can pinpoint what function is messing ur stuff up
after that check the source if u can
if u cant, try a new function lol
The ones marked as a UPROPERTY inside the USTRUCT will yes.
maybe that "lobbyData" ur using is being reset somewhere
https://forums.unrealengine.com/t/replicating-structs-with-properties/555990 - James answers it here
Goes a bit more in-depth as well
Is there a way to create game state variables at runtime? I want to keep creating a variable with the same name in the gamestate even after server travel
pinging the wrong max lmao
When the game mode is initialized by server travel, do all the variable lists saved in the game mode disappear?
Or do only the variable values โโbecome default and the variable names remain the same?
The gamemode doesnโt just delete defined variables. It however doesnโt necessarily persist the data those variables hold after restarting.
Oh,,,I got it ! Thank you~!
game state is also same?๐ซ
In general the game state is different from the game mode, but this in specific is the same yes.
Both do not persist data beyond a restart.
Here's an article about stuff like that: https://wizardcell.com/unreal/persistent-data/
If you want to build a multiplayer sword melee game, are you pretty much resigned to switching off the orient rotation to movement?
I was thinking that I wanted to somehow allow the player to aim their sword swing as they were swinging, correcting the feet and spine chain as they turn with the swing
You can create a child of the CMC and override the function that handles the logic for that. That's what I did.
So your CMC and anim BP graph handles letting the player turn around midswing and it looks natural? I'm wondering if the UE 5.1 new motion warping or pose warping (or both) could help me achieve what I am trying to do
Since documentation on custom CMC is scarce. At least I have only seen custom movement modes in C++ for custom CMC, nothing beyond that thus far.
anim bp graph shouldn't be involved imo. Also, my game isn't a fighting game, but the concept still applies
Right it doesn't have to be a sword swing
anything with the general motions and aiming
Animation should just be playing forward, then the CMC rotates for you
ah
I've tried with 2 plugins / advanced steam session and steam core and I have the same problem... is there something new in ue 5.1?
I was thinking about that. Only having a forward and then use something to correct the bones
But how is your custom CMC twisting the bones? Doesn't it just generally manipulate the capsule?
I haven't tried any of the new animation stuff networked yet though. So don't know how well that'll work
I have no need to twist any bones. The animation does that.
The CMC simply rotates for you
I don't get why you need a custom CMC for that then. I must be missing something. The CMC already handles rotating and the player's aim is already replicated
You specifically asked about the orientate rotation towards movement option
True
Ok, so you leave yours on, which is what I have now. My problem is I want the legs and spine to twist to match the character's aim.
So that's more of the anim bp. Are you using control rig or anything?
Or are you just blending based upon yaw?
Thank you for the good material!
Hello! I have a quick question for any multiplayer experts! Im making a local coop game (spitscreen) and was wondering, if I have a boolean in the thirdperson character called "giveweapon?" But I only wanted to activate the boolean for a specific player, how would I go about doing this, the weapon thing is just an example of what Im trying to do with booleans for different existing thirdperson pawns in the world
if someone has a working example of advance session or steamcore working with 5.1 that would be awesome
lost a full day on it
I want to create such a feature for my game that shows the friend's location on the screen with an arrow that shows the players where are the friend's locations, like call of duty zombie black ops,
but I don't know what I must search to find a tutorial. what is this feature name? any one can help?
Server Travel not working (UE5.1)
should i put the whole path of the map to the command console?
It looks like you may be appending without a space so the command being processed would be "ServerTravelTryLevel" rather than "ServerTravel TryLevel"
๐ฅฒ Thank you
Also your logs usually tell you if this stuff is wrong ๐
At least in the editor I guess lol.
Offscreen Indicator
I didn't know that I should do๐ซฃ
The logs are pretty useful with a lot of things ๐
That's right, I'm glad I come to know that!
I wasn't familiar with Rogue because it looked so difficult๐ซ Thank you!
I only let the level load, and when the game state variable changes, I turn on the visible of all clients' levels through tick. but Level visible doesn't turn on...
Is there a problem with just loading the level and setting it on visible later in another line of code?
My brain is having a little.. divide by zero moment. If I want to run an RPC function on a single client, is the only way to do that if the client is the owner? Scenario is a player triggering an overlap event on an actor, I want to use SetVisible just for that player
I imagine instead of using SetVisible I could spawn an actor just for that client, making it the owner and have it so it's only replicated to the owner.. just feels a little messy
Just send it from within the PlayerController to the client with a reference to the actor.
Hmm. So from the Overlap event on the actor get the player controller and tell it to run a function, then from the PC run a multicast function so only the PC's owner will run it. Ya that would work but I hate the idea of having a function on the PC that is specific to this actor
You would not run a multicast. You would just run a regular RPC to the client as the client already owns that PC.
Ideally it wouldn't even be a RPC considering it's a state I guess.
Sure, sure.
"Ideally it wouldn't even be a RPC considering it's a state I guess." not sure what you mean by this part though
I want my server to be the authority on whether the client overlapped the actor so I don't see how an RPC is unavoidable. Or are you just saying to use a replicated variable instead
Still, my biggest problem with it is having a
UpdateSomethingSpecificForThisActor()
function on my PC..
You're changing the state of how that actor is perceived in the world. If your client disconnects and joins again that state isn't the same (or loses relevancy for example) because it was a RPC.
Depends on the use case I suppose though ๐
Hmm, that's ..true.. I may have to revisit this problem later when I have more brainpower to focus on a proper solution.
Hey My Touch Interface Joystick Isn't working
It worked at first but not now
How to fix this?
Debug
Add some breakpoints and prints
If it worked and itโs not now then you can make it again
Guysssssss, I have a more complicated issue and a bug to report.
In short, in multiplayer if the player is not an owner of any rigibody actor, then this actor physics will never go to sleep locally, for remote players. They will have object jitter around and non trivial performance cost for each physics object on scene.
Iโve confirmed this on 3 different versions of Unreal 4.26,4.27
This is not a bug.
If a replicated Actor "has no owner", clients will handle physics themselves and get corrected by the server, hence the jitter effect.
Yes, this also happens if someone else becomes the owner.
Soo this is intended behaviour?
Like what
I can manually handle this, but is it really how it works? Everyone just has to manually put objects to sleep for non owners?
Whatโs the best solution to fix it?
Why itโs not taking โsleepโ thresholds from the object?
Once you set an Actor's dormancy to sleep on the server, that Actor will no longer replicate stuff about.
If physics are enabled once you put it to sleep, clients will manage it themselves.
Change dormancy at runtime? I tried all of its settings with no changes.
Lower the performance cost of apples lying around to grab by vr player and throw around
Simple stuff
Just 200 objects I placed on a big scene
Jitter is unnoticeable in vr but itโs cost for my mobile vr game is too big, it they sleep as they should (on host in p2p) itโs all fine.
I use Smoothsync to replicate movement but this issue is not relevant to the plugin , we tried without it.
I'm implementing something quite similar; not at that scale, though, and my take on it is broadcasting an event that "apples are lying" and enabling physics/disabling physics on both client and server instances.
It's working pretty well; it's consistent; and I see no performance hits. But again: my scale is not 200.
You're running that on a replicated actor, right?
This is what I used to mitigate the problem
Yes on all grabbable physics objects
This is nasty workaround and now when I know the cause I can make something better
Hm.
You can see this behaviour clearly if you tick physical actor printing if itโs awake
It always is on remote until they became the owners
When it comes to performant solutions, they usually look "weird" and "non-practical". It sounds counter-intuitive, but if that's solving your problem, go for it with no mistake.
All object which should be sleeping are not, cost for updating physics and overlaps and everything is obvious.
One thing you may try
Disable that and let each instance to handle physics themselves.
I bet your jitter problem is the server trying to adjust location.
Once that's disabled, the server will no longer intervene.
Smoothsync also has an option to replicate sleep and ignore small changes, I can set it to any value. And I did with no success
Iโve seen itโs code, itโs just basic stuff everyone would do, proper replication done in a proper way.
Iโve asked an author and he also pointed itโs not an issue with Smoothsync directly
And he didnโt know about this problem and personally tried on two versions of unreal
And I canโt really find anything related on the web which is suspicious with this kind of thing
Thx for help, sending love and peace, come up to my place so we can drink a tea if you ever nearby ๐
Love Poland. โค๏ธ
And I really appreciate your kindness, although I wasn't much of help. Ha!
Cheers from Brazil. ๐ง๐ท
I have a component that holds the web socket connection on the client and need to stay the same when moving between levels. It can't loose connection, nor it should reconnect. What container for it should I use? GameInstance?
GameInstance(Subsystem) for example yeah. Also I would highly recommend testing that in a full packaged build. I was just using this my self for something I was making and it crashes my build because of a bug in how it initializes.
We love you too
Hey guys! Basically i was trying to make a shooting system using the player camera manager but i can't seem to make it work cause of it using the 1 players camera and not being able to kill anyone.So how can i get the ID of The Get Player Camera Manager?
Always explicitly initialize your dependencies when using subsystems
thats what the Collection is for
also dont make too many dependencies between subsystems
๐
A pull request for it got merged into Unreal 3 weeks ago, not sure if itโs my fault tbh.
But yeah, I was going to do that tomorrow ๐
๐
Maรฑana Maรฑana
Itโs midnight alright ๐ฅฒ
Although to be fair the whole way that websocket module worked is pretty weird lol.
Hereโs the PR: https://github.com/EpicGames/UnrealEngine/pull/9376
I think Iโm just going to merge it into my own source build. Might as well I guess.
Nevermind i just had to replicate it to work
Iโm pretty sure that pawn or the character has a GetControlRotation or something similar for this. See if you can find that ๐ Nvm I guess.
That code needs to be burned with ๐ฅ
thx but i already got it to work
I know right ๐
this is all i had to do
BRUH I WASTED LIKE 2 HOURS
hate making multiplayer in ue4 bruh
i have already been welcomed a year ago but today i wanted to learn multiplayer
and i its painful
dam
This is by far not the worst stuff yet though.
The character system is up there I would say. Probably prediction for a lot of people too.
yeah tbh its hard i tried to make my own took me like 3 days it kinda reminds me of gta v
Also I guess bugs that only happen at random with a certain amount of latency lol.
yeah bp are very slow
compared to c++
that's why you have to make everything so organised and not too long
or else chaos will appear on your screen
like this
not my code
btw
same
This is blueprints from the streets you know
i organise mine like this
I'd that too if it weren't for BlueprintAssist :/
Gash. I remember the times I was full Blueprints lol.
Using Blueprints at that scale now gives me anxiety
You using BlueprintAssist?
Yes
You press a button and it automatically organises your nodes for you
is it free?
oh noice
i just press q
and it will make everything in a straight line
but in some cases it doesn't
or just makes it look weird
Wait
The straight lines is another plugin
Electronic Nodes
Now, without Electronic nodes ๐
You press one button aaaaaand:
But both are paid :/
Although I'd say BlueprintAssist is a must, specially if you're 100% Blueprints. ๐ข
19$
Electronic Nodes is meh
i am
sad face
Yeah :/ - PS: I'm not affiliated with the developer of BlueprintAssist, it was me #justsaying
k
alright thx for the reccomendation
i might get it
if i have enought money left in my card
lol
this is why I hate nodes. Even in materials I recently tried writing HLSL and the difference is huge
Normally I agree. But burn HLSL ๐
Guys back ontopic please.
Sorry ๐
It's a lot cleaner if you don't ever let anything but execution go from block to block
Stuff like this is gross
anyone know how I could make the t. MaxFPS cmd work only for the client?
testing in the pie, I wanted to test my game when the client has low fps
but when I execute that command on the client, it affects the server too
Make sure you don't have "run under 1 process" in the PIE settings ticked.
ok yea that was it, thanks
This event binding not working..If i replace it to delay, code works well What am i doing wrong? I need to use the time when loading is finished
I didn't understand fully..but i tried as you mentiond and successed! thank you!๐
I've got a casual setup and networking is going relatively smoothly but I was just curious what packet loss level I should be simulating? I've been running at 20% but I've heard that even 5% is considered excessive?
Depends on your game and how noticeable packet loss is. I test with both the Average and Bad profiles. 5% is pretty bad for a network but you could probably have spikes of up to 100% at times. In the real world the duration of a "lag spike" is variable and could last anywhere from a few seconds to an all out failure of the network. So how you handle that situation depends on your game. Maybe you have a widget that pops up when packet loss reaches a certain threshold and informs the player of what's going on.
how do you check if the client or host has the same game version as you when searching or joining a session?
ie, if two players have different game update versions (on android or pc), they can't join each other's games
Hi,
I have a widget blueprint set up to spawn on each player's screen. I'm trying to make it so one player can reserve a certain role and be only client in that role unless they relinquish it. In each playerstate I have an enum that corresponds to the five roles possible. I'm struggling with figuring out how best to store and replicate that enum from the server versions of the PC/PS and GS and get it to the clients. This was as far as I got visually.
I imagine I need to put a "run a server" custom event that calls a multicast somewhere, but I'm just not sure if it goes in the player state, player controller or elsewhere entirely, and how to validate the playerstate's enum against the other player's playerstates is a bit lost on me.
Replication only happens one way, from the server -> client. Any variables that you want replicated must be set on the server.
So your OnClicked needs to call a "Run On Server" event, likely best on the player state as that is where you'd want to store your selected ENUM value.
Once you've verified on the server the selection, you can set the enum variable on the playerstate. You can make it a "RepNotify" variable which can then trigger an OnRep function when it replicates to others so you can update any UI, including if other players should be able to select the option or not.
You also do not need a "Replicated Player States" array. There is already an array on the GameState called "Player Array" that is generated automatically client side (and on ther server) whenever a player joins the game.
are game mode and game state, player state, destroyed when travelling to a new map?
Hi, could anybody help figure out what is wrong with this BP? Client-A is the server and updates its Nameplate and Client-B but Client-B only updates its own and not Client-A.
Don't use RPCs for something stateful.
You can send a client -> server RPC to transfer the name, as you're doing, but then set that name in the playerstate in an OnRep variable.
The OnRep function should then call an "Update Name" function in your character which takes the name as an input and sets the text like you're doing. To access the player's character from player state, use the Pawn Private variable and cast to your character.
In the character's begin play, you can then also run the function that updates the name - this is mostly for when characters are out of relevancy range and when they come into relevancy the name will be updated with the value from the playerstate.
Perfect, works flawlessly. Very good solution, thanks man
Thank you! This has gotten me most of the way there, there seems to be a few hitches but I think that's an implementation bug on my side more than forgetting a networking feature. The client still seems to have some deference to allow duplication of roles. I'm posting a video and the graphs of the player state, wbp and onrep team role in the player state
In here, don't set the enum until you know for certain that no other players have the role. I'd also put this within a function just so you can use some local variables, namely a boolean that you set to true in the loop if you have someone that already has that role. On the completion of the loop, you then check if that boolean is true - if it is then that is not a valid selection as it's already in use. If it's false, then you set the enum on that playerstate. Edit again: No it stands. Set only after you've checked all players. You can still break if you detect just to loop less ๐
Thank you for providing that fix, I'll be sending an update of that playerstate and function. I also am begining to think I am calling the widgets incorrectly and will run that code by you if that is okay
You need to change this. By default the "Can Change Role" should be assumed true.
If a player has the desired role already (team role == desired team role), set the "Can Change Role" to false and break your loop. Don't do anything with the boolean if (team role == desired team role) is false as by default it is already true.
Are Steam sessions really broken in 5.1?
Hey guys! I'm trying to create a teleport system for my local multiplayer game. All works well here, other than the fact that it only teleports the second player? Not too sure what I've done wrong as Im still very new to programming multiplayer mechanics into UE5. Many thanks if someone can help!
Your issue is likely that you are using a delay. First player overlaps. It runs through everything, hits the delay and stops. Second player runs through, code runs and stops at the delay. When the delay finishes, you're pulling off of the cast node, which will have the last overlapped character and that is all you're teleporting.
I see, should I remove the delay? Just worried that it wont enable the collision of the trigger quick enough to then call the overlap event
What is the full intended effect here? Do all players need to be in this area before teleport?
Can each teleport individually?, or are you just trying to teleport everyone when any character overlaps this?
So essentially (because Im still studying the ways of implementing multiplayer mechanics), I have added a huge collision box contained in an actor called "teleport players". On the begin play event, the collision is turned off so that once the players have chosen their roles and pressed the ready up bind, the collision can be enabled again, triggering the overlap event, teleporting both players to a location, which in this case, are 2 spheres contained within the same actor blueprint
Ok I made it work in the end, just had to copy and paste the bp and remove the connection between the teleports to target the designated class
[/Script/OnlineSubsystemEOS.NetDriverEOS]
bIsUsingP2PSockets=true
P2PConnectionTimeout=80
MaxInternetClientRate=15000
MaxClientRate=20000
NetServerMaxTickRate=60
ConnectionTimeout=20
InitialConnectTimeout=60
[/Script/OnlineSubsystemUtils.IpNetDriver]
ConnectionTimeout=60.0
Guys can I ask? How I can set best values for these things in multiplayer? Also is there any solution how to set how many packets can be lost? during gameplay because my friend tested game with me and he lost 2 packets and his window freeezed during it. Thank you.
Packet lost is not something you can control that much, the engine can drop unreliable messages when there's too much network load (I think at least?) but your message can also get lost when send across the internet. You're simply going to have to deal with this scenario, every game has to.
All packets are sent over UDP. UDP is an unreliable network protocol by design
There is network noise, and packet loss is a thing
reliable packets are sent through a special mechanism that emulates TCP (reliable protocol, arrival and order of arrival guaranteed ) properties on top of a UDP connection
๐
okay thanks so I cant do anything with it
Hi!
I'm making a multiplayer game where the client seamlessly travels to a server world.
The client can disconnect and reconnect to the server.
When the client connects issues may arise from internal systems accessing objects / object's variables before they have been replicated from the server and initialized (as you may very well know)
In order to ensure functionality I'm creating a system that serves to monitor certain objects and values and to make sure they have been replicated across the network and initialized before they are accessed by the client.
If I make this system into a GameInstanceSubsystem I know that the subsystem itself exists before objects are replicated, and everything works smoothly. Whenever objects are "ready" they notify the subsystem and the subsystem dispatches the relevant information.
However, when developing the game in editor I usually play with multiple simulated clients in a single process, which causes multiple clients to communicate with the same subsystem.
This causes the concept of "Is the local Player State ready" to become overwritten, for example.
Thus making it a LocalPlayerSubsystem sounds more reasonable.
The issue with a LocalPlayerSubsystem, however, is that I don't know if the LocalPlayerSubsystem is guaranteed to exist before anything else in a multiplayer game?
Is there a guarantee that I can access it as soon as objects start being created / replicated when connected to the server?
If so, what is the correct way to fetch the LocalPlayer?
Thanks!
Hey Is Google Play Services a Online Subsystem?
If yes then Can it be used for multiplayer matchmaking?
How to add it?
A local player subsystem is created directly after the ULocalPlayer. The original ULocalPlayer is done severely early in GameEngine's Init, very shortly after GameInstance creation. So it should be available long before any networking requirements I would think.
My research has led me to the same conclusion. Thanks!
My next problem is that I would like this subsystem to exist on the dedicated server as well.. but that's up for discussion with my colleagues.
Pretty sure that removes a player subsystem then. Bit odd that you're getting the same subsystem from multiple editor windows though. As far as I was aware, PIE created a separate GameInstance for every PIE instance.
There's a slight possibility that I've misinterpreted my results and made the incorrect assumption.
I'll run a proper test and report back
@kindred widget
You are absolutely right. Embarrassingly enough I think I invoked the synchronization event on the dedicated server in my initial test, causing me to misinterpret it as being a shared game instance on the clients. They all seem to have a unique GameInstance.
Thanks again! ๐
is anyone with that gif may have an idea why my ai has a laggy behaviour ?
It looks like they're snapping to the location received from the Server. CharacterMovementComponent has functionality in place to predict and interpolate / extrapolate movement. Which, if any, movement component are you using for your AI?
this one ?
Try resetting all settings to defaults under Character Movement (Networking) settings.
Are you playing as Listen Server configuration or Client?
It could be the case that your AI is moving on both the Client machine and Server, causing corrections.
Try playing with the console command p.NetShowCorrections 1 and see if you see any green / red capsules show up. This tells you that the Server is correcting the positions of your AI on the Client machine. You should only move the AI on the Server
Are you playing as Listen Server configuration or Client?
we play with a dedicated server, so all clients are only clients, so server only has authority on the controller. Controller is only created on server right ? controller is not supposed to be replicated (?)
Try resetting all settings to defaults under Character Movement (Networking) settings.
where ?
p.NetShowCorrections 1 > on client console ?
p.NetShowCorrections 1
nothing is showed so there is something wrong i guess
All controllers are created on the Server, but each Client has its own local Controller.
They're not replicated but are created in a way that they gain elevated network authority (the Client can send RPCs to the Server directly through it, etc)
The Controller is separate from the pawn the controller moves.
You should make sure that only the Server moves the AI pawns.
You reset the settings in the component settings when you click your Character Movement Component in the Blueprint editor
Yes, enter the command on the Client console.
so that should be what we do for spawning on server side right ?
everything is setup by default
What happens if you remove the delay?
Event possess > Ai move to
Guys
Is A Online Subsystems Definitely Needed for a multiplayer game?
Create,Join , Find Session?
in theory no, in practice very much so
you could get by playing on LAN with your friends without a session system
but not much else
A Online Subsystem has to be used?
my player is not spawned when the ai is possesed so it just do nothing
has to no, but it should
Oh
A Online Subsystem has to be used?
its just simpler that way
Like
you do get to pay the entry cost first time around though
For Games Like Fortnite , Pubg ?
But those are two separate things
Start a match, a online subsytem helps to create sessions?
but when i remove it it just do nothing
all released games use online subsystems nowdays, in one form or another
subsystems as such are relatively new, but the implementation isn't much different
Is it like necessary for these?
What Subsystem would you received for use in mobile ( Google play store)?
The delay is causing the laggy AI movement, so you need to know when the player pawn is already right? You could dispatch an event and when itโs called you can spawn your AI.
i'd probably go with EOS, but i don't do mobile, see #online-subsystems and #epic-online-services
Ok but it's more easy to use Lan right?
but this node will not follow the player if it start moving ?
Plus the AI controller isnโt auto possessing
But now this seems more like an #gameplay-ai conversation
Does OnNetCleanup gets called if we experience a crash so to do some cleanup in a pawn ?
OnNetCleanup runs whenever the connection is killed.
If the crash breaks up the connection, then yes.
ok cool thanks
Hello,
I would like (c++) push the player in XYZ direction when he receive a bullet,
I perfectly see how to avoid server correction with the CMC for jumping, but i don't get the process when the player is not aware of the velocity change in first.
Any help, video, or ressource on this ?
To some extent you have no choice but to live with corrections. Client is forward-predicting, but bullets will be behind. Best bet is to apply on both server and owning client, and hope the correction goes largely unnoticed.
Hum and if i turn off prediction when he receive bullet, and reconciliate after a grace a time ?
correction*
or it would be better to juste increase net distance correction ?
Won't work. Bullets are behind by clients ping, by the time they know the bullet has hit them it's already too late, server will have corrected (or at least, move will have been sent to the server)
The two things are happening in different frames of reference.
There's also no point in having a grace period because then the client will just override the action.
I see.
Exactly. Queue a "no bullet stopping power" hack
wdym ?
(and increase distance correction for the whole character and hope will not do the trick ?)
Correction distance won't help, it'll just result in larger errors and clients will be in the wrong place
As in that the client cheats by saying it never received the update and just abuses the 'grace period' it has.
Is what I assumed Jambax meant.
So, there is 0 way to do it at least less noticeable for the client ?
Again. There's no point in setting the correction distance higher, if the server applies the velocity and the client does not the client will override your velocity change because it now has more distance for not getting corrected.
got it.
Hopefully the built in smoothing will make the correction less noticeable
The client could "forward predict" bullets that are near it by their ping factor, to try and predict stopping power, but it's still gonna be flaky
Just don't make PvP games and let players do w/e they want. Networking on easy mode ๐ง
Might result in more misspredictions tbh
Introducing Minecraft where both scenarios are true. Cheaters? We don't care about it. PvP? Heck yes! ๐คฃ
Gears of War had stopping power and there's nothing explicit for it in the codebase, so guessing this is what Epic did tbh
They also used hitscan though, made life a tad easier
Less time for things to go wrong or diverge
I don't see how on earth you want to predict a bullet though. At least if we're talking with other clients shooting them. You can't possibly predict a different client shooting ๐
In my co-op game, I do hitscan with the client and the client tells the server, "Hey I hit this", server does an ultra simple linetrace itself, and if it was possible, just agrees.
is anyone can tell me the right procedure to spawn an AI ?
like i do :
spawn on gamemode
ai controller : on possess -> do action
ACharacter is replicated and mouvement too
Doesn't have to be in the game mode
But all you do is, while on the server, spawn an actor like normal
Set your AI pawn class to auto possess when spawned or placed in the map and that's about it
Make sure it is also using the correct AI controller though
it's what i do too, except bullet have flying time.
but same idea.
Ooooh, i've maybe have idea, a bit cluncky but
Player receive the bullet -> Client apply the force, then send to the server who apply also the force.
not cheat proof, but should be seamless
It will look delayed on the server as well though, but that's kind of your only option if you really want this I guess.
Yeah it's chaos. I tried forward-predicting projectiles and it became a real minefield
Predicting your own.. not so bad. Predicting other player projectiles? Noooo chance
That's why I still don't understand how Rocket League works lol. How do they predict the ball when other clients are touching it? xD
yeah, i guess i can just play with some offset with the mesh itself and try to predict, smooth the the result for proxy
and will not look so clunckly hopefully.
until someone have 200ms.
"go play on your own server f************"
Well, the answer is quite simple actually. They're better than us.
And also spent like 2 or 3 years on this specific thing.
I recall them talking about how they were working on it for so dang long.
But still, conceptually I don't see how you want to predict a ball on the client while a moving other player can change the trajectory to anything at any time. I see how that works when you're the one playing but I don't see how that works with others lol. Although I know RL is far from perfect, but as far as I can tell it does not constantly set back the ball when someone else is doing things with it.
The one mystery that I'm really curious about haha.
Exactly! Cheaters have ruined PVP for far too long. I guess it's time to make a player vs player puzzle and maths game instead and watch as the $$$ pile up. Something similar to the all time classic Treasure MathStorm! https://www.youtube.com/watch?v=JzWfspUYWnU
@thin stratus and @twilit radishIm the guy with the weird ai replication bug from yesterday, I finally found the culprit. I replicated a bool on my character cpp class and that made the ai's replication glitch out. I still dont understand why, since members should be able to replicate on an AI's character class. Now to my question since this is prob an engine bug(I did everything like in my normal player char class to replicate props) is it worth opening a bug ticket? Never reported an engine bug, thats why.
How did you define that stuff?
It seems really unlikely to me that it's an engine bug honestly. Trust me, been there many times ๐
Nobody can help you better answer that question unless you post some code
Given the amount of uncertainty in your messages it is highly likely to be user error, rather than an engine problem. Of course, nothing is ever guaranteed in life, that is just an educated guess
If you post the exact context, code etc... comparison of what worked vs what didnt. Someone can help you make that determination better
made a normal declaration of bool Dead = false; with upropertys(replicated). In cpp i then added it to the replicate function void AMetaAI::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const { DOREPLIFETIME(AMetaAI, Dead); } I also added the Unrealnet include in the cpp file. Replication is enabled as default if im correct.
thats my setup
@twilit radish
And there's your issue.
You're not calling the super so it won't do any of the replication properly for the rest ๐
void AMetaAI::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
DOREPLIFETIME(AMetaAI, Dead);
}
```:D
i swear this happens too often to count
I do it all the time too with random stuff ๐คฃ
thanks a lot for the help!
And there we go, that is why it is easiest to give as much context as possible, including code snippets
I had to take a phone call and by the time I got back to reading someone spotted the issue ๐
Always call super. This includes making nodes to call parent function in BP
I have lost count of how often I have needed to drill this into people...
๐
yeah, weirdly it always happens to me when i declare the lifetime replciated props function
Hey there, I hope it's okay for me to double post from a different channel, didn't realize there was a multiplayer one. I've been trying to work with the CharacterMovementComponent to create a Teleport, but it seems like the teleport works when I run the project in the "Standalone" play mode, but if I play as the client, the player gets rubberbanded back to their original position due to server reconciliation
would be happy to post code, but I'm not 100% on where this issue might be coming from
Would definitely be a good idea to show how you did it yeah. Generally I would assume the issue being that the client teleports but then the server doesn't and then the server corrects the client, at least is what it sounds like so far ๐
I'm almost certain that that's what's happening, because I can see the client teleport to the expected position for like, a frame.
I'm honestly also still learning how the CharacterMovementComponent works, so I was having trouble finding what functions handle the corrections from the server
this is the function that physically teleports the player as a start:
void UShooterCharacterMovement::ProcessTeleport()
{
FHitResult res;
UE_LOG(LogTemp, Warning, TEXT("processing teleport %s"), *(teleportDestination).ToString());
SafeMoveUpdatedComponent(teleportDestination - GetOwner()->GetActorLocation(), GetOwner()->GetActorRotation(), false, res, ETeleportType::TeleportPhysics);
execSetTeleport(false, FVector::ZeroVector);
}
@fleet viper AI actors exist only on server they are not replicated
Ai controllers only exist on the server, ai characters have to exist on server and client. Otherwise the client wouldn't be able to see the ai
by AI character you mean ACharacter derived classes ?
hello !
I am trying some things on multiplayer these days, and I am in the context of a dedicated server that would be supposed to run for days.
Players can alter the world ( ie actors that are part of the map ), and to be able to replicate those changes each time a player connects, I am basicly destroying all the actors and re spawning them client side from what the server has been saving on its side.
It works great, but I am afraid that the more the server 'lives' and register changes, the bigger the loading client side will be since it basicly adds up more and more...
Would you have any suggestions on how to optimise this ? I was thinking maybe saving the map with all actors 'as it is' as a new map server side, and just send the map to all players connecting afterwards, but not sure on this one...
If we're talking just a couple tens of actors every so often just set the distance on when they become relevant to something appropriate so that not all actors constantly replicate towards the clients but only when they are near them.
ooh I see, it would be kind of making a chunk replication system right ?
Although here I am more talking about hundreds, if not thousands of actors... making this 'chunk' process even more needed
Hi devs , got a quick noob question, if i spawn a replicated actor the server , since its is replicated it will be automatically spawned on the clients as well right?or i am messing up something?
Allegedly, yes.
Same if you destroy it from the server
guys is this good way of setting players name in multiplayer game or not?
Why would you call a RPC if it's already a replicated variable? Just use an OnRep. (Which is also better than a RPC IMO in this case).
you mean using a RepNotify ?
Yeah.
when I have this variable set as replicated then in game its not replicated
but I can try repnotify
but I remember it did not work too
yea RPC does not work
he should has name test
so i used this
I think instead of setting the name from the server to the player
you should try asking for the name from the server, using your character controller
the widget you are using probably ( ? ) only lives on your owning player, and the server can't access it
just a guess though
I used repnotify here but same effect I dont see enemy name ๐ฆ
idk why I see my own name but name of enemy is not replicated even it's in repnotify
should I rpc rep notify?
Looks like you are setting the nickname on the client without a Server RPC
The replication works from Server to Client.
You change the value in the Server (if from Client than you should make a Server RPC)
The Server will change the value and replicate to clients
Does point damage also trigger 'Event Any Damage' ?
Good evening all. I have this intuition that I'm missing something very fundamental on my collision-based RPC. The listen server does not activate the On Component Hit event when a client hits the actor's collision mesh (sphere). I am using the default pawns in the map.
When the listen server pawn hits it, it properly triggers the multicast. When a client hits it, the client instance triggers the event as well.
Perhaps I'm fundamentally misunderstanding how this is supposed to work. Do you see what I'm doing wrong?
You should be doing all the collision stuff on the server, and just replicate the results to clients.
So even the client pawn, that pawn still lives on the server. The server handles it and letโs the client know.
That's what I'm trying to do
Hence why I say my intuition is that I'm doing something fundamentally wrong here
I'm monitoring the instance of the server object
Is there some document I can read? I've pored over the guides in the official documentation and read a search here for "client collision" but something is not clicking
should not rep notify automatically be replicated on clients and server too?
rep notify = a notification that a replication happened.
The replication system happens from Server to Client.
So in your example the Client has the Name. He first need to make a Server RPC so this data can be send from Client to Server.
The Server receives the RPC and update the Name. Since this is marked to replicate, the Server will replicate this data to all relevant clients. Since this replication has a notify the OnRep_NickName triggers.
You are not sending any data to the Server in this RPC
The Client Set the NickName then make a Server RPC that directly make a Multicast RPC
The Server need that NickName data.
UE use Server Authoritative model. The replication is just one way, from Server to Client.
If your Client Set the NickName there is no replication.
The Client has the NickName value.
He sends this data to the Server using Server RPC.
The Server set this data value and since this variable it will be replicated to all clients
I suggest taking a look at this https://cedric-neukirchen.net/Downloads/Compendium/UE4_Network_Compendium_by_Cedric_eXi_Neukirchen.pdf
If I get player 0 pawn from the level blueprint, is it player 0 on the server or player 0 locally?
Both
do i need to set has auth to begin play on repnotify?
because when i set has auth it is not setting the name
i mean with not setting when player join relevant distance again it is setting name to nothing with has auth but working fine without has auth
Are you setting something to itself?
Not sure why doing that either
Do you call SetName from somewhere?
Why a Multicast when you have an OnRep....
yes an actor just set random name
I think you might want to check the above discussion which seems similar to your issue what you want to achieve
so i dont need the has auth in begin play? in secure cases
Using HasAuth in BeginPlay would help you to split your logic between clients and server
Which doesn't seem like required here
to set the name again in relevant
The value is still the same on the server
When they get back into relevance it should just call the OnRep
There is also no reason to multicast
but it is not calling it in my case
Then just do the thing you do in the OnRep additionally on BeginPlay
For Clients at least
They probably get respawned with the correct value
Is the issue happening only when you get out of relevancy?
yes
it is working without multicast thanks
When creating AI for a multiplayer, it should be controlled exclusively by the server logic and only replicated on clients right?
it's weird mine repnotify was not working without multicast
idk what I did wrong but it was like this and names were not replicated
As with anything, it depends. In a normal scenario, sure. You don't normally want NPCs to be affected by clients outside of gameplay stuff. On the other hand there are small cases where you might want a client only ai pawn. Or maybe cases where each client might simulate AI on their own for visual effects. Like just flavor ai citizens in a multiplayer city builder.
you have the code up there if you want to try it in side project to make sure
.
and this is the last step the variable string in widget text (replicated)
i do not have binded my text I am just setting up text by set text maybe that's the problem
when it's not binded it's not replicated
setting the name (widget) and get the name repnotify to set the name in widget ๐๐ป
this is how my repnotify looks and then my widget bind to name and name but its showing nothing above enemy plane... ๐
weird
simplify your life
player state already replicates the name, and it will by default pull it from whatever service you use to play (steam name if you play over steam)
also replicated FText = bad
put your widget component on the PlayerState
and attach it on its PlayerPawn
that way your replication goes through only one, not two actor channels
makes it way simpler
I have name stored in my game instance as player state is not persistent when you join the session
