#multiplayer
1 messages ยท Page 676 of 1
I have a giant struct array that updates tons of units at once
every unit saves snapshots going back in time
the client can then diff against those snapshots
so
this is a good interpolation/exterpolation system:
for snapshots
however
the actual multiplayer code here
is terrible
and incredibly unoptimized
but the interpolation/exterpolation code
is excellent
and can be ripped out
replication is far more efficient than the rpcs and garbage serialization used in this though
it basically serializes in a way that disables unreal from using its built in bitpacking code
but you can rip out the snapshot code, which lets you have great control over smoothing and how far back to interpolate
yep, exactly. To be fair an RTS is not that hard at its core - a relatively simple 2D physics simulation, deterministic game logic... the rest (graphics rendering etc) is only client-side. The problem is getting there with Unreal
for the moment, each Unit is ACharacter which gets replicated, I didn't do much besides some testing and profiling
that is probably not the way to go
also I wouldn't send rotation if you don't have to
and can infer it from what is happening
since rotation can be used to calculate flanking damage etc I think it is important in our case
can't you infer it from their state?
also
damage would be calculated on the server anyway
that is true
still, I don't have a way (yet) to send properties separately, I am sending the whole ACharacter
from what I understand, you have your units/actors/whatever, and you don't replicate them directly, but hold the properties that you want to replicate in an array, and sync both?
i have an actor that I sync in the scene
and overseer
it has an array
I replicate that
then update the actors
I mean
to have 1000s of actors
you want to use a hism anyway
which means you don't have 1000+ actors
to make it run not like garbage
you can't have 1000s of skeletons in the scene
hi all, when a second player joins on a play in editor test, first player loses their ability to input controls
it seems like the input bindings are getting overwritten maybe?
Hello, I'm pretty new to unreal engine and trying to figure out some movement mechanics for a top-down game. Hopefully I'm not too far off in my current understanding of what I've done.
I'm currently using the CharacterMovementComponent, configured to orient towards movement, and uses accelerations for requested moves. This allows me to use a client side nav mesh while supporting multiplayer. I'm currently wondering if there is a better way to "turn in place". I've hacked together something using a path following component and an ability task to turn my player's character towards a cursor location when they want to use an ability, but I've done that by navigating to a location a nominal number of units ahead of the character, along a look at vector.
Is there a way I can turn the character without requiring that small amount of forward movement while using a CharacterMovementComponent configured to orient towards movement that is integrated with that system? Will I need to make my own set of RPC to explicitly LERP the character on the server side and have that replicate back?
this is my current movement and the client appears incredibly jittery to the server. Should I have set it up differently or something?
you just replicate the array that exists on the single actor
you don't replicate anything else
or sync anything else
then use rpcs to coordinate the other information
Is there anyway to confirm a replication happened?
on the server
like to know a client replicated a change
RPC the server.
ok that is slow af though
like internally unreal does confirm packets it received
for replication
is there any way to see that though?
Interesting, I tested 2k actors locally (singleplayer) and performance was bad due to collision/physics, but the draw calls were not very expensive
Does HISM replace the need for individual actors entirely, or only their Static Meshes?
hisms replace everything and are just a transform
Ohh I see! And so animations etc are just animated textures?
umm
the textures go into the shader
yes
and they are just maps of vertex displacements
@slow pond interesting, thanks for the idea, the concept was a bit new for me, although I have seen something similar for an RTS game
So you basically want to have very basic "units" which are just the minimum bunch of needed properties, in an array, and display them as HISM
yes
@dull chasmDo you have any engine experience outside of unreal? Modding experience? Attempting to do a multiplayer game right out of the gate is going to be one heck of a headache if you answered no to all of those questions.
Anyone have any idea when doing a destroy actor event that the client doesn't have a reference to the actor? I know it sounds rudimentary for this particular case, the multicast shows the client as not having a valid reference to the actor while the server does. Doesn't matter who destroys it (client or server), the client never has a reference. Destroying actors how I normally do in MP simply doesn't work for this.
Clients shouldn't destroy replicated actors
Actor is set to not replicate
Then you need to destroy it on all machines seperatly and a replicated reference will NOT work
They aren't the same actor on server and client side if it doesn't replciate
^
only way you can handle this is having a unique ID on the door, and each client going through all door actors and destroying the correct one if its not replicated.
sending the door reference will not work.
Like I said, I know it seems rudimentary the normal method doesnt work. The client asks the server to do it, even if the server does it itself, it still remains on the client
Because the thing isn't replicated
replicate the door
Same result if I set it to replicated
show your logic
It's not a door, for what it's worth
okay, this will a sec because it is a long chain of events
oops ignore Door, i was working on doors, so got a bit brain farty ๐
and where is this called from?
I have no issues removing the ISM
If I break the logic the ISM is removed on both
right lets step back a bit, cause you seem to be doing a lot of extra steps
Okay, let me do just a high level walk through, I very well may be doing extra steps
I had it that way but the results I get are the same
right so change it back
make it runon server and have it do the multicast
will clean up some nodes
Line trace hits ISM, replaces with BP, BP health is 0, spawns resources and it destroyed
okay will try
right, so you need to do a couple of things
client hits ism -> Tells server i hit the ism, server checks the health and destroys if needed, else it replaces an ism?
It replaces on a single hit, but all that functions
If I disconnect here, the ISM is gone
Running replace foliage on server directly produces the same result
I'm assuming it has something to do with spawing the master resource actor
Pretty much, but the ISM isn't the issue
This guy, which is just a basic actor, will not be destroyed
yes
because you spawned that locally
server and other client have no idea what that actor is
Okay, so yeah that was what I was figuring
At one point I had it functioning, but the client had to destroy it twice
this can not be addressed over the network
we handled all out ISMs with C++ and fast array serializer
was so much simpler that way
replicated ism instance infos?
issue is not the isms apparently
its the actor is spawned locally
isms work by index so technically you can not go wrong with them
@spring vortex i suggest a rethink of your design
you should spawn the ResourceManager on server only and set it replicated
Yeah, I'll need to. I did work towards a Resource Manager actor in the world but gave up in it
or you spawn it locally and map it with a unique ID
and look up the local instance spawned, by the ID via a Map.
I guess my question would be, how is this different than spawning a pick up actor and having it be destroyed?
theorically I mean
pickup actor is spawned on server
and replicated
and server destroys the pickup when its finished
correct
ah okay
everyone creates there own copy of that actor
hmm
locally spawned actors often get out of hand, especially if you have join in progress new client will have no idea about them
even if you replicate it, clients will then have 2 (locally created one and server replicated one)
so maybe I can call replace and respawn as two different events?
you can consolidate that logic
into a few simple steps
what you have done is complex for what is happening
yeah I need to get it under control
@spring vortex here:
Client Hits ISM -> Server Replace Foliage gets called -> Replaces ISM -> Spawns new Actor. New Actor replicates and sets the mesh, etc
server also destroys the actor if its dead
also you should move those multicasts into the actor
they do not belong on the character bp
Appreciate the advice
if you need help i don't mind jumping on screenshare with you and explaining, if you are still a bit confused ๐
Would you call these events from the ISM?
I would love too, but given the current circumstances at home it would be less than ideal
its all good, just offering ๐
I appreciate it, for real
I would have an actor with ISM and replicated fast array member for state .
hits/updates happen on server
onrep of state array would update things on clients
As far are removing the ISMs and having them destroyed on a loaded game, not issues at all
how does it work if someone new joins the game
So I worked toward onrep for a bit, but then I stopped as the actor would be gone, so my assumption was that the rep wouldn't fire
or they enter relevancy of the actor?
Multicasts are good for one off things
but not for maintaining state
Host has to join first and it removes the actors before the player does. As far as I know, the client doesn't see them but we can test that in our next stream session
before the player joins I mean
i like to use the Barrel analogy for Multicast vs OnRep. A barrel exploding would be a multicast, a barrel in dead state would be via a RepNotify.
you don't want to do explosion particles on a dead barrel for a new player, but you want to show the barrel being dead to the new player.
so onrep will still work even though the actor has been destroyed
okay, need to confirm that client cannot see server destroyed ISMs on load then for sure
will add that to the check list of the next MP test
As a side not, I will need to store the resource hit array some place else, as it stands now only the sever array is saved to remove foliage
right now it is just like minecraft, I haven't gotten to the point of saving and loading client data like inventory, health, equipment etc
conceptually I'll just store a struct array using the steam ID as the "primary key" for loading in client data
That is something that MUST be solved at some point though lol
You sexy son of a bitch! It got it working!
Just some icing on the cake lol
I have it sorted, but it is funny getting excited for having it working then getting a merge conflict
hello, iโm having an issue with replication
from what i can see in logs, all my actors are being properly replicated once, but after that one update, nothing more is updated on the clients
any ideas why this could be happening? thanks
Is the actor spawned or placed in the world? Is it dormant?
Have you set bNetTemporary = true;?
Are you using push model and if so, are you marking properties dirty when changing them?
And of course.. are those actors relevant?
That's the main culprit
what exactly is a push model?
Common issue is too high a network load, like reliable RPCs on tick
Also BP or C++? If BP, you don't need to worry about push
c++
If you don't know push model you ain't using it
itโs weird because i can see the actor channel being created for every actor that needs to be replicated and i can see some properties being updated but as soon as it replicates once, it will not replicate further for any actor and all i can see is acks in logs
Show the code
not at pc currently
hi up please ๐
i really need help, i don't know why client can't interact with textbox (but can interact with all) but host can
There is no difference between server and client interaction with widgets until you program that in yourself. UI is all local, and should be treated as such in code. If your clients can't use that, check everything referencing it and look through the list of bindings in the widget. Something has to be doing checks or setting it up in a way based on net mode.
the problem is that I tried to make a new widget (with an interaction)
that computer with widget interaction
and so when I redid a blank widget, I only created a button and a textbox, I could only interact with the client side button
Ah. I don't remember how to set that up, but I remember an issue where you have to assign IDs to the widget interaction components if memory serves.
i do
in my bp character
host have 0
and my client have 1
widget interaction is on my bp character
so idk what wrong
why only my client can't interact with the textbox but can interact with all
this is just really weird though and i havenโt been able to find anything about it online
itโs not like it only stops replicating one actor, it stops replicating all of them
hello, good evening, anyone know a recommended link for a good multiplayer fundamentals utorials video?
check pins
so how i can unlock this ?
Start by having the entire UI stuff happen purely client side
If you have network issues in your UI, you are doing the UI wrong
ahhhh okay, thanks
i do this
its simple
and i have created a simple widget test
all clients & host can interact (i mean buttons and all shits)
but client can't interact with all textbox
no sence
stupid question, why my OnRep_Notify method executes on server?! it is simple method to spawn effect, if I using multicast unreliable nothing happened but if use reliable effect also spawn on client
Actor where everything executes is marked as Replicates
i thougt OnRep_Notify always executes on client
They do, unless it's Blueprint because BP is stupid
yes ๐
what usually manages spawning of FX for weapon projectiles?
Player Pawn has Weapon Actor
Weapon Actor produce Projectiles (sadly they are spawned via netmulticast and very short-lived and super fast)
if projectile hits any actor that implements IDestructible it triggers TakeDamage and does damage processing
but what manages spawning on-hit effects when projectile hits something like landscape or anything else? Would it be responsibility of projectile or weapon or something else
i'm trying to un-vaal this system for several weeks that was made by some madman
Projectile would spawn it IMO
as it become extremely overcomplicated
the problem is, projectile effects are based on damage and what it did to actor
but the projectiles are spawned locally which gives tons of headache and authority checks
every time projectile is shot - netmulticast, every time projectile hits something - netmulticast
eww ๐
with several people with 600 rpm automatic weapons it destroys network
We actually process all damage locally anyway, just we only ever modify health on the Server. The engines built-in damage system (especially from Blueprint) doesn't make that easy though
Thankfully they're removing that crap in UE5
not using UE TakeDamage system at all?
i can't get rid of it since professional blueprint coders actively use it
i have a LocalFXManager actor in the world
which handles pooling/reusing of FX, etc
I think in this case it's more about spawning different FX based on damage.. but that's only calculated server side
Strange way to spawn FX though
Normally it's based on the surface you hit or something?
there are tons of math and calculations on each hit counting entire actor, what bone was hit, what angle, what force etc then damage amount calculated and fx is chosen
i hate client side damage
especially when you have modifiers and calculations
showing bad damage numbers, etc is worse than a delay
we predict the hit FX, but all damage is server side, with callbacks to the client who dealt damage with the damage data
yeah that's the only sane way IMO
(in my personal project anyway)
in RS2, we have clients doing damage (all clients)
and lots of issues with bad damage numbers/health being out of sync etc
ah yeah we only modify health server-side, just can predict the calculations client side
(and no damage numbers for us)
how do you interact with it? via reliable rpcs ?
i use GameplayCues
oh
and weapons for example, handle these and forward off to the LocalFXManager
@chrome bay in my project, a single weapon shot can do about 4-5 gameplay cues
per shot
each one of these is a Unreliable Multicast
i ended up doing custom batching based on the cue tag, as the data is the same for each cue, and just do one multicast, and unpack it and invoke the cues on the client
I never got that far into GAS/Cues.. are they like batched up unreliables with some data attached?
they are not batched
ahh kk
every cue is a single multicast rpc
righht
that was 5 multicasts per weapon shot
i even ended up batching the ability activation
that was 3 RPC's per shot
now its 2 rpc's per shot, one for Ability Activation, Target Data, End Ability, and one for the Cues per shot
Yeah that's one thing I still need to do for our weps is batch the shot + hit together, but since everything is a projectile usually they aren't in the same frame anyways
my weapon abilities are just simple trace, produce target data, send target data, end ability ๐
i did all the weapon firing (ROF, etc) inside the weapon class
or if its projectile weapon, it spawns projectile
Projectile then handles the stuff itself (i just send along a special GameplayEffectContainer that the projectile uses for Hit and Explode)
does NetMulticast triggered on dedicated server too (just to confirm)
hmm not actually sure tbh
ListenServer it does
so it probably does..
let me test real quick
so atm weapon does netmulticast rpc that spawns local projectiles with no delay
the local projectiles play basic effects on hit
the projectile with owner that has authority applies damage and broadcasts damage effect hit netmulticast rpc for secondary effects
good
Iโm lost at vr multiplayer, thereโs literally Zero tutorial for unreal engine
2 VRs with 2 PCs
Can anyone help with this issue plz?
Should work the same as regular multiplayer
Have one of he players run as listen server, the other can connect
open <ip> in console to start with, and then you can move on to sessions for your preferred social platform
VR doesn't change anything here, any tutorial on multiplayer should cover it - and you should probably work as much as possible with one PC without the VR support
Key to multiplayer work is to set yourself up with a nice environment to work in multiplayer and two different machines, while very good for real-world testing, ain't it
Okay so please bear with me, spawned 2 player starts
And then
I changed these settings here to this
So i made listen server, now after this step should i package it and open it on another pc too so i can open console and connect ip and it can join ?
That's one way but you'd only do that when you're confident the multiplayer code works
Use the editor multiplayer to prototype outside VR
Very strongly this
i tried this method, but seems like something is missing, and the widgets don't appear on screen, looks like it only works for fps, not sure how to correct it to be vr
I'm doing a game that will ultimately be VR, but I'm validating my replication through some non VR characters first because the iteration time is so much more rapid
Does anyone have Bp code that i can apply to mine ? all i want is to simply join with another vr PC ( as i do have 2 VRs and 2 PCs)
That's a vague question. You already can join another computer, just type
Open othercomputeraddress
With the other computer running as listen server.
Pardon me Adriel, just to understand you correctly, can this โOpen othercomputeraddressโ be done after the game is packaged? Or by pressing the play button
It's a console command. It can be difficult to do console commands in VR, so for PoC it would be good to use the "Execute Console Command" BP node and hardcode the address
IIRC the VR Expansion Plugin example has some UI to do quick LAN testing, but I've not used it myself
What i meant is since @bitter oriole told me i need to check my network BPs, isnโt there someone here who done the same thing, who can just pass me the BPs so i can apply them to mine?
Ok thatโs good i actually downloaded the plugin and Iโm about to experiment with it
You sound really new to this. I'd recommend getting something super simple working on my player before trying to jump right into multivr
Iโm sorry for being vague but i seriously need to make this work
Iโve worked with unreal for 8 months but nothing multiplayer
Guys I have a problem I am doing a game mode of respawn of players with their statistics that I have saved in load and when I eliminate the server player when respawn again I do not get their statistics and it is because I am eliminating the server client user there Some method so that the other players take their load
VR is no different from regular multiplayer. If you dont know how to set up a regular walking MP character, then go do that first before trying VR stuff. There's a million tutorials on it.
Make sure you get the example version of the plugin as well. That's the part that shows how things go together.
:triangular_flag_on_post: Adrio#7720 received strike 1. As a result, they were muted for 10 minutes.
Hi guys, we are trying to get 2 occulus quests to work together, we have 2 pcs at our workplace. We are struggling for a week to make multiplayer work. ive seen ppl ask here about it,
we have the same issue
Hello I'm a ue4 developer and I want to create a online game like fortnite and I've created characters and maps please help me and tell me how can I will programing my game's online part?Please provide a training package or a YouTube channel for this๐๐๐
@dark edge Hi, since you're also working on multiplayer vehicle physics. is it possible to share your physics correction settings?
Also, all you said is that you are a ue4 developer - no mention was made of how many years of experience with C++ or any other language you have.
There are no "make a complete fortnite game from A-Z" courses out there. Best you can do is check out places like Udemy's or Tom Looman's multiplayer courses or browse the example projects UE puts out there (such as shooter game)
eXi's docs are really good too
Simply put if you need a tutorial for making a game like this you should forget about it
You lack experience
that was pretty clear lol
๐ฉ
like when people think they're going to make an MMO as their first project
I would advice everyone here to not engage users like these too much,specially if they show no understanding. It's an ever repeating thing and it costs time and energy
Should probably make a website for this with multiple urls pointing to it
and it's just a single page saying "Don't"
It is unfortunate too because I definitely have no desire to quash people's desire to develop games by being dismissive about it but they need some kinda reality check
Yeah I mean you can discuss with them if you want. And maybe the understand and you can guide them to a smaller scope, which would be wonderful
The problem with ignoring them completely is that they won't take that as a no. They will continue to waste time trying to complete an unattainable task.
Just make sure you back out if it looks like they don't get it
only so many times you can have the same conversation though ๐คทโโ๏ธ
Yeah, that part I agree with
Let them, they will learn that way
well this channel has a bunch of useful pinned messages for networking topics in UE4
I definitely sympathize with them a little bit because I remember back when I was ~13 thinking I'd get into game dev and make an mmo
A shitty formatted compendium that should really be redone to match current state. Maybe with the release auf UE4 and new images
20 years later now I DEFINITELY don't want to make an MMO ๐
I sympathize with them too, tried to make some multiplayer game in unity a couple of years ago and started in UE4 with trying to make some story driven multiplayer survival while studying.
Internally we are now down to a Singleplayer game with limited scope :D
Yeaaah.. I started with multiplayer in UE4 and hit the same walls so many people do. But instead of scaling down to singleplayer I slammed my head against the wall for 5 years until it all made sense. didn't necessarily take that long but ..
I don't know. I have a hard time with singplayer. I know I would have actually completed stuff by now if I did singleplayer
but .. i cant
the thing with SP is mostly things "just work"
After having worked on the Ascent for 2 years I really don't want multiplayer anymore atm haha
different story for online MP
I'm in the same boat. I'm a single dev making a game in my off time (like now, during my 2 week vacation, I'm making my game). I could have had the game already into the pure content creation phase at this point if I didn't try to make it MP. But SP is boring for me. I want to play with my kids and wife
so if it takes another year and a half, so be it
Hopefully you don't burn out before you finish ๐ฌ that's been the story of my last .. 10 projects
Here's to hoping. I've been able to stay on the same one for over a year now.
We actually stayed in the same world as the previous project which is on halt due to scope too, so we can reuse things in the future
Work smart!
But yeah, to get back to the original thingy, guide them but don't burn out on those peeps
I had to stop answering questions on the UE4 forums because so many questions were basically "how do I make a game"
My Ill butt will now try to sleep. Have a great day/eve and take a break once in awhile!
g'night! but .. no ๐
yeah the r/unrealengine subreddit is pretty bad too, even the memes
the memes are like "yeah, I can tell you don't do this professionally"
some of the memes give me a chuckle. specifically ones about compiling shaders
Does anyone happen to know if there is some indication client side when re-relevancy occurs for an actor..? Seems a bit meh to check the life time, but I can't really see anything in the net driver. 
would a dedicated server that is struggling network-wise (e.g. way too many rpcs/players) cause fps drops on clients?
I wouldn't think so ..... but I may not be fully comprehending the impact that would have. I would think clientside you would see a lot of rubberbanding.
But not necessarily FPS drop ..
Actually really interested to hear what others would say about that
Theoretically I suppose you could affect FPS from what you do on the server. Say you send a lot of data that then has to be processed in the actor channels at frame start. But realistically, I have a hard time seeing that ever being a concern
And if that is a concern, you probably have a larger design problem on your hands :3
You can always see what is going on by using insights though, so you should start there.
@harsh lintel
@odd idol what do you mean with re-relevancy?
if thats some proper engine term, I certainly dont know about it ๐
NetRelevancy is an engine feature that lets you stop replication for designated actors either for all or only some channels
Re-relevancy is when an actor that has become irrelevant for some client (and was thereby destroyed) becomes relevant again (and is thus spawned on that client again)
ah, gotcha. All our actors are AlwaysRelevant so I wouldnt know about this
As far as I can see there is no good way to determine if a spawn/beginplay was due to rerelevancy or not though 
But seeing that the actors are non existant when not relevant, BeginPlay would jhave been my guess
I mean you could manually denote the intentional spawning, no?
Yeah, but a BeginPlay could be because a spawn was issued, or it could be because of rerelevancy :<
with BeginSpawningActor -> Set bool that its not through net relevancy -> Finish Spawning Actor
BeginPlay is only called after FinishSpawningActor
UGameplayStatics I think it is
I believe that chain occurs for both spawn paths, so I don't think it would make a difference ๐ค
I'm currently trying to debug if there are any callstack differences, but don't really see anything so far..
no, you spawn that said actor manually, at runtime, right?
Using SpawnActor I suppose
The engine does, yes ๐
technically your CPU does ๐
Well, by engine I mean it is the net driver, not project code that processes the spawn
so just replace SpawnActor with UGameplayStatics::BeginSpawningActor, then set the boolean, then call FinishSpawningActor
Ohh wait
so your issue is not to differentiate the spawning of that actor through a.) the unrelated spawning locally due to some gameplay actions and b.) the actor being received through net relevancy
but instead a.) being spawned through net relevancy and b.) being re-spawned through net relevancy?
Otherwise I don't get the issue, then you could just use the approach I mentioned
Well, it's all kind of related, but my specific issue is to determine whether an actor receiving fast-array replicator data was spawned due to re-relevancy or not ๐
So what are the different cases that said actor can be spawned through?
Just want to make sure we're not talking past each other
Hmm, I'm probably missing a few, but the ones I can think of right now:
- User-code
- Load from package
- Re-relevancy
- Netdriver/replicated spawn
hmm
Right. Those all sound pretty easily distinguishable for me, given the approach I mentioned
I might be misunderstanding then somehow
Because you're issue is differentiating between User-Code and Re-Relevancy, right?
primarily for now. Then we could talk about Load from Package
No, in most cases it would be between a netdriver spawn (spawned on server, then replicated to client) and re-relevancy
ah, yeah you added that afterwards, or I am blind
No, I was struggling to find the term xD
yeah given that it's literally not connected at all anymore to any potential previous instance of that actor, I am not really sure
Yeah, it's a bit weird though, since this seems to me a fairly common thing 
is it? Whats your use-case, roughly?
well, yeah now that I think about it, I could see why you'd like to know
If I get signals after re-relevancy, I don't want to replay certain effects for example
Let's say something blows up when you first shoot something, when it becomes re-relevant I don't want it to blow up again ๐
Normally you would solve something like that with RPCs or cues
well the issue is that our servers normally handle up to 15 people without issue, but we have a new map and new character meshes I don't know if that could be the issue
But there are circumstances with our project ๐
not sure if thats just a poor example, but the "explode" would be a state or RPC in the first place, no?
you'd have some sort of state boolean or enum "am I exploded", which you'd check on the client
Like, there's no data being lost, right? the initial replication has to have finished, before BeginPlay is triggered, so all the info regarding whether anything would have to explode again should be available on the client
Hm, in that case I would strongly suggest you open it up in Insights, it will tell you exactly what is going wrong โค๏ธ
if you want we can jump on a call, may be easier
Nah, it's okay ๐
While what you say about state above is true, there is no real way for the client to know if this just happened or not unless I decide to expand the packets, which is also something I'd rather not do ^^;
But my workaround with checking actor lifetime works
Yeah but I am curious, I don't like not understanding the issue ๐
Would just be nice to be able to get relevancy status from the net driver... might make a PR if this annoys me enough ๐
It may be something very specific to your project, but the fact that you said it's something fairly common, it makes me think whether you may be tackling something a way its not really intended to be tackled in
I don't recall the specifics but I did loosen up the error / unit settings. Just experiment with it until your objects behave good enough
It's a trade-off between smoothness and accuracy
It might not actually be that common now that I think about it. Most projects would probably just solve this with Cues.
But you know, secret sauce and all that 
Still on Embark? ๐
Anyway. Don't know of a solution for what you're specifically looking for. I too hate it when I google some question, finally find some obscure UnrealAnswers post and people are just like "weeell you know this isnt best practice anymore since 4.16, do this and that instead"
I also loosened it up + gave some linear interpolation, seems ok now thanks
i just wanted to know if u have found a sweet spot that I could try myself'
Eeeh.. walking the stack up and down a bit, I feel like passing relevancy state to PostNetInit would be really sweet here...
That will probably be the PR if I end up making it at least 
I'm setting all players in my session to a new location using SetActorLocation called by an RPC that is Run On Server, from the gamemode. It works for the player that is hosting the server, but all of the connected clients do not see that they are at the new location until they jump. Any ideas?
There may be another way around it, I never cared to look. But I know the reason for it was CMC stuff. If you do a character RPC and set the actor's location locally I recall that worked pretty well.
There may be a way to mark the CMC dirty too. Would definitely be cleaner code that way.
I'm trying to understand some of Unreal's multiplayer terminology and how MatchState is expected to flow. Maybe someone can help.
It seems that as soon as someone joins a world, the match is automatically started? I thought there would be a period of time while players are setting up before a match actually starts?
Should I be getting my players to join as spectators first?
Are you using game mode or game mode base?
@dark edge GameMode right now
If someone happens to run into my problem:
The way I solved it was to record the creation time of the net channel. You can then compare relevancy time with the creation time and pass that into PostNetInit() to let user code react to it.
This works since channels are not destroyed during non-relevancy.

Take a look at what functions are available for you to override. There should be some functions regarding match flow in there
Unfortunately bool ReadyToStartMatch isn't virtual, it's just a BlueprintNativeEvent ๐ฆ
ReadyToStartMatch_Implementation is virtual
dose is server also return true if the server is a dedicated server
Hello I want to ask some things about multiplayer. I can understand that if you want to make a pvp game needs a server behind. But what about a coop game
One client can be the host
So he can be the server?
How this work?
Do I need to host a server for this?
Can it run p2p?
This is called Listen Server. The game is run as both the server and the client.
It sounds like you are just getting started with all this. Keep in mind it is a long trek. Here's a good video series for getting started: https://www.youtube.com/playlist?list=PLemTaQ_N519DocM4AqiK08GfsUSnxRPdv
Yep my first time in networking, I would love to learn about how multiplayer games work. I know about how dedicated servers works
One question
If someone become listen server and server check almost everything
This is heavy right?
Regardless of whether the server is a listen server or a dedicated server, it should be running all the important game logic
A listen server will be heavier than a client.
Backbone for network multiplayer is replication and RPC. That video series gives a really good introduction to the concepts.
Okay thanks I will check them
Hey!
I want to use AWS GameLift services for my game,
I have created a free account in AWS,
now I want to upload my game server to the fleet,
I want to know if I have to close or disable the server or services when I am not using it,
If YES then how?
I have linked my credit card with the account and I am just testing so I don't want to spend money on a server or services that I am not using since I am testing the free services will be enough for me.
@slim matrix IsServer will literally return true for everything that is not specifically a client. The check is GetNetMode() < NM_Client. Which the NM_Client is the last entry in that enum. So DedicatedServer, ListenServer, and even Singleplayer's Standalone setting will all return true for that function.
Not much heavier than just running the game in single player really.
Of course the more clients the heavier but it depends.
You'd only use listen servers for small cooperative games anyway
So it doesn't really matter much
The bandwidth will be much more limiting than performance
not quite
performance is a problem on listen servers much more then bandwidth
as you need to run client + server
can vary with the game, ofc
but we have very low bandwith use with 8 player coop on listen servers
while we are still struggling to optimize
Yeah it'll depend on the game for sure, but I wouldn't expect a 8 player listen server to be way more expensive than a client
It'll all depend on what you're doing really. It'll cost somewhere between O and O^NumClients depending on how good your architecture is.
@bitter oriole you are mistaken tho
NetTick is around 4-8ms
with a 8 player listen server on a moderate size game
and most of that is replicating actors
even though we went to lengths to reduce that count
(and we have about 200 actors only that are replicating), its still expensive
is NetTick mainthreaded?
yes
Does it seem that cost scales with actor count or what? Like for a really systemic game would one maybe be better off with less but more complex actors?
BulletManager vs 1 actor per bullet for example
it scales with actors and rep property count
as there is also a cost on property compare
also net update frequency and priority
all of them combined tbh
So something with non replicated data but replicated events (replicating "Bullet fired at position x and velocity Y" rather than the bullet state) might be a lot lighter I think. That'd be good for something with a lot of projectiles in flight at any given time.
Just have to compare to how Epic used it in the past. Think about Gears/UT etc. Gears was 10 players max and Gears 1 + 2 were all listen servers
UT I think scaled up to 16 players max maybe?
RPC's also have a cost
Alright, didn't think it could be that much
What did you find that really stood out as spendy?
sheer amount of replicated actors
Dormancy is your friend
make sure things that are never moved are domant
and just flush dormancy if they need to update something (if they update very very infreq)
domancy flushing does force all props to replicate
but its better than replicating it all the time if its state changes like 1 time a minute or w/e
or maybe never changes at all during the game
Hi, when i spawn an actor and assign him a integer based on whom spawend him. (Player 1, Player 2).
Does the other Player automatically know that integer because im replicating that actor or would in need that integer a repnotify?
property just need to be replicated
RepNotify is if they need to respond to that property changing
Well the other player uses this integer to assign it a color. And since the integer changes from 0 to something it would be a repnotify? Because if you create an integer variable on an actor it is normally 0.
yes it will need to be RepNotify
and handle the colours in inside the OnRep function
Ok thank you
Hi all, I'm looking to spawn a replicated actor with some preconfigured properties (different than defaults). If I use deferred spawn on server, setup my properties, then finish spawn, would that actor spawn on clients with synced properties? Or would there be a delay between spawning and getting properties? Thanks.
they would be synched
even if you didn't defer spawn it
if you set properties the same frame, replication happens a few frames later
Would it be safe to call functions on client at beginplay that are based in those props I want ready at spawn?
Or should I use onrep?
Thanks ๐
Hi! I am sending a Struct (UStruct) as param for a multicast RPC, somehow the Server gets the struct correctly but the other clients don't (its values are initialized as default). I am not very sure how Structs work in terms of reference/value and how are they passed around
are the props marked w/ UPROPERTY()?
the ones from the struct? no
nice thanks
sadly didn't work
when using the debugger, I get this:
error = read memory from 0x4fa7f81843 failed (0 of 1 bytes read)
the struct itself is just a param from the function, it is not a class member of any sort (it is just a temporary data container)
Just a shot in the dark, but are you trying to send a derived struct using a base struct declaration?
You override the _Implementation if you have to override anything at all
Generally not a good design approach though
nope, the struct is not derived from anything, thanks for the idea though
Is the struct marked with USTRUCT?
yep
Hmmm... I'm out of ideas.
yeah me too ๐
it is not the first time I have issues with structs, but it is the first time I encounter them in a RPC setting
I've seen unit'd structs go across a rep, but it was a different scenario.
The only thing I can think of
Paste the USTRUCT declaration
also is struct huge?
no, it is small
yeah but paste, need to see code to see any potential error
Does your deferred spawn happen to have anything to do with Voxel Plugin?
lol yes
Is it a voxel world?
lol yes
USTRUCT()
struct FOrder
{
GENERATED_USTRUCT_BODY()
UPROPERTY()
EOrderType order_type = EOrderType::ORDER_None;
UPROPERTY()
FVector location = FVector(0.0f);
UPROPERTY()
AEntityHandle* target_handle = nullptr;
UPROPERTY()
APlayerController* controller_instigator = nullptr;
UPROPERTY()
EOrderQueueType order_queue_type = EOrderQueueType::Perform_Now;
UPROPERTY()
bool ignore_buildings = false;
UPROPERTY()
bool auto_rotate = true;
UPROPERTY()
FRotator rotation = FRotator(0.0f);
};
I can help you over DM if you like
thanks! I can dm when I get started with it, just thinking ahead for now
It is very nuanced. I'll have to look at my code to see how I dealt with it.
UFUNCTION(NetMulticast, Reliable, WithValidation)
void NetCastPerformNextOrder(FOrder order);
It should be const ref
Also WithValidation has no effect on NetMulticast IIRC
It's only for Server RPC's
compiler should output a warning about that last I checked
RE const ref
Bear in mind though, APlayerController* will only be non-null on the client who owns that controller, and if AEntityHandle hasn't replicated yet that will also resolve to null
yep, I am aware of it ๐
It is working now! Thank you
Can you recommend any read that talks about structs? I don't quite understand them in UE4, in C++ they are mostly equivalent to classes but not here, if I am not mistaken
USTRUCT() at least is very different in that it's just for data, generally
yeah
They can have functions but not UFUNCTION()
and I cannot have pointers to UStructs
You can but not reflected ones (i.e. UPROPERTY)
Any pointer to a struct that you keep, reflection/GC is unaware of
makes sense
There's ways around it but it requires a lot of supporting code usually
and is generally not so useful
yep, I usually use UObjects when UStruct gives me problems
I dont know if it is a good idea but usually worked
I'm still trying to get my head around what Unreal wants me to do regarding HasMatchStarted. It seems to be used both in GameModeBase and GameMode. Their concept of "match" is just people being in the server? It seems that MatchStarted is called as soon as people join?
Can I define it to be when people have joined and chosen characters and readied up, or should I just ignore it and make my own concept like HasRoundStarted?
I'm wondering at what point I should be deciding to go for GameStateBase vs GameState (and GameModeBase etc)?
What does it mean when the SharedSeriaialization RPC Miss and SharedSeriaialization Property Miss are spiking?
If I spawn a non replicated actor clientside and serverside independently is there a way to tell the server that they are the same actor? As in associate the clientside and serverside representations? Is that driven via name or netguid?
is 6k bytes reasonable net traffic?
The connection keeps getting flagged as saturated--
bool UObject::IsNameStableForNetworking() const
{
return HasAnyFlags(RF_WasLoaded | RF_DefaultSubObject) || IsNative() || IsDefaultSubobject();
}``` this is what disabled IsNameStableForNetworking @jolly siren
did you increase the defaults for allowed sizes
iirc the default is super low
we just return true on our fake ones
listen server?
Yes
yeah you need to clamp it
if someone is running like 200fps
boom
saturates the connection
clamp = MaxNetTickRate ?
This is a VR game with just two players, so I was trying to keep the net tick rate relatively high. What should I clamp it to?
Thanks Kaos
we run that on 8 player coop
Cool I'll give that a try. This has been driving me crazy.
Thanks for the help
@meager spade I've got voice data going through an RPC. The RPCs should respect this tickrate limit too, right?
And I think that bClampListenServerTickRate tip was the key. The huge lag is gone now.
It's odd to me that that isn't enabled by default
It's caused me like a week of pain
Hello, hopefully somebody can offer some advice. When a client dies in my game, their mesh is supposed to convert to a backpack after simulating physics for a few seconds. switching the mesh to a different object seemed to be the easiest way to stop expensive physics simulations without it looking too strange. The issue is that clients seem to often miss this replicated event altogether, and see a stationary character mesh standing in place after they respawn or enter an area where somebody else died. Should I create a new event and set it to reliable? or is there something else I may be missing?
I'm trying to send a NetMulticast RPC called from the server, however in the same function I need to do SetReplicates(false).
When I try and send off the NetMulticast RPC, then follow the next line of code with SetReplicates(false), the RPC does not get sent. Is there any way I can somehow force the RPC to be sent before SetReplicates gets there first to stop the RPC from being sent? Thanks ๐
It's likely because the packet gets placed in a buffer and you're disabling rep before that buffer is sent, I know there's a PreReplicate function, might be worth checking if there's PostReplicate also
if there is then you might be able to mark the actor to stop rep and then disable it, optionally if that doesn't work you could just do it on the next pre-rep and that might work too but i'm not that knowledgable on how the actual internals of rep work once it gets to the buffering stage, even if you get to the next PreRep it might drop it, worth testing tho
Ah interesting, I'm trying to find the PreReplicate function on the docs but I can't find it. Is that the exact name for it?
Ah I think I found it, I believe it's AActor::PreReplication.
I am unaware of a postreplicate, but if that exists I would love to know about it
If I have a UPROPERTY(Replicated) and I change its value on the client, does the server update to reflect that? Or do I have to call an RPC on the server from the client to request that its state be changed?
I'm guessing you're using an RPC to make the character change to the backpack?
Nothing set on clients go anywhere else, so you're correct - you need to RPC to server.
@sinful tree Thanks for your response. yes, itโs part of a long chain of functions that run on server when a player takes damage. It runs a check if a playerโs health is at zero, and from there simulates physics and converts the mesh. Whatโs strange is that everything works correctly every time until it reaches the end where the mesh is converted.
What you want to do instead is use a state - so a boolean or an enumerator that is set up w/ notify on replication. Then OnRep function should then be used to change the visuals based on the state of the replicated variable.
So then when your player is ready to turn into a backpack, you change the value of that variable on the server so it replicates, and then the OnRep function fires on clients that receive it - including those who may not have received the initial replication of the variable.
I see what youโre saying. That sounds like the perfect solution. I really appreciate your help with this, very kind of you.
@sinful tree ^
Repnotify
Repnotify on an enum or bool
Lol ffs I'm late to the party
I know this isnโt official support, and probably an obvious question, but Iโve been wanting to make a small multiplayer game for me and my friend, however I have a couple of questions. Is port forwarding the only way to get us linked on 2 different ips (not locally in better terms), if not is it the best option out of the others to go with?
Edit: I have 2 multiplayer classes next semester, that will probably cover exactly this, but I am eager, and all I can find online is port forwarding stuff, and idk if there are other options or not.
UPROPERTY(ReplicatedUsing=OnRep_CombatGroup)
UCombatGroup* CombatGroup;
UFUNCTION()
void OnRep_CombatGroup(UCombatGroup* OldGroup);
if I add the CombatGroup object to ReplicateSubobjects, is there a race condition between the pointer replicating and the object itself replicating? if so, do I get a RepNotify call when the pointer stops being null (the object is replicated to the client)?
It seems that when players join a server and are spectating, their PlayerControllers don't have a PlayerState? is that correct?
No
You always have a PlayerState
Obviously normal replication applies here.
The PlayerState may not exist immediately.
But it will be created.
Hmmm, I'm doing something wrong then.
I'm inside a user widget and using GetOwningPlayerState and it's not finding it
ah it migth be too early in that case
oh yeah, it was too early, nvm
Might be to early or the Widget may not be able to resolve the PlayerState from its Owner.
hello there.. I am trying to understand how UE4 Network profiler works.. I can see something like FrameMarkers. Is there a way how to add custom marker into frame?
Hi! I am trying to use an AAIController to move some Units client-side. I read here (https://forums.unrealengine.com/t/spawning-ai-on-client-only/121202/2) that it is possible to have client-side AIControllers if I spawn them there. I did that and according to the debugger, they exist and execute the movement functions as they would in the server. However, when I play in the client they still don't move. I also checked that "allow client side navigation" setting is checked out in the project settings
Great success! At least for navigation part, will see how it goes with behavior trees. Enable โAllow Client side navigationโ in project settings. (otherwise SimpleMoveToLocation fails because MainNavData is null) Disable auto possess and replication on pawn since controller would exist only on server side anyways. Spawn pawn, spawn AI contro...
what would be the way to handle shooting behavior, both manual and auto fire?
I currently start/stop on client side and have a timer to call shoot...
but depending on network quality this can happen:
where 2 bullets will be spawned at almost the same time due to the server handling two requests after eachother
You should only tell the server that the player pressed or released the key
The server can do all the shooting
alright, so that's what I thought
I call a start/stop reliable server and it has the timer and everything else then?
will try that out thanks ๐
Yes
There is some prediction you can do on the clients end, but all in all, the should be only 2 rpcs, at least in most common setups
hmm that's giving me the opposite result ๐ค
now client side sees different bullets than server, I must be doing something wrong haha
Your client might be seeing different things cause the bullets get replicated to the client
And you won't really be able to change that as long as you make those bullets server auth
There is no predictive spawning of actors in UE, at least not out of the box
So the client has to wait until their RPC is at the server and then until the actor replicates to them
You can use the a Projectile movement component to sync the movement iirc
yes I have that component, let me see
But the bullet can have moved a few units already when it spawns on the client
One thing with the projectile movements component is that it has a function called SetInterpolatedComponent or similar
You want to call this on BeginPlay or similar and pass in the visual mesh
That helps to smooth the visuals
CMC does this by default with the character mesh
But the projectile move comp doesn't have a fixed owner class so you have to supply it yourself
SetInterpolatedComponent indeed, let's try that out
It won't fix the delay
But it fixes teleporting of the mesh when the updates of the location come in a bit slow
it does look way better already
I guess this will do for now, can always come back to it if needed
thanks again! ๐
jambax talked about this on his blog https://jambax.co.uk/better-burst-counters/
I'll save that and check it out later, thanks!
Is there a property in Actors to make it only exist on server? Like a manager class you put in the level
Did you cut out the Super Call on your setupPlayerInputComponent?
Also, not sure why you do jumping like that
Jumping replication happens in the CMC
yeah but they want to do a rotation
And yes, AddControllerYawInput is a local thing
tho not sure why from a jump?
problem is, the roation is always going to get overriden by the CMC
The whole setup is wrong too
You don't want to override input stuff for that
What you want to override is the part where the CMC performs the jump
And replace it with what you do
It's worse if you hack it together
/**
* Perform jump. Called by Character when a jump has been detected because Character->bPressedJump was true. Checks Character->CanJump().
* Note that you should usually trigger a jump through Character::Jump() instead.
* @param bReplayingMoves: true if this is being done as part of replaying moves on a locally controlled client after a server correction.
* @return True if the jump was triggered successfully.
*/
virtual bool DoJump(bool bReplayingMoves);
bool UCharacterMovementComponent::DoJump(bool bReplayingMoves)
{
if ( CharacterOwner && CharacterOwner->CanJump() )
{
// Don't jump if we can't move up/down.
if (!bConstrainToPlane || FMath::Abs(PlaneConstraintNormal.Z) != 1.f)
{
Velocity.Z = FMath::Max(Velocity.Z, JumpZVelocity);
SetMovementMode(MOVE_Falling);
return true;
}
}
return false;
}
i did mine via gameplay ability (like double jumping etc) hehe, but i can cheat ๐
bool UYourCMC::DoJump(bool bReplayingMoves)
{
if ( !CharacterOwner || !CharacterOwner->CanJump() )
return false;
if (bConstrainToPlane && FMath::Abs(PlaneConstraintNormal.Z) == 1.f)
return false;
if (ShouldDoArcJump())
{
// New Velocity calculation
// Velocity = ...;
APlayerController* Controller = Cast<APlayerController>(CharacterOwner->GetController());
if ( Controller )
{
FRotator NewRotation = Velocity.Rotation();
// Remove Pitch and Roll if needed
// NewRotation.Pitch = NewRotation.Roll = 0.f;
Controller->SetControlRotation(NewRotation);
}
SetMovementMode(MOVE_Falling);
return true;
}
else
{
return Super::DoJump(bReplayingMoves);
}
}
something like that
I think Kaos' jumping isn't directly input driven, iirc.
It's an ability he lets his characters execute in an RTS style or so?
Something something
You can do the rotation where the NewVelocityCalculation happens
I updated the code above a bit
It's pseudo code, so not sure this works 100%, but that would be my first attempt
It should
Since here you are doing it in the same timestamp
If you do it via your own RPC, then the RPC isn't guaranteed to happen at the same time as the ServerMove one
So there might be timestamps where they move differently
And the move where you do your actual custom jump, which is of course a 1 time call, you might use the wrong rotation
No
ControlRotation is ClientAuth
The Client sends it to the Server
The Server applies it on the top red line
And the bottom one is what makes you ultimately jump
Does your character use control rotation in any way?
Otherwise you need to set the Characters rotation too
No, as in, the Default Settings of your Character
You have these "UseControlRotationYaw" etc. checkboxes
Then it should work with the control rotation
Why not
It's the input based rotation
Usually controlling the view
Can't aim if you aren't in control
I can't recall seeing any Rotation overrides
So yeah, it's fully client auth
Either way, it should work if you do it in the same timestamp
So yeah, try the CMC way
guys, is it possible to implement a leaderboard system for a listen server?
Leaderboards don't work at the server level, so yes, you just need to solve the cheating problem

Server first is fine if you're ok with lag. Has anyone extended the CMC to handle rotation as well? It's probably not built in as most games don't care about your rotation or rotation rates etc. But if you had a design that needed server authoritative rotation for some reason, I don't see how it's be insane to also handle rotation in the CMC move system.
After all spinning a capsule doesn't change anything about it's collision etc.
Pitch would be weird.
we have a overriden the rotation stuff
we rotate the player based on mouse location in the world
I could only see server authoritative or predicted/corrected rotation being needed for a design that had taunts or other forced aiming effects maybe.
Or maybe a sim shooter where you don't want ppl doing flick 180s
CMC does handle rotation
void UCharacterMovementComponent::PhysicsRotation(float DeltaTime)
Does it correct if say you had a server forced rotation? Like a taunt forcing aim direction
you should use control rotation for that
we use that for focusing the player
never had issues
Do you have a separate rotation you replicate for pitch visualization on other clients or how do you sync that
UE4 replicates the Pitch already
FRotator APawn::GetBaseAimRotation() const
{
// If we have a controller, by default we aim at the player's 'eyes' direction
// that is by default Controller.Rotation for AI, and camera (crosshair) rotation for human players.
FVector POVLoc;
FRotator POVRot;
if( Controller != nullptr && !InFreeCam() )
{
Controller->GetPlayerViewPoint(POVLoc, POVRot);
return POVRot;
}
// If we have no controller, we simply use our rotation
POVRot = GetActorRotation();
// If our Pitch is 0, then use a replicated view pitch
if( FMath::IsNearlyZero(POVRot.Pitch) )
{
if (BlendedReplayViewPitch != 0.0f)
{
// If we are in a replay and have a blended value for playback, use that
POVRot.Pitch = BlendedReplayViewPitch;
}
else
{
// Else use the RemoteViewPitch
POVRot.Pitch = RemoteViewPitch;
POVRot.Pitch = POVRot.Pitch * 360.0f / 255.0f;
}
}
return POVRot;
}
Other clients won't have the Controller, so they end up in the RemoteViewPitch part
Ya the disconnect between base aim and control rotation had always thrown me for a loop.
Yeah functions are named like dogshit
Or the fact that they are separate and we don't just have 1 variable rather.
Could have just been GetControlRotation on the Pawn
That returns it from the Controller or a replicated version if non exist
But well
Pitch is replicated seperatly tho
which is why they do this
strange, but hey
possibly cause you dont ever want to pitch your control rotation
Yaw is inherited from the Actor Rotation
Same as Roll I guess
Probably all comes from UE being UT Engine at first :D
Guys a question how could I replicate the camera of a player so that the player who dies can see his camera and see how he moves because currently I take the last position and he does not replicate his movement
sooo my gamestate isnt running BeginPlay on my clients
and i have no clue why
where should I begin looking?
@winter ploverAs in any actor at all?
That sounds like the wrong game state class with the wrong game mode.
If it's a specific actor, I'd look at relevancy. Make sure the client is actually getting the actor.
as in the gamestate actor
Would make sure that your GameState/Mode both inherit correctly.
GameMode needs paired with GameState. GameModeBase needs paired with GameStateBase.
the blueprint gamemode was indeed parented off of GameMode, not GameModeBase
and it seems like that solved the issue
When I launch my server with:
"G:\UnrealEngine\Source\Engine\Binaries\Win64\UE4Editor.exe" "G:\UnrealEngine\Projects\IntConBasMMO\IntConBasMMO.uproject" MultiplayerTestinMap -server -log
and my client with:
"G:\UnrealEngine\Source\Engine\Binaries\Win64\UE4Editor.exe" "G:\UnrealEngine\Projects\IntConBasMMO\IntConBasMMO.uproject" 127.0.0.1 -game -log
The UI loads, and I'm getting responses in the log with with UE_LOGs, but the viewport is just black. Any advice?
Lol.... Typo.
UFUNCTION(reliable, server, WithValidation)
void ServerStartFire();
``````cpp
bool AShooterWeapon::ServerStartFire_Validate()
{
return true;
}
void AShooterWeapon::ServerStartFire_Implementation()
{
StartFire();
}
Is there any reason WithValidation is used here?
yeah I think I'll remove validation as i'm the only dev
and it has a lot of internal checks anyway
Preeetty sure it doesn't allow Reliable without WithValidation
So you will have to use it :D
And Unreliable is wrong here
huh why would reliable without validation not be allowed?
It does now unless it does it automatically
Then they changed it recently
yeah I think it was 4.27 they changed it
Well it's all fine then. My info is outdated then
could be 4.26, I know for sure it was a requirement on 4.25
I actually don't recall the last time I wrote a Reliable RPC... ๐
the issue doesn't seem to be from your moveright or moveforward
did you change something else?
are you using the default CMC?
does your floor have CanStepOn set to true?
did you mess with maxwalkspeed?
Same
Same with 4.24
Mandatory validation was dropped around that time
anyone able to help me understand why this method never fires?
from my server client it does, but from a connected client, it doesnt do anything
Do you own the bow?
yeah
oh
wait
perhaps not... let me look, and thank you for a spot to look
I believe it is owned by my Player character what would determine that exactly?
Print the owner of that bow and see who it is.
is attaching actor to actor replicated?
Actor attachment should be replicated, yes.
Should only have to call it on server if memory serves. Though there are a few reasons to do it on client via pointer onrep.
4.25 works too
only if the attached actor is replicated and the parent is net addressable
Fair enough. ๐
without the parent net addressable, or with it being instanced, you end up with something like that bug you had stepping on an ISM component
Teleporter pads!
Thanks for reminding me. Still sour about Static Mesh On Rep. :/
Does replicated movement work on the level of relative movement or world movement? That is, of you attach actor B to actor A, and move actor A around, is B eating up unnecessary bandwidth or is it smart enough to realize that it only has to replicate if moved relative to A?
Or in my case, attaching actors B-Z to actor A, sometimes more.
Anyone have any ideas as to how to go about troubleshooting an issue with a local dedicated server? https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/Networking/HowTo/DedicatedServers/
following this article, the server gets stuck on bringing the level up, and doesn't proceed further:
[2021.11.18-17.17.22:597][ 0]LogWorld: Bringing World /Game/Maps/Maps/ServerMap.ServerMap up for play (max tick rate 30) at 2021.11.18-08.17.22
[2021.11.18-17.17.22:597][ 0]LogWorld: Bringing up level for play took: 0.002848```
But I understand when its working fully, it reaches a state displaying "EngineInitialized" and LoadMap(). I have to assume this is what is preventing me from connecting to it.
On the client side, no errors are showing up:
LogNet: Browse: 127.0.0.1/Game/Maps/Maps/StarterMap
LogInit: WinSock: Socket queue. Rx: 32768 (config 32768) Tx: 32768 (config 32768)
LogNet: Created socket for bind address: 0.0.0.0 on port 0
PacketHandlerLog: Loaded PacketHandler component: Engine.EngineHandlerComponentFactory (StatelessConnectHandlerComponent)
LogNet: Game client on port 7777, rate 100000
Surprisingly, the game works fine networked in our server provider, or even set up as a listen server.
Any suggestions are greatly appreciated
I am feeling incredibly stupid. I print the value at the end to check if its actually 0 or less..which it is..but it still goes through the brtanch
neevrmind I got it
//Pawn::PlayDying sets this lifespan, but when that function is called on client, dead pawn's role is still SimulatedProxy despite bTearOff being true.
void AShooterCharacter::TornOff()
{
SetLifeSpan(25.f);
}
```anyone knows why super isn't called here (and why is this like this)?
So I want to show each player's name above their head in-game. Inside ACharacter::PossessedBy I'm using APlayerState::GetPlayerName() to set text on a UWidgetComponent on my character.
But this doesn't work for clients, the text is only correct on the serve servers.
The name isn't really important so I thought each client could do it themselves without having to do replicated stuff. But PossessedBy only seems to be called on the server?
Alternatively if I make it fully replicated, I'd have to make the component, the widget and the text widget itself replicated?
Is there an easier way to do this?
you could do it on BeginPlay it should always be called once by the pawns on every client and have a SetWigetText function be called from it, which would initially try to get the PlayerName if it has it
but since it could also not have it you need to make PlayerNames themselves replicated and make it so that when they get replicated they update the widget texts
sorry I've never used this so I can only give you the logic I'd follow to solve it
Looks like PlayerState isn't set up yet in ACharacter::BeginPlay
I personally find replicating text pretty pointless, but that's mostly out of habit of localization. Playerstate's beginplay should probably broadcast a delegate for name update. UI should probably bind to that and also try to set it when the ui is initialized.
@rancid flameCould also override Pawn's Playerstate onrep.
May not have the name by then. But could set up bindings to receive it when it is set.
There's a virtual onrep for PlayerName as well.
When running in editor with viewport as listener and a second window as client, get player controller of 0 returns the viewport pawn all the time and 1 returns the client? But in a packaged game running on two different machines, 0 should always return the pawn the player is controlling right?
@neon mango'should'. Though there are conditions where this can fail. They're rare, but they happen.
Usually related to servertravel.
If you have any C++ ability. Consider making a simple static function of GetGameInstance->GetFirstLocalController
@rancid flame name is a state. I would on rep it
It's already replicated. Just need to override the virtuals for some delegate broadcasts.
What about associating the name with the pawn though? How does a late joiner know what to put above everybody's head
Playerstate's pointer in Pawn is also OnRep and has a virtual override.
So then the only thing you would manually need to catch would be a name change I'm guessing. Not that big of a deal
i kinda prefer attaching the PS to the Pawn
@kindred widget Thanks I think I got this!
and letting it handle any widget components
Yeah that might be the best way to do it if names are only on player characters. It all depends really.
I have another question: I want to hide the UWidgetComponent from the player who is controlling the pawn. SetOwnerNoSee seems like it works in single-player but in multiplayer the server owns the pawn so it doesn't work... Is there something else I should be using?
Could probably just hide it via IsLocallyControlled.
Shouldn't the player connection own the pawn?
Unless your camera is on the Pawn, then OwnerNoSee should work.
Unless owner no see doesn't mean the same ownership as is used for calling rpcs which would not be the first inconsistent thing and unreal
If memory serves, OwnerNoSee is badly named, it doesn't actually have anything to do with Owner variable. It's camera view.
Lmao
IsLocallyControlled worked ๐
Is there a standard way to get debug cheats working on multiplayer? I'm trying to implement a PlayerKill cheat. I've overridden GameMode::AllowCheats to always return true but setting a breakpoint inside my PlayerKill function shows it's never getting executed
How would you do that though, use the local cheat manager and forward the command?
Oh. @rancid flame I got mildly curious because I remembered an issue with updating names on players through widgets. Had to go digging. I normally hate delays, but if you implement this normally without the delays, you're going to find an odd bug where ListenServer does not actually update other player's names from a beginplay run. It needs a single frame of time before the name is set correctly on the server.
Top is widget, bottom is character with the widget component.
Bindings are the ones I mentioned earlier, just overriding the OnReps.
Character
h
UPROPERTY(BlueprintAssignable) FBasicDynamicMulticastDelegate OnPlayerStateReplicated;
virtual void OnRep_PlayerState() override;
cpp
void APortalVillagePlayerCharacter::OnRep_PlayerState()
{
Super::OnRep_PlayerState();
OnPlayerStateReplicated.Broadcast();
}
PlayerState
.h
UPROPERTY(BlueprintAssignable) FBasicDynamicMulticastDelegate OnPlayerNameChanged;
virtual void OnRep_PlayerName() override;
cpp
void APortalVillagePlayerState::OnRep_PlayerName()
{
Super::OnRep_PlayerName();
OnPlayerNameChanged.Broadcast();
}
How do you type in cheats in your project?
i use cheat manager o_0
can spawn items, pickups, give god mode, inf ammo, etc
and that then gets compiled out in shipping build which is the benefit to it
Does this inaccuracy include Post Login as well? Post login the players array or player count doesn't seem to report two players in editor when setting editor number of players to 2
I don't know the exact reasons. I know I walked face first into it like my first month where I work because I thought I knew how to use GetPlayerController0 correctly. ๐ Then Kaos up there crashed on it.
It's one of those things where 99% of cases it's fine if you use it correctly. The other 1% will bite you in the ass. And with enough players, 1% is a bad thing. ๐
Ah. Why index on the State?
wdym?
In general, relying on index isn't a good idea. It should never matter in what order players join/leave your game.
the order doesn't matter
Someone log's in, they get 1, second person joins, they get 2, so on...
Then I set in their player state to remember it
but I seem to only get 1.
Yeah. Then player 3 logs in. They get three. Then player 2 leaves, and now you have to update player 3 to player 2.
It's unnecessary upkeep though. Why do clients need to know in which order other players joined?
But Player Array is inaccurate
Tangent aside, Player Array should be accurate
But does not seem to be
PlayerArray is fine. Unless you're using it too soon.
let me delay
If you're using C++, there are overrides you can use to add delegates for UI update in GameState if memory serves whenever a playerstate adds itself to the array.
So tell it to spawn 3 players in editor
I wait 10 seconds
10 seconds later first PostLogin fires
Guess what the length of the player array is? 1 lol
That doesn't seem right
10 seconds cannot be to early
Wait. What settings are you using?
Settings in terms of?
You're running as Listenserver or?
Yes
Listen Server
3 players
or 2
It is like GameMode is resetting or something
Even if I put a Counter, and increment TotalPlayer by one every time PostLogin fires it just prints out 1 for total players?
Not sure what the issue there is. I've never seen that happen. If I print with no delay in PostLogin the length of PlayersArray with three players. I get the correct count.
When networked. Printstring will always show Server: or Client:
Looks liked it switched to stand alone
Good catch
Ok let me start testing again
Yeah that was it.. Facepalm
Hey guys! Can anyone recommend the minimum amount of spell cast time time for a multiplayer game? So higher ping players could also react...
@kindred widget Now with the proper player Index I can get the right player controller server side
@neon mango PlayerArray is not replicated, rather the PlayerStates are
they register with the GameState when they arrive on clients
It was working I forgot or didn't realize the switch to stand alone.
via Add/Remove Player functions in GameState
both virtual
and both can be overriden to fire OnPlayerJoined/Left locally
ok
and @kindred widget is quite correct, i watched him faceplant on GetPlayerController[0]
the only thing that is really good for is
splitscreen, or iterating over all PCs from blueprints
Well right now as shown in my screen shot above, damage is done server side, so my issue was that the Player Controller 0 was returning 1st player or a single player every time. I kept thinking the player controller is local on this machine should return the right one but this overlap happen server side only and there Get Player Controller 0 doesn't mean what I think it means client side. So now I get the right index PC and it works
Gotta get back into the MP mindset...
