#multiplayer
1 messages · Page 680 of 1
That's nowhere near enough info to diagnose
Well, one simple thing I tried: map Numpad + on the controller and Numpad - on the character and show a debug string
- (controller) executes on both clients ... while + (character) shows only on each client, which is normal
how to make sure I have 2 different instances ? I see 2 players, and their movement are replicated, that should be enough to say that there is 2 instances right ?
is it normal to have this behavior with the a controller input ?
I am almost tempted to move the arrays I have on the player state to avoid those issues ....
I was correct, my issue is now resolved, damage wasn't applying properly
Guess I'll have to do as you say:
You could do ‘Run on Owning Client’ to ensure things only run on that particular Client. You could also Spawn an Actor 'locally’, so actions will also not be replicated. Then use logic like: isLocallyControlled and Switch-Has-Authority ‘true’ to allow you to branch to that code uniquely for the Client that owns the actor with ‘all the calculations’ etc…
something like that ...
more IF XD
Yep. I found out that apparently RedpointEOS plugin is causing the issue. I'll update when the issue is solved incase someone else runs into the issue.
Is there any way to check what objects got replicate and in what order ?
hey all, I'm trying to figure out a network solution for a melee weapon actor that I'm programming, I'm able to make my Character do a replicated montage, but I've tried TakeDamage and ApplyDamage function in my actor and neither works on the client in a dedicated server setup. Works in standalone though.
void ASWeapon::CalculatePlayerWeaponDamage_Implementation(ASBaseCharacter* Enemy)
{
Total_Damage = GetPawnOwner()->GetTotalDamage(bMelee, bSubWeapon, HitDamage, Enemy);
FPointDamageEvent DmgEvent;
DmgEvent.DamageTypeClass = WeaponDamageType;
GEngine->AddOnScreenDebugMessage(19, 10.0f, FColor::Cyan, TEXT("Attacking Enemy on Local Game: " + Enemy->GetName() + ", TakeDamage: " + FString::SanitizeFloat(Total_Damage)));
//Enemy->TakeDamage(Total_Damage, DmgEvent, GetPawnOwner()->GetController(), this);
UGameplayStatics::ApplyDamage(Enemy, Total_Damage, GetPawnOwner()->GetController(), this, WeaponDamageType);
}
bool ASWeapon::CalculatePlayerWeaponDamage_Validate(ASBaseCharacter* Enemy)
{
return true;
}
void ASWeapon::OnMeleeCompBeginOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
ASBaseCharacter* Enemy = Cast<ASBaseCharacter>(OtherActor);
GEngine->AddOnScreenDebugMessage(0, 10.0f, FColor::Red, TEXT("Actor Found :" + OtherActor->GetName()));
if (GetPawnOwner() != nullptr && GetPawnOwner()->GetMovementAction() == EALSMovementAction::Attacking && Enemy && !HurtList.Contains(Enemy) && GetPawnOwner() != Enemy) {
HurtList.Emplace(OtherActor, Enemy->GetHealth());
CalculatePlayerWeaponDamage(Enemy);
for (auto It = HurtList.CreateConstIterator(); It; ++It) {
GEngine->AddOnScreenDebugMessage(0, 10.0f, FColor::Purple, TEXT("Applying Force -> Actor Name # " + It.Key()->GetName()));
}
}
}
LogNetPartialBunch: Error: Attempted to send bunch exceeding max allowed size. BunchSize=70130, MaximumSize=65536
Anyone know about this error, Is it possible to increase the maximum size
Kind of embarrassing, but for some reason I cannot get some "basic" replication to work (that I had working previously). I am trying to spawn an actor from client. (listen server model by the way). So far either it just appearing on the host (client or host call) or it just appears unreplicated on the person calling. My current set up is player controller on input event, store some variables (e.g., transform) -> client destroy preview (unrelated to the problem, but why the variables have to be stored) -> server spawn (passes the variables over to the server). Server spawn, stores the variables and calls multicast spawn. Multicast spawn takes the data from the server and then spawns actor from class. This set up results in just the host seeing the actor. The actor is replicated.
never mind I think I resolved it. (too tired to be doing this if i am making these kinds of simple-ish mistakes)
Only the server can replicate things to clients. You only need to spawn the actor on the server and it will replicate to clients. Calling a multicast after the fact would make all clients spawn their own copy of an actor that only that client knows about.
Which is what I was attempting, when it wasn't replicating I tried to use multicast
when I did it as server only, client calls got ignored
however, fuck me... I found the reason. The variables are not being stored correctly
(that is why it was glitching out. I just stored the replicated variables in the wrong spot. So when nothing was showing up it was because all the settings were null)
does anyoneen have a bp tutorial that they know actually works for multplayer (not on the same lan)
by not the same as LAN, I assume you are looking for a non-listen-server style?
You want a dedicated server?
i want to use my pc as a servr (like minecraft servsers)
so a listen-server
So in terms of programming gameplay, LAN and listen-servers are the same. How the lobbies are formed, how people can see them are different. And that comes down partially to subsystem you are using (NULL, steam, etc.)
LAN isn’t the same
They're the same as far as unreal's server setup and networking goes. Not the same in regards to session handling/online subsystems.
Sounds like this is a question about online subsystems though.
Think he was just asking for tutorials, in which case there is quite a bit in pinned messages
Yeah.
As well as a BP only tutorial series from unreal on youtube
Only difference between LAN and online is that the default NULL subsystem is LAN only, so you need Steam or EOS or another service to matchmake over the Internet
Usually for Blueprint developers that mean downloading Advanced Sessions plugin and calling it a day
The rest is regular multiplayer stuff
Having a weird issue where positions or the meshes are different on the server and client. What is the setting to make the server sync bones and animation. I know the Set Tick Pose & Refresh bones setting in the character mesh but thats not working. Example of why this is a huge problem. On my client where the simulated mesh is I'm getting a hit with my projectiles but its not registering on the server because the mesh isnt really there. This only happens when my AI are moving. I have to lead my projectiles extremely far to get a hit. Its weird.
As far as I know there's no "setting" for that - animation is locally driven and getting it to sync is a lot more complicated than you might think
Shooters usually trust clients to some extent on this
If the shot makes it through the player capsule and is head-height and the client says it shot the head, well, hard to prove that it didn't
but yeah, games like Fortnite, etc, trust the client on what they hit
as bone detection is not accurate on the server
There's always the classic source multiplayer networking article (https://developer.valvesoftware.com/wiki/Source_Multiplayer_Networking, talking about the lag compensation section), but that's the "hard" way to do things. Probably only necessary if you're building a highly competitive shooter like CS. And you won't find any built-in way to do that, it's going to be all custom.
Im confused on how that works. Im spawning my projectiles via the server so how can the client say it hit something?
The fundamental problem is that in a shooter, all clients have a large degree of autonomy and implement prediction to a large extent. That is, they see things that haven't actually happened authoritatively on the server, or the lag would be unbearable.
So when you shoot someone in the head, it's fundamentally unfair because you are doing it to a character that's about your lag time + one server frame + the other player lag old
The other guy might have got hidden since that
There is no way to know but now you've shot them in the head and the game needs to decide what to do
Usually, games trust the client shooting to a large extent, that is, to the extent you can't prove they're cheating
Which is to say that games often don't do actual hit detection on the server
So now my question is do I spawn client sided projectiles and call a server function when they hit.. I feel like thats saying hey come cheat here. lol
If you have actual projectile weapons with slow travel time, and they don't collide at the capsule level but at actual geometry, it gets really tricky to implement well
Right now Im using Unreal Tournaments projectile logic. Its watered down a ton though probably need to look and see what else they did for latency. Right now im testing with 240 ping..
(240 ping is probably a somewhat worst-case value where you should expect competitive play to break down a lot, 100 has been a max ping limit for years)
And yea Im colliding at the mesh level.. I guess what I could do is collide on capsule level on the server and let the client collide on the mesh for fx and what not. but I think my prob will still be the same.
i never bothered with client side projectiles, (my projectiles are only things like sniper bullets, rocket launcher, grenades, etc) and you can kinda just mask them behind FX.
So you are just line tracing then? with a fx to give that sense of projectiles
My thinking is pretty much that you can have
- accurate weapons with client-side detection on the shooter (sniper, assault rifles) with line tracing
- explosive weapons (rocket launcher etc) that use projectiles + capsule hit detection
those are client authoritive
I would have to rewrite my entire system. Right now I spawn my projectile in a Gameplay ability and the projectile handles all of the damage and hit detection on its own. The only trace I use from the client is to point the projectiles rotation in the right directions so its just not floating straight from its spawn transform
This makes me wonder if any game uses projectile based bullets
a lot do
some use fake projectiles (where they tick the bullet without using physics)
there are advantages and disadvantages to both
The problem with a projectile based weapon that's also bone-accurate is that you need insane accuracy of simulation
Everything has to be completely deterministic to a very high degree
If your client shooting the gun suddenly has 20ms more lag, it's likely to throw off the whole thing
is there a "go-to" way to handle initializing replicated UObjects on the client? I'm running into what feels like the same issue for Buffs, Stats, Resources, etc. where I set them up on the server and replicate them using ReplicateSubobjects then have to set them up on the client as well in either an OnRep of something or in PostNetReceive, or replicate the pointers to the objects as well in an array on whatever is managing them and then check them for IsValid and initialize them there in the array's OnRep. where do you guys do initialization logic for UObjects when they first get replicated to clients?
Well the good news I didnt build a bunch of abilities that I'll have to rewrite
So after turning on the capsule collider in game so I can see it. Everytime my ai moves the capsule collider moves and the mesh lags way behind.. This is where my problem is coming from.
Because you don't get a steady stream of position updates, the mesh interpolates it's relative location to the mesh for smoothing.
Otherwise it would look snappy and jumpy in a real-world situation
its super far off like 2 whole meshes off.
Where is this setting at. I want to control it by ping
You can adjust NetworkNoSmoothUpdateDistance in character movement to limit it
But bear in mind, it's got nothing to do with ping
Packet loss and bandwidth constraints is the reason that smoothing exists
But if you do want to mess with it in realtime you'll need to adjust the CMC's cached value in the client prediction data too
Is it considered overkill to blast the server with RPCs every frame, for each client?
Considering that the server sends info at a limited rate, I was wondering what the recommendations are for the other direction
@bitter oriole Yeah ok! I'm thinking it's mostly unreliable ones, such as aiming/moving
Reliable RPC on tick would definitely kill your game quickly
Especially on a fast-running 120fps client with bad connectivity
Ouch yes
You should really limit it to some cap anyway though, and try to condense things down if you can.
Even if they aren't sent or don't cause slowdowns they can still choke everything else you may want to send.
One thing I could do is to compare if a change has been made. But that makes me wonder if I should send all the data in separate RPCs, instead of in one struct. If I send the entire chunk of data each time even if only one property has changed, that seems a little overkill
Depends, generally there's very little reason to send anything to the server at such a high rate anyway
Movement commands are really the only exception
Separate RPC's has it's own overhead anyway
Fewer you send the better
After a certain point not sending the whole struct becomes diminishing and more prone to error
Yeah hmm
At least if there's a large amount of things that rarely change together with a small amount of things that rapidly change, it seems like perhaps there could be a compromise with using two RPCs?
One struct is convenient for several reasons though. For instance more simple to save a buffer/history
Is it feasible to replicate an array (up to 2000 items, each being a struct with some floats/vectors, not more than 4-5) using FFastArraySerializer, in 100 milliseconds (or 10 times per second)?
Alternatively, is there any way that I can calculate the approximate cost? I can get the bit size of each replicated variable and multiply, but idk if that is realistic, and to which point Unreal is optimizing it
5 floats is 20 bytes so that's a constant 400KBps bandwidth potentially
Assuming 5 float vectors that's 1200KBps
Not impossible strictly speaking but unrealistic
Needs to push all bandwidth limits of the engine and it'll only actually work if only part of the array is affected
I see... I can reduce it to 3 floats I think, additionalliy, could I use a smaller type than float, like a smaller int, since the values I work with won't be super big nor need such precision I think
But probs it's still too big, idk
And in the worst case scenario all the array could be affected at the same time
In the case that I used vectors (not needed) I would pack floats into them, so the max I could think of is 400Kbps.
That's if you only have a total of 5 floats per struct, yes
I think the engine default is like 10KBps though it's a conservative value
But hey, try it
:D
See in real world conditions how long it takes for each update to go through
sounds reasonable
is there any way I can benchmark it?
afaik server doesn't know when a client recieves a rep
Build yourself a few test arrays, rig some buttons on screen for each, and then on the client test on tick whether the current value is the test one, then print which it is on screen
Run client and server with pktlag 50 and check visually
👌
There's really no better test than real-world but if that works flawlessly for you with reasonable lag, it's likely that you can move ahead with the idea
Well this is going to be interpolated, so I was planning to have 2 cached values (200 milliseconds overtime)
and this is a very worst case scenario, usually I would have much less items
half or less
okay, this sounds dumb but in C++, how can I tell the server to apply damage from an actor owned by the client?
RPC the server and apply the damage there
thanks, I realize I had the function set to NetMulticast instead of Server
right, I am getting cross-eyed. So probably logical issue here. Code is in C++ but I was testing some of it it in BP to see if the logic was correct. When I converted the logic (the functions were in C++ - see screen shot) the implementation stopped working (i.e., the spawned building would only show up on the host's screen). I must have changed something in my code because now neither the pure C++ or the BP version work. Screen shots show the logic used.
On Primary action, the PlayerController checks if the the preview building exists (the building is replicated). If it is and it is in a a valid spawn area, then there is an ROC for storing variable (before any asks why I am using the controller to pass information to and from the same source, I had issues with replication and that solved them). The preview is destroyed (as the preview is only visible on the person who spawned it, works for both client and host). Then there is a server event to spawn the building (under construction; again had the same issues where i needed to use the controller to pass information to and from the same source).
Here is the logic in BP. I can share code for each part as needed:
also as a side note to this error:
when the host spawns a building under construction, it shows up as a building under construction (only the host can see it)
when the client spawns a building under construction, it shows up as a building that is constructed (only host can see it)
you only need one server RPC, and a confirmation back
what the host sees (host under construction on the left, client on the right):
buildings are, i assume replicated
what the client sees:
@winged badger
to your first comment, there is only one server RPC. The other are client, just so data can be stored between the deletion of the preview and the server event
and yes
preview should generally only be local
preview is only local
the left most is not preview it is under construction (no mesh or materials. so I made a place holder)
then client stores the data and sends the Server RPC to spawn the construction site
yes
of type at certain transform
Server sends a client RPC confirming action suceeded/failed
That part is the part I might be missing
thats it
no other client RPCs are required
building should replicate its own stuff
it's not though
based on the screen shot (with the two buildings) I can tell you that some of the server events aren't firing correctly
also, using GameplayTags names for rownames makes for more convenient use/networking
^that will be addressed in refactoring/clean up
as you can spawn building by gameplay tag then
I will tackle that issue down the road and refactor as needed (waiting on information from designers).
well, i haven't seen what that function does
no idea what blueprint its in
and you haven't confirmed buildings are actually replicated
oh you did
I did
and I also stated what blueprint
it is in player controller
void UBuildingManagerBase::ROS_SpawnConstruction_Implementation(FTransform TargetTransform, FName InRowName)
{
TSubclassOf<ABuildingMasterBase> BuildingClassLocal;
// use deferred spawn to begin all the various aspects the system needs
ABuildingMasterBase* ConstructionBuildingLocal = Cast<ABuildingMasterBase>(UGameplayStatics::BeginDeferredActorSpawnFromClass(GetWorld(), ABuildingMasterBase::StaticClass(), TargetTransform));
if (ConstructionBuildingLocal != nullptr)
{
BuildingRef = ConstructionBuildingLocal;
BuildingRef->GetClass()->ImplementsInterface(UBuildingInterface::StaticClass());
IBuildingInterface::Execute_TriggerSetRowName(BuildingRef, InRowName);
IBuildingInterface::Execute_TriggerSetOwner(BuildingRef, ControllerRef);
IBuildingInterface::Execute_TriggerSetConstructionStatus(BuildingRef, EConstructionStatus::UnderConstruction);
// finish spawning the building.
UGameplayStatics::FinishSpawningActor(BuildingRef, TargetTransform);
}
}
that is the code for that node
its a little weird, but it should be working
It was earlier too
I know that the client isn't firing it from use of break points and because 'IBuildingInterface::Execute_TriggerSetConstructionStatus(BuildingRef, EConstructionStatus::UnderConstruction);' is the the line that made the materials different
first you don't need GameplayStatics here
Really? damn it ever example I saw used it. Can I just drop that?
(and without it I get an error message)
wait....
stupid question.
If the ABuildingMasterBase is set to replicate... do I need it to be on a server RPC?
can I just make it a regular function?
FActorSpawnParameters SpawnInfo;
SpawnInfo.bDeferConstruction = true;
SpawnInfo.Owner = this;
SpawnInfo.SpawnCollisionHandlingOverride = whichever you need here;
ABuildingMasterBase* NewBuilding = GetWorld()->SpawnActor<ABuildingMasterBase>(AbuildingMasterBase::StaticClass(), TargetTransform, SpawnInfo);
// don't really need the interface either
NewBuilding->SetRowName(InRowName);
NewBuilding->FinishSpawning(TargetTransform);
SpawnActor doesn't work for me
can I still do 'IBuildingInterface::Execute_TriggerSetRowName(BuildingRef, InRowName);' between SpawnActor and FinishSpawning?
I will try that approach, ideas about my question around the fact it is set to replicate and not needing a server RPC for the spawn?
you def need a server RPC to spawn it
that is what I thought, but I just wanted to double check I had not missed something bloody obvious
best to have SpawnCollisionOverride set to AlwaysSpawn as well
was going to adjust but always spawn
if you're doing manual checking for room
as that pretty much makes you, instead of the engine, control the spawn checks and transform
and you really don't want 2 different algorithms running CanSpawn and Spawn
if something appears not to be spawning
also I do need the interface
compile DebugGameEditor, start the editor from VS, breakpoint ABuildingMasterBase::BeginPlay, add AActor::Role, AActor::RemoteRole and AActor::Owner to the Watch
and see what hits
interface is useful to have shared API on otherwise dissimilar Objects
what i have now btw is:
FActorSpawnParameters SpawnInfo;
SpawnInfo.bDeferConstruction = true;
SpawnInfo.Owner = ControllerRef;
SpawnInfo.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AdjustIfPossibleButAlwaysSpawn;
ABuildingMasterBase* ConstructionBuildingLocal = GetWorld()->SpawnActor<ABuildingMasterBase>(ABuildingMasterBase::StaticClass(), TargetTransform, SpawnInfo);
BuildingRef = ConstructionBuildingLocal;
BuildingRef->GetClass()->ImplementsInterface(UBuildingInterface::StaticClass());
IBuildingInterface::Execute_TriggerSetOwner(BuildingRef, ControllerRef);
BuildingRef->FinishSpawning(TargetTransform);
if you don't plan on something else that is not a building, running the building interface
then you really don't need it
was cutting back on dependencies between the classes is all
as far as i can see now, that interface can just be part of AbuildingmAsterBase
didn't work
adding break point now in VS
might be a bit slow (just got a work call) will do the debug in a moment
Role = ROLE_Authority
RemoteRole = ROLE_SimilatedProxy
Owner: BP_PlayerController C 1 (which is the the client, and I removed the underscores due to discord)
with your version of the code, it destroys actor because the rowname isn't set
with my version:
Role = ROLE_Authority
RemoteRole = ROLE_SimilatedProxy
Owner: BP_PlayerController C 1 (which is the the client, and I removed the underscores due to discord)
so the same
HOWEVER
it fires a second time on my version
and the second time it fires its owner is BP_PlayerController C 0 (the host)
yeah still cannot see why it isn't working
hello friends, with 4.27, I compiled my project from visual studio as development editor and then as a developmend server. I opened maps called Entry Level Transition level and GameMap. My game will support single player and multiplayer, so I need to add a startmap other than dedicated, but I cannot add a server when the game opens, how can I prevent this?
@slow mirage on your skeletal mesh component of your character, set Anim based visibility option to Always Tick Pose and refresh bones
I'll try it right now
THANK YOU! I've been stuck on this for like a month, I posted on the epic forums and no one could figure it out. I would like to send you a tip $$ so just message me your paypal email address if it's allowed to do so. Thanks again you are awesome!
@grim geode void ClientTeamMessage(class APlayerState* SenderPlayerState, const FString& S, FName Type, float MsgLifeTime = 0); on the PlayerController
we store the teams playerstates
then we have a server rpc from the caller, which grabs the team info actor, grabs the teams controllers, and then does those client rpc's
this is done via our APrivateTeamInfo actor (based on AInfo)
privateteamactor is spawned unique for each team and holds who is on that team
yes
that is where it gets tricky, cause you don't want to do RPC's for that
we haven't actually done that, but you could use a kinda replicated array of messages
with a set size limit
and pop old messages when the buffer fills
the OnRep of this array can update the clients global chat window
well Steam actually has a way to send lobby messages
EOS i think also, otherwise you will need to do some kinda socket thing (or via beacons if you use them)
not familiar with mobile games sorry or the limitations of them
i am sure it does, yes
might want to ask in #epic-online-services if it does
another way is to use beacons, but that is another big rabbit hole.
Don't have to
Yeah you're not gonna get that for free. See if there's a plug-in.
If you have to ask the questions, you aren't going to have a thousand person lobby on mobile. Start small until you know what you're doing.
Yeah that's a big operation.
There's nothing like that built in on PC
Something weird is going on. When I show the capsule in game the mesh is super far from that capsule not inside it. I thought It could be because of my network settings where i'm simulating a bad connection with 240 ping but I opened up a fresh project and added the same networking settings and the mesh is lined up perfectly with the mesh. So what would be a reason the capsule is moving without the mesh? This is happening in my AI as well as my player controlled characters
Start with being able to run around and see each other on mobile, with local chat. That'll keep you busy for a while. Learn how to crawl before attempting to Sprint.
this is what I mean hopefully you can see the capsule in the screen cap
ACharacter does some smoothing of the mesh vs the capsule, but are you sure you're not ever moving the mesh with your own code?
The only code to move the mesh is when you are the client, it moves the 3rd person mesh behind so the shadow doesnt affect the fp arms.. I can double check that this is not happening on the server
that feels weird
but yeah feels like server is being pushed behind, you want to only do things like that on IsLocallyControlled pawns
Thats the thing. This code is only on my player character behind a IsLocalPlayerController() check.. So the AI shouldn't be doing this at all because the only extend the base class which has nothing about moving the mesh
but that looks about right though for simulation, let me check how far my ai drift
yeah mine is very tight
hardly noticable even at 200ping
whats your net update rate
of the ai character?
then again the capsule is moving ahead
did you tweak any values
with regards to the interping?
these settings
1.0 seconds?
between corrections?
should be .1
also smooth location time is a bit high
at .5
.1 to .2 i found the sweet spot to be
Okay that was the setting that was making that happen. although it does say its not used in linear interp. Have you noticed any differences between exponential and linear.
your interp is exponential tho
so it is used, and exponential is the best for listen servers (only one allowed on listen servers)
and yeah, never used linear
Well thanks. Now that I see what these settings affect. I wonder if its possible to adjust these values by view angle. Like if you are not being rendered to a client then throttle you to update less frequent. Is that a server side optimization or gameplay side?
As far as I am aware, there is nothing of this sort out of the box. If you want some form of global chat, you are likely looking at implementing your own backend server in PHP/ASP.NET with some form of connection between Steam for profile information and game systems to send/receive the information. It's not an easy task unless you have network engineering experience.
Although now that I've said that I went searching and found some interesting Steam API stuff...
@winged badger found that issue from earlier. Know how I said it worked earlier? I made an update from boolean logic to using enums for one of the settings. Forgot to replicate the damn enum.
There are some clan chat things that look fairly easy to implement. I'm not seeing anything past that though.
There's also a built-in XMPP client in the engine.
You can make it so your game servers connect to an XMPP server and relay the messages sent from the clients, then the servers receive the messages and then display them to the clients.
I'm looking for recommended reading on how to represent and transmit the state of a networked strategy game. Anybody have any references they particularly like?
Is there ANY replication function/method that could cause my pawns reset their location back to where they spawned?
I'm having a weird issue that when my pawns die and start simulating physics on skeletal mesh they reset their world location to where they placed on level or spawned
This issue was combined with an engine rendering bug that I already submitted a report, I somehow found a workaround to avoid that rendering bug but this issue persists and only clue I have is, this happens only on server
Though GetActorLocation returns the location where they started simulating physics, but their mesh is resetted to their spawned location. So actor location is being reset, skeletal mesh is. What's eating me is this is only happening on server's viewport
hey there, i'm currently trying to create a local server aswell as clients in the windows command promt, the server seems to function and the clients load into a world, however i don't think they're connected to the server since there is nothing new in the server logs when i load them up and they can't see each other either. here are my instruction lines::(without ip adress lmao)
for the server: "E:\unreal engine\UE_4.27\Engine\Binaries\Win64\UE4Editor.exe" "E:\unreal engine\Kurs\multiplayer\multiplayer\multiplayer.uproject" /Game/ThirdPersonCPP/Maps/ThirdPersonExampleMap -server -log
for the clients: "E:\unreal engine\UE_4.27\Engine\Binaries\Win64\UE4Editor.exe" "E:\unreal engine\Kurs\multiplayer\multiplayer\multiplayer.uproject" ipdadress -game
i'm glad for any help since i'm rather certain i did just like the gamedev instruction course i'm doing said, and i'm also pretty sure my ip adress is correct since i checked it with multiple websites. do you see anything i could've done wrong?
got it fixed using the universal IP-adress in the course, my assumption is that it has something to do with the browser security i'm using (although idk how since i don't use vpn or tor) or with me using wifi instead of ethernet to get my connection
ideas on how it happened are still welcome 🙂
If you do it via CMC you will ensure that both corrections and replaying moves function properly
Given you implemented it correctly
is there way to call SetScalarParameterValue and SetVectorParameterValue on a server owned actor's material instance from the client? I tried to create a server function but it doesn't seem to work when playing as the client
there is, im guessing you sent the DMI reference in the payload, and that is why it doesn't work
as dynamic material isntances are generally not replicated
having an issue where im running a rep notify on the server but the rep notify only seems to be updating the other actors in my game rather than the actual client. I have it so it increments a value on the server and tells the clients to print that value out (and also store it in a local variable.) but when i manually tab into the other clients or server in the editor, its like nothing has happened, neither the local or global variable shows any difference, even on the server.
Video for demonstration, any ideas?
red and green values is the servers output of the variable before and after the rep value is set
ok it seems like none of my attempts at replication are successful. Im running these on the server, are replicated values not possible on your player controller?
Show your code, specifically where you set the variable
this was my rep notify attempt
and this is how i was calling it. The function already run on the server.
its basically meant to increment the variables for all users on pickup (eg. slender but multiplayer, every page someone collects contributes to the 10 page goal)
If anyone sees this, don’t hesitate to send an answer if you can, I’m at a complete loss
@gleaming kite What is your intention here? You said this was on the playercontroller but also said you wanted this to happen for all players?
I ask because PlayerController is local and server only. Client1 has it's own controller, Client2 has it's own controller. Server has Client1 and Client2's controller. But Client1 does not have Client2's controller, etc.
I’m trying to replicate an item pickup to other players. (Player picks up item > that value is replicated to other as a sort of shared inventory)
And I already have an inventory system I made so I would like to use that for the items, but instead of adding it to my local inventory I want to add it to a shared inventory
If you need these values per player, I'd consider their PlayerStates. If this is just a simple single game wide value, then GameState is probably the place for it.
Ah ok. Any reason even my multi cast for a variable wasn’t working? Is variable replication through the player controller just not possible?
And thank you very much for the help
Clients have only their own player controller. An object has to exist on the machine before it can receive data. So if Client1's controller on the server sets a replicated property or calls a multicast, it's only going to go to Client1. Because that controller does not exist on Client2.
eXi has a diagram thing somewhere.
Ah ok! I understand thank you
I’ll be sure to save this thank you
Where is it?
Yeah. Second pin in the channel.
Ah gotcha, thank you
Is there a way to choose which network a LAN listen server is hosted on? I am trying to connect through a router with no internet connection through LAN while the host has another network connected to the internet. The only solution I can figure out is by unplugging the internet connection, which is not ideal. How would I go about forcing the server to go through the second router?
is that a train flying xD
sorry guys, do u know how can I show a widget only for the player that interact with the actor?
becuase it shows the widget to all the players in the server
do u know how can I solve that, guys?
Have the player interacting set the widget to visible or hidden, I guess ?
I revised the bp and it's actually a bit more complicated, because I would like to display the widget to the character when it collides with an actor
is that possible?
I tried to do this with the key E without colliding, and in fact when the player press it only his client can see the widget and this is what I'd like to do with the collision too
it works only if I use a key, do u know how can I solve that problem? (and so use the collision)
Sounds like you just need t owire collision events to what the E key does
it works only if I use a key? your saying that this only works when using a key on your kb/m?
exactly
you should not be storing widget data in the blueprint of the character.
and where can I store it?
I already tried it (u can see that in the 2nd image that I sent)
Now check whether the overlap event fires
did you try adding it to begin play?
let me try
I added the event to the being play (in the ThirdPersonCharacter) and it displays the widget to both the players
so you want it to only spawn on one of the players?
so IF the character is dead, if true, display widget.
if false don't display widget.
so do you have a is dead booleon?
no, I'm gonna creating it
You need to think about these things bud 🙂
how is the game going to know if the character is dead, if you never made a value for it
are you using ragdoll?
you can always say, when the character is in ragdoll
display widget
I'm a beginner, so I'm not very good at the moment 😆
its all good man
make sure your replicating values like ISDEAD
but your doing things correctly tho i seen you replicate to client perfectly int he last screenshot
so I should put the IF statement (or branch) into the event tick?
or in the event that I created before?
yes
When the players health turns to 0 the is dead value should be checked to true
okay
making sure
this is why i put everything in the playercontroller btw 🙂
or game state
i mean basicly now that the character knows he is dead, you can add the widget with a branch node.
Wait
make a custom event
for server
SV_isdead drag the bool in
make a client verson and drag the server to the client
that way you are replicating correctly.
yupp
i wish i could open the editor and show you lol i messed up.
recompiled engine source 😦
the widgets should be client only
so did you recompiled all the engine source?
sense there is not reason to run them on server.
the disable movement should be on server.
ok
where are you calling the server event?
in the "On Component Begin Overlap"
in the future I'll find a way to put the die animation
if I put the disable movement on server the others players can't move too
thats because you are telling the server the player is instantly dead.
take a look at the video above.
got to go to work tho 😦
talk to you later!
👍
any resource in network prediction? I am trying to get a pawn that is NOT a Character to replicate and not be jittery 😦
ok, it is something
/*
========================================================================
Here's how player movement prediction, replication and correction works in network games:
Every tick, the TickComponent() function is called. It figures out the acceleration and rotation change for the frame,
and then calls PerformMovement() (for locally controlled Characters), or ReplicateMoveToServer() (if it's a network client).
ReplicateMoveToServer() saves the move (in the PendingMove list), calls PerformMovement(), and then replicates the move
to the server by calling the replicated function ServerMove() - passing the movement parameters, the client's
resultant position, and a timestamp.
ServerMove() is executed on the server. It decodes the movement parameters and causes the appropriate movement
to occur. It then looks at the resulting position and if enough time has passed since the last response, or the
position error is significant enough, the server calls ClientAdjustPosition(), a replicated function.
ClientAdjustPosition() is executed on the client. The client sets its position to the servers version of position,
and sets the bUpdatePosition flag to true.
When TickComponent() is called on the client again, if bUpdatePosition is true, the client will call
ClientUpdatePosition() before calling PerformMovement(). ClientUpdatePosition() replays all the moves in the pending
move list which occurred after the timestamp of the move the server was adjusting.
*/
(still, if somebody has any resource on this topic, I am more than gratefull)
The only resource I can remember
has some interactive demo (2D, 2 balls) at the end to explain what is going on
It won't necessarily help you implementing it, but it should make sure that you understand what has to be done
Not UE4 related though
Just generic
❤️
Thanks for the pointer, if we can't reference a DMI on a server function then how do we alter a dynamic material instance over the network, from client to server wise? I noticed that the DMI does take effect from projectiles calling TakeDamage because those are spawned on the server.
You don't modify them directly, you send parameters that clients apply to their local instance
But really since it's a visual effect, networking shouldn't be involved at all (unless for some reason the client can't do it themselves)
Thanks, I'll try to work with those restrictions in mind.
Hi. Setting up DORMANCY seems to doesn't work at all in blueprints. Anybody can confirm?
Works okay for me
Is this a custom class or something?
If so make sure you aren't calling SetReplicates() in the C++ constructor, otherwise the actor gets added to the network driver before BP settings are serialized.
The engine will log a warning about it, silently.
When an actor is set to replicate it's physics: do I get an event/method/notify clientside when the server sends the order for that actor to be somewhere? 🤔
if I had to name it, it would be something like "onServerTick"
Is there a repnotify for the physics being corrected? 🤔
that's the good stuff 😄
OnRep_ReplicatedMovement() is the rep notify for replicated movement, which in turn calls some other virtual functions
The smoothing may interfere with things a bit
@chrome bay it's Pawn class. Movement is custom
Pawns probably can't be dormant
If it doesn't replicate it can't be dormant
Dormancy has no meaning to a non-replicated actor
On host i'm setting vector and client receives it and Sets actor location
i dont use repl graph
it's 100% blueprint project
Why would you want a pawn to go dormant anyways?
One thing with possessed pawns is they are always force-replicated
Ok let me ask this way. Does Dormancy should impact all replicated variables?
in class
yeah it affects the whole actor
when dormant, the channel is closed
When it wakes, the actor channel is recreated and every property is sent again
@chrome bay is net dormancy something after net relevancy ? cause if actor is not relevant its channel is closed as well 🤔 AFAIK
similar but not the same. relevancy destroys the actor client-side for one thing, dormancy does not
@chrome bay one last hope. maybe it only works with real network test, not local?
i tried everything, two people on the internet wrote same thing, they tried everything, still replicates
tbh it's blueprint, anything is possible. I would try with an actor that isn't a pawn
A pawn going dormant is probably not that common, it might be the engine has something preventing it ever going dormant
yes, ive checked, for class Actor dormancy works
thx
BUT ! Now it only works only when class default is dormant
But not when i trigger it from gameplay
A print string gave result in log
@chrome bay
Any idea? xd
no idea
dormancy takes a while to kick in
The most recent changes have to be sent and acked first
Blueprint might do something stupid like flushing dormancy if you change a replicated property automatically, IDK
hahah yeah it is. just me testing moving a static mesh along a spline
Trying to test server travel in editor but I get "TravelFailure" LoadMapFailure: "Failed to load package because the map is appended with the prefix "UEDPIE_0_", is the only solution not to run this kind of test in editor?
So I'm using Advanced Steam Sessions, and when I have one client create a session to host, the second client can find it in the server list, but it does not show the correct player count as it shows 0 players connected, and when I click on the server to join the session, it is successful, but when client 2 loads, it looks like it's in it's own session as client 1 is not there. Where should I start looking to get this corrected? I did see a warning message saying Script Msg: FindSessionsCallback - Invalid player state and am wondering if that's why client 1 doesn't show correctly?
I am using 4.27.
I have tried going through the forums of Advanced Steam Sessions and searching through here already, not sure if I was using proper search terms as couldn't find specific to this case.
This is probably not an Advanced Sessions thing. Advanced Sessions just calls Unreal's stuff under the hood. It's a wrapper for what the engine already does natively, exposing things to BP.
Oh ok. I'm just not sure to why I can't seem to get the 2 clients to connect to the same session successfully then... 😩
You can also try with Open "IP OF LISTEN SERVER"
I too am using Advanced Sessions and am having some odd issues but I don't think it is Advanced sessionis.
I can connect to my PC only via Open IP (SO it seems firewall isn't in the way) but Advanced Sessions "Find Session" isn't working
But same project on laptop connects just fine via Find Session
Oh ok. Find session shows me the server is up, but doesn't seem to see the players. So maybe it is only half working, I dunno...
Do you have a game mode and game state? Are you handing player starts and Event for Post login ?
There are a few things that I could see going wrong that would make it seem like the 2nd player isn't there even though they connected to the server
I do have game mode and game state. I haven't done anything for post login yet.
I put a text widet on the screen that runs on tick that counts how many networked players are connected and for both clients, it only shows 1
How is the counting done?
Start by logging a lot more...
There’s a lot of info you can just print on joining session
Hmm I think Get Num Players is called from Game Mode which is ran on server only
As well as session details, and actual log file
You’re kind of just shooting in the dark now
Rather try to find out and pinpoint what’s going on, where does it go wrong
Well from the server list, it doesn't seem to grab correct players, that is the first issue I notice
What do you mean with “correct players”?
It does see the server, just doesn't display correct number of players
correct number of players
That’s very weird
It shows 0 when there is 1 client connected
So maybe as Nonlin was suggesting, I should have some sort of event post login ?
Do you get it from the found session result?
From the found session result
Hmm no I haven’t gotten one either so far
That’s very strange
Are you actually joining the found session?
In the server list, it displays 0/10 (max number I have set for public connections currently)
That I do not know for sure, as I have each server row as a button essentially so when I click on it, it is supposed to use the found session result for that row to connect me, but neither client can see each other.
Should be "Join Session" node
Which takes search result and Player Controller
Player Controller should be the clients
not servers
I was trying something at that point because I had the Get Player Controller (0) before, but the result never changed.
Hadn't switched back yet.
If Client is controlling their own pawn when they trigger the join then Get Player Controller index 0 should be fine
Just swapped it back
Index 0 should always be fine in non local multiplayer
But so should owning, since you only have 1
Have you tried checking logs in meantime?
This showed up after clicking to host session
is your DefaultEngine.ini setup correctly ?
I added this
Is this a LAN test or Steam test?
I just enabled the LAN on the create advanced session node and no difference in results
In the case of steam you can only really test a build on different steam account and device
So make sure you are also doing that
Does it work if in PIE you set it as listen server with 2 players?
Nope
Because that would automatically mean 2 players
Steam only runs in standalone
1 server 1 client you wouldn't even have to do a Find Server and Join server
Well right now I'm just in PIE running 2 clients
That won’t work for steam tho
I think we are trying to test without steam first right?
Why have net mode as client, set net mode as listen server so you can have at least one server
Well then he should set subsystem to NULL or disabled in defaultengine
If they can get it working in Editor and get player count I'd say thats a good first step
If you want to test sessions manually don’t do clients
Use standalone instances
Unless that’s different in your engine version idk
Also UE5 might umm have some bugs
“Might”, guarantee you it has 😛
So I switched it to listen server, on the server one, it brings both players in upon just the server one clicking "host". If I try the client window, I load in fine, but the server window still only sees 0/10 players
I'm running 4.27 right now.
Well with running it as server they would both travel to your current level
So that would be the menu 😛
You can try again on an actual game level see if both players spawn
Yeah with this setup, just start in the level you want all players to be in. You won't even have to click on anything to host/join/ The editor will set the main Viewport as the listen server and the second window that pops up will be automatically connected as a client.
If it doesn't work here, baring any odd things with your code, might be a UE5 bug worth asking in the UE5 general
He’s not on ue5
Ohh oops
Sorry the Editor looked different, made me think it was UE5 and missed his comment saying he is on 4.27
Inside a level, both clients spawn
Although the local player looks fine, the other client is in the jump loop state until I jump lol. Then it sets the character correctly.
That's another issue I'll deal with later lol
side note, I have no idea what I did different (aside from restarting PC after some firewall changes) but my PC now advertises and is detected via Find Sessions...
Are you getting the right player count?
do you have a player count set up for your server list?
I want to show a health bar above stuff when it takes damage. In a single-player I'd create a WidgetComponent on each actor, and bind to an OnHealthChanged delegate in my HealthComponent. But for multiplayer I'm not sure what's best?
I have a HealthComponent that is has UPROPERTY(Replicated) int32 HitPoints; but if I make a delegate, it's only getting fired on the server it seems?
Should I make a delegate and fire it in OnRep_HitPoints?
Nice
Well it works, I just don't know why it isn't working in your other test case. Not clear to me what you are even doing for your other test case
So it's something with the menu system then from creating the session to other client joining.
I currently do that, although via Blueprints. I fire updates like heath bar change via OnRepHealth function
Networking confuses me sometimes. Like I had an issue where the projectile was told to get the player controller and pass it to the Event Point Damage, so you know.. the person getting hit knows who hit them. But the Projectile was SERVER OWNED. So the controller I was getting was always the SERVERS never the client.
The widgets should be Client owned though but just gotta think if you are thinking about ownership correctly
Yeah it seems pretty confusing haha.
yes, the client would call the delegate from their onrep
and it can be the same delegate
do you do stuff like make delegates clearly client-only with names like Client_OnHealthChangedDelegate?
no, usually it's just a shared delegate
I've started using functions with Server_ at the front to make it clear
makes it way easier for UI code that has to work on and offline
o right, yeah
not even sure what the advantages of 2 separate delegates would even be since you can just lookup authority if needed
so I should call the delegates both in my SetHealth function and in the OnRep_Health
yeah or call the OnRep function on the server, which mimics the BP behaviour
is there a reason for UNavigationSystemV1::NavDataSet being empty on a server? works fine in the non-multiplayer configs like dev ed, shipping etc.
might be a cooking option for it?
@neon mango @keen surge Thank you both for your help. I see there is a Steam Multiplayer video posted in the discord here so I'm going to check this out and review my setup in my menu system and hope I can find something in here to fix my menu lol. Thanks again!
guess i was thinking of the inverse scenario
that gave me an idea though - checked if there was anything for "ue4 cook navigation server" landed here https://docs.unrealengine.com/4.27/en-US/SharingAndReleasing/Deployment/Cooking/ but it's saying
-targetplatform=<Plat1>+<Plat2>
Specifies the platform(s) to be cooked. The list of available platforms are WindowsNoEditor, WindowsServer, LinuxServer, PS4, XboxOne, IOS, and Android.
this is obviously incorrect, targetplatform can't be WindowsServer but there might be something indeed
we don't do anything special and our navigation works on DS
windows or linux server?
WindowsServer and LinuxServer targets
nothing special for nav
thanks, I'll keep looking
@neon mango So I added ?listen to the options tag in Open Level, and now player count is correct in the server list..... lol. Does not join the same session but going in the right direction now haha.
So you were not hosting it as LAN correctly then
No wait... this is how one does LAN
This would be no LAN
I'm not sure. That was the only thing I changed was adding the ?listen to the options tag on the open level function. I guess the settings did not flow to the next level.
Client 2 still cannot connect though. I'm still watching the video though, just thought I would write that down in case someone else searches through this discord as well.
does localplayer/player controller will always spawn first before other player spawn ?
Do spectators add to the total amount of players?
or how does one exclude a server from being seen as a player? I'm sure dedicated servers don't but do listen servers have to?
hi all, whats a smart way to interp a character from A to B in a networked way. I'm assuming the CMC will not be happy about it, do I just disable CMC on client and server and then let server interp the actor?
I'm talking interps that defy typical character motion, no collision moving a char 100s of units
Hello, there is not much resource about the dedicated server system, so I need something. I am trying to make both multiplayer and single player game mode in my project. I compiled my project through visual studio, but there is a problem, I want the login map to work even if the player's internet is turned off, I could not succeed whatever I did. Any player's internet must be open and the server files must be working. The player opens the game in this way, how can I overcome this, please help
that's not really enough information
"login map" isn't this something game specific that you control? what is that to do with the dedicated server? the DS can have its own default map
The entrance map is counted as an entry level, it directs it to the transition map from there, it directs it to the server map in the transition map, it shows me this in its unreal resources
really not following
because if the player is offline, why are you trying to even attempt a server connection?
there will be two modes in both singleplayer and multiplayer project so I need server connection
I'm progressively now getting even more confused
since for singleplayer, you would just travel to a map locally
multiplayer, you travel to a server
but when I export the game and run it, I can't enter the game, it wants the server in the background, otherwise I stay on the unreal engine screen.
define "can't enter the game" and "wants server in the background"
if your startup map doesn't travel or use the open command, then that's definitely not default UE4 behaviour
there is no way that UE4 expects a dedicated server running on the same machine
i did this
but the server must be up to go to my login map
How to run i login map without internet and server
"login map" is something specific to your game
and I'm very familiar with what a dedicated server is
because in my login map there are two ways, singleplayer and multiplayer
so why am i staying on the unreal engine screen
I get rid of this screen when I run the taki server
i don't know how to install the debugger i run the game on the phone
well something specific to your game is making it connect on startup. this is not default UE4 behaviour
Can someone remind me if root motion animation were replicated by server (with CMC) automatically when triggered from server or we had to use multicast?
do you mean this
yes, unless they join with SpectatorOnly=1 in their travel URL
ok here if i don't run server.exe -log i can't open menu map
yes so search what in your project is trying to join the server on startup
which is specific to your game
I'm saying this, I want to enter the menu map without running server -log so the player can enter single play
What is trying to connect to the server is a map called entry level.
but it doesn't work when the game starts
this is NOT default UE4 behaviour
😦
I haven't applied anything else.
why would you do that in begin play?
look at the map names, not at the beginning
still
and what does StartLevel do?
do you have any references to your host PC's IP address anywhere in INI, code or BP?
C:and what does StartLevel do?
NO
Interesting is that a c++ only thing if we want to do that from the server right as soon as server hosts?
I don't really know but I don't know how you do MP code in BP only and retain sanity
but if you can add a travel arg to the client connection in BP, you'd do that
usually it's something like open IP?SpectatorOnly=1
that worked for us in a playtest and it WILL spawn you as the player controller type defined by ReplaySpectatorPlayerControllerClass in your game mode
when i export the project for my phone i choose this can this be the source of my problem Build Target :Server
you would NEVER use a server build type for a mobile device
So maybe adding that as flag along with the listen? Will make server be a spectator
use game or client
I’ll look into that lead when I get home
yeah, theoretically
thanks i guess that's the problem i'm trying the game right now
I have one more question, is it possible to use a savegame.sav file on the dedicated server, if possible, how can I pull it from the dedicated server and reflect it to the game?
I've not had to have a dedicated server save a game
and on the client we use JSON files for user preferences
I just want an opinion sorry I may have been too busy 😄
I am currently using a mysql database and pulling the data there as json, do you think this is a correct process?
nope
mysql is a pretty trash RDBMS compared to alternatives like postgres and usually you use a web service to sit in the middle
sql injection in a game server would be a pretty interesting attack vector
yes it is but mysql is the best area i was just wondering if it is correct i can't directly extract the json file
there is a possibility for this
it is possible to show mysql tables only in the specified field example maygame.game.com
what does "the best area" mean? I'm sure the existence of wordpress is the only thing that keeps mysql popular
so that data can only be read from within that game, it is closed to outside interventions.
you write too fast I can't catch up I use google translate 😄
the best i understand
I'm a web software so in that sense
Hello, I am disturbing it again, but it did not work. When I export the project, this panel opens directly and as long as this panel is open, I can go to the menu map. When I close this panel, the game does not open at all.
I did not understand
What you’re doing is cook on the fly, not cook by the book, so a server on your dev machine will be cooking assets as they’re needed
That or you pressed “launch” which is not a packaged build
Yes this isn’t packaging
enable cooking ?
This is building a binary and pushing cooked assets from your PC as needed
should i turn this off
No?
But if you want to test your game in an offline environment then actually do a packaged build
This is nothing to do with a dedicated server
but with 4.25 I was able to test my game offline like this
I can't enter the game right now because I'm closing that log
Nah or you were pushing packaged builds to the device
Which disabling cook on the fly probably does
let me just pack it and try
nothing has changed, it wants me to run the server file to open the game, otherwise it stays on the unreal engine screen 😦
When my pawn is possessed, its player state hasn't necessarily replicated yet, when do I know when its player state is valid?
this is nothing to do with multiplayer, this is the behaviour for cook on the fly
I don't believe the engine has a BP-exposed delegate for it, but if you don't mind getting your hands dirty in C++ it should be easy to add one
the crappy BP-only workaround would be a delay node
Yeah I think the appropriate way to do this is basically my pawn on C++ needs to use OnRep for a variety of things, possession, player state, etc to fire a finally "everything is replicated and we're ready for initialization" event
👍 ty
yeah the pawn has OnRep_PlayerState which is conveniently virtual
Yeah was just looking at that
does anyone know how i could make dedicated server save files?
or can refer me to documentation on it
you need some database to store that data
Im trying to make a trace on the client side, from which i want the hit results to go on the server side. but the "ServerPunchTrace" event is not firing
is it not?
all i want is the client side hit trace info to be sent on the server so it can apply damage to actors. the reason im not running trace on server side is because the trace does not start from the hand, but on the pelvis region of the character, idk why
this method is working for player controlled characters though
@worthy knot on the skeletal mesh
turn on Visibility Anim to Always tick bones and refresh pose
i did
seems like there was an option of visibility being changed in the blueprint
its fine now
i changed it, thanks
Is there a way to measure the time that, let's say, an array took to replicate? I don't need a crazy accuracy but it would be nice to know if it is 50ms or 200ms (as totally random values) 🙂
My current idea is to get the time before replication, and send an rpc back from the client when the updated value(s) are recieved.
how can i fix it
that is nice to hear 😂
Why do you think this is even a problem? Cook on the fly is a standard workflow
Also this is still the wrong channel
This is not a wrong channel. A project that I didn't compile as a server works fine. I have a problem when I compile as a server. multiplayer on this channel
Launching with cook on the fly is literally nothing to do with multiplayer or even packaging a server
/path/to/server Map?Game=GameMode?other=params -Port=gameporthere -QueryPort=steamqueryporthere
Hello,
having an issue where a muzzle-flash is supposed to be attached to the weapon of a player, server sees the client do the shooting and the muzzle-flash moves along with the muzzle of the weapon - but the client-side (if the server shoots) spawns the muzzle-flash emitter in the world where the weapon's muzzle was at the time but doesnt move along (hope it's clear what i try to say lol) will attach the blueprint and a video of the issue. anyone sees what i am doing wrong?
the bottom emitter spawn on the screenshot is for the third person view
hi. whats wrong here? (dedicated(looping is off because it gets called again at end)
- Begin Play fires on clients as well as on servers, so your timer would be getting started on all machines when that actor comes into play.
- The events that normally connect up to timers are supposed to be local only. ie. When you have an event hooked up to a timer, you usually can't set it to RPC like you have here.
- You have a "Set with Notify" for your Sun Rotation being triggered on a Multicast RPC. Assuming that RPC goes through, all clients and the server would be setting that value, despite it is already supposed to be a replicated variable.
- RPCs won't work on actors that are not owned by the client. Seeing as this appears to be an actor that's meant to control the sun, I imagine it's not something owned by any specific client.
Consider doing this:
Using a "Has Authority" node on the begin play, you can make it so the timer only runs on the Authority (the server).
Remove the Multicast RPC, and the RPC call on your timer event. They aren't necessary.
The timer can then set your Sun Rotation as it needs to. When it replicates to clients, the generated OnRep Function will be called on clients that have received it.
Use the OnRep function to perform whatever you need to on the clients (and server as well) to utilize the new Sun Rotation value that was received.
If you haven't already, make sure this actor is marked as Replicated and also since it's something a bit more global to the level, you'll need to set "Always Relevant" to true.
PlayerState's bIsABot doesn't seem to be replicating for me correctly. It returns true on the server, but false on the client. AIController and PlayerState are both set to replicate, anyone have an idea of whats up? 🤔
how to make a timer like this. And how to make it works for multiplayer
What is the timer related to?
its should be like that when its player on the glass bridge then they lose when timer go to 00 : 00
if they are on the platform then they go to the next level
I personally find that the best way to do timers, is to set a float of ServerTime+DesiredTimer. Replicate that to clients. Then your clients can look up how much time is left with ReplicatedVariable-ServerTime.
okey can you teach me how to do it?
Kind of sounds like something that could live in GameState. Just make a float in your custom GameState, set it to replicated. Doesn't need a notify.
In your widget where you're displaying that, just make a small tick that sets the text. Text would be a format of seconds converted to the display. To get seconds you GetGameState, GetServerTime, ReplicatedFloat-ServerTime.
Then when you want to start that timer, you set it to ServerTime+TimeYouWantItToTake on the server.
If your Seconds are < 0 , just set the display to zero maybe. Or whatever else you want.
can you teach me how to make it please
But I did?
so when i do this then i get the timer?
thanks for the reply. im going to just dm you that if thats ok because im wayy too tired to try and work right now.
What are the best ways to test multiplayer functionality in an automated way? These would be two things I would love to be able to test:
- Load testing
- Animation replication testing
Is there a method for detecting packet loss? Does the netdriver have anything to tell you there is packet loss occurring?
not 100% sure anything built in
but i know games like fortnite/rocket league do detect it
NetConnection has this that im looking at now
using FNetConnectionPacketLoss = TPacketLossData<3>;
const FNetConnectionPacketLoss& GetInLossPercentage() const { return InPacketsLossPercentage; }
const FNetConnectionPacketLoss& GetOutLossPercentage() const { return OutPacketsLossPercentage; }
so there must be something we can grab
ah so the InPacketsLossPercentage seems like it should work
float GetLossPercentage() const { return LossPercentage; }
/** The average loss percentage over the previous X StatPeriods */
float GetAvgLossPercentage() const { return AvgLossPercentage; }``` seems like this is what you want
Yeah looking like it is
would probably need to sample these on tick or a timer
check if the loss goes above X amount, and throw a message to the player
Id assume they would be already being sampled, grabbing it would be just for that frame.
Yeah for now ill be visualizing it for debug, not to the player themselves.
yeah, i mean i know fortnite show it at the top of the screen (if you turn on net stats)
Ah yeah
is it possible to access clients game instance from server?
Not directly no.
The GameInstance is not replicated at all.
Think of the GameInstance as the .exe running on the machine.
Im trying to change a value in game instance from gamemode to check it later
not possible?
with event handle starting new player
You would have to RPC down to the Client first from an Actor with an NetOwningConnection, such as the PlayerController.
You mean, make an rpc inside the controller to get gameinstance value and sent it back to server, then call that at event handle?
Thats seems a good way, if i understood correctly haha
You cant send the GameInstance through an RPC.
Its not replicated...
As i said earlier.
You should probably read or watch some of the pinned comments in this channel to better understand how replication and rpcs work.
I think i got it, thank you i appreciate it 👍
I'm curious how games like Fortnite / PUBG spawn interactable objects ( such as ammo pickups / breakable windows ) in a large open map.
- Are ALL of the actors spawned at the start of the level?
2)Are the actors spawned whenever a player enters a zone ( then the Game manager just spawns the interactable objects in that particular zone. Once the player leaves the zone, the objects are destroyed?
If the method is 1), doesn't that cause a huge network spike when the player joins the server? Doesn't the server have to send replicated info for every interactable object to all of the players?
Or does the server only send the replicated info to the players in a particular radius..
i read somewhere to replicates whats near you
you can google "ue4 replication graph"
I've been going crazy trying to figure out why APawn::IsBotControlled() is false on the client for my pawn being possessed by an AIController on the server. It's acting like the GameState's bIsABot isn't replicating, as its correctly true on the server. Both objects (pawn and player state) are set to replicate correctly. Any idea on what would be going on here?
What is this uint8 SomeBooleanVar : 1; notion? does it mean it gets serialized as a single bit?
my understanding is that these variables are packed as single bits inside one uint8, rather than sending an entire bool for each one. check out the concept of Bitmask
not sure on the syntax for it or where the packing actually takes place though
🧐
Gah, on an unrelated note, I'm really confused reading SceneComponent.h, there are all these replicated properties (relative loc/rot/scale, attach parents/children, visibility stuff), and they are not conditioned by some boolean property I, the user, can control...
And from tests, I never really understood what these properties end up doing for me, I always found I have to replicate these kinds of values myself
Since, well, every time I launched a server and a client, everything was desynced except object creation
I need to check something in debug with -stompmalloc, the problem is that it's so slow my client gets a timeout during servertravel, is there a way to disable timeouts?
What is a proper way to do server side initiated movement of owned character in CMC? Imagine a situation when only server knows that your character is doing some movement and it wants to override to combine it with client input.
The problem I am facing is that server is not really doing movement on its own, its just verifying input received from client and sending response.
hello, after the process is finished, it does not go to the map I specified, instead it opens the map I am on, where could I have gone wrong again?
you do this, and you get ungodly jitter
all predicted movement needs to start from owning client
typo in map name, if packaged map might not be packaged
another asset with exact same name as the map can also be a candidate
map name is correct, I have manually introduced the lobby map from the project settings
not possible i checked
that's something I already learned today haha
but it sounds a bit dangerous to give client a decision whether he wants to do some interaction or not and rely on him that he won't cheat and not allow it
and check after some timeout on server whether he really moved?
why?
The thing is that client does not know about this iteraction. It is not player initiated but server initiated. Think about it as if server just decided that it wants to move your character somewhere. With this approach I will need to replicate the request to client and client will initiate it and replicate back to server, so the move will happen also on the server. But then it sounds like its client's decision to decide whether the move can be executed or not.
(at least technically, one could modify packets/game to block the move on client, so it will never happen on the server)
so why would you take away control for hidden interaction that sounds bad?
Let's say some other player hit you and threw you back
so it is the server who wants to move you, not you
then give the thrown player an ability that is using GameplayTasks
to implement root motion
yeah, I think have to look more into root motion and how I could drive it dynamically without having an actual animation
I think UE5 is doing something similar with its warping
basically, you give him an ability that activates as soon as its replicated to owning client, and initiates root motion
still needs to start from client
just in my case it is not as simple as "move back" but follow short navigation path
makes sense then
that it will need to start from client
thanks, I think this is what I was looking for that it is not really worth it to try to do server-side movement.
its not really possible
in this scenario
if your movement is click to move / RTS controls over navmesh
then it kinda is, but it will still feel choppy
with WASD controls, RIP
the complicating thing is that it is both. PC = Gamepad, AIController = Mouse and you can switch between these anytime while playing and while things like anims, root motion are evaluating and replicating
you have predicted movement via AIController done?
skipped predicting AIController for now to simplify things
need to derive a custom CMC for that
to break the assumption that Pawn is possessed directly by PlayerController
or
implement PathFollowing on the PlayerController, and drop the AIController
yes, I have been looking into it a few times and decided that I don't want to mess with it.
and its not just CMC
APlayerController::TickActor is also making the same assumption
also need to set Roles by hand, and few other things
but it is worth doing, game feels much more responsive afterwards
Why not just replicate them directly?
Hlo .I am trying to build Gamelift server SDK .It is failing in msbuild.During msbuild it is failing in building boost engine.
Plz help me
<@&213101288538374145>
:warning: Failed to send a DM. User will not be notified.
:no_entry_sign: luminix6💚#9784 was banned.
Guys can anyone check my msg
Why do you need this many actors though? Curious what the actual use case is.
Haven't played, but first impression is that the majority of that needs to be done through components, via a manger, and possibly even submanagers for zones depending on map size. FastArray is probably a good choice for that if for no other reason than the callback per replicated struct. And you can netserialize them as well.
this doesn't seem UE4 related and what's with the ugly font rendering? lol
is there an unreal engine networking guru? I'm trying to further my understanding of how multiplayer works and have a lot of questions lol
Have you read the compendium?@sullen steppe
im trying to set up a red/blue team for my capture the flag type game, but ive been struggling to find how to do that with either c++ or BPs. i just created two different playerstarts but they both spawn the same pawnplayer (which is what i want), but i dont know how to assign each pawn instance a team of red or blue
anyone have any resources/tutorial for this? ive tried going on YT but to no avail
Yes
@sullen steppe Just ask the questions here. Somebody will know the answers.
Enum on pawn
MyTeamEnum::Blue etc
@crimson python you'd also use the same enum in many other places like the flag, the capture area, the spawn points, probably on the Playerstate or Controller etc
not totally sure how this works. if i created an enum in the pawns, how would it know which team to choose when it is spawned? i made it so there's a red and blue side and i want the pawn that spawns on each side to always be of the same color as their side
Move the enum up to PlayerState or PlayerController
Select spawn point based on that enum, set enum on pawn to be same as PlayerState when spawning or just make a getter function.
However you do it it'll all boil down to selecting and branching on a team enum for many of the things you want to do.
For example, for capturing the flag, in the capture area.
On overlap -> cast overlapping actor to flag -> if flag enum /= capture area enum -> capture flag
Does anyone know if Game Instance Subsystems will work with replication? Do I need to do something fancy other than UPROPERTY(Replicated) and GetLifetimeReplicatedProps?
Edit: Seems to work!
You shouldn't be able to replicate anything from GameInstance. And even if you could manage it, I wouldn't advise it. GameInstance is kind of meant as the one space a local pc has for it's own control. It's a good place to handle storing local data not directly associated to the current game, or handling things like loading screens and such. It shouldn't really be allowed to be altered from another machine.
seems to work? how
no subsystem type is capable of replicating
You really shouldn't be replicating anything from the game instance, it's not meant for that
It's a simple notification system for our prototype, so when a player dies or gets a weapon or something. I just threw it in as a GameInstanceSubsystem
that doesn't really change anything, GI subsystems are owned by... the game instance.
aren't subsystems just objects that are constructed and destructed along with another class
is there actually any gameinstance logic implemented within the gameinstancesubsustem?
the logic isn't the point here
the lifetime and use of gameinstance is
a game instance represents... an instance of a game. On a local system.
It shouldn't be replicated, objects it owns shouldn't be replicated.
Conceptually - A replicated object is the same "object" on all systems it is replicated to. But a gameinstance (and its owned subsystems) are specific to the local game.
I am surprised too. Does it really support replication?
I was under the impression that subsystems are not supported
Hey does anyone know why this doesn't replicate from the client to the server?
why doesn't the RPC send that info? you can't guarantee the replication order
RPC? I'm fairly new to replication sorry
remote procedure call
it's what the client/server/multicast events are
though netcode in BP, kill me now
Thanks for the patience, it's like 3am and you helped me fix something that's confused me about an hour. You just made my night, thanks man
you could replicate a subsystem if you really wanted to
it would not be even remotely worth the effort
UObjects need an ActorChannel to replicate them, and their Outer is generally not an Actor
worse yet, if an Actor replicates a UObject that doesn't have that Actor as Outer, after replicating UObject will swap Outer to Actor that replicated it, and this will happen only on clients
so, really not worth it, replicating subsystems
also they are setting repliucated properties
which means that the function before that should be on the server
thus making the server RPC to the Multicast redundant
replicated property there is set client side, which does little to help the situation
and even if it was set on server, it would still require OnRep to actually trigger the montage
but then the server and the other clients never recieve the change
probably what they should do actually
yes, it doesn't work without pushing the montage asset pointer through the server RPC
Not sure why you’re devsplaining but replication can be out of order and it’s just more appropriate to send it as parameters for the RPC
I know, but @rancid flame said it like it is working out of box o.O
its not
any idea about how games(like war3) make listen servers but not LAN? Trying to do it on steam but seems impossible
Listen server with Steam outside LAN is essentially built-in
Get the advanced sessions plugin to skip the 100 or so lines of C++ and get simple Blueprint nodes
Yes, it works perfectly well.
thanks
Just need to add 10 lines of config in your ini file, start the game outside editor on two machines with different Steam accounts
with a lot of pain and sweat
physx is not deterministic
so it doesn't really work with networking well
or at all
if you were hoping for a quick fix, there isn't one
hey, im wondering if its possible to replicate a property inside a component that isnt replicated? the component is attached to a playercharacter which is replicated however.
Not without copying it and replicating it elsewhere
Seems pointless though, may as well mark the component replicated
ye thats what i was afraid of, i only need a rotation (fvector) replicated tho, pretty wasteful to replicate the entire component for that. Thanks for the response ❤️
Hey, if I have a server owned actor and I want to change a property of this actor that has to be replicated to all clients from my custom playercharacter, should I implement it by calling a function in my player controller from my character, which then calls a multicast function defined in the actor?
Just set the property serverside and it'll replicate. No multicast.
Root Motion sources in abilities are based on Duration, what if I want to move at constant speed instead of constant time? I could drive Duration dynamicalyl by getting distance between target and current but it feels weird and I am not sure if it would not break something if this ends up to be different on client & server.
This is the node I mean
it feels a bit weird (from gameplay perspective) that no matter what the distance is, it will take same amount of time to get there, even if the target is just a few centimeters away
I'll want to be able to change the actors properties from any client, but I can only change it with replication on the listen server
hello, in the project that I compiled as a development server through visual studio, when I open a level other than entry level transitionlevel and serverlevel and want to go to that level with openlevel, that level does not open. There is no problem in the editor, but when I compile mobile, is there a solution for this?
You RPC through the player controller or possessed Pawn
Input -> run on server event -> get whatever server side actor -> set property
So I set up a Server ufunction on the controller and its working now, I kind of got the hang of replication now, thanks 🙂
Just keep in mind that you typically should do something by replicating a property instead of multicasting an event.
Rep notify is one of the most powerful tools you have
as of right now i replicate the property and set up a server function in the actor which modifies this property and then i call the modify function from a server function in my playercontroller
The function in the actor doesn't need to be a server function then.
So you have to change a replicated variable on a server object with a server function, right?
Okay, ill try
You only need to traverse from client to server once. You don't have to do it with a server function, you just have to do it on the server. How you get from the client to the server can vary
hello, i created a host menu but the host button don't want to open and i don't no what i did wrong
Put a breakpoint on it and figure out where it's screwing up
After removing the Player Controller -> Server travel the server function in the Actor wont execute, only on the listen server client
You need one run on server event. Put it in your player controller. After that, it can call a regular event on the actor to set the property
This works now 🙂 Thanks again for your help
i dont see the problem
i see the problem
hey all! trying to implement a system where upgrading power includes aesthetic changes as well. so in my instance, if power == 1, make all the doors look one way, but if power == 2, make the doors this other way (which includes different sounds and opening animation than the first door.
i already have a master class for my doors that tell them how to operate, and that has child blueprints for each door. so my question is
- to change the doors if the power is upgraded, is it more efficient to destroy the old doors and replace with new doors?
- OR is it more effiecnt to replace the materials and sounds etc of the old door with that of the new door?
thanks in advance!
okay ty!
ill give that shot
how to make my get owning player for all the players
Hey guys, I'm looking for a way to implement a pause in multiplayer from the Host, but I can't get the clients to pause at all.
I've found 3 ways to pause so far
- console "pause"
- SetGamePaused
- PlayerController->SetPause)
I've tried to RPC from host to client and none work on client side. I've tried host only hoping they would replicate, and i've tried to call it on PlayerController(1) from the host hoping that would replicate.
nothing seems to pause on the client side, several methods are able to pause the server only.
@random hazel did you set bPauseable to true in gamemode right?
yes, Pausable is checked in the blueprint
although i wasn't aware of that setting, thank you
hey guys im pretty new to multiplayer but i have a problem. im making a top down multiplayer shooter but when i run the game all the players look at the same cursor location
Hey! If I want to spawn a replicated actor at runtime, in BeginPlay, within a level-placed actor (which is also replicating), do I have to only do that on the Server, or can I do it on all clients, and UE is "smart enough" to make the connection between the spawned instances?
reason being that I would like to cut down on the amoun of statically placed actor every map of ours needs, so I would like to just spawn some AInfo actors at runtime, but also would like them to be immediately available to all clients (hence I would like to spawn the actor on BeginPlay, for all clients)
Yep just wrap the spawn function in an GetLocalRole() == ROLE_Authority check
So that you only spawn on the server, the spawn function takes care of the rest
@lament cloak but then the actor would be NULL on clients until it replicates. Which I could probably work around, but it would be cleaner if I could guarantee it to exist at all times
or am I misunderstanding that?
It will be null for a few milliseconds
yeah, practically it will probably make no difference. Just curious if theres a way to avoid that
You can also use stable name replication but that means the server sends a string, and as long as the client also has the same exact name it will figure it out. I dont have a lot of experience with it but you can Google UE4 stable name replication
But I wouldn't recommend this if youre doing a lot of them. If its just a few actors then do that
reason being that this is an actor that will handle an aspect of synchronized settings, which will be accessed by all sorts of different parts of the app. I just dont like the idea of there ever being a scenario where that actor is not yet available, because some other actor tried to access it shortly after begin play