#multiplayer
1 messages · Page 690 of 1
indeed, whihc is why I wouldnt use a listen server for a game where there is competitiveness
its just a fun game to pass the time, and i thought it would be neat if there was a multiplayer gamemode where you could invite your friends
and I also wanted to learn about it quite early in the project's life cycle because I don't want to launch promising something I cannot deliver
Yeah that's fine, What I'm saying though is the same rules still apply. The client will still have to replicate to the server. (Most likely in the game mode) that it has beat its assigned level
thats fair, i can explain in more detail what I aim to do if that would help
It would
I understnad a bit about replication and all that, because the client needs to check if it's instance matches what the server says is happening
basically, I want a gamemode where you load into a lobby, that can accept up to 4 people from a steam invite, from there, you can choose a map and a gamemode to go into, when everyone is ready, you load in and complete the level, and then you return to lobby
now I do see an advantage of having a dedicated server, because it means I could make lobbies where you can find random players rather than just friends
You dont need a dedicated server for that
but that would be something i'd have to rent because the security issues and legal issues of setting up a server at home to handle that is not something id like to face lol
wouldn't it possibly cause security issues to be able to have random people connect to a server hosted on someone's pc tho?
or is there protections surrounding that
No, not really. Plenty of programs and games use listen servers
I would avoid dedicated severs if you can, especially if you’re making a casual game. They are expensive / time consuming to host 😅
how would you go about showing someone a list of lobbies if you use listen servers though? Because it would be impossible for one person's game instance to know how many server's there are surely?
Because youre connected to a subsystem
I feel you there, I have experience with how painful dedicated servers can be
What you're looking for is listen servers with session hosting.
Onlinesubsystem
oooh ill have to look into that, that sounds quite good
What I'm confused on is what you want to accomplish by writing to the game instance for clients?
oh no i dont mean game instance, as in the physical thing in unreal, i mean the instance of the program that is open on someone's computer
I take it, since I will be working through steam for this, that the steam online subsystem is what i'm looking for
i would be surprised if it isnt
For example Steam provides a system for this for players on their platform, they keep track of ‘sessions’ so others can connect. The drawback being in this case that if you are on multiple stores you need different solutions as it won’t support crossplay. Epic has a crossplay system but I’m not too familiar with it 🙂
It is what you want. That's what will allow you to connect to or find other players
I dont plan on releasing on any other stores tbh, or porting because that sounds like a lot of headache, and yes, the online subsystem session interface is exactly what I'm looking for, thank you
Ah the good ol' days of Gamespy looking for TF1 games... or the original Counterstrike games...
I'm kinda sad I missed out on classic Pc experience, my time was a mix between 3D pinball and PS2
was a console player for a while, only got a PC for gamedev
thanks that solved my issue
I'm spliting screen with the Create Player node on Begin Play of the level BP and saving that reference in game instance when I open a new level and check the game instance the variable returns None in Begin play on level BP ... Any ideia?
Saving what reference?
the create player return node
I'm not sure if player controller references can exist between level changes just like you couldn't save a reference to an actor in the game instance.
Best you could maybe do is store whether or not there is more than one player in the game instance, and then recreate the player controller after the level transition.
so how can I remove one player, cause If I redo the create player node it will make screen split in three
Ok, so it looks like the game will still remember that you have two players, it's just the old reference goes null.
It's probably recreating it for you automatically.
yeah, but when it loads the camera is in weird position, so I thought I could fix by possessing it
but without the reference I cant
I am just starting with replication, and I'm running into a gap in understanding from previous networking systems I've used- is there mechanism wherein a client can have authority over the position of its character controller but the server can constrain it such that "impossible" behaviours don't occur? For example, enforcing a maximum movement speed by rubber-banding the player back if they exceed it, to avoid cheating
Does that happen when you load into the same level?
no
Client-authoritative movement is something you'd have to write yourself. ACharacter and UCharacterMovementComponent are server-authoritative with a fairly complex client prediction framework that accounts for small mispredictions and lag without rubber-banding.
It wouldn't be hard to do client-authoritative movement, you'd just have to echew any of CMC's networking.
I'm going out on a limb here, but I think you may be using incompatible game mode / game state. If you use game mode base (or child thereof), you need to use game state base (or child thereof). If you use game mode, you need to use game state.
Ahhh, okay- I assumed that the character was client-authoritative with server-side enforcement of constraints
this delete, so Im going to create a new one at every level
I'm used to first-class prediction, wherein roughly the same simulation is run on both sides, and while the client may be "authoritative", there's a threshold condition wherein the server will override it and force the client's state to the new state, or "fold in" the client's close-enough value
That's basically how this works, but I wouldn't describe that as client authoritative. The client is at no point just telling the server what position it is in.
The client sends the moves it is making and runs them client-side, the server runs the same thing server-side. If the server disagrees with the result, the client corrects its simulation.
So a call to HasAuthority on the controller would return false for the client, under the "normal" setup, then?
Correct.
This prediction layer- I assume it's working by RPC'ing inputs instead, then updating itself to guess what the result will be?
Basically. It's not RPCing the inputs directly but that's the simplest way to think about it.
It's a series of saved moves that are sent to the server.
The server plays them back, if it works, the server allows the movement.
CMC is annoyingly complex... at some point it'll probably be torn apart and simplified when the new network prediction plugin is ready.
If it doesn't it corrects the position.
There's a small bit of documentation on how CMC works here - https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/Networking/CharacterMovementComponent/
It surprises me that it doesn't do this as a first-class system, but it probably allows for more fidelity on speed-of-light compensation and chrono-shifting replay
Prediction isn't a first-class system because it's both very hard to get right and also not super generic for any game. That'll change a bit once the network prediction plugin is finished.
In the meantime, CMC's prediction is pretty robust, it's just super specific to its own use.
ooo, that sounds exciting - I imagine it'll expose a threshold predictor system for non-speed-of-light-corrected predictions and then give a framework for organizing something like the builtin CMC in a modular way
The work on NetworkPrediction can be seen on github.
It’s very similar to overwatchs prediction
From my understanding
In the sense of sending inputs
Also, the gameplay ability system has its own prediction system
not complex enough for character movement, but it works well for abilities
And doing stuff by frames
I've not played it, due to its association with Blizzard, so I'm unfamiliar- sorry ^^
The gdc talk I’m pretty sure talks bout it
In this 2017 GDC session, Blizzard's Timothy Ford explains how Overwatch uses the Entity Component System (ECS) architecture to create a rich variety of layered gameplay.
GDC talks cover a range of developmental topics including game design, programming, audio, visual arts, business management, production, online games, and much more. We post a...
Idk how to not show previews on mobile
thanks- I'll check this out in the morning ^^
Prediction is easy, it's rewinding characters for projectiles that gets tricky
have you guys actually implemented rewinding or are people just kind of trusting the client and checking that the target the client thinks he hit isn't more than x distance away and the hit location is within client line of sight
Yes
But you don’t « trust the client » you checking those things on the server
i just mean you trust the client as far as allowing them to send you "i hit this guy at this location" and then rather than rewinding to 100% check that the hit actor was at that location at that exact time, you just check that the location isn't absurd and the guy could've been there based on where he is now
It depends on the game... there are absolutely games that do full rewinds.
i know, im just wondering if you guys in this discord have personally implemented full rewind
and if so how much work was it?
i can't wrap my head around how to get animations synced up perfectly, but i haven't actually tried it yet
That sounds like an insane amount of work for very little benefit IMO
i just mean if your hitboxes are tied to the skeletal mesh, you'd need animations for the rewind to be accurate, but i agree that sounds like a ton of work
i know valorant does that but i wonder if smaller games have bothered or if thats something you do for AAA esport titles because you need that fidelity and otherwise dont bother
Most games don't even have animation phase synced. Sounds pretty rediculous actually. It's not like heads move that much in a run cycle.
There's a very specific set of games that absolutely do. Any tactical shooter (CS:GO, Valorant, R6 Siege) for example.
Honestly, most competitive shooters probably do.
You just rewind the hitboxes themselves lol. Animations are a result of movement, within reason they should be similar, so long as the movement and any actions are also predicted
I only save hitbox location/rotation for rewind, don't bother rewinding full pose, I don't remember the precision but think they were compressed without any, or 1 point at most, felt flawless
I don't want to share my solution for rewinding characters being hit by projectiles because I feel like there are a million ways to approach it and I don't want to put my solution into anyone's head to distract them from a better way 😄 I'm not happy with it at all, even though it was 'good enough'
I've done half rewinds before and it wasn't trivial, doing full rewinds in UE is kinda tricky because it tends to imply that your simulation runs somewhat deterministically and that the animation state is always going to be synced perfectly to the server, Animation blueprint just isn't really designed that way, however what did end up working well enough for me is to build a pose timeline from snapshots, and then you can just rewind locally, as long as you don't mind that the animation part of the rewind is client authoritative then it works okay
Valorant has a pretty good vid somewhere explaining how they did their rewinding, it's likely out of range for anyone without a big team since they made some pretty big edits to the engine but worth looking at still
Is this fix still required in the Engine source in order to build a dedicated server in UE5? https://forums.unrealengine.com/t/how-to-package-the-game-with-server-target-setting/232377/11
I’m guessing your symptom is “the game still launches a GUI”? I believe the instructions from @Eqric should be updated to also include the -noclient argument. Here are my changes that gets me a headless dedicated server (which uses -server instead of -dedicatedserver; they are aliases): diff --git a/Engine/Source/Developer/DesktopPlatform/Priv...
I don't see an answer to a question I have: I am trying to make an exploration "game" for my son. Think 'Universe Sandbox2' but where you can land on statically generated planets and moons and explore them. Currently there is no other mechanic. But I cannot find a white-paper or even a tutorial on how to attack the issue of map size, where in essence it needs to be partitioned across servers to allow for n-number of solar systems. Assuming that no single server could handle a dozen players with a map size that encompasses a galaxy of solar systems. Anyone have any pointers or thoughts on this?
This is not really possible in Unreal without a lot of work. There's no way to transition players seamlessly between multiple servers. Its also one of the most difficult types of game to make, so ideally you could find a way for it to work local coop or session based.
If you must make something like you describe then a system like Improbable is likely your best bet.
Hello guys, so when I run the test multiplayer server, and I put in the constructor of my playerController a print of the PCs names: I get printed at lunch, MyPc0 created, MyPc1 created, MyPc2 createed ( with 3 players and the listen server mode ), issue is, when in game I print the PCs names of my pawns, I get MyPc0 for all of the pawns in game, wether it's on the listen server/client1/client2 and I get the getControllerId = -1, I don't understand why, as the constructors are rightly called for 3 different PCs at lunch, maybe locally every PC consider himself MyPc0 ? Shouldn't they had least have their identifier different, given on connexion ?
The latent issue, is that I try to access the class variable of a certain client PlayerController by making an RPC from that controller and giving a ref of the controller in the RPC arguments (using "this" in the playerController class ), but this only works on the listen server because it seems he is the only one that is giving the right reference to his own PC in the process, I feel like clients are giving a ref to the PC of the listen server too, there must be something I'm missing ?
thanks - not the answer I wanted... but you are re-enforcing my current understanding. will make this more hardened and hopefully will make APlayerController::ClientTravel or UWorld::ServerTravel work as I am wanting
Does PostLogin for the server run before BeginPlay?
One way of doing this would be to connect the player to those different servers upon transition. So the spacecraft could have a landing sequence. But if it's supposed to be fully player controller movement, with a transitionless movement between space and planet surface, that's something you're not going to be able to do the way you described
I'm creating a map of spawn point to playercontroller in the GameMode at BeginPlay. Then assigning the spawn point to PC at postlogin. works fine for client, not serve
In multiplayer, every client sees themselves as PlayerController 0 as player controllers only exist on the owning client and the server. Other clients do not get references to other player controllers.
In your situation as you're running a listen server, one of the clients is the server, and so, they would see multiple player controllers.
Typically it's best to avoid referencing player controllers by ID in multiplayer games.
@wary sand also good to not get into the habit of using the constructor, use BeginPlay
OK so I fixed it in a slightly hacky way by creating the map during postlogin as well, but if anyone has a better soln pls lmk.
Kinda silly that login is being called BEFORE beginplay
It's probably something that is happening simply because of how play-in-editor works and the client is joining at the exact same time as the server starting. If it was an actual server, the server would likely be running well before any client joins.
Hi thanks but I'm referencing with 'this' a.k.a *myPC not by id in c++
Well the rpc works for the listen server, and is also triggered on the clients but when clients give their pc to the server it seems their pc is not rightfully initialised ( inventory variable ) is null
Well the clients are doing fine, its the server (listen server) that calls postlogin on itself before beginplay
When I try to connect to my dedicated server, I successfully join the game but for some reason I can't seem to be able to do any inputs. Any idea on what could be the problem? I don't have any issue with the "Play as Client" option in the editor.
Hey people, is there anything to worry about array inside array in terms of replication?
Let's say I have a MyItemsArray and I do something like this: MyItemsArray[2].AttachedItems[7].Durability = 3.0f;
Would it update the entire MyItemsArray[2])?
eh
you accessing the item at 2 in MyItemsArray, then accessing an item at 7 on its memory to set durability
so what do you think?
Hmm, thanks
Is there any way to set a specific FPS for a dedicated server? I see an option to set the FPS in the simulator.
Is the listen server running each player's player controller?
so if a player for example presses a key to spawn an item that should only be done on the host with HasAuthority
HasAuthority is always server only, inputs are fired locally, and the server has all player controllers, though all remote players also have a replicated copy
Is GetOwner() guaranteed to replicate down before any properties?
So clients would get a valid pointer from GetOwner no matter how early they call that func?
well the server should have all pcs
NetServerMaxTickRate
If you do not define an online subsytem, can you still connect to servers by their ip? open my.ip.address Or better yet, is a custom online subsystem required for basic connection to an IP?
I heard something about the null subsystem only working on LAN. Is this true?
I think someone said that on here. I will not be using any of the built in features of the subsystem, I only will be connecting to servers either using: APlayerController::ClientTravel or open my.ip.addr
That's fine. I can setup proper load balancing and such to handle direct IP connections.
I just wanted to know if it works and it sounds like it will, so that's awesome. 🙂
The subsystems feel a bit overkill for a lot of the stuff I want to do as well. 😄
This has nothing to do with loadbalancing. And the idea is certainly not awesome. Home routers have software firewalls, you can't just direct connect players, unless you're planning on running your own dedicated servers where this isn't an issue
You don't need to educate me. I know what I'm doing.
👍 you never know. Doesn't hurt to check 🙂
Load balancer would only be used in production if there are any issues with connecting to servers 😛
Is there some kind of event for when the possess gets replicated to the client? Because the On Possess event is only run on the server side.
I said On Client Possess but it turns out that's a function I made in c++, looks like I call it from AcknowledgePossession in the playercontroller
Oh, so this is most likely where this is done? I'll look into that thanks.
virtual void AcknowledgePossession(class APawn* P);
I see that it send back an ACK to the server to confirm as well.
I believe that is called on all machines, so if you only want to add some client logic make sure to check against role
er, not all machines, but server AND owning
There's only one Controller per game instance no?
Well if I run on listen server though that would be a problem of course
in that case you can check IsLocalPlayerController()
Yeah that's what I was going to use.
Thanks for the method! 👍 They should expose this event to blueprint it would help some people.
agreed!
Is clienttravel the correct thing to use if I want to defer travelling back to the server online lobby until the client decides to leave post match screen? When my match ends, players will get a widget displaying the match stats and a button to go "back to lobby". Server will travel to lobby map as soon as game ends and then clients only travel back to lobby once they click the button.
Hi guys, i'm new here
I have a basic NetMulticast func in C++ (in a component class) that is called on the server
In my printouts, i only see the Server receiving it, BUT im expecting clients to receive it as well as per the documentation
However, if i run that C++ code in Blueprints, clients do receive it as expected
is there some sort of oddity where Component NetMulticast does not work in C++?
AI players perform actions, and those need synced up; You'll see better scaling with AIs than with players, because the AI actions are only sent to players, while an additional player adds another destination for all traffic as well.
each new player adds AI*N*P traffic, while each AI just adds AI*P
Depends on what they're doing. Think about the minimum amount of data needed to represent the game state. That's what needs to be synced to everybody.
A player will cost more bandwidth than an AI because not only are they generating more data, they're another client you need to send data to
that's what I said 😛
er...
depends on what you mean by "client to server load"; see, the client also needs fed data by the server, for updates by everyone else
at which point, we could repeat our answers from above but they'd just be a repeat of the same ones
The cost of replicating a player from the server to all clients is no different than the cost of replicating an AI controlling the same character.
The additional network cost a player brings is purely due to having to take input from and replicate everything to an additional client, or because you have deliberately designed a game where players control something with more complex replication.
That's just network cost. This has nothing to do with the performance of the server or clients.
Needs to be ran on server, on an owning actor and component that replicates, and the actor needs to exist on the clients
can someone tell me if you need to publish your Steam store page in order to do some beta testing with a bunch of people? Is it possible to test without publishing the page?
You don't have to publish the store page, you can generate keys and distribute them still.
do i need to use steam Playtest right? or other features?
Is there any logic to set my TimeHandle as replicated for my respawn counter? I wanted to replicate it so I could reach it from clients to show the remaining time in UI but apparently GetRemainingTimeByHandle doesn't give the actual remaining time on clients. Should I just fake the remaining time on client side by saving the death time + respawn time?
You just send them the key. It works like it usually would, it'll show in their library, there isn't a store page.
Not used the playtest feature so not sure how that works. Probably better off consulting Steam documentation.
But either way, you can distribute keys without publishing to the store front.
cool, thanks!
Hey,
I have a Multicast RPC that some of the clients might not need to receive.
Is it more or less performant to send multiple Reliable, Client RPCs, to the clients that I know need to receive the information, than sending a reliable multicast to all clients.
A scenario could be that there are 20 clients, but only 10 need the information.
It just lets people request access and then you can open the gate for X number of random peeps
We use it on VAIL for our alpha testing, tis pretty kewl, I know super people uses it too
Only thing that sucks is you can't let specific people in if they request, it is just random
There's barely any difference other than reliable having more overhead
At the end of the day you're just sending a UDP packet with a header
Multicast tends to be the most expensive RDP type anyway, but honestly I wouldn't worry about it, make it work in a logical way, then network profile
I have some physics nodes being called by the call of Input Axis events. I would like to replicate those nodes as they don’t work with 2 players, but I have no idea, I tried with the RPCs but it didn’t work, any help?
axis events are called constantly with tick, you are calling server rpc every tick in this case
and input will never go through the authority
hey I have a question about projectile movement component
I'm trying to use it with networking, by using the interpolated component
the idea is, that server moves the root component and clients receive the position and interpolate the mesh
the problem is, that on clients it also causes the simulation to occur, which doesn't seem intended. Shouldn't the simulation only occur only on the server?
the problem I have is that the projectiles on clients instead of stopping when they hit a wall, they wall to the ground
kek
obviously I found the answer 2 hours into fiding the issue, but 2 minutes after I asked
bSimulationEnabled should be set to false on clients
So there’s no way i could replicate this?
Currently trying to make my character rotate to face a clicked point.
I've attempted using SetActorRotation, but it will either instantly snap the character to face the direction with 0 interp speed, or not turn completely with a higher number.
Its used as part of a command to make the character face in a direction and attack.
projectile movement generally doesn't need replication past the initial velocity, which gets replicated inside the actor owning the projectile movement, and gets set to PMCs on clients at or before BeginPlay
clients then just tick their version of the Actor, which doesn't replicate position or movement while staying pretty damn accurate
i don't know how you imagined to replicate that without sending the axis value through
So you mean you simulate on clients as well, but don't replicate movement?
yes
hmm
only time you need to do anything different
is if the PMC gets affected in flight due to player actions
how would you replicate the rotation? on server the mesh rotates but not on client
the torque node doesnt go over on the client and add torque
@winged badger tried looking into how UT does it and once again, they have semicustom solution with fake projectiles and replicating position on their own 😐
replicating position takes resources
and you don't want to spend any you don't need to
why would you need a real projectile on a client
I'm just worried that it will be behind on clients
you can't notice the difference with 30 replicated actors on your test level im guessing
but with 300+ the actor replication will get staggered
and replicating position becomes more and more choppy
well the projectiles I work on won't be used for guns, so that's kinda fine-ish
i only used them for grenades
guns are hitscan
replicate the trajectory and then make the launch on the client
the projectile will be exactly as far back on clients as the rest of the simulation
yes, but the state might differ
it will be sameish
for example on client which is behin, the enemy will move to the side
and it wont hit it
welcome to multiplayer 101
then I have different state
Physics isn't deterministic though. Could run into issues.
nobody suggested using physics yet
In this 2011 GDC session, Bungie's David Aldridge discusses the programming that drove Halo: Reach's online networking.
Register for GDC: http://ubm.io/2gk5KTU
Join the GDC mailing list: http://www.gdconf.com/subscribe
Follow GDC on Twitter: https://twitter.com/Official_GDC
GDC talks cover a range of developmental topics including game des...
👆 This comment
watch that, talks about lag reconceliation
even valorant has its problems\
peakers advantage
it is multiplayer 101
you just need to hide it well
sure, but using replicated movement makes sure one of the issues is semifixed -> only server is authoritative, no desync
by eating more networking resources, yes
and also, you always do the simplest implementation first then iterate as needed
in valorant if you peak you have the advantage of seeing the enemy before they see you
you don't do 12 steps ahead
i'm in the iteration phase RN 😄
lets say you synced it with a player that has 50 ping
how about a player with 80 ping
how do you plan to sync it with everyone the same way
because if lets say
you delay the server explosion by
.5 seconds
to match with sync issues
you will have a player with 10 ping
the way to sync it is to use CMC replay
nah man, listen server with full authority, I'm not touching lag reconciliation, not a pvp game anyway
you will be fine
then you are fine
with replicating just velocity then
and setting it on PMC on BeginPlay client side
the original position gets synced during process of spawning a replicated actor
so you're good on both variables that drive its position over time
i guess I'll try
the only 2 issues after that to fix is pooling (of replicated actors, so thats gonna be fun)
and I want the client to have some kind of fake-ish projectile immediately, which get's swapped for the replicated one later
looks weird if I throw a grenade and it appears after 100ms
if you can guarantee both client and server decide to spawn the actor with the same name
you can spawn it separately on client and server
and network it after the fact
and just make the projectile travel little slower on clients
does that have any advatnages?
it does, but its also fairly complicated to pull off
I've seen plenty of games that do just wait for the server to respond with the okay to spawn the grenade. In the world of networking - most players understand why it happens.
i mean if I pool the actors, they will already exist on both, so I can prepare it on client I guess
networking actors after the fact generally needs you to lie to the engine
and they should already be synced, all I need is to make sure server and client selects the same actor
make it think those actors were loaded in with the level
yeah I think child actor component does that
ugh
seen something like that
CAC is evil
don't forget to turn on dormancy while those actors are not in use
no reason to evaluate them for replication
Quick question.. about how Data Assets work when passed in RPCs -
If I pass a pointer to a Data Asset pointer as parameter through an RPC, does it send all the properties (and use bandwidth equal to the total size of all the DataAsset's properties)?
or does it just send a pointer (and use bandwidth the size of a single pointer) and then Unreal uses the AssetManager to find the asset's definition on the receiving side?
Like... for just getting properties over a network and not writing anything should I just be passing a TSubclassOf? or a StaticClass?
hmm.. yeah. I understand. Just trying out DataAssets and AssetManager on a new project over the weekend... and the DataAsset is currently too small for me to see if it's sending something huge over the network or not using Stat Net, and setting up the NetworkProfiler just out of curiosity sounds like overkill
references to assets, including data assets, do not replicate their properties. it's just a reference to the asset itself
I'm considering about how I should implement melee attacks in my game
the player has a lot of movement so they should be able to avoid it
I was thinking about having a sphere attacked to the claws of the enemy that starts listening for overlaps at a certain point in the anim then stops
the only issue is that I don't know how multiplayer friendly this is, will the listen server be ticking the anim bp if it's player doesn't see the enemy ?
and if so, will the sphere be at the right locations to detect the attack?
Hi folks, I attached a gun to a skeletal mesh's hand socket and am driving the hand position via IK from the user's VR motion controller. When firing the gun, it is firing as if the hand hasn't moved, however all clients see that the hand and the gun are moving. This leads me to my question - does a dedicated server not animate the IK of a skeletal mesh, thus meaning it wouldnt have the correct placement of the gun?
why not attach the gun to the controller directly ?
Because the hand's position is actually the hand of a giant mech's hand, so it isn't 1:1 of the player's controller transform
the player's motion controller is driving the position of a mech's hand, and the mech is holding a rifle
ah I see
thanks for the input though
I just confirmed that it works on a listen server, which further leads me to believe it has something to do with a dedicated server not simulating the bones of a skeletal mesh
@slim mist funnily I found the answer to your question while looking at my issue
ooo
you can make the clients send the transform of the gun to the server, the server would validate them first and then replicate them to other clients
actually you probably don't need to send them to other clients, only the server
yeah, the other clients already have it lol
so I essentially send a server RPC to just manually set the guns transform?
what about bone transforms when a notify fires? can I assume it's correct or not?
if what is attached?
dat necro
omg lol I thought I was going crazy
dedicated servers don't render animations by default, i guess maybe vr controllers are included in that? but i don't know
yep basically
you can even do it on your fire I guess
you don't technically need to know it all the time
you can send the bullet origin location and bullet direction vector
then server side you can simply validate it to see if it's an acceptable value
also @winged badger sorry for bothering you but this thing is really hard to test out, please @ me when you see this
Thank you so much @rocky topaz for the help. I'm still running into a weird issue but I think you're right on the money with the approach
a replicated actor attached to a net addressable actor will move with its attach parent
as the AttachParent will replicate, and any updates to its position will update the position of the attached actor
as for montages and bone transforms, approximately
they will look more or less the same to a human eye
which doesn't mean you can use them to do some precision sync between client and server
oh so if I need to do a 50 radius sphere trace every 0.02 seconds I can count on the transform to be good right?
you generally don't trace towards a bone
huh?
I mean a simple sphere trace with the bone as the origin
sorry
sphere overlap*
frick I'm loosing my words I need sleep
yeah, but that sphere might be in significantly different positions on server and client
at any given time
ah
so how would you make an AI claw attack apply damage as the claw sweeps through in the animation?
can the players make a precision dodge?
yup
you'll need more sync then works out of the box then
I guess I'll cry
it is possible to sync network clocks
have server announce the attack beforehand
so it plays at exactly the same time from exactly the same position on clients
and use replay on server to determine if client was out of the way when the attack landed
as opposed to being out of the way when the inputs arrived on server
how could I get the replay then?
I see
so while the CMC is skimming through replay I can figure out when the attack hit and where and know if the player dodged it or not?
I think I'll just make the ugly ping dependent one for now, I have 2 weeks to finish a ton of AIs and make the menus system
you can replay players last few moves, and see if players position was out of the attacks way at the tiimestamp attack landed
without that, you can end up in a situation where player dodged the attack in its own simulation
but got hit on the server
and the chance for that increases with latency
yeah I understand but if it's a week's worth of work I don't know if I really have time to deal with this
how would you do it btw?
i'd start with searching for replay on this channel, see if someone actuallyy explained how it works in detail
incorporate dodge in FSavedMove so it can be handled predictively and replayed
would I do something like, when the attack is done I cache the sphere trace locations on the server, then after say 1 second, I grab the players and check where they were at trace time on their own simulation?
syncing network clocks and having AI announce attack at specific timestamp is trivial
I've already had to play with the CMC to make my dash, slide & other systems
then providing you find a good replay explanation (i never needed to do those myself)
you might accomplish this in 3 days
also note that this might get real expensive real fast
if we're talking 50 AI
if we're talking 3-5 at a time its fine
well there can be a lot of AI but not many attacking at the same time
especially not in melee
this is also much easier with very fast attacks
like bullets
as they are typically past the possible hit area in a frame
so you only have one frame to check
this is not the case with claw swipes
yeah 😢
and not 100% its even practical
I mean melee is kind of a second thought in this game to begin with
there wasn't even a melee class before I thought it would be cool to add it
I think I'll make the ugliest solution and just say players need a 5ms ping to play
😂
so its a feature creep?
yes kinda
I mean it's supposed to be a doom style FPS
except they were missing dodgeable attacks
which made it very not doom like
I'm trying to make the game great again by making stuff dodgeable
but coop itself was a thing they wanted to add just cuz it would be cool
a feature not on production level that doesnt tie well into the game is best cut
Thank you that's what I was wondering.
I think for now, I'll put two anim notifies on the montage one for the damage start and one for the damage end, then every 0.02 or 0.05 seconds I'll do a sphere overlap on the claw bone's location, you reckon that should work perfectly on a low latency situation right? @winged badger
I think we will advertise our coop as LAN only btw
nobody plays lan these days
🤷🏻♂️
I mean yes but also since we're in europe nobody has a ping above 15 ms these days
and technically even with a 150ms the anim is still has 1.2 seconds of windup
sure the hit window itself is 250ms so there can definitely be some last second missed dodges from high ping
but even AAA games don't handle 150ms ping well
and I don't think trying is a good investment tbh
my concern is mostly about what visibility optimization atm, you said bone transforms should be pretty much the same to their actual animation version on the server, even if the animation isn't playing on the server right?
( @winged badger )
also sorry for bothering you
I just want to confirm this so I can stop thinking about it and go sleep
from what little i can tell
you should probably start cutting
how long till release? publisher involved?
(i thought it would be cool is a terrible reason to have something make the release version)
no publisher involved but we need a prototype in like 18 days
we have a lot of prototypes btw but all of them were singleplayer
they have always wanted to do coop multiplayer
and have some kind of arcade versus multiplayer "that would be cool"
also couch coop "that would be cool"
I told them to scrap the couch coop cuz that's just waaaaaay too much of a pain
versus will be added probably post release and as an obvious extra
but coop is kind of one of the cores of the game as far as I understood
and how does a tacked on melee fit into all that?
as I said they have always wanted to have coop and had been wanting to have it in the game since the beginning but they had no dev (until they hired me)
ah you mean the melee
well there is a rhino that only hits in melee and as I said it's supposed to be a doom style game with dodgeable attacks
we can afford some inaccuracies
as we can have over 200 AI running around engaging players at the same time
yeah that's what I've been thinking too
like it's cool if the player can do a last second dodge
i don't even care to replicate shots to simulated proxies
i just tell them the target, weapon and firing mode and let them draw their best guess
@rocky topaz when I call the server RPC to give the weapon's location, it spazzes out in a similar manner to two overlapping physics objects. doesn't happen on listen server. any ideas?
super simple implementation
bottom is called on fire?
naw on tick. but it happens similarly to on fire
I see
it just spazzes out for 1 frame 😆
having location updates on tick is probably a very bad idea
i don't even guarantee a shot for shot
btw you didn't answer my question about the accuracy of bone locations @winged badger can I assume it's precise enough to use it as the origin of a sphere overlap?
for precise dodge, probably not
montages will be out of perfect sync, so will positions and rotations
and there is the matter of having players dodging get to the server
even assuming it's on LAN?
i would never assume something is on LAN
hum
I mean since it's a coop game with listen servers
I could technically do the damage testing on each clients
I already "trust" the coop game host client so might as well trust the other clients too
that is also something i'd never do
why not?
we have listen servers, and players get really annoyed when someone uses a trainer
now over time hosts doing that don't get any players joining them
but if clients could just join and do that... ouch
but it's a coop game, and if they don't like their friend using cheats they can always tell them to not use any
Yah unfortuynately a listen server means giving direct power to the host
host is still much more responsible party
we won't have online random multiplayer
then a random joined player
only "friends" multiplayer
say you have a 8 player coop
4 max
and 5 players who usually play together start a game one of them hosting
and 3 randoms join
(as I said no randoms)
then 1 of those randoms turns on no skill cost or cooldown cheat
never ever trust a client, listen server or not
ALthough,
even friends playing together
even a. friend
If they are granted certain privleges for a client
can still place cheats
If you don't utilise the hasAuthority correctly
ok so back to my original solution then, I'll just do sphere overlaps on the server and screw lag optimization
you'd do better with a box then
it covers the area where you get hit in one frame
instead of sweeping
I mean the game can still be played as a solo game
it wouldn't be nice to remove a solo/low lag feature just because it does work the same way as a box for laggy clients on multiplayer
my whole question is
assuming no lag, can I rely on bone location or will it be super buggy and off the spot?
more or less
if it's not being rendered because of optimization
also they have to be montages, not animations
can I just enable always tick pose when I run the anim montage and then disable it?
yeah they are
as animations won't fire any notifies unless its on listen server host's camera
good to know 😳
@winged badger can I get the latency to a client and use both?
I could show some kind of "high latency" icon on the UI to show that the player is laggy and have the game work in different ways no?
the only issue would be where do I even draw the line
meh I think my sphere traces would work the same way as a "regular" big one anyway
Heads up for anyone using FFastArraySerializer:
https://github.com/EpicGames/UnrealEngine/commit/b9ff4c2d44eb474c3b646714bd0a066973bfc9b3
Apparently causes some very spurious issues with GAS in particular since it makes such heavy use of it
that on UE5 only?
I'm not sure, it looks like the original issue may have been in UE4
But was a really rare occurence
Hi there! I'm trying to create a HUD but don't understand where I should call the create function. I've tried making calls from the controller's OnPosess function, but it's not a multicast or client-side function. Can someone help me please?
Please tell me how I can transfer the player's token when connecting to the server using open level by name?
begin play of the player controller
When respawning, the controller remains the same, just moving to a new pawn
yeah, you don't want to create a new HUD every time your respawn do you? you can simply reset it
But what if I want to clear the interface when the player dies?
Hi there! is it possible for me to use a home computer to be a dedicated internet server? I have already opened all ports 7777, disabled firewall, opened the ports on the router as well. and I can not enter with my ip only local works.
Let's say I want to build a RTS multiplayer game. What aspects of the unreal multiplayer framework do I need to consider? Does replication for 1000 units for example work or would I need some systems on top that for example manage movement of unit groups and replicate that. What are the benefits of using the multiplayer framework of unreal instead of using TCP + UDP to create my own?
Unreal is tried and tested and works, so there's that
(Also nobody should ever network games with TCP)
RTS has been done, but obviously you'll need to squeeze everything you can out of the engine to get the most out of it
So the answer is depends
Many RTS games use lockstep determinism, which is effectively impossible in UE.
As in, it's not, but it might as well be
Seen some games separate the simulation layer from the presentation/game layer though. Deserts of Kharak did that. Could work
Sadge tcp needs more love
There's no good reason to do MP games with TCP, and I've worked on older games that did it, not my decision. It was done because people didn't know any better and it was easy to do
🤦 my face when explaining to them afterwards that TCP and P2P NAT are not play buddies
Because essentially anything you get from TCP you can build on top of UDP without the inbuilt limitations
😄
Hey, my Anim Notifies are only working on the server. Is this a known issue?
I've tried RPC
I have one question, when client pawn needs to move, using character Movement Component. do we have to set the location on server in order to replicate to all the clients ?
I previously thought, we move client on client side and the character Movement will automatically send it to server and the all other clients will get it from server ?
Can someone clarify this ?
Does anyone know why UCharacterMovementComponent::AddInputVector stops doing anything in a Dedicated Server when ownership of the ACharacter has been forcefully changed?
virtual bool ForceSecondaryPossession(AController * NewController)
{
if (NewController)
{
PossessedBy(NewController);
}
else
{
UnPossessed();
}
return false;
}
It works in a local environment and on a listen server, but not in a dedicated server. I've confirmed that the same input values are being sent to AddInputVector on both the owning client and the dedicated server
It works in a dedicated server when I DON'T use ForceSecondaryPossession
The Game Mode, from OnPostLogin, is sending that player controller via a server RPC to the pawn, which then calls APawn::PossessedBy (via ForceSecondaryPossession)
Sorry, what does CMC mean?
Thanks. I've confirmed that the CMC:AddInputVector is being called from the owning client, if my understanding of your statement is correct
However, puzzlingly, the role on the local client is ROLE_SimulatedProxy. I would have assumed it would be ROLE_AutomonousProxy
IsLocallyControlled is returning true when GetLocalRole is returning ROLE_SimulatedProxy
spawned from the server
for some reason my hot-reloading of changed engine source code isn't having an affect in game, which would give me more insight into finding out what specifically is causing the change
the most I can do is add breakpoints which hasn't given me success for pinpointing
hot-reload bad. Live code good
sorry, live code, thats what I meant. I use ctrl + shift + f11
engine code isn't made available to live coding by default.
(or at all if you're using a launcher build)
thank you!
Confirming that it happens on this very specific line. When I comment this out, movement still works: https://github.com/EpicGames/UnrealEngine/blob/c3caf7b6bf12ae4c8e09b606f10a09776b4d1f38/Engine/Source/Runtime/Engine/Private/Pawn.cpp#L517
line 517:
However, if I comment that out, then other things depending on this client being the owner are broken
Which is exactly as expected. The Controller = NewController just means you're associating the variable of "Controller" to the new instance of the controller created above it. If you keep the existing reference, the rest of the code below will execute on the current controller stored in that reference.
Thereby, you're not changing the controller, but you've changed the owner.
Thanks for the response. Do you have an idea as to why the assignment of Controller would prevent UCharacterMovementComponent::AddInputVectorfrom working in a dedicated server environment? It is being called from the owning client, the client whose Player Controller has been assigned to its Controller
This is the stock engine code, there's nothing that's new in the highlighted area?
Sorry, I don't understand the question
Oh, are you asking if I've modified anything else?
You've given context that you've modified the engine source, but the gist that you posted is the stock engine code, no mods. What are we missing?
Because I'm having trouble with compiled changes of engine code showing up in game, I brought the engine code into my own function and modified it there.
void ASecondaryPossessionCharacter::ForceSecondaryPossession(AController* NewController)
{
SetOwner(NewController);
AController* const OldController = Controller;
// Controller = NewController;
// ...rest of function, abbreviated for discord
}
the only change i made was commenting out the highlighted line
to clarify - I made that change just to see what was causing UCMC::AddInputVector to stop working in a dedicated server
I dont have any actual reason or desire to comment out that line
I'm trying to figure out why UCMC::AddInputVector is not working in a dedicated server after calling APawn::PossessedBy, and I noticed that the specific line highlighted, when commented out, allows it to work. However, this is obviously not a solution, because it breaks other things
You are manually calling PossessedBy?
Yes
Why?
Great question 🙂 I want the player to have ownership over this actor, however the actor derives from APawn. It appears that in a networked environment, APawns are special in that ownership is only granted when it is being possessed
However, I can't have the player possess it, because they still need to possess their original character
Context: The player is possessing a VR character, and they are operating a cockpit inside of a mech. The mech is the APawn
This workaround of directly calling APawn::PosssessedBy was discovered by the creator of the VR Expansion Plugin, and apparently was also later adopted by FortNite for their vehicles
lmao my fitbit thinks me typing on discord is me taking steps
So this is not true. You can set the owner on the server as to who the owner is of the pawn and so long as that pawn replicates, the ownership can change to other controllers.
If my understanding of your statement is correct, @dull lance, that would cause the player to momentarily leave the body of their VR Character. They are always staying within the body of their VR character and interacting with the world through that classes' hands, just as we do in every day life when hopping in/out of our car
rereading this multiple times to try and understand 😆
You can set the owner of a pawn to anything on the server. The ownership will replicate if the pawn is set to replicate.
Am I understanding your statement correctly in that you are saying the server can do APawn::SetOwner(PlayerController), and that client should should be the owner?
Yes. The only caveat is if the owner is set to a player controller, other clients who are not the owner will not see any value set for the owner.
From my experience this has worked for everything but a Pawn (or classes derived from it), but it is entirely possible I made mistakes lending to my experience not being valid
I don't know if its worth mentioning, but I'm on 4.26
Interesting, I'd be eager to learn
The thing is if the pawn becomes possessed, then the ownership changes to the playercontroller who possessed it, which is what you have here...
void APawn::PossessedBy(AController* NewController)
{
SetOwner(NewController);
// yadda yadda yadda...
If it's never possessed, then the ownership will never change unless you manually set the owner (I'm fairly sure, but could be wrong)
I'll bite. Why do you want to change ownership? What's the actual problem that you're trying to solve?
I just tested it. From the server, I did APawn::SetOwner(PlayerController), and APawn::IsLocallyControlled is returning false from the owning client
That's because it's not controlled, you only set the owner.
Ownership =/= controlled by
oooohhhhhh shit
Yeah I know, but ownership has nothing to do with this. Wondering what the actual problem is
Cool Movement Component!
The player is operating a vehicle, and I want them to have authority over it and also latency-free interactions with it
I really appreciate all of you spending your time and energy in this discussion, it means a lot
Good luck
thank you
Yes wish you the best of luck, I can't chime in one the VR-based problems that you're experiencing since I've never worked on one of those
I may have mischaracterized this challenge as being specific to VR - its not specific to VR.
I appreciate you bringing this up. Do you have any more time to elaborate on this?
Sorry, I don't understand the context with this statement. I am using ACharacter, and I am using its CMC.
I haven't done this before, but gut feeling would be to make your vehicle a character, use CMC with it. Possess it on the server, call it a day
I was referring APawn because that was the function being called. The class derives from ACharacter, however.
sorry for the confusion
@slim mist is this in anyway a networked game where other players interact with one another?
ACharacter::PossessedBy is pretty much Super::PossessedBy and then one other check
This is a networked game where friends can co-pilot a mech
They both can do any of the controls, its up to them to delegate responsibility
Uhm 😄
I mean I guess that's -technically- possible, whether it's a good idea or not is a different story
Yes, I've been trying to communicate this...I guess I failed at it
Yeah I'd rather go the a) route, because then I'd have to implement the false-possession of the VR character for each vehicle
Part of the success strategy for making it through game development is reducing your problemset
that means making the simplest and cleanest solution for problems that you have
sorry for the confusion, when I said false possession I was referring to manually updating hand positions of the VR character to give the illusion that possession has never been lost
great reminder, thank you
Hey, i think i'm missing something with replication. My function works server side but not on the client side. Can anyone see why?
when it's called by the client i mean
@dusty radish just replicate the state of the inventory
that's the thing the inventory is replicated, unless I'm misunderstanding what you mean
Ah ye you calling it through a run on server event?
You need one of those to get from client to server
Input -> run on server event -> DoThing
I tried that and still nothing, hang on I'll hook it back up
Show the ROS Event
there it is
That's a really awkward event signature. If it's called remove item from inventory, it should just have a field for item to remove
you're right, I'm just getting it working and then I'm going to clean it up after
Running it this way I'm removing the item from the server's inventory, any ideas on why this is happening?
Using a "Run On Server" event will execute whatever you're doing on the server's copy of the object in question.
Can you show what the rest of this function looks like?
I see, I think my GetPlayerController will be to blame then. This is the function
That it would be.
Remove the get controller. Shouldn't need it anyway.
oh yeah i see the ref to self.. thanks
any ideas for the other issue of it not working?
I didn't read everything, but just based on that screenshot, you're doing GetPlayerController(0) on a function that runs on the server, that's already a big nono 🙂
What's the other issue?
hmmm thats it, how do you get around that?
Think of blueprints this way
A blueprint runs on an instance of an actor that exists in the world
(self) is always that actor
it just changes execution context between client/server when you pass through events/RPCs
that's really helpful thank you, but how would you recommend fixing the issue above?
Whats the other issue?
when the function is called the item is removed from the inventory correctly on the server side, but on the client side it removes the item from the server
I know the issue is definitely the player controller but I'm not sure how to get around that
This statement doesn't make a lot of sense. If you have an inventory that is replicated (eg. the component itself is marked to replicate & the the variables storing the actual contents of the inventory are marked to Replicate) any changes made to the inventory variables on the server should replicate to all relevant clients, so long as those variables are don't have any replication conditions set on them.
I could DM you a screen capture if that works? I realise this doesn't make much sense at all
Is ServerTravel with a client and server supposed to work in PIE? Only my server is travelling
It seems like my client's connection is getting closed?
I'll try explain the issue a little better. The issue is that if you (host) have the required resources and build something then your resources get used. If I (client) build something It checks my inventory for the appropriate amount of items and then once I build the item successfully this function runs and removes the items from the player. This is getting the server host though so the host loses the resources when the client builds something
Won't be able to advise any further with the images provided as it depends on how/where the event that fired that is causing this "Remove Items From Inventory" function to execute.
As it stands, you are calling it from a self reference of "BP EBS PlayerController". That means anything you're manipulating is on that particular instance of the "BP EBS PlayerController" - when you execute that "Run On Server" event from the "BP EBS Player Controller" using a reference of self, it'll specifically be referencing that instance as well. So if you are calling this on the hosts copy of "BP EBS PlayerController" then everything else with a reference to self will be in reference to the host's copy.
If you're consuming resources while trying to build something, normally a Run On Server event would be called from the player controller or character asking to place the item on the server, and it subsequently remove the required items from that player's inventory. Since this would be running on self, then you would know who it originated from even on the server. Your issue could be stemming from the fact that you used Get Player Controller 0 or Get Player Character 0 somewhere earlier in the chain of events and calling functions on that reference while already on the server.
ServerTravel does not work in PIE, no.
This is called and is part of the controller that the players use.
Thank you for the in depth explanation.
How do I make the reference to the client?
So it should go something like:
BP EBS PlayerController Event that triggers the placement of an item > Place Item (Run On Server Event), Probably with inputs for location & item type > Server event verifies placement of item is valid, verify player has required items & any other checks > Server places item & consumes items from the controlled pawn of the BP EBS Player Controller that placed the item.
There really should be no need to get a reference to a specific player. If you need to move the code into a different area, you can pass in a reference to "self" as the player controller calling the event.
It should do and does everything like you say until consuming the items from the client inventory
What comes before this?
just this
What calls that BPI?
either of these two
Ok, so lets follow the Complete Upgrade - where is that called from?
okay, I'm just searching
I'm not going to lie I have no idea, this is the easy build system
I've tried searching through all BPs but nothing come up
Ok, then how about the Complete Repair?
Back up a bit. What actor is doing all the building/upgrading and where are the resources stored?
Pawn or PlayerController should be doing the building and Pawn or PlayerState should hold the resources
there's 3 components in the player controller that do everything, the inventory that I'm trying to use is held in the player character
again, another dead end
Back up and start from the ground floor. So the building logic lives in the PlayerController and data (inventory) lives in the possessed Character right?
correct
That sounds fine. So for anything involving resources, it should flow like this
Input -> LOCAL resource check on MyCharacterRef(can omit) -> Run on Server Event
Run on Server Event -> resource check on MyCharacterRef -> resource deduction on MyCharacterRef -> DoThingToBuilding
Both resource checks are the same function
Just run it locally before trying to send RPC and can play error sounds etc
The important thing is that the player controller doing the calling is talking to its character. Not get player character, not player Pawn 0, but the controllers character.
Get player character and the like will return the HOSTS pawn on the server, which is the root of your problems.
I think this has single-handedly fixed the issue
i've been looking at all of this for most of the day before talking to anyone on here and it all makes sense now
thank you both for your patience!
and help!
when running without the RPC it works perfectly and doesn't steal resources from other players
No run on server event at all?
yeah it works great I completely removed it and it works perfect
i'm not even sure how to be honest
Yeah it's definitely not working.
yey!
lol
Somehow somewhere there has to be an RPC between the client and the server for the server to know anything.
should i post a short video of it working?
I'll be home in a few and can do a stream if you want.
sure that would be great
I'll pm when I get home.
sounds good
I said this the other day to someone... The appearance of working, and actually doing what you expect is two different things.
that can absolutely be the case with this stuff
Especially so with multiplayer.
I've been using UE4 for a long time now and only just started doing multiplayer stuff but I think its both brilliant and terrible
I've been working with it off and on for like 7 years and started out with multiplayer day one, but I knew absolutely nothing coming in. Learn new stuff everyday
I take it you remember paying for unreal too?
that's pretty lucky I think it was just as my second payment one came out and I got the refund for the latest one
@dusty radish PM me, I can't PM you
Hey all, does anyone know what would cause some users to be able to see Steam sessions but some players are not? They are all using the same build, they are all signed into Steam, but for some reason 1-2 people are able to see and join the session out of 8 possible
@bitter comet regional manager that the steam subsystem uses
It’s part of the steamworks sdk documentation
I think it can be overridden but you likely don’t want to
As it would cause really bad performance
Usually latency is too high between the listen server session and the client
The only other reason is the nat type limitations from host within a network hosting from a wifi connection
Closed nat type routers have difficulty at times communicating with other closed nat type connections
yo that was me lol
what are the preferred ways of making tracking events when player posesses / unpossesses pawns?
my current is: server side PC::OnPossess calls a client PC::ClientPossess which triggers Multicast delegate but there are cases when PlayerState not up to date yet
alternative ticking controller checking for client player state & playerstate pawn and trigger multicast delegate
in UE5 there is a delegate in PlayerState that triggered when pawn posessed but i'm still on UE4 😦
I'm back again for my timer, my timer is wrong, at 10 AM it considers that as Night and goes faster and I don't understand why 😦
Here's the timer https://blueprintue.com/blueprint/uuhry-mh/
On PlayerState, there should be a AcknowledgePossession function that only runs on owning client
Ah sorry it was on PC
You can try ClientInitialize() though
I use Controller::SetPawn() for pretty much everything
They took my delegate PR then 😄
is ti called on clients too?
i'm thinking on making some delegates for ui to subscribe
didn't find a better way as some ui sections have to be hidden when no active pawn or swap when possession changes to another type
yeah, I use the controller::SetPawn then notify the HUD from there
then hud does whatever it wants
Hey y'all, on an ACharacter, if you had one person responsible for it's CMC movement, and another person responsible for moving the end effectors for it's IK driven arms, what do you think the optimal relationship would be between the ACharacter and the two players? Obviously client side prediction is a big thing with this because both players are adjusting the position in a way
Hey, I am uploading my build on Steam to test the game internally and I got this
"An error occurred while updating _______ (invalid app configuration)"
Is this error happening because of some wrong uploading process I did or what? I tried to run as admin or verifying integrity of game files and stuff but apparently is not working (my store page in not released yet I don't know if this can cause any issue it's my first time with Steam) Thanks!
@thin stratus Found this rather randomly and i'm wondering if you are aware that someone uploaded it there (Just assuming this isn't your account xD)
https://www.coursehero.com/file/114526715/UE4-Network-Compendium-by-Cedric-eXi-Neukirchenpdf/
na it's not me
They even uploaded the page with my name and company
uff
Send them a support message :P
@thin stratus
Sounds like somebody might be entitled to compensation
Ah, if I need that, then it wouldn't be free to begin with :P
I just don't want them to host something that needs to be paid, while it's available for free
But I also have no clue what CourseHero is
Just send them a friendly reminder that it's free. Can't really send a takedown notice anyway
I've got here a problem where i'm unsure what the problem actually is. (That's not the full code, but it should come down to this)
void UPlayerInventorySystemComponent::Server_DuplicateItem(UItemData_Base* ToDuplicate)
{
const auto& DuplicatedItem = DuplicateObject(ToDuplicate, this);
InventoryItems.Add(DuplicatedItem);
}
The inventory system component itself is replicated just as the InventoryItems (Which is an TArray<UItemData_Base*>).
The duplicated item is valid on the server, but not on the client as the new element in the array will be an nullptr
Kinda feel like it's a simple thing i'm missing here 😅
Not sure if it's important, but UItemData_Base extends from UObject
UItemData_Base needs to be replicated somehow for that pointer to be valid
(Or stably-named i.e., an asset)
I'll try that, thanks
Some actor needs to be replicating them as sub-objects, essentially
I feel like i've did it correctly, but it's still not working.
Can it be by any chance that it's happening cuz i'm using DuplicateObject rather than e.g. NewObject ?
Anyone know why my static mesh won't move up and down with the player camera when not on the client running a listen server?
Component replicates is enabled on all the components there and movement replicates also is enabled. Everything else replicates fine but the up/down movement of this static mesh. Rotation seems to work fine for the host though (Host is on the right of that gif)
Am I crazy or does a dedicated server not simulate a skeletal mesh at all? I have the transform of an end effector for arm IK in the animation blueprint for a skeletal mesh, and all networked clients see the arm properly moving - but the dedicated server itself does not see the arm moving. I am validating this by logging the position of a gun that is attached to the socket on the hand.
Is there a way how to disable replication but only for owning client and not for simulated proxies? The best I can think of is duplicate the property, give it different replication conditions and disable the one replicated to owner when needed. (Trying to prevent ammo replication while the weapon is shooting, so that received ammo values won't be fighting with local prediction. Other players still need to be able to see your ammo count.)
I think if the player who is shooting the weapon is the owner of it (ie: Weapon->SetOwner(PlayerController)), then they can be the authoritative source of the ammo and tell the server how much ammo they have. Their int AmmoCount can have repnotify, where the notify conditions are that it skips the owner. best of luck
check out pages 57, 58, and 59: https://cedric-neukirchen.net/Downloads/Compendium/UE4_Network_Compendium_by_Cedric_eXi_Neukirchen.pdf
That would work but I am not sure if I want to allow client to tell server how much ammo he has 😅
Predict the ammo usage. Burst Counter is a good approach I've heard.
Control rotation isn't replicated to all clients by default. The host will see the control rotation as that's something that is passed from the client to the server.
Would a replication graph be the way to go if I wanted to "hide" actors from certain players' client, or is that just for network optimization? If so, what should I be looking into?
Like in an RTS, if the unit isn't revealed/visible to a player's units/structures, their client shouldn't know anything about it to prevent cheating.
Sorry if it's a dumb question, just getting into MP.
I don't know if I'd be too worried about cheating at this early stage of your work.......though yes you could use replication graph to achieve this
Related, you should strongly consider not making an RTS in Unreal, because doing so requires extensive networking, movement, and navigation custom optimization which almost nobody does
I am working on a top-down RTS style game but with very few units-per-player
If I were you though, I'd just let the building network itself in and out and use radial BP logic to trigger its visibility
which is vulnerable to cheating but who cares
I'm not that worried about cheating, just wondering what systems/terminology I'd need to read up on to get it done in future.
doing so requires extensive networking, movement, and navigation custom optimization which almost nobody does
Because the systems are that expensive, or just that nobody wants to do it? lol
network relevancy
that's the "basic" way to do it
replication graph might also be able to handle that but it's a more complex system.
Bookmarking. Whats the "advanced" way? Not that I'd go that route, just curious
the problem is that Unreal uses Server authoritative movement which is not historically very compatible with games with lots of moving units. The bottleneck is almost entirely a bandwidth bottleneck, made worse if you expect clients to be able to responsively control their own units (as opposed to controlling them with .1 seconds of input lag)
older games like Age of Empires use an ancient technique of simultaneous simulated networking which has been lost to time
in those games, clients just send move orders to each other, and every client issues everybody elses move orders to his local units and they all perfectly synchronize in acting out those orders
There are some dark wizards who have worked tirelessly to create systems of network bundling in Unreal, where all the location updates of all the units are compressed very efficiently and sent in one very efficient update every (server) frame over the network, but they keep their secrets well guarded and will extract a high price if you seek their knowledge.
(I've estimated under normal conditions for an RTS in Unreal, you can get between 100-150 moving units going at a time before net bandwidth begins to struggle, this is all moving units in the game, so in a 10 player game each player would have no more than 10-15 units and even then not very responsively)
That assumes everything is constantly being replicated to everyone, though. Which is exactly what systems like replication graph are meant to fix.
Not saying that massive-scale RTS are a good idea with unreal's built-in replication system but 100-150 moving units being bandwidth-limited seems suspect.
I'd expect that to be more of a server perf (cpu/memory) issue than bandwidth.
At least if you're using CMC or similar.
Yeah true truebut remember in RTS, lots of times all the units end up on screen simultaneously.
Sure, but they don't all need to be updated in realtime to every player.
Yes CMC is to be avoided as well
in major battles they would, based on how most RTS work
Sure, because very few RTS use the sort of replication unreal does. But there's quite a bit of leniency you can get out of units you don't directly control.
true
Which means network update rates can be massively lowered on everything else.
As long as the game looks mostly consistent it isn't going to matter.
wellllllll.......players expect alot of networking precision if the RTS is competitive
that's why it'd be much easier to make a cooperative (not PvP) RTS style game
which I am doing
Is Net Update Frequency an setting that can change dynamically, or is it set it and forget it? RTFM, seems able to be changed
If you're new to networking, I suggest you look into the Smooth Sync plugin
it will save you some big headaches once you finally decide to take the leap and stop using Character move component (CMC)
because without CMC you will need an interpolation solution to smooth out those slow server updates
and smooth sync is ideal for that and free
and even has a Client-Authoratitive option for movement which I rely on extensively for nice responsive movement
I'll check it out. Not new to networking, just UE networking
Appreciate the help though, I'll have to do some reading
the "cutting edge" advanced system right now is replication graph
so look into that
Yeah thats on the reading list. That'll probably be a necessity for optimizing, but I was thinking that combined with net relevancy for finer grain would be reasonable. I'll have to do some perf testing
whats your target total-simultaneous-moving actor count?
This?
yeah
oh, well it was free for a month
a must have IMO
unless you want to sit there and write your own
but it's got the bells and whistles
I purchased smooth sync in hopes of fixing the spectator camera for my game…it improved some things but also introduced problems i didn’t have using CMC
Don't really have a target, just learning and figuring out the boundaries of the engine really, not set on a design yet
Oh good, you can work on my game
I'll get the dungeon ready
lol
Yeah, plugin looks neat. Even for $20 honestly.
But I have no need to not use CMC currently.
I have a C++ NetMulticast func in a Component that fails occasionally
Meaning that some days when i run the project, the client just fails silently to receive the RPC. If i test it by calling it in Blueprints, I will get an error linking that BP Func node (at least I get an error in BP)
-
Re-compiling
-
Changing the C++ code and Re-compiling
-
Restarting UE4 and IDE
All the above does not fix it -
Deleting Binaries and Intermediates
This fixes it
But why does it keep happening :/ and at this particular code and function.
I'm reading through the Network Compendium now to see if there are any ahas or gotchas i've missed. Am I using RPCs wrongly, is it not meant to be called in a component?
Should be working fine but I would first check that the array isn't exceeding the maximum data size, and also that hte object is network relevant when the RPC is broadcast
If an object isn't relevant to a client when that RPC is called, they'll never recieve it
recompiling wrong binaries would also explain it
Ah ill keep that hot reload in mind and see if it still occurs, thanks!
with time period being "some days" i doubt that you never closed the editor and recompiled
Do you guys now any way to store individual player information across levels? I've been told that gameinstance is the only persistent actor across levels.
PlayerState in combination with CopyProperties and SeamlessTravel
@past seal
SeamlessTravel is recommended way to transfer between levels
So i can use the same playerstate for both levels then copy the properties somehow?
Ah, I assumed it would be included in the movement. Works like a charm now cheers
you make a base PlayerState class that all your PS classes derive from
and you put members holding the persistent data into it
you also implement CopyProperties in the base class to copy that data from old instance to a new one
by the time GameMode calls HandleStartingNewPlayer for the player (which engine uses to spawn the PlayerPawn) that data will be available, even if the PS class changes between levels
and you should use HandleStartingNewPlayer, and not PostLogin, as PostLogin does not work for seamless travel, while the former works for both login and seamless
also, its worth noting that GameInstance is not an Actor, and it can't be replicated
I got those warnings here
Warning LogClass Property InventorySystemComponent::bReplicates (SourceClass: ActorComponent) was not registered in GetLifetimeReplicatedProps. This property will not be replicated. Use DISABLE_REPLICATED_PROPERTY if not replicating was intentional.
Warning LogClass Property InventorySystemComponent::bIsActive (SourceClass: ActorComponent) was not registered in GetLifetimeReplicatedProps. This property will not be replicated. Use DISABLE_REPLICATED_PROPERTY if not replicating was intentional.
Warning LogClass Property PlayerInventorySystemComponent::bReplicates (SourceClass: ActorComponent) was not registered in GetLifetimeReplicatedProps. This property will not be replicated. Use DISABLE_REPLICATED_PROPERTY if not replicating was intentional.
Warning LogClass Property PlayerInventorySystemComponent::bIsActive (SourceClass: ActorComponent) was not registered in GetLifetimeReplicatedProps. This property will not be replicated. Use DISABLE_REPLICATED_PROPERTY if not replicating was intentional.
But it's alright, right ?
Cuz i don't think i ever saw someone replicating bReplicates or the others
Never had that error, but it almost looks like there was a super call missed.
did you forgot to call Super::GetLifetimeReplicatedProps?
Yeah.. forgot the super call in my UInventorySystemComponent 🤦♀️
So I'm trying to interact with a 3d widget with a Widget Interaction component, starting from the Collaborative Viewer Template.
I can't seem to be able to click the 3d widget on the client. My custom hit is ok on the client-side but the "Press Key" isn't actually clicking the UI. Any ideas on what I'm missing? It's probably something really stupid that I forgot :q
This is called when I click (non-VR) or point-and-trigger (VR)
Does HandleStartingNewPlayer fire after PostLogin?
Yes. PostLogin is before HandleStartingNewPlayer
Good to know, I've been relying on PostLogin for my setup needs. Haven't gotten to seamless travel yet.
2 things call HandleStartingNewPlayer
PostLogin, and HandleSeamlessTravelPlayer
its BlueprintNative, unlike PostLogin which is BlueprintImplementable
and c++ _Implementation is what calls RestartPawn which by default Spawns DefaultPawnForController
_Implementation being AddParentCall
from BP
Awesome Possum. This is great to know, went ahead and just changed my setup to use that instead of PostLogin. Even gives the controller, so that's nice.
I've found an issue, whenever I fail the pounce attack as a client (which is meant to send you into a cooldown animation- which is fully functional on Standalone) it sends to "set movement mode" node to the server. I want it to trigger for the client, but it automatically sends to the server and punishes the host instead. Could this be something to do with the "Get Player Pawn"? Or maybe the cast? Or should I use something else instead of the Set Movement Mode?
I've tried setting the Max Walk Speed to 0 but that allows the player to spin in place
Don't use Get Player Pawn in anim BP. Use TryGetPawnOwner.
OH MY GOD
YOU JUST COMPLETELY FIXED MY ISSUE IN ONE MESSAGE
What a live saver! Thanks so much!!
I want to make it so that when a client hovers over an actor in the world, it changes its appearance for only the client that hovered.
Inside of this character, I have it so on BeginPlay it binds OnBeginCursorOver and OnEndCursorOver to the character's Capsule Component.
In OnBeginCursorOver, I set the widget text to something, and OnEndCursorOver I set it back.
As you can see in the video, it works for both of the connected players to hover over each other's characters, however it does not work on a character that was already placed in the world. I can't figure out why.
show code 😄
void AVCharacterBase::BeginPlay()
{
Super::BeginPlay();
GetCapsuleComponent()->SetCollisionResponseToChannel(ECC_Visibility, ECR_Block);
GetCapsuleComponent()->OnBeginCursorOver.AddDynamic(this, &AVCharacterBase::OnMouseEnter);
GetCapsuleComponent()->OnEndCursorOver.AddDynamic(this, &AVCharacterBase::OnMouseExit);
GetCapsuleComponent()->OnClicked.AddDynamic(this, &AVCharacterBase::OnMouseClicked);
}
void AVCharacterBase::OnMouseEnter(UPrimitiveComponent* TouchedComponent)
{
FString HoveredName = FString::Printf(TEXT("- %s -"), *DisplayedName.ToString());
LocalPerformSetDisplayName(FText::FromString(HoveredName), false);
}
void AVCharacterBase::OnMouseExit(UPrimitiveComponent* TouchedComponent)
{
LocalPerformSetDisplayName(DisplayedName, false);
}
void AVCharacterBase::LocalPerformSetDisplayName(const FText& NewName, const bool bOverwriteActual)
{
PerformSetDisplayName(NewName, bOverwriteActual);
}
void AVCharacterBase::PerformSetDisplayName(const FText& NewName, const bool bOverwriteActual)
{
if (bOverwriteActual)
{
DisplayedName = NewName;
}
Overhead->Nametag->SetContents(NewName); // simply sets the text contents of the widget
}
kind of a wild guess, but maybe: GetCapsuleComponent()->SetCollisionResponseToChannel(ECC_Visibility, ECR_Block)
maybe the collision response is not set for the objects that were already placed?
maybe nothing in the BeginPlay() gets run for them at all
I have log messages at each function and they do print when hovering over that object placed in the world
hm!
I probably need to re-think where I'm calling these functions based on ownership. I didn't think it would matter for a client-side effect but I am probably wrong
i'm pretty new myself, sorry
I have never done this myself, but given the symptoms you are experiencing the answer is yes you want to do that once the local player actually does beginplay
because as you experienced for actors that already exist it wont work due to it not being networked ( I can't confirm this cos I'm knee deep in something else right now )
but the basic logic you can apply is to check on the character's beginplay that it is the local player, and then go over all those actors you want this enabled on and set it then
Is there any way of getting a client player controller of one client on another client?
No. Player controllers only exist on the owning client and on the server. There is no means to reference another player controller from a different client.
You can use the pawn or playerstate reference of a player and pass it to the server, and the server can do what it needs to with the player controller associated to the pawn or playerstate.
Gotcha, thanks!
Got here a small problem which is probably related to the amount of time which it takes to replicate things down to the client.
I'm dropping an item (Server side) and i want to update the inventory on the client directly after the drop, but the client will still have the old amount.
It will be updated when i manually click the "Update inventory" button in my UI, but it's pretty weird that you'd have to do that manually.
I've already tried to OwningActor->ForceNetUpdate() before updating the inventory, but that will also not work, any ideas ? 😅
For now i'd just update it like here as it seems to work, but it feels rather dirty. Not even sure if that's a thing i should do tbh 😅
FTimerHandle UpdateInventoryHandle;
const auto& UpdateInventoryDelegate = FTimerDelegate::CreateWeakLambda(this, [this]()
{
Client_UpdateInventory();
});
GetWorld()->GetTimerManager().SetTimer(UpdateInventoryHandle, UpdateInventoryDelegate, .1f, false);
Why not have your inventory replicated VIA RepNotify? When the server changes the value, the repnotify would fire on the client when it's received the update and you can use that event to drive changes to any UI etc.
Hi so I have a repnotify function associated with a variable, yet it is not being called.
To break it down, a variable is being set server side (I have verified this happens) yet when it is changed the associated function is not being called. The variable is being used in GetLifetimeReplicatedProps and is declared as show below:
UPROPERTY(ReplicatedUsing = OnRep_CurrentHealth) // Has a UE_LOG on initial change of this variable through a function that is being called by the server
float CurrentHealth;```
UFUNCTION()
void OnRep_CurrentHealth(); // Has a UE_LOG that is not being called once the variable has been set```
Can anyone help me?
Somehow didn't thought about the RepNotifies, will try it ^^
You mean not getting called on the server or also on the clients ?
the on_rep isn't being called anywhere, so on neither
Alright, cuz it wouldn't fire on the server as you'd need to call it manually in C++
Any chance that you've forgot to enable the replication on your owner or similar ?
actually it was that, constructor wasn't being called to do that for some reason on compile
will definitely check that in the future, thanks
so if i have 2 character pawns (eg the provide ThirdPersonCharacter pawn), if i call Player2PlayerController SetViewTargetWithBlend in blueprints, using Player1's character pawn, the camera for Player2 is now controlled by Player1. is there a way to stop this from happening so that Player2 can control the camera?
Can I make a property that is not replicated in the father(engine class), replicated in the son(custom derived class)?
well usually it's just "parent" and "child", but what exactly are you trying to replicate from an engine class?
there's usually a good reason it's not replicated by default
SpectatorPawn from PC
I need it replicated, because I want a way to tell a spectator to spectate another spectator. So I want them to know about one another
Does anyone know why my rpc _implementation functions are throwing intelisense eorros?```void ATicTacToePlayerController::Server_SetEOWNER_Implementation(TEnumAsByte<EOwner>,APieceSpawner *)': overloaded member function not found in 'ATicTacToePlayerController'
void Server_SetEOWNER(TEnumAsByte<EOwner> type, APieceSpawner* in_spawner);
Have you declared your _Implementation in your .h?
I never have before, I have other RPC in the same class and just define the server function. I just tryed to add the implementation and validate to the header and still same error. I am very confused.
you did not implement the Implementation function
also TEnumAsByte is some 2014 stuff unless this is a legacy engine enum
did not do the implementation function, never do. I did just try to add it and I get the same error for some reason. What do you use in place of TEnumAsByte?
I said implement
you must do this for all RPCs
declaring is optional
since UHT does this itself if you don't
WithValidation is also optional now btw
oh well yeah I implemented it in the cpp
show code then if it's not working
I ctrl + x. closed Visual studios and then ctrl +v when it opened back up and now it compiles....
oh well I guess?
I really doubt that did, but take the win I guess
What's the dummy ez way to replicate some data for a World Subsystem, just make an actor to do it?
Hi, I need players to download the host's save when they login to a server. These saves can be quite big and give me that max size error if I try to just replicate them. I can't find what method I'm supposed to use to transfer large data, does anyone know how?
Surely there must be a better way than trying to send the entire save over to clients.
What is it within the save that the clients need?
mesh data and textures
Your options are pretty much any one of:
- Put that data in replicable objects with appropriate properties (not just a TArray of binary data that might be too big - I know this isn't always easily possible)
- Chunk the data up yourself and send it via multiple RPCs
- Come up with something outside the replication system. This could be anything from HTTP to custom TCP or UDP sockets. You're not really making use of the engine's networking aside from maybe the built in socket classes.
Are blueprint interfaces replicated by default? Or do I have to rpc the message?
No replication on them. All they do is pass a message from one place to another on the instance of the game they're run on.
gotcha, thanks. I was wondering why my bpi wasnt working
sorry for a newbie question - i'm following a tutorial and the first step is #include Net/UnrealNetwork.h but my autocomplete doesn't find it, and SetIsReplicated breaks the build because it's not found
so I see in the docs that maybe this moved to Components/ActorComponent.h but the build fails with that include also
is my IDE set up wrong, or is this tutorial too old to be useful, or... where should I look
#include "Net/UnrealNetwork.h" is correct
is it a clue that the visual studio autocomplete doesn't find it?
right, so I am wondering how to check if I have something not setup right with vstudio
no, the quotes are there, the highlighting looks right
it built before i added it, it's a pretty clean from scratch c++ project
I think you should be using bReplicates = true
i just want to work through the tutorial to start, it's OK
i was worried that maybe it was too outdated though
Maybe close the editor and rebuild
I should be using this include, right: https://docs.unrealengine.com/4.27/en-US/API/Runtime/Engine/Components/UActorComponent/SetIsReplicated/ ?
Enable or disable replication.
SetIsReplicatedByDefault is preferred during Component Construction
but to follow the tutorial, just how do i import that particular function correctly?
i get it, i'm just trying to follow along though
and am stuck on literally the first line
how did you create the class
we right clicked in the editor and did 'create c++ class'
and then vstudio detected that it was added and did some compiling
if you selected actor component as the class, it's already imported
otherwise from a different parent class what you posted would work
hm
#import "Components/ActorComponent.h"
just because auto complete says its wrong doesn't mean it is
what does the compiler say
identifier "SetIsReplicated" is undefined
ok, thank you though, it helps me rule out some obvious things
can you post the code around it
{
Super::BeginPlay();
SetIsReplicated(true);
}```
there's no code, it's just added that single line so far
oh yeah
you made an actor it looks like
not a component
what's the header for APlayerStats
the A is the clue
it should be U
okay
no, i'm going to use what the tutorial uses.. thank you, that was it
👍 glad it helped
is there a good way to replicate a map? ive read that i could use a TArray but .. im using a map to guarantee unique keys which i cant do with a TArray
Maps can't be replicated. Closest you can do is use an array of a structure with your key type and your value type and having functions set up to add/remove/find items from the map that search for the key within the array structure. You can also simulate replication of a map by having the map exist on both the server and client and update it on both VIA RPCs (ie. sending the key and value through the event) but that's only useful if you're working with actors that are always relevant otherwise the clients will go out of sync.
How would you suggest keeping a BIGASS adjacency list in sync between server and client? It'd be about 5,000 rows long at absolute max and each row would have maybe 5 entries, either pointers or GUIDs
I could use an edge list instead of adjacency list, then it'd be a single array of up to 15,000 or so tuples of pointers or GUIDs
I think you can overload == on your entry struct and use AddUnique
so it'd just check MyStruct.Key for equivelency
Any reason why that when setting a rep notify array's elements, the rep notify runs on everything but the dedicated server (only the clients)? When completely setting/overwriting the array, everyone gets the rep notify including the dedicated server.
RepNotify doesn't run on server because it doesn't replicate to itself
Except in BP because...... idk why it's just BP
I think it's just to be helpful. Honestly I'd prefer it as it makes it easy to make things state driven everywhere
Yeah I think it makes more sense, what doesnt make sense is why only some edge cases replicate to the clients only
They really oughta bring the 2 up to parity and choose one approach.
Definitely
Can confirm it’s a design choice from BP designer
That’s what I heard from Epic
Random fun fact about that BP RepNotify. That is actually the Set node. You do not get the same affect when doing a ++ on an integer for example.
Course Hero took the content offline. Thanks for the heads up!
Im getting really beaten down by rep notifies tonight but why do array rep notifies not run on the client when you are using a custom actor class? Non arrays rep notifies to all clients just fine on custom actors but once its an array, it doesnt work?
hard to explain but when i use a replicated array on my first person char, it runs this code fine
but when doing the same on another class (Its set to replicate and is being set by the server), it only prints from the server, never the client
well i put my functionality on the game state and it all works. Just really wish bps werent half finished/implemented
They work fine. Chances are that your actor wasn't relevant?
If your actor was just a scene component, it won't register as relevant to a client.
I am having some issues with replication in my ue4 dogfighting game. The guns replicate, in the editor it all works flawlessly, but in actual multiplayer their source seems to lag behind the aircraft that fires them. Can't really figure out why
as you can see the other ship is firing, but the lasers aren't coming out of it, but rather from nearby
the lasers are physical objects being spawned from the muzzle of the ship
@rough jolt welcome to multiplayer 🙂 I advise testing in editor with Network Emulation set to Avg at least at all times, then you should see the same problem in editor at least.
By the time the fire RPC comes through, the remote player is no longer in the place they were due to prediction. A common way to handle this case is to fire the shot from the current remote player location and lerp towards the correct flightpath over a short time period.
Thanks! I dont know if this changes anything, but i should note the bullets are desynced in his screen also, which makes it hard for client players to aim
similar issue. a lot of games like this use client side authority for shooting, so that the client always sees their own bullets correctly.
Client sends a message to server saying I fired from X location in Y direction, and spawns it's own bullet so it looks correct.
Server receives the message and can either spawn a bullet and fast forward it based on the round trip time, or just replicate the message to other clients and allow the firing client to handle collision.
Yw ^^
I'm spawning some non-replicated actors on both the client and server independently and then calling SetNetAddressable() on them on both the server and client. However, when I do this I get a lot of log spam on the client. Does anyone know how to avoid this?
I get that spam until the client finishes spawning those actors
@winged badger I think you have the most experience with this?
they need to have the same name
also, you shouldn't turn replication on until client has spawned them
I'm not specifically doing anything with the name. I only get this log spam until the actor spawns on the client though.
I'm not turning on replication at all
These are for actors that have IsReplicated set to false
if its NetAddressable
AActor* const Actor = GetWorld()->SpawnActorDeferred<AActor>(ClassToSpawn, ActorToSpawn.Transform, nullptr, nullptr, ESpawnActorCollisionHandlingMethod::AlwaysSpawn);
if (!Actor->GetIsReplicated()) {
Actor->SetNetAddressable();
if (GetNetMode() == NM_Client) {
Actor->SetRole(ROLE_None);
}
}