#multiplayer
1 messages · Page 68 of 1
There are some dev blogs about Paragon showing that
I never developed a system like this but I heard lots of the stuff they made to get that to work is in the engine. Basically that motion matching or whatever the call it. They showed that partially off with the ue5 demo.
ready I did it with the root motion in the blend space hahaha
and replicated
there is actually a trick to make it super easy
Glad to hear it's possible without much work. I wouldn't know how out of the box but there is a lot of stuff hidden in the engine
I actually cheated the engine
I made a mirror and that animation replicated me in real time to everything except the blend space actor
I’m working on a 2d game with rather small actors (pixel art imported small so I went with it). Everything seems to work fine but I noticed replication can be a little off at times. I assume this is because of my small scale (player is 10 units wide). I am considering making everything bigger with the hopes that these small in-accuracies won’t be noticeable at larger scales. Is this a valid thought process or am I about to waste a few hours?
I think it might depend on how replication is setup and the reasons behind the inaccuracies. If you are sending float data I doubt larger scales make a difference, with int data it might
Maybe the jerkiness is due to packet loss or lag or client/server disagreeing about some state
ensures only ever happen once per application start
My main concern is a vector - players are able to stand on platforms, when this happens I stop replicating their world position and start replicating a position relative to that platform (the vector). When the player moves this vector is updated thus moving the player.
mmm that should make no difference, although I'd personally would keep replicating the world position unless there is a very good reason not to
are you using any of the built in replication (character movement component for example) or is it all custom?
I initially started with the built in stuff but eventually moved to a hybrid of smooth-sync and my custom vector updates. While not on a platform they are just free floating with physics and thrust. During this they use smooth-sync which works perfectly. When on a platform it is just a relative vector replicated. Every tick that position is read and the player is moved.
Platforms use the same smooth-sync settings the player pawn does when free floating.
No character movement component or anything. All custom.
I can send a demo if you’d like to see what’s going on
This is how possessing helikopter looks like if you do it "fast". It works.
This is when you stay in helikopter little longer and exit. it spawns player to player start and creates new ui top of old one. Like calling player beginplay. Why this could happen?
single player it works
This I mean creates new ui also. That ui is created in player beginplay.
guys i need help really bad. i cant get the client to play a gunshot sound without also hearing the multicast gunshot sound. this is my setup
if i only play the multicast, the gunshot sound is delayed by a number equal to my ping
i cant have a delayed gunshot on left click it feels so bad
I need to trigger overlap events locally for visual effects (item highlighter) - using this BoxComponent i've attached to a 3rdPerson Template project character class - on the follow cam...
While the box (hiddenInGame=false) visibly shows that it is moving with the camera spin (mouse event) - when i play 2player it definitely doesnt move (i expected this... its local translations)
How can i get this overlap event to trigger just locally? When I use the CharacterMovementComponent and make the box overlap the objects in the scene - my overlap event happens no problem... telling me its an auth issue?
i have 0 need to make this replicated function to spin the mesh - unless maybe i just change it to repmode client-only .... maybe?
Maybe perhaps is primitivecomponent::onbeginoverlap() a replicated funct?
overlaps are local only, always
so only networking problem you might have there is that the components are not in same position on client/server
Possessing other actor in server deletes old one? Thats why possessing back doesn't work after couple of seconds.
Singleplayer mode this doesn't happen. Weird
Fixed it was because set actor hidden in game. I don't know Why it deletes actor in server but removing that node now it works.
fixed
i think
no way to test the actual multicast on another client
Is it absolutely necessary that a Player who wants to Host a Listen Server have the level open with ?listen before they Create a Session?
Or can the Session be created first and then immediately moved to the Listen Server level?
This is false by the way - i've debugged this and get SERVER AND CLIENT responses on every overlap.
this was tested as both listenserver and client playtypes
So players outside the render/relevancy range of an entity do not receive the multicast for that actor, and when the player comes into range, they get the update.. Correct?
So for example, if a player is outside of a chest's range when the inventory is changed they will NOT get the update, and then they enter range, when they open the chest, they'll have the latest copy of the contents?
Basically I'm trying to avoid players having to receive inventory updates when they're not near the actor, to save bandwith/etc... But if three players all have the same chest open they all need to see the contents in real time, so ownership won't work here.
can someone answer this?
If you're running SetActorLocation on the client, it won't work since it violates the movement prediction constraints. You have to run it on the server.
can u pls give me a idea how can i solve this ?
how to replicate movement in client then
is there any other function i can use
Just use SetActorLocation on the server, on the one you're trying to move
As long as the actor replicates, it'll replicate the movement
i am using it in server
this is the code in player controller and i am calling it in widget since i am using drag operation
UFUNCTION(Server, Reliable, WithValidation)
void DragCharacterInServer(FVector HitResultLocation);
bool DragCharacterInServer_Validate(FVector HitResultLocation);
void DragCharacterInServer_Implementation(FVector HitResultLocation);
.cpp
void AMultiPlayerController::DragCharacterInServer_Implementation(FVector HitResultLocation)
{
if (CharRef)
{
CharRef->SetActorLocation(FVector(HitResultLocation.X, HitResultLocation.Y, HitResultLocation.Z + 100), true);
}
}
void AMultiPlayerController::ImplDragCharacterInServer(FVector HitResultLocation)
{
if (!HasAuthority())
{
DragCharacterInServer_Implementation(HitResultLocation);
//on the client
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::Printf(TEXT("Has no authrity ")));
}
else
{
//on the server
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::Printf(TEXT("Has authrity "))); //this is executing
CharRef->SetActorLocation(FVector(HitResultLocation.X, HitResultLocation.Y, HitResultLocation.Z + 100), false);
}
}
UCharacterMovementC9mponent
This replicates movement including jump out of the box.....simplest way
thank u solved @worthy wasp @drifting heath
@fathom aspen I'm not sure if i'm just missing it but is there anywhere in your compendium that talks about how/when previous level playercontrollers are destroyed after a seamless travel?
they are local only, as in they are not networked in any way. every machine does its own overlaps
Hm, I got a question about how one would solve this gracefully. I have a GameplayAbility that runs predictively on Server and Client.
The Ability spawns a Replicated Actor with a Spline. I spawn this on BOTH Server and Predicting Client.
The Actor isn't needed to actually replicate anything and only shows a drawn Spline path, so it's mainly replicated for Simulated Clients and the owning Client has a local copy to predict drawing instantly.
Now this all works so far. Now once drawing is over, a Projectile will be spawned that follows the path. That Projectile, in all other cases, is not coded to support prediction (yet, but no time to change this atm).
The Spline Path should fade out when the Projectile gets destroyed or reaches the end. That is also working.
The problem I'm facing is that since the Projectile is only spawned on the Server, the local copy of the Spline Path for the owning Client has no way of getting a ref to that to listen for being destroyed.
I thought about spawning a local copy of the Projectile too and just hiding it, but i'm a bit afraid of any side effects, because the projectile isn't meant to be predictable at this point.
I heard that I could spawn Actors locally that automatically sync up with the Server version and don't create a second copy, but I have no example of that.
I would spawn the Spline Actor with that, so that the Server later can set the projectile ref on that ONE Actor.
Currently solving it via this:
The boolean is set on the Actor when spawning it with IsLocallyControlled. First time I actually use the SwitchHasAuthority node to check for a local client having auth :D
Probably don't even need that since the boolean doesn't replicate to anyone but Server and owning Client on the local copy I guess
Maybe my fear for side effects is unjustified. I will keep it like this for now. But still happy to discuss cleaner solutions
Whats the best way to handle automatic guns
do I just start shooting then send info to the server every shot ?
I doubt you need to notify the srever every time you shoot.
Just the start/stop event.
and if so then what do I do when firerates increase ? or am I just trying to optimize bandwidth prematurely
then how will the server know where I am shooting towards every shot ?
The server should be handling shooting the actual bullets.
You're constnatly telling the server where you're looking?
No
the idea is for the client to shoot first then tell the server to shoot
to make it seem as though the client has no latency in his shot
then the server would decide on damage and all that stuff
Nobody said you couldn't do that as well.
wait so then my options are to tell the server where I am shooting at with an rpc each shot
or replicate look direction ?
You can't "replicate" look direction.
*rotation
That either.
bruh
You'd have to use an rpc.
so then each shot would send a server rpc with look dir for the shot ?
So are you not telling the server where you're looking already?
you just said I cant do that
as to do that I would have to replicate my look rotation
No, I said you can't use replication.
or derive it from base aim rotation
Replication is one way, server to client.
maybe its my use of the world replication
as I can use an rpc from the client to tell the server where I am looking
That R doesn't stand for replicate/replication. 😛
Yeah, it's a terminology thing.
If you say you're going to replicate something to the server, you might very well mean you're just going to put Replicated in your UPROPERTY and expected it to work.
but that would essentially yeild the same result as sending where I am looking at each time I shoot
oh
because If I just send updates to the server, every x secs about where I am looking at it could lead to inaccurate data when I actually fire
But, I mean, do you not want other players to know where you're looking? Or maybe you update look direction slower in other circumstances?
I can derive that using base aim rotation
but idk how that is handled and at the moment when i fire the rotation may be innacurate
Give it a try. See what happens.
If you send a Reliable RPC to the server, it still may be inaccurate.
If the RPC fails, it will have to resend it and all kinds of things might bog it down.
It cant be unless precision is lost over the network
It's not about precision, it's about the lag between sending and receiving.
then that will just induce lag which I can handle later, at least then the starting info would be accurate
Plus if you send an rpc every time you shoot, and you expect the server to just take your word for it, it might lead to some speed hacking exploits. You speed your fire rate up by 10% and the server might just think that's within acceptable limits.
that can be detected
There's no harm (I guess) in rapidly sending your view direction, though.
if I send a shot time each rpc I can measure the difference in shot times with the guns fire-rate
There isnt
I just wanted to know if there was some way to do it without rapid rpcs
Except network latency will just screw with you on this.
I can use the clients local time
It doesn't matter what the client's time is.
or some time I sync up once the client joins
In fact, the client doesn't matter whatsoever
It's all about the time the packets arrive at the server.
Which will not be consistently spread out at the smae rate as your gun firing.
If one packet arrives a millisecond late, the next shot might not go off because it arrived on time and, oh wait, it's too soon to fire, let's drop that shot.
oh are you talking about inconsistent fire rates ?
No. I'm talking about inconsistent network latency.
between the client and server ?
like the latency causing the server to not fire at each x interval and instead fire at each x+-latency interval ?
Yes. That's part of it. But also, as I mentioned before, you might find clients are cheating and firing too quickly, even by a small amount, and you have to watch for that with your system, which means legitimate shots may be dropped because they hit some cheat detection.
Fire the actual shots on the server with the server's own timer. Simulate those shots on the client, with the client's timer. Send your view direction often so the server fires the right way.
Or even do some backtracking when you receive view directions on the server. Go back a few milliseconds to make sure you fired the right direction at the right time.
bruh
Maybe I'm just wrong. Shrug
It depends how competitive you want your game to be.
If it's just a fun shooter that isn't going to be the next valorant, your system is probably fine.
makes me wonder how lyra and stuff do it , since all the WaitForXData tasks are just "Wait for client to tell us what to do" nodes
but I guess you're right
depends on how competitive you want to get
might see if there is some valorant talk about how they do it
Thank you
I'm quite sure games like that will have very complicated systems 😛
When designing a multiplayer RTS game in unreal is switching to deterministic lockstep a must? If not what are the alternatives/optimizations - I presume UE's state synchronization is not ideal for this type of games, correct?
I would appreciate insight on how much work it would take to design and implement a deterministic lockstep in context of UE game. Asking this questions obviously hints that I'm completely new to this, so if it is too big of a challange maybe there are some smaller steps one could take to learn?
deterministic lockstep requires you to build a separate engine that is deterministic
quite a nightmare
it is possible just not easy
Build new engine as for discard UE completely, build something on top or modify existing code? Also are there any shortcuts one could take to avoid the nightmare part, like maybe compromise unit count?
basically your engine runs in parallel with Unreal and Unreal acts as a renderer + manages input. Take note that I have never done it, it is my suposition given my knowledge and what I heard from others that attempted it
There are no shortcuts for lockstep, it is really a tricky system
But there are way simpler ways to make an RTS nowadays and depending on the unit count and other factors it might be relatively straightforward
How about attempting to optimize what unreal has out of the box, is this valid for RTS?
I'd appreciate any link on alternatives, all I could find when looking for RTS resources are sources on how deterministic lockstep is fast and robust, but considering it takes a lot of work I'm not sure If I can handle it
if i use a 'Run On Owning Client' to set certain variables from the server to the client, is that susceptible to hackers changing things client sided?
it seem to be the only way i can transfer variables from the server to the client
Why not a Server RPC with a replicated variable
does it matter? thats kind of my question
AFAIK yes it does matter, because that runs on the client only
okay much appreciated. i didnt know replicating them would send over the values like that
i have a very surface level understanding of replication haha
Hey, I got a quick question. My game can be player solo and in a coop session. I want to have different UI elements shown depending on if it is being played singleplayer or in coop-multiplayer. I'm using the Advanced Sessions plugin. Is there an easy way to check if the game is being played in singleplayer or multiplayer mode? I know I could just save a flag somewhere but I was wondering if there is maybe something already built-in?
I used to have a load of macros for that. Was glorious.
Why I used macros? Who knows...
lol why
I'll write a bit about the topic later and send some links, but I think the most important think is that you know what game you wanna do, and then find solutions to the specific circumstances that you'll face. RTS is a broad genere from quasi-MOBAs in competitive style to city builders to total war-like stuff
Im leaning towards direction of Starcraft, They are billions (but with multiplayer) or age of empires. I know the selection is broad, hopefully its not too broad. I will very much appreciate any insight 😄
Yeah I see, you still need to know how the gameplay is.
I'm working on something similar (2k units, semi-fast gameplay), what I can tell you now is that 1k units for 2 players worked fine using a client-server approach and Unreal's network stuff (in a custom way but nothing weird)
I suspect we can go up to 2k units and 8 players but didn't confirm it yet
I recommend Glenn Fiedler's articles on multiplayer physics to get an idea of the existing approaches, pros and cons to each way to sync movement and positions
It doesn't go in depth but it's a good general overview
uh
little help
im spawning a projectile on the server
its components are not set to replicate
yet they exist on the client
what gives
I skimmed through it, I'm yet to finish it. I also found this but I'm not sure if its relevant (but the title it looks promising) https://ruoyusun.com/2019/03/28/game-networking-1.html.
I wonder if there are some sources that approach this problem with some code examples?
nope that I ever found
that article is nice too but very general, I'd also recommend Valve's
maybe the components are spawned without a server authority check, so both clients and server spawn them
Hi
I have made a pawn movement system
That is when you rotate camera you can go forward the direction of forward of Camera
But I have a problem
In multyplayer when camera moved direction don't change and its like 2d movement
Haw can I fix it?
oh, you are right (im modifying existing code and i did a goof, all the check does is HasAuthority before spawning it directly)
I should do a server RPC to spawn the projectile there, right?
if the projectile is spawned on behalf of a client, yes
like, "if has authority -> tell server to spawn the projectile there -> stripped down projectile replicates down to clients"
yeah I think that sounds right
huh, how does it work so weird right now for auth proxy though?
just so i get it better
no idea, never used auth proxy
it spawns locally, but if i turn of replication it does not get the proper velocity
the character movement component?
its projectile movement component
ahhh
well I assume that if you intend to use it in multiplayer you need to set it to replicate
im super confused now
if im on a client instance with replication disabled, the projectile spawns and falls down to the ground
but with replication enabled how does it know to link with the server version?
why confused?
like, everything that gives the projectile initial velocity should work on the client projectile
well I think that there are two context variables to take into account: the inner workings of the component, and your setup that might be causing different behaviour than expected
the correct or usual way to use this kind of components, if it is like the CMC, is to spawn in the server version of the actor and set it to replicate
if you spawn only on client or client + server, it won't work as expected (and maybe the behaviour is random, undefined or just wrong)
Ugh i must run
Yeah I thought it was getting spawned on the server only, but the ability that spawns it is a bit weird
I can't seem to find anything for this in Blueprint. Is there an alternative for Blueprint?
Yeah, that's what I told them to do originally
Overall, knowing at least a little amount of C++ will open the door wide open for you in UE. Can easily just make simple BlueprintFunctionLibraries to expose more stuff.
Well I'm not shy of using c++ but I'm still mostly working with BP
Was just wondering if there was an alternative
NetMode is the way to check.
Could also store a bool in your GameInstance. Then when creating/joining a session, flip that to true. When not in a session, flip it to false. bIsMultiplayer
Yeah I had that as a backup but wanted to see if there was something built-in already i could use
Guess I will play around with GetSessionState and see if that works. Otherwise I will just go with some c++ i guess 😅
Thank you guys!
@wooden abyss IsStandalone will work fine for your issue. You cannot be in Standalone mode while hosting or joining a host. As hosts can only be DedicatedServer or Server, and joiners are always Client.
Im getting this, any ideas what could i do to check what property is it failing on?
and how can I replicate it from there?, especially considering late joined clients, and I also need to set a widget component with the name, so should I put all the logic in the game mode?
Anyone yet to find a fix on this thing right here :DD. Been at it for about 2 weeks and cannot for the life of me find the solution
It works perfectly fine in ue4
Hey! Anyone have a nice howto in regards to testing a multiplayer game with a dedicated server? Lets say I want to connect 32 clients to that server, just to see if it works and do some measurements
well the server system is pretty much, have a server build that opens a map as a listen server, and the clients just have to join to his ip, is the basics, the server has to have a public ip and can be an aws ec2 instance or a normal computer
ChangeName modifies the already existing playername property on the playerstate
Which is why it might be desired to use that instead of adding a second name variable
okay, so can I just use that player state variable to set the widget?
Usually yes
alright, thanks, I would try it
Thats nice. Thanks @kindred widget
Yeah, well of course. The basic knowledge is no issue. The issue is that I'm 1 person wanting to connect with 32 clients (all signed in on different accounts) without having to create a lot of different accounts for this, but I get that this might be the only way. Thing is that we're using EOS service for sessions and that won't work if I'm connecting 32 clients on the same account..
Any testing framework out there worth mentioning when it comes to this kind of testing?
what kind or accounts are those? well if you just want to test ignoring account systems, sessions, etc. I recommend you aws ec2
- Both should work.
- Make a copy of the old array and pass it to the OnRep
It doesn't per se, but it does. Usually that should happen at a point closer to where the new one was created (if no one was created then the old is persisting), and where a copy to the new one happens, and that's why it happens inside AGameModeBase::SwapPlayerControllers
If the If at the end succeeds then it's done, if it's not, then it's destroyed inside UWorld::DestroySwappedPC
Uh, how does visual studio debugging work when I'm running in listen server mode with 2 players? Is it aware of the client game instance?
if you run it in via the editor (not standalone or packaged) yes
Hello, I would like to know how I could make an RPC from client to server that tells the server some information it should save in the playerstate of the client that called the RPC. I have the Level of the Player saved in its savegame but I want it to show in the playerlist on other clients as well. So I tried to send it to the server with an RPC. Now how can the Gamemode(Server) know who this information should be updated on?
So the client should tell the server to update its playerstate so other clients can know its level as well
Yes it would but i'm fine with it
It's a singleplayer game with coop features
If someone has fun cheating he/she can do it
I'm trying to do all the rewarding/etc server side so cheating would only really effect the client that is cheating
Like getting more experience
Is this supposed to be displayed in the browser list? Or only when you actually connect?
When the client connects, load the save game. Then just do a server RPC to the server to update the level. Then use UE's standard replication stuff
This is basically what I tried
i might be talking out of my ass, but, when you call an RPC from a client object instance it will run the code on the server object instance
This is inside the controller
uh
Then there is an error somewhere in your code. Because this process works.
It's how I handle clothing for example.
isnt the problem that the controller does not exist on the server?
Ok so sending the client-side replicated playerstate to the server should make it so the client handles the correct server-side playerstate? And after replication the client will get the correct updated playerstate?
only if the client has authority
PC exists but does not have authority on the server
Client joins and is given the playerstate and all that jazz
Then do a server rpc to update the client's level.
Update it on the server side, having the player level as a replicated variable.
i think thats the problem?
you need to put the code in different object?
You send the values, not the entire playerstate
like, auth proxy calls the rpc and the object has to have actual authority on the server?
or am i wrong
Yeah thats what I was wondering. But if I only send the value, how does the server know who send the value
Like which playerstate to update
majic
Because you're sending it to the server's version of that instance
network coding deals mental damage to me
I feel that
LogTemp: Error: ROLE_Authority
LogTemp: Error: ROLE_SimulatedProxy
okay, wtf is going on
no, nvm
i am
When the server creates an object to be replicated down to the client, it gives it an id for the network. When the client then tries to do a server rpc, it uses that id to know which object to call it on. (Obviously more stuff happens than that, but this is the super birds eye view of what happens)
incredibly confused
I think you're mixing up authority and ownership
You have to own an actor to RPC through it. That doesn't mean you have authority locally or anything
mmm my bad, I definitely mixed those up
what does authority mean then, in this context?
I though it was tied to ownership, at least in most cases
The simple way I always think of authority is "what machine spawned this thing"
(I know technically all machines "spawn" it, but you know what I mean)
Which machine is the "host" of this actor 🤣
stupid question, but how is this ID called?
Hostname? Computer name?
i mean, what function will return it, i literally forgot and cant google it out lol
mmm I see, thanks
so, what did you do?
Basically what I did before but I didnt try to send the PlayerState to the Gamemode and let that handle it
I just changed the level in the playerstate after sending it to the server
And I got the PlayerState from the controller on the client
Not sending the controller ref to the server and then trying to get the playerstate
can someone help me with UProjectileMovementComponent
how do i actually make it work for networked game?
i cant stop it from replicating with my projectile actor
and the simulated proxy instance literally is fighting the authority instance making the movement all jittery
i guess the UProjectileMovementComponent gets spawned anyway since its a default object in c++ constructor
but, how do i make it work right then?
does anyone know how to replicate players control rotation to server?
but why are you not wanting to replicate it?
i have no idea how its supposed to work, there is litearlly zero documentation
the simulated proxy instance does not get initial velocity
so it just falls to the ground
look, it won't ever work if you just do weird stuff
If it is a multiplayer game just set it to replicate
and if you turn of movement replication, the local instance still has no velocity
so each update it moves to new point then just starts falling
i have no idea how to not "do weird stuff"
there is no documentation on how you are supposed to actually use this in networked setting
how do i stop the two instances of it from fighting each other
do i just disable simulation on simulated proxy?
and use the interpolation part?
have you tried it with replication enabled at all? I've been asking that all day
You're always mentioning how you disable replication which makes no sense if you intend to use the projectile in multiplayer
yes, i described what happens:
the two instances fight eachother
- server version gets initial launch velocity and simulates using the projectile movement component (so it flies as it should)
- client version gets no initial launch velocity and simulates using the projectile movement component (so each net update it gets moved, then does random things because the local projectile movement component insists on trying to simulate it)
so, the end result on client is the projectile keeps jittering and teleporting
ok, understood. When you mention two instances, are you manually spawning two movement components?
no, i thought it was replicating, but i just realised it is a part of the c++ constructor, so it gets created either way
And in the constructor did you put a check to only spawn on server?
HOW TO REPLICATE FUCKING CONTROL MOVEMENT HELP ME!!
uh...can you actually do that?
what do you mean
void AMunitionActor::BeginPlay()
{
Super::BeginPlay();
if (GetLocalRole() == ROLE_SimulatedProxy)
{
RotatingMovementComponent->SetComponentTickEnabled(false);
ProjectileMovementComponent->SetComponentTickEnabled(false);
}
}
this seems to have drastically improved the output
it's the first thing I said xD
i dont think you are supposed to have any gameplay code in c++ constructor though
unless you mean something else
im tired lol
and madge
Why not xD
This is initialization code
you check that the component is only spawned on the server so that the replication works fine
it gets run even when you start the editor/engine, id have to litter it with about 20 null checks to not crash i think
actually, i kind of need it, you can use it for interpolation on the client
i think
what i do not understand is
Math?
why cant epic spend like 0.0000000000000000000000000000000000000000000000000000001% of fortnite money to get documentation
no need to be violent :p
The truth hurts, man.
all constructors run during engine initialization afaik
hey, i did some vector math over past two days and actually managed to somewhat fake rotation physics for the projectile movement component
spawning a component and doing a server check is totally fine
c++ constructors are for initialising variables, that is it
i gave up on actually making the math real, the rotational velocity has magic 25 number
uh oh
false alarm
i broke it then i fixed it
hello there, have you ever figured out how to solve this issue? I am facing the same thing right now with steam online subsystem - client connects to the session (which I can tell by getting session info from the online subsystem and from the logs) but client doesn't load the listen server's map. idk what to do 🤔
Might have better luck asking in #online-subsystems
i did 🙂 noone has answered yet
hey all, I'm working on a coop game where NPCs have automatic weapons that shoot physical projectiles (proc movement comp powered). I'm assuming that spawning replicated projectiles on server is a quick way to eat up too much bandwidth. Is that a correct assumption?
I'm considering making NPC shooting logic client side, maybe server just determined desire to shoot but actual shooting is done on clients
what is the best way to troubleshoot poor multiplayer performance? events that require server input for example are pretty 'laggy' even though overall ping is good
i think the rpc buffer is overflowing but not really sure how to check what is causing the overflow / taking up too many of the rpc calls
Are you using any client side prediction? Ex: Input happens, change variables on client before RPC on server to make the same change. This way the client can continue running using the new values before the server sends a correction but it won't have to send a correction because the values will already match.
Just have to make sure that the anti-cheat logic for if the variables can change or to what values they're allowed to change to (clamp) happens on the server and not the client so that the server can issue a correction if it needs to.
So for example if you hold shift to sprint, the movement speed value change can happen on the client first, then RPC to server so they match. But if a cheating client were to change the value to something extreme the server has to clamp the value before setting it.
But that's a bad example because something like sprint would be far better off inside of custom movement component written with c++ as part of a series of saved moves but hopefully you get the idea.
which Replication Condition should i choose to make Health variable replicates correctly?
Yo, has anyone come across this before!??!
LogWorld: Bringing World /Temp/Untitled_1.Untitled up for play
_ _
I'm having an issue with the game crashing before finishing a seamless travel and this seems to be a warning sign for sure
Don't need one per se. Just making it replicated is fine.
But if you only want it to go to the player and no one else, you'd use Owner Only.
Not for the actions in question. Opening a container inventory, shooting a gun, etc.
if i dont choose anything, it dont replicates correctly
looks like every player interact with his own independent Health pool of a pawn, but obviously every player need to interact with same Health pool for a pawn
Might help
You literally just need to have the variable replicate. Thousands of games have been made with just that.
You're doing something else.
Replication conditions are not a requirement.
now i set Damage event and HP bar Update event to multicast, and now, when listen server is damaging a pawn, HP bar is updating correctly for a client, but when client is damaging a pawn, its not updated for a listen server
You are lacking the fundamentals of networking in UE.
You need to understand the server client model
and after i understand, how to replicates health correctly?
if you know the fundamentals well you'll know how to answer that question
i know
it must be replicated
and i need an answer, how do it correctly, because simple Replication is not enough
Hello! Quick question, if anyone knows. I'm just looking for best or at least decent practise for the following - I'm working with a listen-server model, and have some information past from an initial map to the main one via the game instance. It's only at that point that clients connect to the host, whereupon they need access to the variable stored in the game instance ideally pre-initialisation. This gave me the idea of having the GameState, on preinit, grab the game instance variable and store it as a replicated property.
But since clients will naturally join later than the host, I suppose the client's game state doesn't attempt to get the server's version on pre-init. Is there a good way to fetch information from the server pre-init, or is it much more sensible to just make the pre-init things more event-based and subscribe to a delegate for when things are ready? Would the game state ever replicate that property to the client, if it isn't changed again? Thank you!
The server and each client have their own game instance. So if you want to share data between the host and all connected clients then yes use the GameState because each game instance has a copy of the GameState inside of it. The server can then update replicated variables and clients will receive the updates.
If you want the host to have ownership over some of the variables then use GameMode as that only exists on the server.
Game Instance should be for things everyone needs to have but isn't related to sessions. Options menu, loading different levels, exiting the game that sort of stuff.
Game Instance is always in memory.
Apologies! Yep, that much I was aware of, I'll try and be clearer - the specific bit that I'm wondering about is retrieving information from the server on pre-initialisation of the client, and if it will happily receive a replicated version of the gamestate as soon as it connects, or if it actually might remain outdated until that property is updated on the server again. I hope that makes sense, thank you!
Well how can the server get info about a client before it has connected?
@hushed heart What information are you trying to allow Clients to know before joining?
Whats the purpose of this?
The GameMode has event OnPostLogin and event Handle Starting New Player (both are overridable)
Ah, I'll take a look at both of those lalwster, thank you! I don't need info about a client before it's connected, I need the client to make sure its instances of things like the GameState are identical before trying to initialise anything. It's mostly for testing purposes, but right now I have on my lobby screen some properties regarding how pawns should behave, which I can move to other points in the logic, but it'd just be nice if they were available from pre-init, ahaha.
It's like you have no game state whatsoever as a client before you connect to the host right? So upon connecting the engine starts to load everything, one of the thing it loads is the GameState and if you have replicated variables on there that were presumably changed from their default values via the host before the client connected, then the client's GameState will automatically sync the values (aka replication) from whatever the host has them set as.
The duration of that depends on network latency, and the amount of work it has to do and the net update frequency of the GameState and the GameState's tick.
Does Handle Starting New Player just bypass all the functions like choose start spot and choose pawn etC?
Handle Starting New Player comes with a Player Controller. I think if you just put it in there without connecting anything it will override the default behavior which is pick a Player Start and use the Default Pawn Class (as assigned by World Settings).
So yeah I think it does
I have mine setup so that I first set input mode to game only, then I find player start (with a specific tag) then use the transform from that for a Spawn Actor of Class and Possess using the incoming Player Controller.
I also call a bunch of other events relating to my game but as an example I think that's everything.
Also I think it goes Event PostLogin first, then Starting New Player after in that order.
Hey All: Rookie Question here.
I'm trying to go through the motions of having a dedicated server (just built from source etc).
I'm just playing around so I'll barely have anyone playing my prototypes, and wondering what the lowest barrier to entry to get a server hosted somewhere in the cloud. I know many game server hosting companies work for released games, but wondering about self hosted vs virtual machine somewhere etc. I'm using a Lyra template, so I know there are some services pretty easy to utilize, but I'm looking for the most simple solution just to start playing around.
I haven't reached that part of my multiplayer setup yet, but what I do have is an old PC so I installed Linux on it and plan on testing with it first before moving to a cloud.
That way I can easily transfer copies of the game via USB stick or LAN.
Hey that's cool thanks. Any tips on how you learned to do that?
A response like this isn't very attractive of an offer for someone to provide help (image at the bottom of this reply). Knowing the fundamentals will go a much longer way than just giving you the answer directly (even though I already have).
Based on how you said you "solved" one piece of the puzzle, it just tells me even more that you don't really grasp what you're doing. And that is okay. There is nothing wrong with not knowing/understanding. We were all there at one point. The issue comes when you just want the answer now, instead of building up the important knowledge.
Your HP update shouldn't be a multicast, it should be an OnRep most likely - that is if you want something to happen when the server replicates the value down to the client (most likely, you want to update the UI). Damage is if you're using the built-in damage system, it is only able to be executed on the server (when things are set up properly). All damage/health calculations should be done on the server.
The general process on how to do something is:
- Client does a server RPC to request to do something (say, pick up an item)
- Server verifies this is allowed and either processes it or rejects it
- Server then replicates (or does a multicast, depending on what you're trying to do) back down to the client or clients.
Which part?
Thanks for the information, friends!
The linux set up / build etc
Not sure if it helps but. Whenever I wanted to test my game back when I was using a dedicated server model, I'd simply host it on my own PC, or a friend's PC. Ensuring the port was forwarded, i'd just be able to have someone enter my IP, and use the execute console command open <ip> and it would connect absolutely fine and smooth! Worked absolutely fine for testing.
Ahhh I just used Ubuntu. You download a file and install it directly to a USB thumb drive then insert and reboot (go to bios) then install from usb. The ubuntu website has detailed installation instructions.
From what I can tell, Windows hosting on AWS is much more expensive than Linux hosting.
There is a service that I've been seeing pop up more and more frequently that might be able to help with personal dedicated server machines. ngrok
Thanks much
thanks for the tip! And that wasn't a listen server right? but a dedicated build?
Correct, dedicated server!
Doesn't matter if it is dedicated server or listen server
That's just how you let anyone connect to something on your network
Yep, it should work the same for both
By default - your home network doesn't let any outside connection in unless you give it explicit permission. This is done most often by just...connecting to something.
What port forwarding does is tells your router/modem that you want to let people connect to this port.
So people from outside of your network can freely connect to it.
some $5/mo beater DigitalOcean instance
or a spare laptop and Ubuntu
Thanks!~
Is this very dangerous for someone who doesn't know how to do it?
Hey thanks for this Adriel. I have an old crappy PC (i5 3ghz, 8g ram). Do you that would work with Linux? Digital Ocean is cool! https://www.digitalocean.com/solutions/gaming-development Is this what I should be looking at? Any tips on getting that set up?
If you're concerned you could always open the port, do your testing, then close it after so it doesn't keep you awake at night.
Thankx
But hey if its an empty linux box then who cares. It's not like you save your banking login as passwords.txt right on the desktop right?
Wouldn't that let them into the network though, getting more access to other systems on the network? Lol I'm a total noob when it comes to networking so sorry for dumb questions
Depends on how demanding your game is, but just know that as dedicated server it runs the GameInstance in a headless mode meaning there's no GPU rendering at all and you can use the Is Dedicated Server node to prevent it from loading any audio (which it can't play because there's no speakers anyways).
Depends on how the connection is setup I guess. I'm going to just have a single ethernet cable between my main dev machine and the testing server.
Really appreciate all the replies in this channel. Nice to see so much action around here.
So I can test via LAN. Then once I'm ready for other players I'll probably upload to a cloud somewhere because I don't know how well my internet connection can handle player data.
Just was reading this: https://unrealcontainers.com/docs/use-cases/dedicated-servers
Opening your network to outside access can be dangerous, yes. But that's just the nature of the beast.
Very true, there's a reason why cloud providers have been so successful. Ain't nobody got time for that!
Most game servers have much less cpu and ram per instance.
That'd be just fine
Wow really? I had no idea. Thanks
Hey dudes quick question is it best to play sounds in multiplayer using a rep notify?
Depends on the sound
Is the sound a one time sound like an explosion, then a Multicast is fine.
If it depends on something that qualifies as state, e.g. a fire that can be turned on and off, then it should be part of the OnRep of that state variable, e.g. bFireOn
Late joining players, or players that come into relevancy range, will get the OnRep update to turn on and off the fire sound, but won't get the Multicast anymore. Which makes sense because why would they need to hear an explosion Sound that was in the past
is there a way to change the replication properties of a Super replicated property?
basically call DOREPLIFETIME_CONDITION with different conditions in a child class
There is a macro for override
Your best bet is to f12 to the macro definitions and check what others exist
thanks
Is there any specific reason why lobbies can't provide informations like ping and similar till you actually join the lobby ?
It's just kinda confusing me as you can still find them through some kind of server browser.
While at it, is there maybe an workaround for that ?
Informationen about servers prior to connecting to them would be done through Sessions
You can add additional settings to them, such as current map, and you can display those in a server browser
They should also have a ping if the subsystem you use provides one
If you need more than that, then you can look into Beacons. They are a lightweight connection you can establish that doesn't require joining the server. They require c++ though and you still need to initially find the server
I should use Sessions, but afaik now (which isn't that much) i should use this setting here SessionSettings.bUseLobbiesIfAvailable = true; which is passed to the CreateSession function.
And from what i know now this is needed for listen servers, i should turn it off when using dedicated server
That's usually toggled via the Presence setting iirc
Which should indeed be off for dedicated servers
My information on that also comes from here https://docs.unrealengine.com/5.1/en-US/online-subsystem-steam-interface-in-unreal-engine/ under the Lobby Details section
What have y'all experiences been with implementing multiplayer for UE4 vs UE5? We're considering staying on UE4 for a bit longer but we don't want to start on multiplayer if it means migrating to UE5 later could cause problems. I assume most of the same logic still applies but I did hear they've made some improvements, I just can't find a good comparison
Yeah that's fine
The only thing I'm not sure about with that docs page is if it is using the new steam net driver or the old one
There is one called SteamSocket or so, which also fixes the 9999 ping issue
By default, it's basically the exact same
This here made me ask this in first place Unlike servers, no information about a lobby is available before joining, such as ping times or current number of other users
And also a quick test on my pc + gf pc where i didn't got the informations in my server browser, so it seems to be true
They are working on Iris which would replace the old system I guess, but that's probably far from release
Not sure tbh. SteamSockets def fixes the ping issue
From how i read it seems like it is intended
Lobbies are ListenServers right?
I'd assume so, but my term knowledge isn't great so far :D
If so then you should be able to get this information
One of our clients uses ListenServers
And we moved to SteamSockets for that reason
Hmm, i can only tell that it worked just fine on my local machine, but there i also had to use the NULL system rather than the steam system 😅
That's an important difference though:P
Null doesn't use sessions in it's traditional sense
Null just asks all PCs on the lan if they are hosting
Well, gotta play more with it then xD
Btw, any chance that you can recommend a way to quickly share a shipped version to the pc of my gf ?
Currently i've just put it on an USB which works, but this seems so insanely slow which makes me wonder if that could be speed up, somehow
If you're on the same network, just set up a shared folder between you two
I figured this would be the case, so you'd recommend just staying on UE4 then. No reason to switch to UE5?
That seems more reasonable, not sure how to set that up but i can find that out ^^
How is that what you gathered from that? lol. It's on you if you want to switch or not.
Obviously, it's just that there are plenty of cons for us to switch to UE5 now and I was wondering if there are any upsides on the multiplayer side. If things are mostly the same by default that makes me lean to staying on UE4 but I was just trying to verify. Was that so crazy?
hi guys, I am struggling with a request related to streaming a multiplayer experience. Up to how many people can be contained in the same experience? Using pixel streaming + AWS or similar
If the networking is going to be the same (which it is, barring Iris), and you have more cons than pros to switch. Don't switch. It's pretty straightforward. About the only change that I can recall is how you replicate Subobjects.
Which, if you don't care about that, nothing really changes.
Define "experience" in your use case.
That was really helpful. thanks! Seems like Iris is meant to be backwards compatible so we could switch to it further down the line (apart from the subobjects change)
It's going to be a minute before Iris is ready.
I wouldn't even think about it currently
hub and some minigames
Is the hub a lobby? Are you trying to have all hubs connected? MMO? Single session?
You can have however many players you want, you'd just have to optimize the networking. As well as linking multiple hubs together. Each "lobby" is one instance of Unreal.
the idea of pixel streaming and tech like GeforceNow fascinates me
all hub connected and yes should be kind of MM0
Are you expert in networking and server?
Yeah - that's custom networking territory. So the answer is however many you can fit with your custom networking.
can i send you a message?
No
Ok no worries. i just wanted to now more about custom networking, is a field i dont know anything actually
Neither did the Runescape people when they made Runescape.
wild
Blizzard didn't either when they did Diablo
wilder
And all of Diablo 2 was ran off one PC
nice
That was the entirety of Battle.net back then.
hahahahah
Now of course back then, it was much easier to deal with certain things.
These days...dear lord.
what do you mean? maybe that the context and tech in general has evolved a lot and therefore everything is way way more complex?
yes.
To do things "properly", it is way more complex.
Just the general evolution of programming, as well as the expectations of players.
ahhh I see
the player expectations are definitely something big, good point
Back then - it was super cool just to be able to play with each other across the net. Didn't matter that it was laggy as hell.
yeah ofc
Now it is, "oh, I have 20 ping. Trash devs who don't care about optimization"
Okay buddy, let me just fix the speed of light.
Don't have rollback in a competitive game? Garbage company. Dead game. blah blah blah
Did Diablo 2 PvP have rollback in PvP? Nope. Did people care? Nope.
and players expect that some feature from one game can be automatically applied to another
ye
Co-op all the way baby. So I can code like it is 1999 ❤️
hahahahahah
"Client said they have 300 health", Okay buddy.
They're a different breed anyway
indeed
Out of curiosity, what are your current cons to switching to 5? As far as multiplayer stuff goes, I would recommend it if for no other reason than getting the CommonSession stuff. But that's related to OSS stuff more than network code. There's also a nice suite or async stuff added as well.
Mostly just performance, as it's a VR project we've lost about a 1-1.5ms which isn't much for a regular desktop game but we're not getting anything back for it (yet) as we're on forward rendering so nanite isn't even an option and with deferred rendering you end up losing even more.
If a game is running and I plug in a new controller... does unreal create a new player right then and there? 🤔
The fast array serializer doesn't call the PostReplicatedAdd/PostReplicatedChange/PreReplicatedRemove serverside/with authority right?
does "PlayAsClient" actually make any sense? the description says, but it just feels like im on a listen server anyway
im having trouble testing my networked projectile code because my old pc cant run two instance at fps high enough to actually know if im getting decent interpolation or not lmao
Play as client is not listen server
Try without editor
and small windows
Look at these old launch bat files for examples
Can anyone think of a reason the client can see the server host character, but the server host cannot see the client character? Both are using the same character type.
How are you spawning the characters?
One sec, ill. SS it. Need to get back to my PC.
@dark edge
i think this is where. sorry, i'm not sure, still learning.
or do you mean the onpostlogin?
I mean wherever the client is getting their pawn
Why are you possessing a pawn that you already possess?
aw, so i'm telling it toactually possess the same....
i'll get rid of this and try it. i think it won't matter though, cause i added this after i seen that the server was not seeing the client character.
brb
I just read a forum post that confused me a bit... the server is the authority on a player's pawn right? not the client itself.
(the pawn being controlled)
and the client has an autonomous proxy
yea, it made no difference.
i got rid of that whole onpostlogin, didn't change anything..
Server is authority. Client is owner
that's what I thought, but in this forum post someone was saying that client is authority for it's own pawn
just wanted to double check
Yeah they just mixed up the two.
You need to be the owner of an actor to call server RPCs through it.
Typically that's playercontroller, pawn, sometimes a few more actors.
how does my game function then?
i have server only functions that actually work in Client setting
Funnily enough, someone mixed it up yesterday as well. Here is how I keep in mind who has Authority: #multiplayer message
@dark edge the spawn player function
this is where i'm trying to spawn the joining player
Why are you duplicating stuff that's already in the engine?
you can already easily get all playercontrollers etc
Also this
in the tutorial is said to plug it in there, and for some reason, it will not let me get from new player anymore..
There are no good tutorials
you're calling Spawn Player but not passing a playercontroller
but you don't need to do any of this
it's all built in
just override the functions you need to in GameMode
i don't understand. but. for context, i just tested it in both headsets. host now spawns +1 pawn. when the client joins, the +1 is all the server sees, and not the actual player. joined client still sees the host character bouncing rubberbanding and the other 2 pawns.
so i'm not actually possessing any pawns
cause as this thing looks, i should be possessing the spawned pawn
cause now the server can see the clients +1, but not him
but the client and see the server pawns just fine, minus the rubberbanding jitter
override which?
well yeah, look at what i circled.
you haven't hooked up the joining controller to that spawn pawn function
Thats what I'm saying, it won't actually let me plug new player in the player controller
I did change one of the cast though... but switched it back, then I could plug it in anymore
I'll fiddle with it. I am getting closer. I think.
from new player to player controller problem was my input reference. i changed it from player controller to my players controller. referencing the wrong one ( at least this will fix my allowed connection Problem.)
gonna test it.
I'm curious how without using get all actors of class (Player controllers) since I don't see a function for it anywhere?
There is a PlayerArray in GameState, and then it's as easy as doing GetOwner on each and casting to PlayerController
Aha! Found it! So there is!
I know lots of people re-invent the wheel all the time for what UE provides, but sometimes things can be hidden. I think I was mostly looking in gamemode and not gamestate for such things
Speaking of Re-inventing the Wheel: Do people use the Legacy Damage System and Damage Types in MP or do most devs use GAS or Roll their own?
There is nothing stopping you from using the Legacy system, though it is limited and I think in 5.x is either deprecated or completely removed?
when using seamless travel, the documentation says that the gamemode will persist, does it mean that you cannot travel to another map that uses a different gamemode??
No, it just means that it wont recreate the game mode if its not going to change.
ok thx
does game state a good place to store information such as how players have been kill in a game,global bountry system similiar to the one in fortnite?
Hey All i have a quick question that i can't grasp. So i have a player controller that stores a variable called "Target"
My server sees my player controller correctly, but that variable is always null on server. Any reason?\
how are you setting the value of that variable?
normally in the player controller
does the setting have to pass through a server event for the server to see it?
well yes, if the server never writes to that variable, it wont see the value
i was under the impression server is supposed to see player controller but other player controllers don't see other player controllers
basically think of server and client as if they were 2 different applications
just because you define a variable and write a value to it in ApplicationA, doesn't mean that value exists at all in ApplicationB
Server has a PlayerController for each player in the game, yes
but the memory on the server and the memory on the client computer are 2 different things
so they are not the SAME object
ok i see what you're saying
in fact in a real server/client scenario, they are in fact diffferent computers!
of course there is a connection between the two
so even though 2 computers have 2 different objects created, they share an ID
which is used by them to identify the corresponding object on each computer
ok so the correct course of action is to have a server replicated event on the PlayerController that will set that variable and then only use that event when i want to set the variable?
seems a bit roundabout but i guess it is what it is
so, even though you have a printed copy of a receipt, and I also have a printed copy of the receipt, they are different pieces of paper, but if we were to talk, and I want you to look at your copy of the receipt I'm looking at, I could tell you the invoice #id, and you can look your copy
now in your example
I could call you and tell you, "hey, remember that invoice #1234? Ok, I need you to write "DELIVERED" in the back of it"
(that phone call would be the equivalent of the client calling an RPC on the server)
keep in mind you can only call RPCs on Objects you are the owner of
(your Pawn for example)
now in case you are wondering, there's also "Replicated variables"
but all that does basically is that whenever the server updates a variable, it notifies clients automatically to update their values
but that only works Server to Clients, not the other way around
hope my analogy makes some sense 😛
yeah it actually cleared up quite a bit hahah
i appreciate the writeup 😛 Especially the replicating variable part. I couldn't find that info anywhere online actually
no worries
and if you think it's a roundabout, think about it this way
you don't trust your clients
so you dont want clients to be making any changes on your server
so what you can do, is allow clients to REQUEST changes, "pretty pretty please, can you update this for me?"
and then if the server is ok with that, it will update the variable for you
that's why replicated variables work one way, not both ways
yeah but all i'm doing is calling an event on server to update that variable but whatever i feed is what gets set
so there's not really any layer of security. At least not that i can see
not sure I follow
ok so my clientside function calls a serverside event
which will set my clientside(and now replicated serverside) variable
if you only need the variable client side, then there's no need to do any networking at all
no i need it on the server that's the issue
but if you want your variable to be visible to your server (and the rest of the clients connected)
then yes, the variable needs to be set ON the server
again, the client can't write to the server's memory, so you need to tell the server to do that write for you
correction, it will set the serverside (then replicated) variable
nothing replicates from clients
the only communication a client can send to a server (and then to anyone else) is through a Run On Server EVent
Yeah i've been experimenting with my issue , just got it working but yeah passing it from server to client is a pain haha
if I use seamless travel, according to the documentation the player controllers persist, does it mean that the begin play event wont be called on the player controller when traveling to a new map?
are things like Attach Actor to Actor or SetMovementMode (CharMoveComp) expected to be ran on the server? or both client and server? do they replicate automatically?
Actor Attachment is replicated, so you could only call it on the Server.
Movement mode is not directly replicated, but if the server notices a difference in end location of a single move, it will cause a correction which sends the movement mode along. Not ideal so best is if you change it on both sides, Server and owning Client. Simulated clients don't matter
I thought actor attachment was replicated, but it's not working properly
gonna have to debug
client side seems to lock position, not rotation, and after a while even the position flies away
I know for a fact that it's replicated, but maybe it requires ReplicateMovement to be ticked?
(this is a character that im not controlling (player entered vehicle))
Ah
Yeah not sure if characters have any side effects
Uncontrolled ones don't run the movement component unless you enable that
Not sure if that matters
can you?
that would solve some problems
Run Physics on bla
but yeah i noticed that the simulatedproxy code is way simpler
Something like that
doesn't do many things
ohh let me check
It should say something along the lines of Run + Physics + Unpossessed or Uncontrolled
the only reason im attaching the actor is because the floor moves
and when i unpossess it
the character just stays in the same world position
voila
awesome
Yeah or that xD
ok that worked
no need to attach the character anymore
it broke something else, but that's a diff story
xD
Wanna know something funny? You are by far not the only person to suffer from that checkbox
Even Riot Games f*cked that up :P
They have a Character that can control a Camera, which is also a Pawn (probably even hero, cause that thing could equip Weapons and shoot them lol). And while the original Character was unpossessed, it might have stood on a wall of a different Hero. When the Wall broke, it wasn't falling :D
lol
in my case it was very evident from the beginning, since the characters are standing on a ship that moves/rolls around
I like those little stories, cause they make it more apparent that even the big studios don't do everything perfect and struggle with the same things the small indies do
so as soon as i unpossesed it, it went flying the other way
oh trust me, aaa companies suffer as much or even worse
xD
Yeah, not sure how your Character would handle rolling of the ship
Cause the Character Movement Comp likes its up vector, but maybe that's actually not a problem
already got that covered, got an arbitrary gravity axis
Very well
and I abuse the "base movement" part of it
basically hacked it so it always has a base movement component attached to it
well, unless you float away from the ship
it still has some issues, like compensation when landing
seems to unsync a bit from the server
but it's barely noticeable in normal ping
Yeah some time ago I had a client that needed Hovering Drones to drive on walls and ceiling.
I rewrote the CMC for it, so I can have any given Up Vector (based on surface).
Was in the end a lot of work but also went around the CMC's limitations.
Can't suggest doing this though, wasn't fun.
hehe
yeah I'm learning that the hard way
although for now im deriving from the base charactermovecomp
and just overriding methods
but it's annoying
i WANT TO DELETE THE SWIMMING CODE
not "disable" it
😛
I guess I could have a swimming pool inside the ship for relaxing purposes...
Well, you never know if you ever land on a planet with some hot tubs
true xD
Is there some tutorial on how to properly work with IOnlineSessionPtr::RegisterPlayer/IOnlineSessionPtr::UnregisterPlayer ?
I'm not quite sure how to actually work with it, i was even surprised that this doesn't happen automatically when joining (and also leaving as i assume) a session 😅
I feel like replication is disable when I make my actor hidden and no collision
🤔
oh nvm, AActor::IsNetRelevantFor returned false, epic optimization hah
else if(IsHidden() && (!RootComponent || !RootComponent->IsCollisionEnabled()))
{
return false;
}
Hey everyone, I've just started learning about how multiplayer is implemented in unreal. So first of all wish me luck, second of all I'm wondering where I've gone wrong with this blueprint because I'm clearly missing something. I'm trying to spawn a cube for all clients when a single client presses a key. My understanding of how this should work is 1.) from the character controller if the client presses the key then request that the server spawns a cube 2.) from the server tell each client to spawn a cube locally at a certain position. Below are my blueprints. But so far if I try spawning the cube on a connected client then nothing happens and if I spawn the cube on the server then it spawns for everyone
Correct, but you are requesting the client to spawn it instead of the server
So your wording is correct
Your code is not
Just make it a server RPC instead of a client RPC
Which part should I make a server RPC?
How many RPCs do you have?
Ah well you have 2
The one in GameMode is meaningless (considering GameMode isn't net addressable)
Just make it a normal event
The one in PC make it server RPC
Thanks, but now if I press the the spawn key on the client it still doesn't spawn locally but spawns on the server
Right because that's what we told it to do
Now make the actor replicated and you're done
BP Replicate bamboozled me into thinking it's replicated
Oh intresting, that makes sense, I just didn't realise I needed to check that box. I had figured that the server would have to call a custom event I made on each PC to spawn the cube
Another question I have then is it ok to create a server replicated event that lives inside a client blueprint like the PC? I understand that the game mode lives on the server so I thought I had to put all my server replicated events on there
If you dont care about the object being replicated and you literally just want to spawn the object locally for clients the PlayerController is relevant for then you use Multicast
Server RPCs generally live inside Actors that are owned by the client, with those usually being PC, PS, Pawn
GameMode is server only exactly as you said. That's why it makes no sense for RPCs to live inside it. There is no form of two ends that you need to transition from/to
I see, and I had originally tried a multicast event. If you take a look at my screenshots again inside the game mode I have a multicast event which spawns a cube, but that didn't work
Right because the Multicast is an RPC and it can't be inside GameMode
It could have been inside the PC for example
Again with the other event fired from input being a server RPC
Sticking a multicast on a PC seems a bit superfluous. Might as well be a single-cast as it's onyl going to 1 player.
Well, one player and probably the server that executes it.
Damn right, on PC multicast == server + client RPC ^^
If anyone may have some insight, it would help. I am trying to get a ship to move, but when I load the game in client mode, the ship just floats stationary. I've written a custom C++ transform replication component which is working fine, but the movement doesn't seem to be working. If I load up in standalone or listen server, it move perfectly fine.
Some context: All ships are owned by the server, replication is on but replicate movement is off. Custom transform replication (location & rotation replication) is on. Physics simulation is on for the server, off for the client. The ship updates location & rotation excellently, but it does not move.
TLDR; Server controls ship location, rotation & movement. Location & rotation is replicating flawlessly. Movement does not happen on clients.
And here's what it's showing during play
Well you are adding movement on the server (on authority) but not on the client, and you have replicate movement turned off
Why would movement be replicated?
It's moving on the server, thus the location would be updated and replicated through the custom transform replication component.
Transform is replicated, but it's not set on the client
Add Movement would need to be done explicitly on the client too in such case
Unless you turn on replicate movement
But then I don't think you need to replicate transform or any of that
I opted for transform replication because the ships were choppy to anyone who wasn't the owner of it, which made multiplayer completely useless lol... I'm checking into my server->client routing, because now i'm curious if something's not communicating correctly. If I cna't find it, I'll screenshot my replication in C++
Yeah replicate movement has by no means smoothing or any of that
I think I may have found it. I missed a NetMulticast designation in my UFUNCTION.
Ah and if my memory isn't failing me floating pawn movement component has no network functionality
Unlike CMC for example
That would be part of the reason why it was working before I tried going the transform route then, lol.
Still waiting for WC's review of the GMC
My thought was if the movement works on the server I can just replicate it via the transform variable. Looks like I may have forgot to Multicast a couple things though.
Well I did one 😛
I do sometimes wonder if there is merit to having just a really lightweight MC. Like, think FPM...but with gravity and basic network stuff
Yeah could be something networking related that you forgot to do
Well - how would I know!? You got a job and now you're too good for us 😭
Soon, you're going to go the way of Kaos 😭
Yeah literally that. Makes me remember myself when I read through the CMC and wonder why they did things the way they did them.
Maybe I will never know until I write my own ^^
Ugggh - work
That's the thing that stops me from doing it
(And CMC works fine for me, lol)
But well I'm still writing articles. Damn it, Kaos writes them too (not an excuse)
By the way recently I discovered that Root Motion is totally broken on clients in 5.1
Because of course it is
I was faced by such bug at work, and it's fixed in 5.1.1
Must love it when you have to make sure to update for the fix to come in
Today that I realized that Unity has it too, and has the same name XD
Has root motion?
Yes
If so - well...yeah, that's just the name of the technique
Unless I was bamboozled by unity ads
No, it has it.
Root motion isn't something that is exclusive to UE. Pretty common way to author animation
In the making ladies and gentlemen
wow nice
Tip: Stop trying to do stateful changes with multicast
Am I hired?
That's tip #10
I will take the chance to say that I will have a live talk at #notGDC this year about it (will try to cover as much of it as I can)
Hope it's not during the same time as Epic showcasing Verse, lol
they'll hate me when I write articles about our RTS networking
wow is it recorded? will we be able to hear? 🥹
Yes it should be ^^
A call to FObjectReplicator::ReadyForDormancy is returning true and letting the object go into early dormancy despite there(seemingly) being outstanding acks for that channel.. at least according to the client who hasnt received his replicated property.. is there some caveat with this system that I'm unaware of?
I went from trying to replicate a transform variable to just multicasting the transform data via multicast every tick. It's working perfectly now. Apparently, there's some kind of issue with replicating a variable, versus just sending multicast events.
Since ships will be moving literally fractions of a second during the entire game session, because of waves, it's probably no big deal to do one over the other.
The variable/transform you replicate, do you come to set it on client (aka SetActorTransform or w/e?)
I was using OnRep_TransformAuth(), with C++, which would OwnerRoot->SetActorTransform(TransformAuth), but it would never be received. Or rather, would get received but do nothing.
I ended up doing Multicast(loc, rot, scale) and it's working, or so it seems
happy party noises
basically, version 1 was set transformAuth on the server, multicast to clients. Version 2 was just nuke it by sending a multicast event every tick.
version 1 was multicast replicate to clients
Unless I'm misunderstanding you
Unless something very internal to SetActorTransform that is failing, I have no idea why that would fail
No that sounds right. A replicated variable to all clients.
Make sure the multicast is not reliable at least
Yep, unreliable.. Not gonna open that can of worms 🤣 It's sent so fast anyway that it doesn't make sense to handshake. If you miss the update you'll get the next one.
I asked this question in C++ and then I realized maybe it is better to be asked here since I am working on the multiplayer aspects
I've been trying to learn more about the character movement component and one term that keeps getting thrown around without explanation is that it is a "safe" movement method / action. What does it mean that it is a "safe method" or that "I can do this because it will only ever happen in a safe movement"?
Does "safe" just mean that I store it in the custom FSavedMove class and set it up in PrepFor and MoveFor methods?
we do mostly the same for the movement updates in our RTS
I think movement sync is one of those cases where multicast is justified over replicated state
due to the rapid changing nature of the value, and the time-sensitiviness nature of it
how use the unreal engine for Steamcore multiplayer setup which is non-region locked?
Blueprint Runtime Error: "Accessed None trying to read property ShopWidgetRef". Node: Add Shop Items
Why does this error comes only on the Client
Im calling AddShopItems() after the player collides with it so why is ShopWidgetRef empty? I dont get it
It sets the Widget in the end of BeginPlay just fine but can't get the target for AddShopItems
During simulation:
The only thing I can think of is that you need to run AddToViewport, or it may be getting destroyed in the background. Not really a multi-player issue though.
But it only happens on the client
Widgets don't exist on the server
Playing it as the listen server and standalone works
There's something else going on, but I'd still add the AddToViewport call. Maybe just create the widget after SetShopItems instead of BeginPlay, so it's created when you need it? I'm guessing something is wrong with how you're creating the actor or whatever this is that's creating the widget.
Widgets are client sided so if it works on the listen server it'll work on the clients, unless something is wrong with the actor that contains the widget you're making.
Ok ill try stuff out. The widget is is attached to an actor which is in the world from the start and the widget is rendered in world space
Or so you expect 😉
Also make sure your widget isn't removing or destroying itself if something is invalid. If it works on the listen server and not the clients, you may not be replicating a variable and that's causing your widget to self destruct.
Too many possibilities, but it's not the widget in and of itself
ok ty
Hi all - happy Saturday!
I'm a rookie building my first dedicated test server today and have a question about the best way to set up access.
I'm under the sense that a client can connect to the the main server over the console, but not sure if that functionality crosses over networks.
Also I see the LyraGameEOS in the VS solutions, and wondering if that's something I can be looking at if I'm just goofing around and don't have a real game yet?
Any general tips on this first hurdle of getting a dedicated server going for testing (and the easiest way to do it) would be amazing.
Sure, just type open IPADDRESS
Dumb question, i guess its completely implossible to programm, but is it possible that i have multiple dedicated servers that serve one single level on the entire world, and every of these servers serve a little part of the map?
i guess i have to overwrite the spawn point of the player when a player joins one of these servers
Probably technically doable but that's one of those "If you have to ask...." questions. It'd take a BUNCH of work, and is probably close to impossible to make seamless.
thank you, i just wanted to know if that is technically possible
To be honest, if your game is too heavy for 1 server but 4 can handle it, just make it able to be handled by 1
if it takes 400 to handle it, then it's probably worth doing. But you're not going to do that, that's 100M budget territory probably.
i have a concept for a game where every player in the world plays on the same map
and a single unreal dedicated instance wouhld never be able to handle this
so i came up with this split idea
Everyone playing Mario 64 plays on the same map
like in multiplayer?
yea but i mean that every player is connected to the "same server"
Yeah that's not gonna happen.
That's basically EVE, Starbase, maybe a few more. Big operation.
thanks for your answer 😄
Leaving signs etc like Dark Souls is a bit more feasable, but it's still a big operation
I mean if 10 people in the world are playing your game, sure
100, probably not
1000, no
1,000,000, hell no
Has anyone done a seamless server transfer or join in Unreal 4/5 yet?
I can't think of any
Pretty sure I've seen external solutions to handle something like that, but that's basically skipping unreal's networking entirely.
If there's a simple way to do it I'm all ears, I'd love to have that for my roguelike
We're trying to have zero cuts from startup to shutdown
right now the only hard cut is on joining another game in progress
host has zero cuts, standalone has zero cuts (it's basically a host with zero clients)
Full screen teleportion FX it is then
Teleportation is a thing (like diablo town -> dungeon loop), so as long as it's consistent and it's not obviously different from a teleport from base to dungeon locally it's fine
joining a game is teleporting from your base to theirs
tell me pls, how it is possible at the same time, and how to fix it?
Have you seen this? https://ims.improbable.io/products/spatialos
@sinful tree @hushed mauve take a look
Hey thanks! Will that work across the internet? (Like to my friends house in another part of the country?)
If the host has forwarded ports yeah
but if you're targetting Steam get steam sessions working asap
Hey you mean targeting Steam like for other people to play the game?
for me for the next month or two it will just be me and a friend.. would be more cool to just connect direct to the host. Should I just google 'port forwarding unreal game server'?
Any general tips for me on how to get that set up?
ok I'm still seeing some oddities with replicated physics... I have an actor with a static mesh component, I set it's physics linear velocity to 15000 on the server, and then I'm printing the velocity on screen, both server and client and I see this:
Ignore the other values, the ones that are the velocity are the ones that have 15k on the X axis
the velocity on the client jumps around 15k, on the server it's 15k spot on.
there's no linear damping, the velocity is not being set or changed anywhere else
Still learning replication, and was wondering if uobjects are not replicated, what if they are used as a variable in an actor? Like I have an actor that is replicated, and then I create a variable of type uobject in this actor. Will this uobject variable be available on the replicated actor?
uobjects are not replicated unless you do it yourself in c++
Im trying to make a holy ground effect where no one can walk inside but the player who creates it. Would be easy in singleplayer, but it doesn’t seem possible in multiplayer.
I’m doing it with sphere colliders, but there’s no way to designate who can go in and who can’t, I can only set collision channels. For example, on the server I can only tell if I can go in or not; I would have no way of telling Client 1 he cant go into Client 2’s zone
Ignore actor when moving
When anything with a movement component is moving I'd guess.
Just calling that locally everywhere should do it.
You are a life saver, it worked. I was Ignore Actor When Moving on the sphere collider and not the Pawn w the Movement Component T_T
Which, in hindsight, is very dumb
ok there's definetly something very wrong with the default physics replication 😐
anyone knows where in the engine code the physics portion of the staticmeshcomponent is handled? I'm assuming it must be a more generic physics body being used somehow
but I can't find it
hey all - I'm SO excited - just build my first dedicated sever and game. Ran the server on my own PC and started two games, then alt-tabbed back and forth (using the ~ connect local thing). I just tried running the server on my PC and connected on my girlfriends computer (different machine / same network) with no luck.
Anyone have any tips on connecting to another server on machine on home network? Does Connect 127.0.0.1. not work to other machines on home network?
127.0.0.1 is your local host ip
Thanks.. So that's on my own computer right?
Meaning my girlfriend would not be able to connect from her PC by punching that in? Any tips on how I might do that? Is it the same process on a local network as outside local network (ie. port forwarding router stuff -- way beyond my skill level tonight)
you need to know the ip of the machine you want to connect to
local network doesnt need port forwarding
that's when you are exchanging between LAN <-> WAN
What makes you say that?
Physics error correction in project settings btw
yeah we already went through that
I tweaked em
but there's still something weird
I'll explain in a min
so I made a similar sample as the other day, basic actor (not even a pawn now), static mesh component. Simulate Physics = true. Replicates Movement = true. Component Replicates = true. Linear Damping/drag = 0
on begin play on the server (authority switch) I set the velocity of the player and the test object to 15000
and this is the result
if you watch the logs or the prints on the top left
the server's velocity is stable at 15000, which is what I set
the client's velocity jumps around
which induces that jittering motion that's noticeable
(I assume)
(lol, I jsut realized that it recorded the music too, sorry about that)
listening to that dune soundtrack
good ear 😄
The issue with your netcode is the platform is de syncing your velocity
from my experience I've seen the character movement component have some code in there to handle moving platforms for networking
the platform is not the one moving
the big white cube is the one moving
also my character is in flying mode, so there's no based movement, and the character has the correct velocity 15000 constant.
ah
the velocity im printing is the velocity of that white box travelling at the same speed than the player
what Im thinking is that unreal doesnt really sync the velocity/angular velocity
but calculates it on the client based on the position delta / rotation delta
and that's why it's not exact
Have you tuned your physics replication settings?
There's a bunch of tunable parameters there
I have a replicated Struct (FGameplayEffectSpecForRPC, from the Gameplay Ability System). The first time it attempts to replicate (set value on server, call rep_notify, nothing crazy), I get an error, the connection drops and the game restarts.
However, from there, further attempts of replicating the struct work just fine and everything seems to be normal.
Why is this failing the first time and then from there, everything is okay on future attempts?
This is the error:
Error LogRep ReceiveProperties: Invalid property terminator handle - Handle=3839
Error LogRep RepLayout->ReceiveProperties FAILED: NinjaCombatComponent /Game/Maps/UEDPIE_1_Lab_Combat.Lab_Combat:PersistentLevel.BP_Battlemage_C_0.CombatComponent
Error LogNet UActorChannel::ProcessBunch: Replicator.ReceivedBunch failed. Closing connection. RepObj: NinjaCombatComponent /Game/Maps/UEDPIE_1_Lab_Combat.Lab_Combat:PersistentLevel.BP_Battlemage_C_0.CombatComponent, Channel: 3
Also, what should I look for (or how do I debug) this type of error?
(btw, my assumption of why it works on further attempts is because I presume I'm actually running "locally" and not as a "client" anymore, but please correct me if that's incorrect)
I don't see any parameter for "dont screw with a simple linear velocity" 😛
the only thing I'm thinking of doing is just storing the velocity on a replicated variable
and forcing the velocity on the client side
but this is very very lame
for seamless travel, will the begin play be called for player controllers when they enter the final destination map? ie, since the controllers persist, will they call begin play again?
You don't see the velocity correction coefficients etc?
yeah, makes no difference
Works on my machine
is there a difference between Set All and Set ?
if there's only one body, doubt it
it takes about 4 seconds to sync up perfectly but it does sync
You gotta remember it's simulating physics everywhere, the replication is just to bring things "in sync" so to speak
ah so you do see it jitter at the start?
I'm just printing velocity but my first velocity is about 14960
are you moving the camera/player WITH the object?
cause I also saw that it synced but when the object goes far away from the camera
im assuming it has something to do with net relevancy
if you stay close with the object it never syncs
(probably the client doesnt even bother extrapolating when it's far away)
I checked Always Relevent and yeah it's always 40 off
yeah velocity appears to never be actually replicated, just derived from positions
What are you actually trying to do gameplay-wise?
Most replicated physics mechanics don't just rely on one boop on the server then everything just going with that
Setting Linear Velocity Coefficient to 10 makes it much much tighter
prolly worse if you're constantly changing velocity tho
Anyways, the physics replication stuff is meant to "square up" server and client simulations, not necessarily to just have sims run on server and appear on client
you should sync stuff like VelocityTarget etc
If i put linear velocity coefficient to 1
I want the player and his ship to be moving, and not having a visible jitter between the two
I think im gonna replicate the velocity myself
I did a quick test and it works way better
I got stuck for several days now on something dumb and perhaps my solution itself is part of the problem - I want my capsule component to match my character mesh somewhat closely during animation (mainly jump/land atm). I've made a 1s long timeline with a curve from 0 to 1 that I then use in cpp w/ variable PlayRate to lerp various values for mesh offset and for halfheight, the timeline is triggered from movement mode change, thus there is no replication for the timeline. The opposite value of the mesh offset is added via AddActorLocalOffset to not sink visually. I got this to work very smoothly on the controlling player (by also running this on server, otherwise the mismatch would cause jitters) and the capsule matches the mesh nicely. However the issues begin once I connect another client. In my current iteration they see the jump to the same height correctly (the AddActorLocalOffset is not called on remote players so that gets replicated from the server) but don't have the mesh offset, despite setting it within the timeline on their end too. If using SetRelativeLocation_Direct, it does nothing for the remote player at all. If using SetRelativeLocation, the offset is correct until the timeline ends, at which point it bounces back. From doing some logging the mesh comp RelativeLocation seems to locally reset every frame on remote player despite changing on the server and local player just fine. I do not have replication on for the mesh component either so I'm unsure what causes this reset? (Did try having the mesh comp replication on but it didn't replicate the offset on the server, maybe I missed some setting for that)
Perhaps there was a better/simpler way to handle this all along and I just went down a wrong rabbit hole? 🙂 Perhaps my approach may bring some unwanted side effects later I'm currently unaware of
anyone know a guide or video on how to set up EOS for android? if so do let me know it will be greatly appreciated
this is the code I am running but on the overlap it seems that it increments coin twice, why?
even with 4 servers it increments by 2
also how can I do something like this to rotate the numbers? since the components rotation replicates by default it looks like I cannot
wdym 4 servers??
3 clients with 1 client running as a server I meant
ahhhh 😅
is the overlap happening ONLY in the server?
have you debugged it?
it
it's happening on every client
but idk what that means
do I just use authority switch?
well
if you have an event happening in client + server
it is likely that it is duplicated
so that is why it increments by 2, most likely
server adds once, clients adds once if that makes sense
ok yeah that makes perfect sense
so either do it server-only with an authority switch
or do it on both sides, but then you need to implement reconciliation when the server sends the update
how would I do something like that?