#multiplayer
1 messages ยท Page 72 of 1
im just getting my bearings i assume this is the file being refered to in the guide
and not the actual character blueprint?
ah yes i missed the naming aspect of the project
i got my answer on my own, thanks.
Cool yeah no they're referring to the one you'll see in the top right of the blueprint, its parent class
I want a targeting system that will 1) be client side responsive (show highlighted immediately on click), but have a server side 'set target' so that server can handle things like auto attack timers
So you want CurrentTarget to be predicted
that sounds right, where can i get into that?
You can just set it locally and skip owner on replication
nice ty ill try
Hello, i'm trying to do a multiplayer game (horror), when the player get jumpscare if the player is the server the camera and the level sequence is launched only on him, but if it's a client the camera and the level sequence is launched on him and the server
Adriel this is perfect ty
I feel like I'm doing something fundamentally wrong. Every time I need to update anything on my pawn from the controller, I'm 'forced' to use a server rpc
Can I manipulate those replicated variables without using server rpcs every time?
You usually only use ServerRPCs for things that are Client instigated. Like Input
Everything after that can just run on the Server
So these couple examples are actually correct?
If i want an attack toggle from click, rpc is required?
Because inputs are detected only on the client, and movement should be server authoritative, you'll always need some kind of client to server call to let it know an input has been triggered
Makes sense, ty
I actually have a question for here if anyone can answer. I've been trying to learn and understand the CMC prediction and correction system so I can implement a simple version of my own. I've generally got a grasp on how it all works now, but the one thing I'm not sure is how it avoids/circumvents standard replication of the character's transform.
To clarify, a standard replicated actor updates the position on the client whenever the net driver updates, and with a predicted actor we want to ignore that so we can do our own correction. I'm wondering how/where in the engine the CMC circumvents this behaviour so it can perform all of its own logic.
I'm hoping that with that information I can get started on working on my own correction, as all I need is some relatively simple latency compensation. Thank you!
void AActor::PostNetReceiveLocationAndRotation()
{
const FRepMovement& LocalRepMovement = GetReplicatedMovement();
FVector NewLocation = FRepMovement::RebaseOntoLocalOrigin(LocalRepMovement.Location, this);
if( RootComponent && RootComponent->IsRegistered() && (NewLocation != GetActorLocation() || LocalRepMovement.Rotation != GetActorRotation()) )
{
SetActorLocationAndRotation(NewLocation, LocalRepMovement.Rotation, /*bSweep=*/ false);
}
}
void ACharacter::PostNetReceiveLocationAndRotation()
{
if(GetLocalRole() == ROLE_SimulatedProxy)
{
[...]
}
}
void AActor::OnRep_ReplicatedMovement()
{
[...]
// Attachment trumps global position updates, see GatherCurrentMovement().
if (!RootComponent->GetAttachParent())
{
if (GetLocalRole() == ROLE_SimulatedProxy)
{
PostNetReceiveVelocity(LocalRepMovement.LinearVelocity);
PostNetReceiveLocationAndRotation(); //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
}
}
}
}
}
AutonomousProxy is generally not doing this
Isn't sharing this much code against Epic's TOS? Thought we could only share like 20 LOC or something like that.
You are just used to it being done for all other actors cause the are simulatedproxy by default
I'm gonna slap you
Ah interesting! I didn't know that, thank you! But then, mm, with regards to autonomous proxies, they also move to updated positions anyways right?
Although hold on, let go read that function through line by line as I might answer my own question there 
Oh I see! Right, sorry I was mobile there before. So they straight up just override this function on the character pawn to only have it apply to simulated proxies! I understand, thank you! That's a big help.
That really was the last thing blocking me. Now by having my pawns ignore that function too except for simulated proxies, I can ensure that my autonomous proxies deal with my own correction code that I can now build. Which I might do using their prediction interface since it's there. Awesome, time to get to work. Thanks again!
What's the industry term for making network context bubbles around players that are close to each other?
Your Pawn should have AutonomousProxy as role tbh. not ignore the function
Then it should work by default
Ah! Huh, but I believe my pawn on the client is already an autonomous proxy, yet without having changed anything, it already updates its position when replicated. If a client's pawn is spawned on the server by default and owned by the server, then on the client its local role should be autonomous by default, right?
A possessed Pawn should have a local role of autonomous on the owning client yeah
I'm investigating all of this because I realised that without some kind of latency compensation for the correction, clients that had latency were being rubber banded back in time by however much the ping was
So I figured I need to stop it correcting movement whenever it receives the location, and instead implement something like the prediction on the CMC, insofar as having the client submit its moves to the server, and having the server perform them and verify against a provided final location from the past rather than constantly force-setting it back in time by default
Sorry, I'm being unclear
You do need to override PostNetReceiveLocationAndRotation in your custom pawn so it doesn't just set the location and rotation on the simulated client, cause that looks awful too.
But for the local owning client I don't think this is needed. I don't see any code that would cause a Pawn to override loc and rot
Unless I'm missing that somewhere
Pawn has some NetPrediction code for smoothing though
Wonder why character isn't using that same code
void APawn::PostNetReceiveLocationAndRotation()
Either way this is not setting Location on Autonomous
So you shouldn't be corrected or?
You could breakpoint SetActorLocationAndRotation and see why that happens?
But yeah, you'll need to implement SavedMoves and reconcialiation
is this thing works for matchmaking without using lan? ๐ค
If I have a bunch of replicated floats... would it help the network if I encapsulate them in an FStruct or something? ๐ค Is it better to leave them be just free floats in my replicated component?
Hmm, I see that it looks like it shouldn't be corrected in any way, but it's certainly what I see, in the sense that. Hm. My actor is simply set to replicate, and the movement component I'm using also replicates (custom one but very simple) and I know that, when I try to move the pawn on the server, if I do nothing else the client does move too. It's jittery obviously as its only moving when it receives the update, but it's strange now you've pointed out that the pawn also doesn't set the location if it's not a simulated proxy
Sorry for the delay, I was away, but I'm really not sure again as to where this is being updated if it's not from there since this is definitely an autonomous proxy 
Ah yep but the character itself would, which is the same as my setup! For sure, I'm not sure where to breakpoint but I'll do some digging, thanks!
@thin stratus using your system, I have my interaction system working on server. However because on client my charcter doesn't own the interactable object, im running a takeownership rpc, before running the interact rpc. This works, but not on the first time (aka the first time I press E to interact on the actor)
for the first time, I get the no owning net connection
but after the first time it works
any ideas on what may be causing this?
Don't do that. Route the RPC through the pawn or controller
What you're doing:
Input -> interface -> RPC
What you should do:
Input -> RPC -> Interface
so instead of calling the ServerInteract rpc that is defined on the InteractableBase object, I should call an rpc from the character?
ServerInteract should live in Character
Then SERVERSIDE, the Character interacts with the Target
Can I redirect a lot of repnotifies to the same function in C++? ๐ค (autoanswer, it seems I can point "replicatedusing" to the same thingy)
I've looked at the vehicle movement class (wasnt aware of it) but it seems to be server controlled, right? There's no client prediction at all?
all default movement components should be replicated over clients by default, if not then you may just not have replication enabled on that character ? which it should be on be default for any new character but maybe just check that because im certain it shouldnt be limited to just the server
yes it's replicated, just not predicted on the client is what I meant
so there's latency between steering and seeing the actual vehicle steer
well yes, it does depend on how you are setting up the game, if your going with a dedicated server for something open world then that may be something you want to customize just for latency purposes. but in most cases if your just doing small map racing on a listen server or something then it shouldnt be a noticeable amount of latency. If it was me, would prototype it all with the default stuff, just to show my vision, and then if i had latency issues, or needed to customize it in the future then i would make my own component at that point, but i dont see a point in putting myself through the stress to build something thats not causing issues as is.
well, kinda. I think the non-predicted vehicle is more thought/suited for an fps game where you just jump on a vehicle to move from point A to B. I'm thinking of a spaceship shooting game, latency would directly hinder your ability to aim properly. Yes it might work fine for local/LAN or even good connections to your friends, but there's a reason why the CMC has prediction built in, aiming and shooting would be a pain without it. That's why I was prototyping in that direction. I got it working pretty much in a similar way to the CMC, but of course since I'm not doing an actual physics simulation, interactions are a bit of a manual thing, which I still have to do.
I'll test the vehicle component anyhow, just to get another feeling of what it would look like.
I'm also thinking that interactions might not be that big of a deal to get perfect, it won't be very common for you to go crashing into your friends, so if it just hard stops, might be fine
yeah its worth a try, if you are doing space ship shooting and stuff where you need that accuracy it may be best just to create your own from scratch, im actually doing a space racing game myself (no shooting or anything just racing) but im just making my own movement on an empty pawn since i dont really need anything accept for move forwards and shifting in the vehicle movement. So you may have to do something similar if you need it specifically for accuracy. but it doesnt hurt to try new things that unreal has out of the box, it may even give you some ideas on how to make your own by just changing a few lines of code
the added complexity of space shooting is that you aim with your ship, so if there's latency to the ship movement, it's unplayable, i think... Imagine having latency on an fps on the mouse look.
yeah if shooting is the main thing your ship is doing and the aim is based off the ship then i would recommend making something custom in that case
lol your solution was so simple, idk how it didn't occur to me. I don't even need a serverinteract at this point
just the one I already had from the interface, since it will run on the server anyway from the rpc ๐
Is the Network Prediction Plugin a working solution? Cause this might be way simpler than my custom MC that I spent all weekend coding xD
it works, yeah
Good artists copy, great artists steal ๐
Can someone recommend a multiplayer package for battle royale 60-100 players?
for some reason my character's camera is positioned in the middle of the map, and all players see it.
help me please
where can I take linux server package from ue5.0? I couldnt find the tab
is there any debugging settings to turn on so I can see what's running on the server/client
BP PrintString logs say client or server in them when in PIE which can help to understand ordering and flow there. in C++, you can do roughly the same thing with the net mode of the actor/component you're in, and can throw this in the watch window to get context of what's going on when stopped at a breakpoint (UnrealEditor-Engine!GPlayInEditorContextString)
In C++ I often spam "GetNetRole()" temp variables to ensure I am on server or client
When is the PlayerState's CopyProperties executed? It's not triggering for me
Is it not supposed to trigger after a ServerTravel?
when a listen server host disconnects, does player controller get destroyed on the clients before sending the client back to the default map?
I have an issue where VOIP is causing a crash on server travel in multiplayer
Does the player controller get unpossessed during a seamless travel?
i destroy one pawn, spawn another one, possess it, and got this error, if first pawn moves before destroying
โSimpleMove failed for โMyPlayerControllerClassโ: movement not allowed"
this error is only for a clients
same problem, as "Allow Client Side Navigation" is False, but its True
upd.
i find this article
how to fix this in a blueprint?
https://blog.jamesbrooks.net/posts/fixing-movement-not-allowed-for-respawned-pawns/
Have you ran into the issue โSimpleMove failed for X: movement not allowedโ when trying to call Simple Move to Location after respawning a multiplayer pawn?
does anyone know if the UMockPhysicsComponent in the network prediction plugin is supposed to work? I'm getting an exception in ShouldReconcile()
if (CompareVector(LocalState.X(), RecvState->Location, NetworkPredictionPhysicsCvars::ToleranceX(), "X:"))
{
return true;
}
specifically there, debugger is kinda wonky in this code, but i think it might be the cvars ?
how to handle Relevancy and Character Teleport related stuff in multiplayer ?
I have a door actor with replicated bIsOpen, when players interact I want the door be opened by animation and playing sound, but when players are spawned there I want to the door to be just open or close.
should I use a replicated property bIsOpen and a MutiCastReliableOpenDoorRPC ?
or maybe another replicated variable like bReplicatedRecently ?
The Door is a lovely piece of sh*t
It's the main thing I ask newbies to try and solve cause it touches so much
You do in fact need RepNotify and RPCs for this
And also a lot of inbetween
but I wanned to avoid RPC ๐ฆ
Yeah but you need to see it like a barrel
Opening the Door via Animation is like the Explosion of a Barrel
A one time event, that no one cares about that comes in later
I mean you can also try to overly complicate it
I used this before to see if the replicated value is initial
bool TDUtils::IsInitialReplication(AActor* actor)
{
if(!actor->HasActorBegunPlay() || actor->GetGameTimeSinceCreation() < 0.1)
return true;
}
but it dosent work for NetStartup && NetLoadClient
If you only use properties, you would need at least two I imagine
But you could also go a bit further
You could replicate a PlayMontage call
and sync it up on server and client
:D or you open the door via a Sequence, cause those can be set to replicate haha
They already catch up and sync
no way replicating montage ! in my whole life I never replicated more than 1 byte ๐
Wasted energy to stick to that but you do you :D
We never really looked at bandwidth for The Ascent and the game is huge
You can get away with quite a lot unless you have the famous 100 player battle royal shit
and also I wonder why there is not such a feature in UE, if we just could somehow now its initial replication or not
๐ค
But yeah, in its simplest form, the Door would be:
- Play Open/CloseMontage locally
- Play Open/CloseMontage on Server -> Multicast (skip local player) Play Open/CloseMontage
- Boolean OnRep for IsOpen (skip local player) to fully Open/Close the Door
Possibly only skipping local player with the OnRep if it is opening the door itself
Can use some custom logic to control when stuff replicates and when not
Cause you don't want the local client to suddenly snap the door open when they are still playing the montage
hopefully mine is not fast pace FPS its top down, I don't need to run it locally, its just server cast
Fair
anyway, thanks, it seems I cant get away from using RPC
wait, RPC on actor is called before OnRep_ ? (when they arrived in the same packet)
There is no guarantee to order
guys, pls, how to fix this in a blueprint?
https://blog.jamesbrooks.net/posts/fixing-movement-not-allowed-for-respawned-pawns/
Have you ran into the issue โSimpleMove failed for X: movement not allowedโ when trying to call Simple Move to Location after respawning a multiplayer pawn?
I want to make a multiplayer game like Mount & Blade, but PlayerController can`t possess character and mount at same time, Any idea about this?
Either you stay in control of the character and route input to the mount, or you possess the mount. My guess is you probably want to stick with the character. CMC won't work, you'll need to roll something custom
Hello!
We have been doing the CRETE playtest over this weekend and has been a great experience.
We have super useful reports for improvements and bugs findings.
However, there is one bug that is a bit outside our scope and has been there for years. I would love to hear your opinion if you had the same experience.
Clients can lose the position synchronization when animation uses root motion + rotation, leading to a teleporting once the animation ends. This is arbitrary, but there are factors as pkg losts /cpu use / ping / number of active AI in the level (cpu use).
When the desync starts, that AI will be always desync in its root motion until destroyed. This can happen from 0 times when the ping is low and the packages are constant, to a crazy 20-30% of AI actors in poor quality connections.
I understand that there is nothing you can do when a pkg is lost, but there should be a way of resynching afterwards.
We are trying to find a solution, and/or a network engineer that can deep dive into the CMC (paid of course), since this happens in Vanilla UE, from 4.27 to 5.1.
Any thoughts?
How to spawn NPCs???
- Have the NPC-Spawner have a giant sphere and when the player enters the trigger make the NPC spawn
- Or let the NPC have a small sphere and the player a giant one ?
Is there any other way that im not thinking of thats more efficient? ๐
Your NPC Spawner should define the size, not other way round
Otherwise you can't set individual distances per Spawner
good point, thanks ๐
r u german by chance? Neukirchen is german thats why im askin ๐
also, not really related to multiplayer, there is no difference between SP and MP of spawning NPCs
its all done server side
Is this the same bug you shared here a while ago? I thought that was fixed in 5.1.1
Multiplayer Programming Quick Start
check done
I have a generic Mplayer question
Is there an industry term for the concept of optimizing netcode around distances. So that clusters of players in a big map are more or less relevant to eachother. Based on distance and so on.
Friend calls it bubble i call it context
But I can`t route input to the mount from client, beacause of the network owningship
So give the client ownership of the mount
Make a server RPC to request ownership of the object and then on the server, give ownership.
You don't have to possess something to change ownership
Ok another question, is there a good page that describes some generic limitations on netplay. like player count, actor count, flying pigs or whatever? UE specifically i guess...
It's w/e your machine can handle mostly.
well networking has some pretty defined limitations in itself
I will give a try to set the ownership, thank
Obviously something with 100 players is more difficult than 10 players.
Sure - but really not much that you need to concern yourself with to be quite honest.
just looking for reading material to set an ambience
There isn't anything set in stone on limitations.
i guess this assumes that optimization is done all the way.
You can have like 5,000 connected players to one server for example. Sure, but can your machine actually handle it? Can your code actually handle it?
But that isn't your game. That is a different game.
How do you get a UniqueNetID of a remote PC on a listen server? I tried
auto ControllerId = UGameplayStatics::GetPlayerControllerID(Player);
IOnlineSubsystem* Subsystem = IOnlineSubsystem::Get();
FUniqueNetIdPtr UniqueNetId;
if (Subsystem && Subsystem->GetIdentityInterface().IsValid())
{
UniqueNetId = Subsystem->GetIdentityInterface()->GetUniquePlayerId(ControllerId);
}
But it only works for local pc
Starcraft 1 did fine with over 1k units networked.
Mo2 test had 400 player fights where server is fine but fps is bad
everyone taking damage at correct time, mana is regenerating, players positions are as accurate as they are normally
everyone gets 25fps and no sound plays.
What I'm saying is that the range of possibility is so vast, there isn't anything concrete. Just how difficult it is to do.
yeah ok
There are multiple strategies you can do to do greater numbers as well.
Its irrelevant to my current project but i might want to brainstorm something else
just incase ๐
Maybe you want to do honest to goodness P2P instead of client/server.
Maybe you want to do lockstep
yeah
i guess i have to look into GDC talks on the topic
get the words about it and do a lil research on my own.
Dead Rising 2, was able to have like 1k+ zombies working in co-op. Just another example.
ah
Where as other games struggle to get like 30
So it is really just...so many factors that go into it
i play some POE, it gets wild when maxing the potency
but yeah, im currently looking at Foxhole and contemplating how it could work if it was all made in chiv2 level of detail for example.
persistent war, big world, smaller zones. all out war, building and other shenanigans in zones.
Input forward with Ownership not work on AddMovementInput,maybe not work with CharacterMovementComponent
Anyone?
Check the source code?
I thought you had to specify which PSs you wanted to copy somewhere.
Hello, for a multicast RPC marked as Unreliable, even some packets are dropped, is there a guaranty that they will arrive in order or not ? In other word, are they tracked by any id ?
No. That's the nature of unreliable
Ok thanks
So in if I need ordering without caring about if they arrive or not, I must track them myself with ids right ? There's no out of the box mechanism in UE for that
Hello. Why on listen server the replication works but when I connect to dedicated for example, the rotation is very glitchy?
has anyone been able to use the MockPhysicsComponent in the network prediction plugin?
Guys, I just noticed that while testing locally with a listen server +2 players, only one controller is spawned, is that correct? I'm starting to think that's the cause of some issues I'm having
you should have one player controller for each player
on the server side
on the client side, just 1
that's what I thought, any ideas on why only one is spawning?
the players spawns correctly, I can control each one of them, shooting mechanics, everything in this regard works how it's supposed to
You're not looking at the right world.
Client's won't see other controllers in the world.
I believe I'm looking at the server's world outliner, it's the one in the main window
if you can control the 3 pawns then there's 3 player controllers
just put a breakpoint in the beginplay or constructor and youll see
I just did that, this is where I set up enhanced input:
the breakpoint shows that only controller_c_0 goes through it
weird thing is I have so much logic attached to the controller that almost makes me believe they're all spawning correctly
here's the world outliner in the server, only showing one controller
and if you debug that you always get the same controller in PlayerController* ?
exactly
weird
if we were talking blueprints, would there be something like replication needed to set in the playercontroller class?
or it would just spawn and assign one for each automatically?
just so I know if I'm missing something in the c++
btw, it goes through 3 times, one for each player, assigning the same controller
erm, now I'm confused, printing all actors of playercontroller class returns all of them
p.NetEnableMoveCombining 1 will ONLY affect clients sending movement RPCs to the server, correct?
And not server owned replicated characters such as AI characters?
correct, afaik
I have a flying character and I'm trying to replicate the rotation. On listen is working smooth for clients and for the server but when testing on dedicated server the rotation is a bit choppy.
It's because the client is not sync with server or can be the latency?
Hey, i want to implement custom lobby join codes and i have a possible solution and im wondering if someone could tell me if the solution is good or bad and if it is bad how i can improve it,
The enters the code and in the background it goes trough all lobbies and searches till it matches with one lobby
Hello,
I have a question about array replication in blueprint.
I'm setting an array element in blueprint. This triggers its OnRep function call on the clients but not on the server.
Is this the expected behaviour? Usually in blueprint when one modifies a RepNotify variable, it calls the OnRep function on the server and the client. ๐ค
Any advice would be appreciated. ๐
Cheers.
Yeah that is expected behavior. Call the OnRep explicitly on the server
And that's just a special rule for arrays?
Yes, non-array properties are excluded
I wonder why. ๐ค
Because that's how Epic implemented them?
Well, yeah. You got me there. ๐
BP OnReps are awful tbh
They are meant to be called only client-side
Like they do in C++
But Epic chose to implement those non-array BP properties like a "property changed" callback
So they trigger everywhere
Ah, okay. Thanks for the information. And for the advice. ๐
Any clue why this keeps failing to cast to the gamemode? This is being called from the playercontroller.
print string is firing
The game mode is a class that can only exist on the server. Your event there is set to run on the owning client and if that client is not a listen server it will return null.
Ahaaaa
Changed it to run on server. Working now. Will this also work if I use listen servers?
Yes, in that case the listen server counts as a server in terms of whether or not the game mode object will exist there.
Thanks for clarifying!
@subtle peak#multiplayer message
Is replicating FHitResult a lot to be sent across network (not every blocking gun shot, only when dealing damage to something that has health)? I recall ShooterGame replicating FDamageEvent on player damage but doesn't that too contain hit info or is that a better struct to rep
Yes it's a lot just send what you need
FHitResult has lots of repeated / unnecessary stuff
I have the same pawn as player pawns and AI in my level, I dont want the AI to trigger respawn events. How can I check that the pawn is being controlled by a human?
A good quick answer to this isn't a simple yes or no. It's, look at FHitResult::NetSerialize, see every thing it packs into the Ar? Do you need all that stuff every hit? If so, could be useful to keep replicating it.
Rule of thumb though, if you are making a prototype or a quick test, it's not going to kill perf.
Cast the controller of the pawn to APlayerController
Smart! Thanks!
Posting here too, sorry didn't want to copy pasta everything again. Is anyone able to check this out and point me in the right direction?
If a replicated variable is initialized immediately after a replicated actor or network object is created on the server, can the actor or network object created on the client guarantee that the variable is the value set in the server?
What do you mean guarantee it?
If you spawn an Actor and then set a value after its spawned but in the same frame, that value will be sent to the client along in the initial message to the client to create the actor.
It was what I wanted to know. thank you
May I know in which class is the engine code that executes the spawn command of the server in the client? It's hard to find out which part it is because I can't accurately grasp the engine structure..
What are you hoping to learn by looking at this? It is not an easy part of the engine to understand and if you are new to unreal or code in general Id advise you avoid getting to deep into that sort of code.
Is there some other question you are looking to have answered in stead?
no. I'm just curious so...
I'm familiar with Unreal itself, but it's my first time with multiplayer.
If this is your first time working with multiplayer then there is likely little information that knowing where this occurs will help you.
UPackageMapClient::SerializeNewActor
This is where it happens eitherway.
You are likely going to benefit more by looking through something like the following:
The network compendium here has a lot of helpful information on multiplayer.
I suggest you read this instead.
thank you! I'll be sure to read the link too
@dark edge mate, u help me a lot before, i think u know everything
can u please guide me to a right direction, what can i do in this situation?
When a Player (Client in a Multiplayer game), in a case of gameplay, Possess a new Character, like in Respawn situation, Possessed Character canโt use โSimple Move to Locationโ function.
In some cases we can got an error โSimpleMove failed for X: movement not allowedโ, in some cases we donโt, but, symptom is the same - its like "Allow Client Side Navigationโ is False, but its True.
During web research, i find this article, and its says the reason is Components not updating correctly.
How to deal with this problem?
Best way to bypass this problem in a blueprint, or, at least, how to use the solution from the article, if its legit?
https://blog.jamesbrooks.net/posts/fixing-movement-not-allowed-for-respawned-pawns/
and this post looks right
where to place this piece of code, if this is a solution?
https://forums.unrealengine.com/t/simple-move-not-working-with-possessed-characters/437136/11?u=samyaza
Have you ran into the issue โSimpleMove failed for X: movement not allowedโ when trying to call Simple Move to Location after respawning a multiplayer pawn?
I know this post was a long time ago but I hit the same problem and figured out what was going on. The issue is that in a client navigation case the controllerโs UPathFollowingComponent doesnโt get updated after possessing a new pawn with its new movement component. This happens because the UPathFollowingComponent normally gets the update from ...
May someone tell me pls
Multiplayer dedicated server price is too High
Is there any solution or another way to play multiplayer with smooth with minimum price
Or
I should try to make single player game
Its just small mobile game
listen server
although idk how that would work on mobile @devout hazel
I mean, it works in theory, but idk about the potential performance issues
Without dedicated
?
Can you tell me just this thing
well listen server, one of the clients will be a host
Why on PIE the replication is very smooth and on standalone I can't even move?
When a client joins brand new existing session, does client have new PlayerController created for him, or is the old PlayerController (one that client used in his Main Menu to click join server in server browser menu) used?
How can I prevent the server from spawning the object for all players? Checking authority/netmode/role only prevents the players from spawning it themselves, the server still spawns one instance for each player. I want to stop this behavior so I can properly make RPC calls from the clients.
anyone that already had that issue ?
So I have this Event in my Player Controller to create a UI Widget
In a multiplayer setting (listen server) the server throws an error:
PIE: Error: Only Local Player Controllers can be assigned to widgets. TowerDefenseController_BP_C_1 is not a Local Player Controller.
Which makes sense, cause it is the server after all. But how am I supposed to create the overlay for my server then?
And the weird thing is the Widget is created and displayed on screen
So should I create the widget another way? Or do I just ignore that message? (Feels kinda off to just ignore it because it "works"...)
nvm, wsl issue
Another Question: I have some replicated Actors that have Maps and Sets as Variables. I know they can't be replicated and as the Editor doesnt let you change replication I can't even try to set them to replicate (I dont even want to).
But I do get Log Messages that say: LogProperty: Error: Replicated TSets are not supported.
Does that happen just because I have an Actor set to Replicate which contains those even though they dont replicate those variables?
You can replicate the actor, you just can't replicate the TSet or TMap
You need to set those properties to not be replicated
Yes I know
My actor IS replicated
The TSets or TMaps not
Like I cant even try. Cause the Editor doesnt even let you
You won't see the error unless the property itself has been marked for replication
Check it's not embedded in a struct or something
Yup thanks for that.... Didnt realize I had a set in one of my structs....
Second client is not populating the Name, and not making the widget on BeginPlay in a Client/Dedicated server environment. It's like the PlayerController doesn't exist yet on BeginPlay. Do I need to do this a different way?
OnPostLogin or something like that?
I don't understand how the 2nd PlayerController doesn't exist yet though, this is in the Player Controller BP.
when I run it in OnPostLogin in the Game Mode BP it correctly retrieves this data
This is not a code you would want to use in multiplayer
This is BeginPlay of GameMode?
that above was BeginPlay of the Player Controller
it seems like maybe I am trying to create the Widget on the Server's version of the PlayerController when I should be creating it on the Client's version?
PlayerController exists on BeginPlay, that's guaranteed
But for example it doesn't have a NetConnection on BeginPlay
Widgets are created at the local controller level
So if it's a listen-server then it's at the server level
If it's a pure client, then it's at the client level
so Get Player Controller, if un on the Client, is always going to get that local version
No, 5.1 root motion was fully broken on client. That is fixed in 5.1.1 Indeed. This bug happens from 4.26 if I'm not wrong, and to reproduce it you need to simulate bad network conditions and server cpu usage.
and I'm running Get Player Controller in an "Executes on Owning Client" event and it's still returning Null on the widget creation
Don't trust GPC getting the correct controller.
Not really, that node is bad, you want to avoid it if you can
It is a deceiver.
If it is a pawn, just use get controller
Otherwise, get game instance, get first player controller
Okie, will give those a try
Well I asked because I'm facing something similar, but I don't think the network conditions are really bad. Only happens in specific scenario too (attack + rotation) and you start getting corrections whenever the montage ends 
Same. Thou is arbirtrary
and the more time you are in a level, the more chances to happen
My cpu usage is an assumption after seeing this pattern either in a good amount of active AI and/or high pings
once an AI is desync, which I understand might happen naturally in a lost pkg.
it won't sync ever again
seems Get Controller returns a "Controller Object" reference, which doesn't hook up to the create widget node
I mean casting is a thing
Let me know if you ever find a potential solution. I've been chasing this 2 years. We are thinking about a clearing up component to manually force a resync once the server-client distance is far enough, or even repossesing, etc.
And yeah, it is fully related to using root motion + rotation
I want to believe it's an engine bug, but I'm almost sure it's something custom to us. But yeah sure, will keep you in mind
I have a question about some replication stuff. In my listen server multiplayer game my clients can build Towers (TowerDefense Game) and when they try to build one they send an RPC to the server and the server does all the work. Now after a Tower is built, I want the client to select the Tower so it can show the Stats in the UI of the newly built tower. The thing is when the Tower is selected the Tower Variable is null cause it didnt get replicated at that point to the client. So I'm now wondering what the best way is for me to handle this. I don't want to just add an arbitrary Delay. I want to really know when the client has gotten the data from the server and is actually able to show the info
What is a good practice to handle stuff like this?
You want to use replication callbacks basically
Pins have a multiplayer tips and tricks article that goes over that
With replication callbacks you basically mean RepNotify?
so when I bind my widget loading to a key, e.g. F, and I load both clients, wait 1 second, press F, the widget loads successfully on either client
but I don't want to rely on some janky delay before loading it
seems BeginPlay is too soon for it to know the right player controller
is there something I'm missing in terms of timing with the client/server and when things are expected to be loaded and which events to use?
Anyone knows is there is a hidden trap to the GMC plugin or is just that good ๐
GMC?
Oh NVM
It just looks like the CMC rewritten slightly to support more than the capsule tbh
Hard to say though, but I imagine all the regular limitations apply
I'm refining the combat replication for our RTS, specifically, how attack orders from the player are replicated. This is roughly the flow:
- Player right-clicks an enemy entity (building, unit, hero...)
- An order is issued from PlayerController containing the target enemy entity pointer and the selected entities performing the attack. Replication happens here.
- Each of the selected entities receive a copy of the order and perform it. Since most units are grouped in battalions, the order is given to the entire battalion.
- Each unit in the battalion gets assigned an enemy from the other battalion (based on distance or whatever).
- Each unit's AIController receives the order and performs logic accordingly (check range, attack, or move towards target, for example).
The current issue I see with it:
Point no. 4 might be non-deterministic, because slight differences in positions might happen that influence units to pick a different nearest enemy in client/server.
I could maintain a FFastArraySerializer with unit ID pairs so that there is a single source of truth to check which unit is targeting which. But not sure if there are better solutions.
Also I don't know whether to "predict" the unit targets on the client and later fix it from the array serializer, or not perform any logic until the target is replicated via serializer.
So my widgets are loading now. Woo. But their values are zero. I suspect it's because the clients don't know their own health values because the server isn't sending those values yet?
How many units per batallion?
5-20, not more
most likely 5-10, but not sure 100% yet
it does ๐
think more SC2 than Total War, despite the battalions
Thats alot of floating ui
So
How can it be not deterministic
Unless you replicate ai controllers
Without them client side, its all server then replicated back
well, unit positions might be slightly different, which is fine. But if that implies that unit A targets B on server but C on client, might happen that on a small number of scenarios unit A tries to move to a different place in client/server
and that would desync really hard
Why does a bot move on its own on client? ๐
bcs it's based on a boid simulation, the AI only decides who to target
but now I am thinking
How fast are projectiles?
With something like arrows you have time enough to eat the lag
that we should have two phases for attack orders:
- Battalion Level: Order is issued and battalions move until they are in range roughly, this uses battalion-level pathfinding.
- Unit level: only when battalions are very close, units move towards their targets. So there is potentially a lot of time between the order given and the individual unit's attacks
slow, and most melee attacks are too. Also, those will be handled by GAS and replicated on per-attack basis
(also projectiles are almost always aesthetic only, melee and range are the same kind of attack with different ranges and animations)
With client simulating the movement
Players will almost never notice lag or slowness when issuing attack orders, because control on units is not direct as in FPS games
How can you guarantee teplicated attack target will be in range?
Boids can get... chaotic
that's the neat part - I don't. As long as it is in range on the server, it will be performed on the client. I'm talking specifically about the "blows" or firing arrows.
The thing is that the range is very difficult to see at plain sight so nobody will notice if units were our of range by a few units, for example
ye, it seems that part is decently sorted out by now
Sounds like you have plenty of time to sync targets
ye
I'll do a higher level targeting based on battalions
and calculate individual units when reaching the enemy, then sync via FFastArray
What is an actor in all this?
units are actors and battalions are also actors. Very slim actors xD
yeah I think the same
everything is replicated through network managers for now, and the plan is to keep doing it
Get ton more responsiveness
ye
well I think I have a clearer idea of how to approach it, thanks a lot!!! ๐
Do you guys usually wrap fast array serializers into some structure to also have mappings to indexes? I'm thinking about something like that to update the serializer items on O(1) and avoid needless iterations
is it possible to save bandwidth by setting quantization of a replicated FVector?
yes
FVector is 3 64 doubles. Quantized is 3 int32s iirc
ah I see, so id swap my FVector for FVector_NetQuantize
and it would Just Work?
if you have a server-client switch, but the player is playing single player and is not connected to a server, which will activate?
not sure, test it. Also I think quantized vectors are way less than the bytes I said, my bad.
cool, thanks for the lead
How would one get the progress bar widget percentage corresponding to the correct client's pawn in a dedicated server environment? I'm pulling the progress bar widget object and then "get percent" and it's always returning 0.0
widgets are not replicated
one of my clients is receiving damage (GAS) and that damage is showing on the screen properly (100% health -> 80%) health
ideally you keep your game logic (health, damage, etc) away from the UI
and replicate only game logic
UI should be independent
so basically, gonna have to calculate the resulting widget percentage in the game logic and then capture the e.g. starting health, damage, ending health, so I can feed that back to the widget?
Widget figures it out based on HP and MaxHP
ya that part is working but I am making a dynamically animated widget that shows the damage you just took in a different color and then that fades away over time, like 1.5 seconds
OK so widget handles that too
You're talking like LoL right?
Lots of RPGs show you just took a big chunk, in like yellow, and that then diminishes
so I have two bars, one of top of another
yeah that's easily done by keeping track of the 3 percentages or HP values in the widget
yellow bar is zordered behind the red bar and needs to wait a second before it fades away to the new health value
OK so it just fades, not slides down. You can do that with 2 stored values in the widget
er, yeah right now I have it sliding down
that would require 3 but anyway it's all widget-side
either way would be good though
For sliding down:
On HP update:
TargetHP = ActualHP
On Tick/widget update:
SlidingHP = FInterpToConstant(TargetHP)
If SlidingHP ~= TargetHP -> LastHP = TargetHP
your 3 bar numbers are TargetHP, SlidingHP, LastHP in order left to right
Sliding slides towards Target and if it gets there, updates Last.
might not need the Last term but it depends on what you actually want it to look like
nice, so all of this can happen without me pulling attribute set values in other blueprints (e.g. where my GE is applying damage)
Assuming you have some way for the widget to know when HP is updated it should just work.
you don't necessarily need to know about damage events, just HP changing
yeah the widget is working, just was having trouble pulling the "percent" value from the progress bar to make my janky method for this work lol
Just do all percentage stuff in the widget
nothing outside the widget cares about percent hp
makes sense, and that interp on tick, I assume right there is where you can adjust the sliding speed if you prefer
thanks! I'm gonna rework this. lots of convoluted stuff I made that needs to be deleted lol
Simplest approach I can think of:
Binding / Tick / whatever it's called in widgets:
Tick -> calculate TargetHPPercent (HP / MaxHP) -> FInterpToConstant SmoothedHPPercent towards TargetHPPercent -> set the values on the bars -> done
Yeah that looks sleek. Appreciate the insight!
Not sure if this is "bad" in terms of grabbing the attributes every tick but this does indeed work like a charm
Prolly can use a custom event instead of Tick eh
then again, the widget is already running every tick anyway. maybe not a big deal
hook up that delta time
because if I'm honest I've been thrashing around and just replicating everything by default then removing replication trial and error lol
removed replication, hooked up delta time, set interp speed to a little higher
looks fantastic ๐
does anyone have experience using world composition and multiplayer or have any tutorials they could link me to? Looking to solve some issues I am having on a large world I want to host on a dedicated server.
anybody can help me about server builds pls ๐ I need a server package but I couldnt understand how to get that zip folder
this can help you out for packaging as a server target instead of client https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/Networking/HowTo/DedicatedServers/
Thank you I will try
Hey all,
~~I'm having difficulty with a seemingly very simple task.
The OpenLevel Node.
On my server/host player, when I click a widget to open the specified level, it works fine. The server moves to that level.
However if I play as a client player, when I click the same widget, it just reloads the current level.
I'm not even talking about server travel or anything like - literally just playing the game in PIE as a client vs playing the game in PIE as a standalone or server.
What am I missing..~~.
Solved the issue by just using a console command node instead shrug
on guides 9.part, when I try to do this: "Development Server build configuration and build the solution again" It gives me error code 6. What I need to do ?
and 44.line is this <Exec Command="$(NMakeBuildCommandLine)" Condition="'$(NMakeUseOemCodePage)' == 'true' and '$(NMakeBuildCommandLine)'!=''"/>
hi, imagine a character holds a weapon in default pose. Then user activates "aiming" pose, which effectively moves a weapon (attached to character's hand socket). This gets properly replicated to all clients.
But when I fire, weapon muzzle socket location/rotation on all clients is replicated properly, but on server it is in default position (default pose). ( I do skeletalmesh.getsocketlocation("MuzzleName") )
What am I missing here, character pose on server with attached weapon is not changed at all?
hi Nordlys, to build a dedicated server you have to build unreal engine from source
part 1 of this tutorial series can help you
Watch Part 11 here: https://youtu.be/DyE5rX9rbn8
This video is the twelfth and final part of an extensive and informative tutorial on how to integrate Amazon GameLift with Unreal Engine, going over the associated costs of the tutorial project. In the process, we go over the general pricing and free tier of the following AWS services: GameLift, ...
basically the marketplace version of the engine doesn't work for building dedicated server
sure no problem
How would one go about having an always relevant actor that follows another actor, for example I have a voip actor that needs to be always relevant, and it follows a player, but the player himself will net cull... should I just grab his position from the server constantly and update the voip actor to stick to that location
hi guys. from what i know that variables in engine can be hacked
and i should just make it with the data base
but also i cant make ton of requests from database just like when player damaging monsters
so what i supposed to do here
request the amount of damage everytime the player damaging isn't a choice
and if i make it as variable it is hackable (get the damage amount from databse and set it to variable inside the engine)
wym bro, can't really hack server sided variables
do you mean event on server and that event contain variables?
Anything on the client's machine is hackable. They can have the stats on their side, sure - but the server does all of the calculations.
Don't let the client tell you that they have 30 HP. The server does.
I'm replicating a Float from Client 0 to Server and multi-casting it to all clients (for movement speed) and yet on Client 1 I don't ever see the value replicated. The variables and the components are all set to replicate.
er, cleaned it up, but still get 0 for the Float :/
if you mean what i said. how i can make the variable repnotify
@round acorn Print the value instead of using the Debug View.
Debug View is contextual and can be misleading.
k one sec
i mean the logic it self how its happening in the engine
I know what you're saying. But my statement remains.
You don't need to do jack all with a database for this
The server does all of the important calculations
6 different numbers for 2 total clients... half of which are 0
I'm so confused heh
The three 0 numbers are the second client, which is not moving, I suppose, and it has 3 values, one of them for the server, one for itself, one for the other client
Why are you multicasting here? It's a replicated variable right? Just set it on the server and it'll update on clients
Flow should be something like:
TriggeringEvent -> Pass number to server
Server event -> set REPLICATED variable.
Voila, everyone agrees on the value of the replicated variable
Aye I was being led down this path because my animation just stops working above a certain movement speed. Basically, above walking speed the client's animation just sits back at idle and the other clients see him ice skating around the floor.
What are you trying to do, sprinting?
As long as I keep it below ~100 or so it's good
Not even sprinting yet, just moving around.
I'm using a gamepad, not sure if that matters.
Are you using Character with CharacterMovementComponent?
or did you make your own pawn from scratch
yeah using a Player State Character with the CMC
Then you don't need to do ANY of this
Look at the 3rd person starter template
You don't need to replicate anything movement related. That's all handled for you already by the CMC/Character
In fact it's handled better because it is doing prediction too
But it's not just a normal set of anims for movement. I have blendspaces with multiple jog directions with breakpoints for speed at 100, 500 and 800
So, just make it work locally and it'll work everywhere
on each machine, locally get the velocity from the character
then do the animation magic
Your AnimBP should do something like
Try get pawn owner -> cast to YourCharacterClass -> get whatever data it wants
that's it
aye, doing that, and there's about a dozen states with bools to set for in/out of those states, like rolling, dodging, walk/sprint, etc
Bools will have to be replicated
I'm trying to learn from the Staff Anim pack I got from the marketplace.
er, for now. You really want to make a custom subclass of CMC to add those mechanics
Trying to replicate the movement in there
but do not replicate Speed or anything else like that. That can be calculated locally wherever it's needed (local characters already know their speed). It's just Character.Velocity.length()
Does anyone know if "Apply radial damage with falloff" somehow ignores the instigator by default? I dont take damage from my own explosions, but everything else does. So wierd. Using the same pawns
I'm prolly gonna need to build this from scratch piece by piece, testing replication for each new piece before adding the next
You'll have to bring C++ into the mix to make it work smoothly, no getting around that. Custom CMC or at least GAS will be the approach to take.
got GAS going so far but yeah I've read issues about the normal CMC limitations
Consider a sprint. Obvious approach is
Sprint key -> tell server -> also set locally
Server updates CMC max walk speed
That doesn't work. You'll get jitters all over the place during the time that you and server disagree on your max walk speed. You need to add the sprint functionality (or rather, the predicted max speed change) to your CMC.
definitely... was hoping to use some interps to smooth that out hehe
sorry for late
Don't fight the system, make it work for you. Old video but I remember it at least covering the basics.
https://youtu.be/RtQRMcupJs0
You'll need to do something along those lines.
Support the channel through donations. Crypto accepted!
PayPal: https://paypal.me/reidschannel?locale.x=en_US
Patreon: https://www.patreon.com/reidschannel
Bitcoin: 1JFwWHr4X6uAeoZadukzqKjzFBj3Qjy7Sk
Ethereum: 0x2B2Bc108F1Cc0fF899959dEF3226637787d8C3dE
Dogecoin: DNQ33YnhpWoTBokBNVkZP5ub8KTLkpyjpv
Join our community discord!
Discord: https://dis...
I think MAYBE GAS can make some of this stuff automagic nowadays, but you'll still need to crack some C++ open for that too.
But BP only is right out for anything beyond what's given to you in the stock Character
so this is a good way to do it?
then i use the amount of damage
What if I call that and say I just did 1,000,000,000,000 damage?
The stuff going from client to server should be stuff like
"I just pressed my attack button"
"I wanna try open this door"
"I want to reload now"
not
"I just did 1337 damage to that guy"
"I just won the game"
"that guy over there just destroyed all his items"
Execution should already be serverside before all of this.
Client doesn't tell the server they damaged someone. They tell the server they want to attack.
what i get the get damage event its from the data base isnt this make any change?
sorry let me question it. how can i call the damage once from the database and use it again without request everytime
counter-question: why are you querying a database from a client in the first place?
to get all information about client. for example he upgraded the health to 1200 i get it from databse
No. Why is the client themselves the one querying the database
Why is the client telling the server how much damage it should do
actually i was asking for what to do here exactly when i call an event on server i can not make the variable replicated or repnotify
i have playfab and i know how to use it only for requests
but i dont know how to make it secure
after i get the data to the engine everything i do seems hackable xD
If you're just starting out in Unreal I would not suggest trying to tie it in with some database right out the gate.
But either way, start with doing EVERYTHING IMPORTANT on the server. The clients should basically just be dumb clients.
in bp how can i make it on server?
Do you understand that replicated actors are on the server and on the client?
if i made has auth - event on server it is still not on server ..
Say you wanted a box that would damage the player when they walked into it
You'd just do something like
Event Begin Overlap -> Switch Has Authority -> Apply Damage
On the server, apply damage would happen
on clients, it would not
The overlap event would fire on both, but it'd do nothing on clients
guys, so after many days of debugging and code rewriting I finally got the first/third person weapon visibility working on all clients. The issue now is that in the first spawn the first client can never see the server's weapon until the server respawns at least once, the second client always sees the others' weapons but after some kills both clients start to experience some missing weapons from others, it's pretty unreliable and inconsistent, I'm even using DOREPLIFETIME_CONDITION(AWeaponBase, TPMeshComp, COND_SkipOwner) to ensure the replication but I have a feeling that it's still the culprit. Anyone has ever experienced something like this?
How do you join a dedicated server from a lobby? I basically have a lobby and then a multiplayer button that once pressed should bring you in the multiplayer map
What should the blueprint of that button be?
your public ip
or if you just want to try it open 127.0.0.1 because public ip needs to portforwad
in the same machine 127.0.0.1 and if you want to try it with other machine in same internet you need your private ip
When the server is started up it should already load a map.
When joining it with a client, you can use the Open Level node with the IP address to join.
If you want the server to move to a different map, you'd have to make sure you're running on the server somehow (either some condition is triggered or you call an RPC) and if you want all clients to move to the new map with the server you need to use execute console command and use the ServerTravel command. Additional information about server travelling can be found in WizardCell's Persistent Data Compendium in the pins.
I have a server RPC 'attack target'. I want to create floating damage popups for the damaging player. Run on owning client from that server attack isn't firing, why?
On what actor are you running the Run On Owning Client event?
Does anyone have any ideas as to why I'm getting this log error when trying to call a GameState Server RPC from a player controller?
No owning connection for actor BP_CoreGameState_C_0. Function Server_RequestPlaceTower will not be processed.
Right now the flow is going
OnButtonClick() [WidgetBlueprint] -> RequestPlaceTower [PlayerController] -> Server_RequestPlaceTower [GameState]
GameState isn't player owned. You can't call Run On Server events from a client on it.
Move the RPC on to your Player Controller, and if you need to when you're running on the server, you can call to the gamestate and do what you need.
Ah right, thanks!
for RPCs, if I have an input for an RPC as an actor class, is it an expensive input that will take up network bandwidth?
or is it cheap, as it is just a referece to a class
first time it gets sent as an FString, its full package path
and it gets a NetGUID assigned, so for any subsequent network traffic it costs as much as a replicated pointer
thanks
if the server owns the game state, how do I make RPC calls on the game state from a client, from a client owned pawn for example
this is a great video I recommend everyone who's doing multiplayer watch
@sinful tree i'm sure, u know about these things a lot
can u please, guide me to a right direction, what can i do in this situation?
When a Player (Client in a Multiplayer game), in a case of gameplay, Possess a new Character, like in Respawn situation, Possessed Character canโt use โSimple Move to Locationโ function.
In some cases we can got an error โSimpleMove failed for X: movement not allowedโ, in some cases we donโt, but, symptom is the same - its like "Allow Client Side Navigationโ is False, but its True.
During web research, i find two answers
which solution is better for multiplayer, and where to place this code?
1.
https://blog.jamesbrooks.net/posts/fixing-movement-not-allowed-for-respawned-pawns/
where to place this piece of code, if this is a solution?
2.
https://forums.unrealengine.com/t/simple-move-not-working-with-possessed-characters/437136/11?u=samyaza
Have you ran into the issue โSimpleMove failed for X: movement not allowedโ when trying to call Simple Move to Location after respawning a multiplayer pawn?
I know this post was a long time ago but I hit the same problem and figured out what was going on. The issue is that in a client navigation case the controllerโs UPathFollowingComponent doesnโt get updated after possessing a new pawn with its new movement component. This happens because the UPathFollowingComponent normally gets the update from ...
Hi guys. I want to make an orbit rotation only for client view. What I'm doing wrong here? It's not getting the input value
Speed not replicated? Dunno
Does it work when playing in singleplayer?
I would try feeding the input value directly into the custom events
Pretty much everything
You aren't sending the input value so the server doesn't know about it.
You are modifying the control rotation for everyone.
This whole thing is a mess.
Variables ONLY replicated from server to clients
you need to send them in a RunOnServerEvent for the server to know about them
but since you said only in client view, why not just do this?
also Get Player Controller 0 in multiplayer is gross
for large world multiplayer games using world composition with multiple sub levels, I have seen some posts that suggest the server may be able to load all sub levels.
I am testing multiplayer with a dedicated server and when I teleport the client to a sub level far away from them, the server starts posting errors about a timestamp mis-match.
The client then gets warped back to their original starting position on the map after I move around a bit more, but they do not fall through the floor or anything.
My best guess is this behavior means the client teleports but the server has not loaded the sub level, but the client has loaded the sub level (so they dont fall through the floor).
What is the recommended way to force the server to load all sub levels? One by one on blueprint? Are there any downsides to doing this in terms of memory requirements of the server?
also side question, are there any commands to run on the console of a running dedicated server to see which sub levels it has loaded? In UE4 client you can run stat levels, but can you run that same command to the console of the dedicated server somehow?
is there a particular reason why replicated actors in sublevels won't replicate on clients? I have a procedurally generated level; I launch the server and it genereates the level; then I send the seed to the client, and it generates the same procedural level; the problem is that replicated actors on the client's sublevels won't replicate...
Hello! I'm on UE5.1 testing out a prototype on Lyra using a simple actor projectile with a sphere and projectile movement component. Using a GameplayAbility I spawn and then set velocity of this projectile to fire it straight, however, on the client it jitters terribly due to a difference in position between client and server I'm pretty sure. Is there a go to video or example for properly creating projectiles? I saw something about UT's projectile system and how they just spawn a fake one client side. Does that mean they don't replicate a projectile and instead just spawn one local and server side? I'm looking for the best approach without server side rewinding because I personally would rather high ping have to lead shots rather than feel like you die around corners. Any guidance/help would be greatly appreciated, thanks!
I also tried using interp movement on the projectile movement component and set the sphere as the updated component, but nothing is smooth still, it jitters forward and backward during flight.
And for a little more info the projectiles move at 2000 u/s and there are a lot of them spawned for fast paced multiplayer shooting.
Is there a way to send extra data when you set onrepnotify for a variable? Like I have an array that is on repnotify and I would like to also send which parts have changed to reduce cpu time iterating on the clients that receive the change.
The only thing that comes to mind is to handle replicating it manually through events that get replicated to the clients from the server.
No
Just to visually show you how unsmooth the client jitter looks. I'm just trying to get this working over the network as a prototype right now, but would really be curious as to what the best practice would be to get it looking smooth but also being accurate as to where you are aiming to shoot them compared to what the server will end up seeing.
are you sure you're not running into your own projectile?
move the spawn point far up or away to make sure that's not what's happening
Absolutely sure. Its collision is turned off until it starts to move and then it ignores the character completely so if I were to run into it later it would go through me.
I mean there's a lot of jank going on, what specifically is the problem?
You can also see how the spawn location is way behind him because the server is getting the spawn later than the client.
If you're not locally predicting you're not locally predicting
The jank is the problem. It's not like that on the server or LocalHost side.
Yea so I'm trying to find out the best solution for this situation/gametype for prediction, basically.
I read somewhere that I can actually use C++ to get the interpolation of the ProjectileMovementComponent working properly, but I'd like to stop replicating entire actors like this in general and have a more robust way of supporting a lot of projectiles that need accuracy in a multiplayer environment.
Can't wrap my head around if I were to throw my own client side projectile then do the same server side, if they would be accurate enough to match up and have the same impacts as each other.
They will be pretty accurate
assuming all else is equal
but say you did a clientside projectile and also could see the serverside one, you'd see it lagged behind because there's ping time between yours and the replicated one being fired on your screen
I just don't want a situation where the client sees the projectile impact someone but no damage is dealt because the server actually missed them
that's how most games do it
Hit happens clienside, server oks it (close enough check?)
Hmm ok, so close enough or rewind check and depend on the client to say it hit then
I mean there's a million ways
Trying to steer clear of as much client trust as I can
Yea for sure, that's why I was trying to gauge what might be the most effective/useful one in this situation
the fact of the matter is that if you have predicted movement, you will by definition not agree 100% on the state of the world at any given time
Local client is in the future relative to server, and sees things in the past
idk how TF racing games do it to be honest
3 identical cars take off at the same local time, everyone sees themselves in the lead
who's in the lead?
Yea I was hoping to get some insight into how the most effective approach might do it, but I guess trusting client and checking if they're absolutely crazy or not might work
I think counter strike does a sort of rewind thing
I'm starting to think that most good implementations are proprietary and no one wants to share them ๐
basically:
Client says they hit.
Server checks if they could have hit that guy at that location at that time. So it basically rewinds the victim
Yea I want to avoid rewind as much as possible. A small rewind to see if it's possible I guess is ok
it'll depend on how fast your dudes are and the average ping
That's why I'm glad I'm not doing any prediction in my project
I am just not very fond of dying behind objects because the laggier player had a proper rewind. I know it's the most fair for laggier players, I just don't prefer it
I mean you gotta pick your poison
either you die to bullshit, or you don't kill a guy and it's bullshit
Yea which is why I wanted to do leading shots if you lag too much.
someone somewhere will disagree as everyon sees a different state of the world
I'm super glad my project doesn't need prediction. Everyone sees the same thing, just if you have higher ping, you see it later.
I mean even games as big as CS:GO have this issue. It's unfixable if you have prediction for player movement.
How did you accomplish not needing prediction?
It's a vehicle contraption building game so 30ms lag on your controls (steering, firing, etc) is fine.
Gotcha
Wouldn't work great for an F1 racer but for offroad death machines it's fine
it's like Space Engineers type of speed. Not exactly snappy.
I don't know why it's so hard for me to wrap my head around it, but trying to think about if I were to simply spawn something unreplicated client side, then at the same time make a call to the server to do the same, even though it would be latent, wouldn't it somehow still match the same position fired from? Or would it be a completely different path.
Or am I better off just sending a payload of this is when/where I was when I shot and this is my trace info
position in the world, yeah
but you're running
so you see it back there
Yea the video shows it spawning late when the server gets it
it's spawning where you told it to spawn
which is now behind you
because you're running
if you stand still it looks right, right?
yeah it'll end up in the same spot
So what that tells me is it's fine to spawn it server side alone, and it will do its thing I would think
assuming all else is the same (hits, random deviation)
Yeah if you're ok with client seeing their shots appear behind them
Well no that's what I was trying to say, if I shoot client side immediately with their own fake projectile
The server can still do its own and both will end up in the same spot?
yes
Ok
assuming same random deviation rolls etc
Most of the time*
It can happen that because the client and server are not perfectly in sync that the projectile differs in certain scenarios. Like a player running into it on the server and not on the client yet. But that's definitely not most of the time going to happen.
and not accounting for floating point shenanigans and framerate-dependent stuff like drag
assuming flight is perfectly deterministic, client and server will agree on the path of the projectile
I'm just a little frustrated I guess that this scenario exists in so many games and there isn't some kind of component to give options for dealing with these different scenarios
what they WON'T agree on is if there is a moving object in that path that gets hit
since they will disagree on the timing
Or an example at least
Yea so this is where I still need to synch things up then
that's where you need to have client say it hit something, and have server check if it's ok
server will have to rewind the thing it hit
You're going to run into this in other ways as well though. Sometimes it's just picking whatever fits best. 99% of multiplayer games have issues with a lot of things (especially at higher latency / with packet lost) because there's no "golden solution" to certain problems ๐
It's kind of like relativity
everyone sees something different
nobody is right, nobody is wrong
Right, I definitely have seen that. I'm trying to just account for the normal/minimal ping situations at present.
So then I guess some kind of minimal rollback is the only option
Without latent firing
If I were going to latent fire though, wouldn't even that lag behind the server?
latent firing is a no go for a fast paced game
If we're still talking about the predicted projectile method if you care about rollbacking it I guess. I don't see it necessary to be honest as the client doesn't deal damage anyway.
I mean you can just do a distance check
Client says they hit this actor at this location.
Is the actor within MovementSpeed x ping of that location?
quick and dirty
Yea I suppose trusting the client early on and worrying a bit more about cheating later would be the quicker/easier solution
Ok, well I have "something" I will try. I still feel pretty weird about this whole situation ๐
Like I said, I just find it hard to believe that there aren't more base classes or modification examples after years of this scenario to be like oh yea let me build off of this and change this or that.
They now have Lyra, but there is no example for predicting projectiles other than the movement component, just feels weird to me.
They were working on a prediction plugin I believe. Although not sure if it solved this in specific but I think it was paused after the main developer of it left Epic or something similar? ๐ฆ
I did see the prediction component. I was assuming that would even replace the CMC eventually. Really disappointing to hear that's not a thing anymore.
is making a mmo rpg a stupid idea
yes
why
Because you're incredibly inexperienced and it requires a metric crap ton of knowledge to do right.
Not to mention the money it takes to run the servers
so it would be better to make it on roblox?
What
where they host the servers for you
Do w/e you want really.
I added a dedicated server to my project, packaged both, everything went smoothly, set up a join button in lobby with my ip but nothing happens, and no messages whatsoever on the server. Any idea why?
I have a print string after the open level input and the string prints but nothing happens I donโt join the server or open the map and no messages on the server
Is there a PostNetInit equivalent for UActorComponent?
Trying to figure something out here. Example: Client 1 uses a lock-on function which sets a replicated bool (lockedon) and then while that bool is true the function makes Client 1's camera and mesh rotation point toward the target. They also start strafing around the target, i.e. their orient-to-movement is off.
But client 2 doesn't see any of this. They see Client 1's mesh still orientating to movement as Client 1 moves around. The movement itself is replicating but the orientation of the mesh (and the strafe animations, etc) aren't replicating.
left image is client 2, seeing client 1 facing away from the target. right image is client 1, locked on, facing the target
Client 2 does not appear to be executing after the Multicast either?
Actually the Server isn't getting there either because the server does not know "lockedon" is true
And when I set LockedOn to True on the server it forces both clients to become locked on, and neither client "sees" that the other client is locked on, it show's false:
I'm trying to understand this, I guess:
- Client 1 wants to lock on to the target
- Client 2 needs to know Client 1 is locked onto the target, but doesn't need to lock on itself
I would expect:
BP0 - Client: LockedOn = True
BP0 - Client 1: LockedOn = True
But BP0 - Client 1: LockedOn is always False
... I think I finally figured it out
I was running a huge logic block outside of "run on owning client" when it really needed to be, because that was the whole lock-on logic and when I was applying it server-wide it was messing with all the clients
If it's added before runtime, I assume BeginPlay should be good. If it's not then how about PostNetReceive?
Hey everyone! I would like to know if it's possible to replicate a Object class child somehow? I'm making an inventory system and just now figured this probably won't work for multiplayer replication. If it's not possible I'll most likely use structures.
I basically created a ItemObject class which represents my in-inventory items. But it seems that my clients can't get these objects. The server (host) is fine with it
Replicating UObjects Jambax or Replicated Subobjects unreal engine for the newer technology
Either option should help you
Alright thanks! I'll check that out
How can I make non-steam friend players servers to appear on server list? In my game people can only see steam friends servers.
can someone help out with this issue?
I was able to stop this jittery crapola from happening by overriding PostNetReceiveLocationAndRotation and not calling super. This doesn't appear to be using the projectile movement component interpolation properly, it's just stopping it from using the super call which is adjusting the location. Does anyone know how to properly use the interp from projectile movement component? I was thinking the collision sphere would lead the mesh and slowly interpolate it back to the sphere?
I even turned off Interp Movement and it's still smooth so long as super is not called there. This feels incredibly wrong.
I can also see jitter when I change the collision sphere scale with it replicating, it's not smooth at all.
If I try and scale the collision mesh by replicating it, the projectile goes back to jittering as well.
im not really sure but it doesnt seem like a collision issue at all because the projectile is still flying in the right world direction, its not bouncing down or in any weird directions. I would say its a spawning issue when it comes to the order of operations on how you are sending info to the server and back to the client
Yea so basically taking the collision component off of replicating and overriding that function smoothed it out for me. It still doesn't seem correct though to just straight up override that without anything else necessary happening.
And now that I don't replicate the collision component, I assume I need to make a custom scale variable and locally change the scale when it's replicated?
im just curious but whats the reason for needing a collision scale change on a projectile during runtime?
It grows as it flies
ahh okay, so did you make your collider your root component of the projectile?
or is it a child of your root component with the mesh, etc attached to the collider?
Yep, it's root with the mesh underneath like they say to if you're trying to utilize the projectile movement component
dont quote me on this but i do remember reading somewhere in the unreal documentation that when it comes to replicating an actor you need the root component as the parent
then collider inside the root component, and anything else you want to scale with the collider attached to the collider
also, where are you spawning the projectile from, is it from the character itself? like a socket or bone? or is it from an attached actor component?
@thin stratus I feel like you've dealt with this before and know something I don't. I read back through some of your posts involving these very things, but I don't understand why the interp isn't working properly, or why I just need to not call super.
Yea it's from the socket as it's attached, then detached and given a velocity.
It works very nicely now that I've taken off replication of the collision component and overridden that function, but it feels wrong and I still need to somehow change the scale over time. Making me think I need to tear it off, destroy locally and create my own somehow.
maybe this will help?
Thanks for trying. I believe relevancy is whether or not it needs to replicate or not which if it's being spawned by me it most surely does, and is relevant all the time, so that's not an issue I don't think.
No prob sorry i couldnt be more of a help, hope you figure it out!
I have an experimental funky projectile prediction system I made where I spawn one on the client immediately so there's no input delay, then using an RPC I spawn one on the server. The thing is that the client projectile is a separate actor which doesn't cause any damage and is automatically destroyed after a ping based delay and is only visible to the owner. Then the server spawned projectile is made visible to the player who fired. Other players only see the replicated projectile.
The end result is a projectile which starts off as expected then it "jumps" to a new trajectory. It still needs more refinement because if you shoot at something before the swap happens you can see the client one explode and the server one explode shortly after.
This is along the lines of what I was thinking I would end up doing. Thanks for the info! It seems to me like if you were to somehow "fast forward" the server projectile to where it should be on the client that might help with that mismatch? I dunno, but this sounds like a good solution.
The server projectile is already in the correct position, the client projectile is remote and not trusted so it gets destroyed (and remains harmless if a cheater wants to spawn a whole bunch of them or something)
Right but with lag, if you were to spawn immediately on client and it starts moving, the server would get that command late to spawn a server projectile
So I'm saying the replicated server projectile would need to close that gap
Yes, and so after a ping based delay I "swap" them
Oh gotcha. So it jumps backward?
There's two projectiles. Shooter sees the client one, meanwhile a network lagged RPC is running to spawn a replicated projectile on the server.
Then the client projectile is removed and the server projectile is made visible to the owner because it was previously not visible
Right so the client one disappears and becomes the replicated one at some point, so if it's far enough ahead it looks like it jumps backward.
I know. I'm saying on the client side. The person who shoots one, will see theirs disappear and become the server one at some point?
Yeah
Right
So if their one shot first is far ahead, it will look like it jumps way backward
If you ping 300 ms
It jumps more depending on ping yes
Which is why I'm saying you could "fast forward" the server one to match where the client side one actually is at the time it gets the event
but it isn't as noticeable because its already moving away from the camera
Right, but if you are strafing very fast, which my game does
Well no because the position of the client one isn't trusted
You can see the projectiles difference easily
That's why it just gets destroyed
But you see what I'm saying. If your projectile jumps backward with 300 ms you're not going to hit the moving target with your replicated projectile that would have hit with your client side one
Because it's too far behind
That's why I'm suggesting to fast forward
who the hell is staying on the server with 300ms anyways?
the whole game would be awful not just the projectiles
Right, I'm just saying ping difference in general, so you could fast forward the 100 ms RPC to make it dead accurate is all
Eating up the lag
So if I use the client projectile's location then it opens the door up for cheaters to spawn them directly ontop of enemies or something
So that's why its just for visuals and doesn't affect gameplay
Yea I get that, I was suggesting a way to eat up the ping difference to make it more accurate
No worries
There's really no perfect solution here
I'm not sure how the fast forward would work. The server doesn't know about the client's projectile. So the location would have to be RPC'd to it which has its own network delay as well. You'd have to somehow predict further ahead along the trajectory based on the current amount of ping. Not sure what the math for that would be.
And That's why I am here lol
Yea basically you would have to send up a location spawned, time spawned and determine how much of a delay there is and see if itโs worth speeding things up or not, or spawning it ahead and doing a line trace for the first missed half as kind of a hitscan.
Itโs basically an attempt to match the server version for everyone else to the instigatorโs version as close as possible
posting again cause it got lost fast, wondering if anyone has a possible solution to this?
1:33 when you use Get Player Controller its only getting the pc at index 0. Instead you need to think about getting all of the player controllers and looping through them doing stuff. You can get them from the Players Array which is default on the GameState
check this on to see the default variables if you can't see Players Array on the GameState
at 1:33 thats the controller in the character bp, it should be fine accessing the index 0 there as it will only get the local controller for that character (which is what i want) the game state holds an array of player states, but the game mode can hold an array of player controllers on login, which is what im doing, and the game mode runs though all the player controllers in the level and should in theory update all of them, and its breaking in the game mode, after i do all the character logic, the race times from the character are sending just fine but its when i try to update the UI for everyone that it breaks
i have also tried doing the for each loop on the game state and updating all the player states with the new race time, but it seems to break the logic for the server too, which makes no sense to me as to why its doing that, cause originally i thought the game state would be a better place to get this info, but the controller needs to update the UI, not the state, so unless you know an easy way to grab the controller of an owning state from the array index in the game state and then update the UI that way, its worth a shot but i dont think it seems viable
The GameMode exists only on the server, are you sure the All Players array is holding more than just the listen host?
this is in game mode
this is after i create the win loss widget on the player controller
This isn't actually quite that hard - you need a synced network clock and you only need to send the timestamp. The server can project forward based on that.
A synced network clock of course isn't super easy, but with a bit of clever interpolation on the firing client's end even a relatively simple one is probably good enough โข๏ธ
The hardest part is knowing how this stuff should work in the first place (and how to make it easy to debug when things inevitably go wrong).
Also, a lot of people's first intuition of using ping in place of a timestamp is simply wrong because the engine's measure of ping isn't particularly accurate (and iirc the default way to get ping is actually an average of a set of samples that aren't taken super often).
its odd that this method would send the correct name for each player, and update it without error, but the time doesn't get printed right
yeah i added a debug there and its accounting for both players when they login so thats not the problem unfortunately ๐ฆ
Maybe its because of the nested foreach loop?
If you haven't already, maybe try setting a breakpoint and step through the nodes checking both client and server. You'll figure out why its not working eventually.
i thought that may have been it too, but if i only do the one loop it doesnt even grab the info from the servers state after clearing the player list box, its super odd lol i have a feeling its the way my events are set up, if anyone has ever done UI that updates a players kills when someone gets a kill (or dies) on everyones leaderboard for a free for all multiplayer shooter or something, it would be similar to that, the only difference is that im grabbing the race time for my character from my finish line blueprint rather than a default 'OnHit' function, I do have the finish line replicated and always relevant
Does array replication send the entire array or just the changes?
it does send the entire array if its replicated
wack, gonna need to optimize my data transfer then
I can't be sending thousands of items for 1 small change
yeah you want to avoid replicating the things you don't absolutely need to
Your Finish Collision overlap would fire on both the server and client, but I'm 99% sure that everything after the is locally controlled check would only ever execute on the client (or the host) that executed the overlap, so that means you wouldn't have the server telling a client to run the event, the client (or host) will be running the event themselves when they overlap.
You should probably gate the overlap with an actual IsServer check just to ensure the following logic is being executed on the server.
Since you've set your E_P)layerHitFinish Event to run on the owning client, it should not be used to call a multicast as it can't actually multicast (which you are doing by calling the multicast on playerstate @2:00) if it gets executed on a client, your server won't end up sending the data to any other clients, nor would the server even know to execute it since a client doesn't send to the server in a multicast, it only gets executed locally - so it would work for the server but no one else, but the server may not even be executing by that point since you're running on the client.
Additionally, you likely should not have clients trying to tell the server to do something in the game mode, especially updating anything, as malicious clients could potentially call that event at any time, even at times you would not expect - RPCs are like opening doors to allow communications in and someone can exploit that.
Your errors are appearing because by the time you are calling the E_RC_ClearFinishedList event, not all clients may have created that widget as you're only ever telling the player who overlapped the finish line to create it, but you are looping through all players asking them to update their UI. A simple IsValid check on the widget reference before the next function should remove the errors.
i will give this a try and let you know how it goes, thank you very much!!
@steel vault idk if I can be of much help
I didn't setup prediction for the spawning yet. So the only thing I can give you is some code that makes it look smoother
But the initial spawn delay will remain on higher pings
My main problem isnโt the spawning delay, thatโs just something I eventually need to handle. My main problem is that the projectile movement component uses none of the interp movement variables when set up exactly how you said in your older messages. I set the update component as the collision sphere and mesh as the interp component after begin play then override Post update position and rotation and call the Movement function like the docs say to and no interpolation occurs. I thought the collision should be way ahead and the mesh eventually catches up over time but itโs just locked in step and nothing seems to change it. There is a lack of examples of actually using it properly online and Iโm wondering if itโs actually just bugged or broken in 5.1 ๐ฆ
I keep messing with the interp variables on the movement component with no actual visible changes and Iโm wondering how they actually work or what is set up incorrectly.
I actually read about the network clock and decided this is what I would use. Thanks for replying and verifying thatโs an appropriate method! I think this makes the most sense for getting things synched up.
There is one other thing I do iirc
Which is override the velocity receive function
And set the movement comps velocity
I did that as well. I needed that to get my projectile moving on the client and that worked perfectly so thanks for that!
It still just doesnt translate what those variables for interp are responsible for and I can just turn interp movement off and it works the same
I'm relatively sure I only do:
- Velocity
- InterpComponent (ensuring all visuals are children of it)
I can double check later though
Oh you mean the component itself needs things to be children of it?
That I donโt have
I never really changed the values for Interpolation
Well
It interpolates that component
Right I probably wouldnโt either I just tried changing them to see what difference it would and should make
Ohhh interesting. I thought pointing it to the update component and interp component would do that for you
That's the same logic as to why visuals should be children of the character mesh and not capsule
Right so I have capsule parent of mesh but capsule is root of projectile with movement component just a subobject of the projectile
So if I make it a child of the component somehow that might work?
But then that would make the projectile movement comp the root? Guess Iโm confused. Was thinking just the capsule as root would be fine
Right gotcha. So how would the capsule become a child of it
That's not what I meant
- Root Collision (UpdatedComponent)
-- Mesh (InterpolatedComponent)
--- Some visual component, e.g. VFX
Ok yea so thatโs how I have it.
Basically don't make the visual component a child of root collision
Cause then it will jitter
Also goes for Audio components of course
Ohhhh so not a child just another subobject
Oh I keep misunderstanding. Visual child of mesh but mesh is still a child of the root
Yes
Right gotcha. I have that. The interp movement checked off does nothing though and changing the values with it on doesnt either so I suspect something is wrong
I will check mine in a bit and see if there was anything else
Really appreciate it. Sank a lot of hours in trying to understand why I thought everything matched what you had and why the interp wasnt visually showing. I showed the collision too and itโs just not obvious any interp is happening and so itโs the same with it off. My C++ I overrode the position and rotation to call the interp move function as well and didnโt call super
You aren't testing with package loss right? Cause some peeps do the mistake of involving high (5%+) values of package loss into their testing
None just default emulator and even turned it off
The jitter disappears when I override the post location and rotation to not call super and then the interp just doesnโt seem to do anything for me so I know something is wrong
Also late for me so Iโm not at my computer to get actual function names but basically followed every step I could find from your steps and documentation for MoveInterp
MovementComponent = CreateDefaultSubobject<UCircuitsBallMovementComponent>(FName("MovementComponent"));
MovementComponent->SetInterpolatedComponent(StaticMeshComponent);
MovementComponent->bInterpMovement = true;
bReplicates = true;
SetReplicatingMovement(true);
NetUpdateFrequency = 20.f;
void ASomeProjectile::PostNetReceiveVelocity(const FVector& NewVelocity)
{
Super::PostNetReceiveVelocity(NewVelocity);
// Update ProjectileMovement
MovementComponent->Velocity = NewVelocity;
MovementComponent->UpdateComponentVelocity();
}
This is actually Ball, not a traditional Projectile, so we call the below function on Server and local Client when shooting it. Have to check if our actual projectiles also do this, but I don't think so.
void ASomeProjectile::ApplyVelocityAndGravity(const FVector& Velocity, float GravityScale)
{
if (GravityScale < 0.f)
{
GravityScale = DefaultGravityScale;
}
MovementComponent->ProjectileGravityScale = GravityScale;
MovementComponent->bSimulationEnabled = true;
MovementComponent->Velocity = Velocity;
MovementComponent->SetUpdatedComponent(SphereComponent);
MovementComponent->UpdateComponentVelocity();
}
Projectile Move Comp looks like this (not the one of the ball, but should be similar):
USomeProjectileMovementComponent::USomeProjectileMovementComponent(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
bInterpMovement = true;
bInterpRotation = true;
bInitialVelocityInLocalSpace = false;
ProjectileGravityScale = 0.f;
}
Hmm I donโt set the updated component or call update velocity like that, maybe those are missing pieces. A lot of that is almost exact or similar to what I have though. You donโt seem to override the post location and rotation to call MoveInterp though which is curious
Yeah I don't
Yea now that I see that I feel like the set updated component is something I was missing years ago when I tried this. Really appreciate you posting that. When I get around to it Iโll try setting it up like this without the other override and then with it and test extensively. Thanks!
I noticed our cpp Projectile isn't setting ReplicatedMovement to true. Quickly checking if that's done on the BP
Hmm yea thatโs good to know I def have it set in BP
If I get around to fixing everything Iโm going to make sure this gets into a video or a post. Kind of frustrating how precise the projectile setup is for proper multiplayer yet there arenโt any guides. Would love to save some frustrations for others.
Hm, Movement is in fact not replicated on the Projectiles. I wonder if that's actually an oversight on our part
Cause the Ball has it true
Or it could be why mine arenโt working and battling with the proj move comp
Would be interesting to see if it breaks when you turn it on
I swear I had notes about this years ago I just canโt find them
Not really making a difference turning it on though
Would even say it has no affect atm
Cause we already replicate the Velocity
Yea makes sense
Sadly can't show you a video
But it's butter smooth on 400ms ping
Minus the spawn delay :D
Not a problem. Yea so when I had it all said and done it looks smooth too but thats with the override. I just donโt get what the interp is for if the collision is locked to the mesh always and never playing catch up
Would think with high ping it would be skipping while the mesh smoothly caught up
I just donโt see that in practice
I built the dedicated server, added it to my project, packaged both game and server and everything went smoothly. Set it up so that thereโs a lobby where you can join the server by clicking a button thatโs set as open map (127.0.0.1) but it wonโt work. I will start the server, open the game and click the button but nothing will happen and no messages whatsoever in the server log. I also set a string after the โopen mapโ and the string will print but nothing else works. Any help?
Your Client should at least be printing something
Do you have the console open for it too?
Not sure I remember that function much tbh
Itโs the same as you have for velocity in your code above but its a virtual override for post location rotation update on an actor
Yeah idk, I would remove that
I can't recall having used that in any project so far
I thought this was the entire basis for interp movement lol
Ok well as long as it works I guess itโs fine
Yeah I mean I can try that in the future
Yea Iโll refine everything and test a bunch of cases again, I just wanted to prove the point of the interp movement somehow but if itโs locked in and smooth I suppose thereโs no need. Thanks a ton!
void UProjectileMovementComponent::TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction)
{
QUICK_SCOPE_CYCLE_COUNTER( STAT_ProjectileMovementComponent_TickComponent );
CSV_SCOPED_TIMING_STAT_EXCLUSIVE(ProjectileMovement);
// Still need to finish interpolating after we've stopped simulating, so do that first.
if (bInterpMovement && !bInterpolationComplete)
{
QUICK_SCOPE_CYCLE_COUNTER(STAT_ProjectileMovementComponent_TickInterpolation);
TickInterpolation(DeltaTime);
}
Always though this was enough
oid UProjectileMovementComponent::TickInterpolation(float DeltaTime)
{
if (!bInterpolationComplete)
{
if (USceneComponent* InterpComponent = GetInterpolatedComponent())
{
// Smooth location. Interp faster when stopping.
const float ActualInterpLocationTime = Velocity.IsZero() ? 0.5f * InterpLocationTime : InterpLocationTime;
if (DeltaTime < ActualInterpLocationTime)
{
// Slowly decay translation offset (lagged exponential smoothing)
InterpLocationOffset = (InterpLocationOffset * (1.f - DeltaTime / ActualInterpLocationTime));
}
else
{
InterpLocationOffset = FVector::ZeroVector;
}
Cause it's already doing interp stuff
Oh god. Do I not have tick on somewhere and thats why its broken? Lol
I should have dug deeper
Welp more things to try. Lots of ideas now
The other function is completely unused in UE and our project.
Maybe I just call that somewhere too. Will try in the future
So strange. Good insight nonetheless
Am I blind or is MoveInterpolationTarget not even setting location?
It takes in a rotation and location doesnt it?
Yeah but that's for the UpdatedComponent
oh
It sets the InterpLocationOffset
And then Ticks that in the TickInterpolation
Maybe I'm missing something too then, But it's so smooth already lol
Confusing af
Yea tell me about it!!! Pulling my hair out today
That might be my missing piece honestly
The component has to tick I assume? If its defaulted off then mine is off lol
Is yours on?
I just have whatever BP gave me when I added one
Maybe the reason it's smooth already is that we make sure that the Client has all the info to move it
Like we aren't updating from the Server
That thing is flying straight after all
But the Ball is also not suffering from it
Hmm yes. I wonder if varying acceleration would show it better
The Ball is specia lthough cause we also set velocity locally
Or a change in speed etc
When we kick it
Unlick Projectiles which we just fire on the server
Well I have 2 weeks of vacation, so will not bother with this until after, sorry :D
Haha no rush at all! I just went deep down the rabbit hole today due to the weirdness, lack of documentation, and jitter I was experiencing
I will probably end up putting it off for a couple weeks as well if mine works smooth for now
I just hate not knowing why it is or isnโt working
maybe your replication freq is too low
or priority
and its not getting the data quick enough and the smoothing goes out of whack @steel vault
any way to set some URL option for PIE ?
Hello, could someone enlighten me about these logs? The multiplayer doesn't really work and I think these errors are related. Thanks in advance.
LogNet: Warning: UActorChannel::ProcessBunch: SerializeNewActor failed to find/spawn actor. Actor: None, Channel: 16
LogNet: Server connection received: ActorChannelFailure 12 [UChannel] ChIndex: 0, Closing: 0 [UNetConnection] RemoteAddr: 127.0.0.1:60764, Name: IpConnection_39, Driver: GameNetDriver IpNetDriver_29, IsServer: YES, PC: BP_TDControllerBase_C_1, Owner: BP_TDControllerBase_C_1, UniqueId: NULL:Doomiprane-FB2CF7244D60FF41E9189EA78474CEA5
LogNet: Actor channel failed: Actor: None [UChannel] ChIndex: 12, Closing: 1 [UNetConnection] RemoteAddr: 127.0.0.1:60764, Name: IpConnection_39, Driver: GameNetDriver IpNetDriver_29, IsServer: YES, PC: BP_TDControllerBase_C_1, Owner: BP_TDControllerBase_C_1, UniqueId: NULL:Doomiprane-FB2CF7244D60FF41E9189EA78474CEA5
LogNet: Server connection received: ActorChannelFailure 16 [UChannel] ChIndex: 0, Closing: 0 [UNetConnection] RemoteAddr: 127.0.0.1:60764, Name: IpConnection_39, Driver: GameNetDriver IpNetDriver_29, IsServer: YES, PC: BP_TDControllerBase_C_1, Owner: BP_TDControllerBase_C_1, UniqueId: NULL:Doomiprane-FB2CF7244D60FF41E9189EA78474CEA5
LogNet: Actor channel failed: Actor: None [UChannel] ChIndex: 16, Closing: 1 [UNetConnection] RemoteAddr: 127.0.0.1:60764, Name: IpConnection_39, Driver: GameNetDriver IpNetDriver_29, IsServer: YES, PC: BP_TDControllerBase_C_1, Owner: BP_TDControllerBase_C_1, UniqueId: NULL:Doomiprane-FB2CF7244D60FF41E9189EA78474CEA5```
Hey, in my project, I use steam subsystem to create sessions and the clients can join to it. But after that, I want to host a TCP listener and I want the clients to connect to it on loading screen or after they joined to the session.
The TCP listener is pretty much done, there is no problem with it if I test it inside the editor.
But to test it in a real situation, I'm not sure what IP should I use to host the TCP listener and what IP should I use to connect to it on the client.
Could anyone help me with this to understand what IP should I use?
what should I write to server auth code? ๐ค
Will try both of these when testing everything as well, thanks.
I had / have similar issues. Is this packaged or PIE?
It's pie
Try packaged. For me, somehow this was an editor only issue
which I could live with, thankfully
not sure if that's an option for you
yeah because it fails to replicate
all dynamically spawned actors are the ones failing to properly replicate, in editor, using dedicated servers
(for me that is)
it suddenly started happening, and I don't really know why, tbh. Spend close to a week trying to debug it, to no avail
hmmm, but i have a second project, where i learned to use ability system and multiplayer and everything works perfectly in pie
maybe try to compare the two and step by step try to remove stuff / add stuff to one or the other to see when it breaks / starts working
and if you do, please let me know, too ๐
annoying that I cant use PIE to test multiplayer anymore
i already done that and nothing defer
does it happen on all maps for you? (if you have maps)
for me, it only happened when traveling in MP
i have only one map
so if the map that PIE loaded by default, it worked on that one
hm. so I guess it's not 1:1 the issue I am having
there were some things I did that made things a little better. trying to remember them
you have a dedicated server runnng somewhere?
nop i only use listen server
another pie
weird
was gonna say, one thing I think did fix it partially was to make sure that the packaged server stored the content in one singular .pak file
for whatever reason
but if your not in packaged, thats not it
i really dont know what to do, i do erveything like in my "course" project and nothing work
yeah, sorry abou tthat. we've all been there. Is it a complex project? maybe try to recreate it from scratch, by copying in pieces, again trying to see when it works and when it breaks. Cant be of more help sadly
the project is not that advanced, but I have already spent a lot of time on it
hi there, quick question. Is the level blueprint server only or does each instance have a copy of it?
Every client can run code in the level blueprint @stoic lake
Hello guys, do you know if it is better to attach and detach an actor to the pawn or to spawn them on the actor and then spawning them in the world again when I want to drop it? (Because often times the attaching is a bit funky)
I made a melee combat system using a sphere trace from the players location. Issue is that when a client attacks, the sphere trace is generated at both the client and the server host. I just want it to generate at the client. Any solutions?
client RPC
Is locally controlled, then trust and verify
What's the prefered way to attach items correctly to fist person arms mesh for the player, and third person mesh for the other players?
Ideally, I'd like to attach an actor, and not just the skeletal mesh which is where I'm getting into issues
Hey, I just wanted to thank the people yesterday that helped me solve my 'RaceTime' issue, especially @sinful tree you led me in the right direction for sure, it was actually much more simple than i originally thought. Ijust stored a replicated time on the player state and updated that player state when the overlapped the finish line, then if it was the local player it would create the widget for them. That way it always updates the list for the players in the lobby but it only shows the widget for the player that actually crossed it. And the widget itself just stores the data for receiving the update instead of the game mode or game state.
Hi, I use steam subsystem to create sessions and the clients can join to it. But after that, I want to host a TCP listener and I want the clients to connect to it on loading screen or after they joined to the session.
The TCP listener is pretty much done, there is no problem with it if I test it inside the editor.
But to test it in a real situation, I'm not sure what IP should I use to host the TCP listener and what IP should I use to connect to it on the client.
I tried using the listen server's local address to host the TCP listener and send it to the the client with the port(I used 3000), so the client can connect to the TCP listener, but for some reason the client won't connect to it.
Also not sure about port forwarding, if it's a thing that's necessary here or if unreal or steam subsystem can handle it somehow.
My TCP setup is based on this code: https://github.com/getnamo/TCP-Unreal
Could anyone help me with this to understand what IP and port should I use?
(I know I wrote this here earlier, sorry about this, but I wanted to provide some more info)
You'd use the IP of the computer the TCP listener is running on, and the port that you've set the TCP listener to listen to.
You likely will require some kind of port forwarding if the server is behind a firewall of any kind, so if it's hosted on something like AWS, you'll probably need to configure it to allow connections on port 3000 if that is what you're using.
If you're running everything locally, then 127.0.0.1 should be the IP address you use, assuming the client you want to connect to the TCP listener server is also local.