#multiplayer
1 messages ยท Page 728 of 1
so where should the server store player-specific variables like selected characters, selected perks, ready-status?
Player State I'd say
The docs say the same, but it's not true. Or this is a terminology game that we still don't understand
but wont that be destroyed upon entering the new level?
@glass orchid Have you missed this?
and if i dont use seamless travel?
I'm not sure why you won't, as it's preferrable
Sure but that's not what you asked, I think.
But there are tons of other ways
SaveGame
GameInstance
I have a blog post in the making 
in theory i could store the selected character on the gameinstance and then have the server request those when the map is ready to spawn them in, right?
Wizard where did you even see that actors don't persist throughout levels with seamless travel? All I'm seeing is the engine code actually preserving all data that is marked.
The UWorld quite literally skips stuff that is marked for seamless travel upon destroying everything: https://github.com/EpicGames/UnrealEngine/blob/d11782b9046e9d0b130309591e4efc57f4b8b037/Engine/Source/Runtime/Engine/Private/World.cpp#L7003
because the map in which the game is played is procedural and has to be constructed after all players ready up. or can i still use seamless travel for that?
For example the old PlayerState is destroyed inside APlayerController::SeamlessTravelFrom
I haven't dug into this yet, but there's prolly an engine bug. I mean AGameModeBase::GetSeamlessTravelActorList will persist any actors you add to it, though the actors already placed there won't
And it may have to do with the fact that these actors are part of a new world creation cycle
But that does not mean that suddenly nothing travels along. Sure player state seems to have some weird specific thing though.
I don't think that has to do with the travel method
i think i found a solution. using seamless travel i can store the variables on the playerstate, and have the players wait in the transitional level until the final level is constructed
Oh yeah that could be it. I should play around with this too much to get my head around it
That what has been stated previously
You dont need to stick them in a travel map
You can just not spawn them until level is ready
Dont let HandleSratringNewPlayer spawn them until level is ready
And call it agsin for each player when it is
Is the map spawned on clients separately?
I feel like I am missing a piece of a puzzle. I feel stupid for asking but: does all code for every player controller get executed on the server? And if not, how can I make sure that properties like health can only be set on the player state by the server?
The Player Controller can execute code both from an owning client and the server.
So no not "all" code gets executed on the server.
Is that the rpc stuff then?
Or, part of what I could use it for*
A projectile is traveling, hits me and I should take damage. Does the server keep track of those collisions?
You can use it for RPCs yes, but you can also execute whatever you want on both an owning client's side or the server's side.
When I try to run standalone builds with simple lobby and seamless travel set to true I get this error below, with seamless travel set to false everything loads up nicely. Is this error supposed to me somewhat specific, because I have no idea how could I fix it
The projectile likely exists on the server I would assume and if on the server the projectile hits someone and the projectile says on the server that it should damage that player then yes.
You probably have a nullptr somewhere.
So the projectile could be an actor in which I check for authority
And if it is, I bind for collisions?
And then if it does, I can use the same authority check to apply damage to a player's health
The HasAuthority stuff, ownership and net roles / net modes is what makes you able to act on what it should do if that's the question yes.
I was thinking of using the transitional map as a loading screen, so all theyโll see is a loading bar
I'm just trying to figure out what goes where. I've now read most of that compendium and I'm just not following it yet.
Let's say guns have a cooldown, then it makes sense to me that the server decides if my projectile is allowed to be spawned
In my mind, everything I do only runs in my instance unless I tell the server to run something
Maybe that part is wrong
I would say the big thing you really need to start thinking about is "where does something happen" if this is an issue. Lets say you have a simple actor that does nothing for now but is replicated and thus at some point exists on both the server and whatever clients join the game yeah? The actor's BeginPlay, Tick etc. all normally get called on both the server and all clients. But no it's not the same exact object that is shared rather the needed things are being shared such as "what actor is this?". Lets say we have a dedicated server (so no client playing on it) and lets say you now add a button to all clients and add a RPC to the actor that sends a predefined string to the server. You press the button and inform the actor on that specific client to tell the server through the RPC "hey I send you a RPC with that string" then the server will receive it hopefully at some point. All that means is that on the client a simple packet was send to the server that will then be executed on the server.
The actor's BeginPlay, Tick etc. all normally get called on both the server and all clients.
This is the part I needed I think
But yes the complexity and often confusion comes in when things need ownership, or have "authority" or not or even don't exist on certain clients.
But user input runs on the client, how does that make its way to the server?
The client presses a key, the client sends a RPC to the server either saying "I pressed the key and want to pick up something in the world" implying that it wants to do a certain thing or it simply says "I pressed the key" and then do whatever the server wants with it. That's all it really is in terms of networking.
i fixed this by using a braindead simple AddMovementInput and getting the target direction and in the future i'll look into using using navmesh points
That sounds like it would cause laggy movement
Or would I do optimistic movement
Correct.
Ah
But movement is really complicated. That's why Unreal has a built in system for it.
Is that what AddMovementInput does
WAIT
Is that the built-in multiplayer part I keep reading about?
Kind of is the answer, but in the end yes it tells the server through a RPC "I want to move"
Daaaaaaang
The moving part is however the complicated thing because of latency.
If you were just saying "move" then it would not be responsive, so what Unreal does is apply local prediction of how your character moves and that is where it gets complicated.
And the standard movementinput thingy solves that so you don't have to? Or you still have to?
AddMovementInput feeds information to the CharacterMovementComponent, which is the best movement component that UE provides for multiplayer. it has the most prediction code
For characters Unreal takes care of things like moving around and jumping.
you can use other movement tools such as AIController navigation movement, but it's not as good for multiplayer. in fact, it's pretty dogshit
I'm setting rotation on the actor
this is fine, what's wrong with this
But again all it really does in the end is "client presses button -> client sends RPC to server saying it moved -> Server receives move packet and does stuff with it"
The implementation is a bit more complex, but just to simplify it for the example.
Because I am doing it client side, shouldn't that also run under HasAuthority?
That's really neat
your rotation should happen in both places: client and server
that way there is no correction
But shouldn't the server decide if I'm allowed to?
ideally they should happen at the same time, but this is almost impossible. so the best that you can do is issue an RPC so that it happens on the server too
sure, but the server can correct if something goes wrong
rotation is very trivial. usually there are little reasons to want to validate rotation itself
Yeah I'm using it as an example
Please just use the built in rotation for characters. Saves so much trouble.
SetActorRotation?
Give me one sec to find it again.
yeah what od you mean by "built-in rotation"? you meant like orient rotation to movement?
That one yes.
this is something else
There's also a pitch one.
wdym?
@vague spruceI'd either orient rotation to movement or use the control rotation. Rotation in characters is fucky IMO, it's a mess.
CMC uses controller yaw/pitch if you want.
Also the controller rotation is already setup for RPCs etc.
that is in relation to ControlRotation, which yes, if your character's rotation is dependent on control rotation then AddControllerYawInput will rotate your character
@sacred krakenWhat is your desired rotation rule?
Characters them selves are a mess ๐
The pawn rotates towards..... what?
Snap rotation, 30 degrees
vr
In this case, anyway
I'm just trying to learn what would be the "strictest" way
and your AI is snapping around too?
There's no AI involved
AI is fluent
Alright I will say one thing right now. VR is an absolute mess in terms of being authoritative or being cheat proof.
It's not my first project :p
yeah that's rough
better than me, MMORPG for my first project
So what data from the client do you care about in terms of being authoritative?
๐
Multiplayer apparently as well
If I look behind me and server doesn't think I should, does my neck break?
They're talking about first project in UE.
It's also not my first project in ue
Net corrections IRL. I'd just trust whatever orientation the client sends
I mean, I haven't published anything but I make something new every day lol
and use ControlRotation for something, but IDK how VR works in Unreal, it might be a special snowflake
And now it's vr and my rabbit hole brought me to multiplayer
Eh, doesn't mean much imo.
If you don't understand the absolute basics of the gameplay framework - doesn't really matter how many projects you've done.
I understand the absolute basics from my perspective of what that means
(Not saying there is anything wrong with it mind you; we all start somewhere)
So yeah you can either use ControlRotation for something or just, per tick
Send info to server, use it locally
Server uses it, setting some replicated stuff
Exclude owner from some of the replication because they're using their local version
Maybe I should just look at the addmovementeinput code and see what happens there
Because what I want to know is basically that
It's complicated for characters. It's really not fun to try and understand how the CMC / Characters work. If I'm allowed to just give some advice, do whatever you want with it, just try and get maybe some hands synchronized with multiple players without any movement. VR kind of sucks if you want to have 'cheat proof' stuff.
I have some stuff synchronized. Position and hands actually
I'm just trying to understand why it works
Even if it's not fun ๐
Oh, it doesn't do anything directly
It updates a vector, maybe it's being sent elsewhere. Like some sort of tick. I'll just keep reading the code and stop asking dumb questions about the absolute basics ๐
Thanks, though, you helped a lot
Like I said the character movement code is everything except basic unfortunately. I don't even know my self how half of it works. But good luck ๐
Also there's this: https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/Networking/CharacterMovementComponent/
The small bit of information Unreal has about how it kind of works ๐
Anyone have an idea or how i should start to make player owned doors for a multiplayer game? Similar to DarkRP / Rust etc? pref in blueprints
Wdym, it's less that 13k lines of code, ez ๐
I'd treat it like a "faction" system.
nice, didnt think of that, ill look into it
So just take those concepts and apply 'em to doors or player made structures or w/e.
on the actors that players can place, add a pointer to the owner (or the faction, depending on what you want the implementation to me)
you can replicate the pointer so it's server-side authoritative
that way other clients can't modify objects in the world and make them their own
ok. Ill play around with it. Thanks for some pointers
@sacred krakenFor example this is my Client passing analog input to Server
If you're doing VR then IDK why you'd even need Character
Just start with a Pawn IMO
leave the character bullshit behind
Why though? It already does a bunch of stuff for me, why wouldn't I use it? Or does it do too much?
13k lines of code worth of stuff at least haha
No tbh, I use it for basic movement and rotation
Yes but you're closer to making Beat Saber than Mario Odyssey
Do you have walking movement or teleportation?
walking
The vr template uses teleportation, I got that part working, but I replaced it with just regular movement
Which all works by the way, works just fine
K so I'd just do the model where you're passing over the HMD and hands transforms every frame
If that's stuff that's important for other people to see
Do other people see where you're looking and hands are or is it a simpler thing?
They see. I want it to be coop
What is the minimal amount of data needed to make another client see what you want them to see?
Movement, and gesture based attacks on AI enemies
So the hand location is pretty important
OK so got the hands. Is the HMD synced?
Is root the thing that rotates in 30 deg chunks?
ok that's fine, use control rotation for that I'd say
so capsule orientation = controlrotation
that's automagic
So what happens if I'm playing and I turn around to look behind me
do I swivel my head like an owl?
I don't know what arma is, sorry
I found the code though
It's actually not that bad
So does capsule constantly rotate to chase HMD or is it only dragged?
What do you mean by dragged?
capsule will be 15
Ah, I see what you're asking now
You're meaning for capsule to represent the general body orientation I take it
Yes, that was the idea
I got movement working, I never checked rotation
I am replicating hmd maybe that's why, gave me some food for thought there thank you ๐
I think I'll have to replicate both
capsule and hmd yaw
Tomorrow I'll try to use AddControllerYawInput based on the hmd yaw, see if that works, I am curious
Here's how I'd do it, short of any automagic replication that is going on. This is ignoring ControlRotation.
On Tick:
Clientside:
Send HMD, LH, RH, Capsule rotations and HMD, LH, RH positions to server in an RPC
Set variables
Serverside:
Recieve the data from owning client, set replicated variables (skip owner).
Everywhere
Use variables to drive stuff. You'll need to interpolate on non-owning clients.
Something like that
Basically everyone is using the same data to drive movement etc.
Except on owning client, they're using their live version, not the server's replicated version
You could also handle the owning/non-owning switch in functions.
A minor delay or a dropped sync here and there isn't that big of a deal I suppose
30ms lag in VR is a vomit simulator
Oh I meant for remote
you do NOT want to use server data to tell you locally where your gun is
The other clients
Yeah, it'll be jittery but it'll work
But that's what interpolation is for right?
You'll want smoothing so everyone doesn't see you spazzing out
Yeah exactly, that's the one part I do know :p
I need to get a VR setup, I have 2 designs that'd go great with VR
All you need is a quest
Vehicle and Fishing games. They solve the main problem, in that you don't often walk around much in VR.
Nah fuck Oculus, never giving them a dime. Them and Apple.
OpenXR stuff sounds nice atleast, co-joined collaboration between every big company
vr is my favourite. Even if I still suck at it
Anyway, it's getting late. Thanks a lot for all the good ideas and the help
I'll be back tomorrow to annoy some more people ๐
I tried to play a little to find out whats wrong, I found out that using custom Player Controller made seamless travel fail when I added custom owner client event. Does anybody know why is that? On screenshot is the whole PlayerController content
so dumb noob question here: can i have 2 instances of my game running and join if one is a listen server?
and whats required to that to work?
Hello I have a multiplayer game which uses a lobby system and a gameplay system using different game modes/controllers.
I want to make a customizable countdown time for the gameplay that players can choose in the lobby. But how to transfer this value to the actual gameplay ?
yea i do it in the editor currently. im trying to google how to do it with packaged builds now
Yup
Just join it
I'm so confused with Seamless Travel, I have custom GameMode, GameState, PlayerController, PlayerState, HUD and default pawn as NONE in the map I want to travel to. (All Blueprints are completely empty)
But as soon as I use seamless travel the game just crashes..
If you play in editor with 2 clients then one will be listen server
You can also launch on the uproject or from editor. I like launching to test as it's pretty close to packaged but instant.
Are you seamlesstraveling in PIE?
The only gamemode that loads fine is the default one in ThirdPersonCharacter package, my custom one didn't work so I tried to create another custom game mode without any logic (empty blueprint) and it still crashes..
Debug the crash, find out what's going on.
Could this mean anything? It's at the very beggining of the file, at the end where I expected errors to occur can't see anything.
No
And have you any idea from which point I could find the problems? This is the first occurence of Seamless Travel, but nothing seems to be suspicious.
How about uploading the entire log somewhere instead of taking random screenshots?
On it, sorry!
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Is that the entire log?
yes it should be
There aren't any errors or crash logs.
Well I copied the whole .txt file from Crash Reporter, not sure if theres something more to it
Shrug
If you debug the editor through vs or rider you should get some better information especially if you have the debug symbols installed or if you are building from source
A noob question: To start a multiplayer game, should I start first with Menu/user login/matchmaking first, or should I start focus firstly in the multiplayer gameplay, and then manage to save the player info etc later?
thanks in advance.
There's no real proper answer. Do what works for you
That's not an #mp question
Prolly #game-design
thank you.
Will it also help when my project is only blueprints?
Yes you can install debug symbols and engine source through the epic launcher, but you will need to convert your project to c++ and debug it through an Ide (like vs or rider)
Afaik there's no way to debug this without making it a c++ project but I could be wrong and it's also outside the scope of this channel
Its already as c++ project I did play with c++ a bit already just didnt use any of it, okey thank you I'm gonna give it a shot
the IDE debugging will help with C++ crashes, not for debugging blueprints. if its crashing on seamless travel you should end up with a breakpoint probably somewhere in the engine source. once this happens just post in #cpp with your IDE output log
is it possible to issue a Server RPC and get a boolean response back?
say, to authorize something?
No RPCs are void only (no returns). You would have to send another RPC back from the server with your response
does anyone know a good guide on the steam subsystem?
like in general what one can do with it and how to
So
That's two different topics
OnlineSubsystem is an interface that sits on top of Steam to expose it in a generic way so we don't have to care about what subsystem is active.
Which half the time doesn't work, but whatever
If you want to know what this implementation exposes, you'll have to go into the Steam Subsystem Plugin and look through the files
That's somewhere in Plugins/Online/OnlineSubsystemSteam
Then you can start with OnlineSubsystemSteam.h
Where you can find all the overrides of each underlying interface (e.g. Friends, Party et.c) and see which ones are implemented
And then go into the classes of those
If you want to know about PURE Steam, so what you could do by implementing the library yourself, you should visit Steam's Documentation rather than asking here
Alright, thank you!
Hey, quick question - I'm trying to make this situation: there are 4 players total, 3 of them sees the item. 1 random player each round can't see the object. i've tried a lot of things, the only thing i achieve each time is that only the server gets these changes ๐ฆ
Probably still too broken to enable it by default
Fair enough I suppose ๐
Only "not seeing" or should it generally not be available to them?
Also kind of depends on if you use C++ or just BP.
Both ways can be useful - the thing i'm trying to reach, is that one random player can't see the item everyone else sees. eventually i'll want him to see another item. but hide the item everyone else sees is a good start ๐
An easy way would be having a PlayerState variable in the Item for who is not allowed to see it
And make that OnRep
and in the OnRep you check if that PlayerState is equal to the local PlayerState
And then hide it
But race condition can break it
E.g. if the PlayerState is not yet available
You can also put the PlayerController in there
That will be invalid for everyone but the local player
Minus the Server I guess
ListenServer's are a special kind of case in all of this
That's the problem i'm reaching everytime, the server sees the updates from the clients
If you do the PlayerState OnRep variable in the Item Actor (replicated), it should work
ur my hero man!!
Btw Cedric if you're still around, what happens if on a Listen Server a "IsNetRelevantFor" is set to false for an actor targeting the local controler on the server? It can't possible just remove it from the server then right?
I have not tried that but I doubt this is even used for the Authority
Or rather the Server NetMode
I'm going to try. I'm curious now.
It indeed either doesn't run on the server or just ignores it regardless.
Unless I somehow screwed it up xD
Why the host can view the steam profile picture but the clients cant?
Hi, there is no travel node in BP in UE5 ?
The only Travel node is OpenLevel
BP never had access to more
The only workaround existing is ExecuteConsoleCommand with ServerTravel
Oh that was what i used, thanks
@dark edge when you have a chance can you take a car charger and see if it chargers that 2 and 1 you have? I want to get it but dont know if it can charge in a car with a regular charger
does the order in the gamestate's playerarray ever change?
I sold it like a month ago, but this charger worked with it
The Flex 5 has 2 charge ports, old style and usb
but honestly you can prolly get a better laptop for the money nowadays, i bought mine like 3 years ago
It seems to not be guaranteed where it is. But I don't think it just randomly swaps around if you would call it several times after each other. I believe it definitely does change whenever someone leaves though.
Ah, well i need a way to check which player readies, and for ui related purposes i want there to be 5 slots, 1 for each player. The player specific slot is highlighted once that player readies up. Im tracking ready status in the gamestate
I would not rely on the order in the player array in that case.
What alternative could i use?
Player state has a PlayerId variable. The comments on it seem to suggest you could use that.
Unique net id number. Actual value varies based on current online subsystem, use it only as a guaranteed unique number per player.
Although weird how they deprecate it being public and then don't make the accessors for it blueprint callable lol.
You could also just of course put the number in the player state of what spot someone is in.
You can also make your self some unique identifier and associate the spot with that. Plenty of options ๐
I think iโll try that one. Once a player connects they get assigned the first empty spot and stay there until they disconnect ๐
Altough i really need to look into unique player IDโs for savegame purposes
Correct. It does change when someone reconnects for example. And that UniqueID property gets copied back when player reconnects inside APlayerState::OverrideWith
@fathom aspen The ID it self is not persistent though. If the playerstate is gone or needs to make a new one then it's likely not the same: https://github.com/EpicGames/UnrealEngine/blob/46544fa5e0aa9e6740c19b44b0628b72e7bbd5ce/Engine/Source/Runtime/Engine/Private/GameSession.cpp#L223
All it does is increment a number and return that lol. So don't rely on it ever being the same if you have to rejoin a server I would say.
It should be persistent. RegisterPlayer shouldn't be called for a reconnecting player
Even if it does it would be overrided by this function
PlayerID is not UniqueID btw.
I'm referring to UniqueID xD
But I was referring to PlayerID ๐ฆ
Unique net id
I read this piece only sorry haha
It's unique per player and also for clients yes but not truly unique in a persistent way ๐
But yeah no worries xD
Also btw where does the entire reconnect process even happen?
In a multiplayer game, the hosting client is spawning the default pawn, but not the other clients, is this expected ? If yes i could i disable the default spawning to handle it manually ?
It does persist a seamless travel for example. See APlayerState::CopyProeties
Well yes but not if the server restarts or hard travels.
It doesn't persist a reconnection though. But I think it's easy to make it so
Correct
It does persist through reconnection.
It copies the ID from the old player state.
Oh wait does it ๐ค
No CopyProperties also includes the PlayerID.
Are you sure the pawn is set to replicate?
ANVAvatar::ANVAvatar()
{
bReplicates = true;
I guess
What is the expected behaviour ? The spawn should be working be default ?
When that happens the PlayerState of the reconnected player becomes inactive. When that player login back, FindInactivePlayer is called and calls OverridePlayerState
The pawn should just work as long as it's owned / possessed by a player yes.
Otherwise it may be a relevancy issue.
I don't actually know if the default behaviour for a pawn is to posses it.
Are you spawning it your self or is it the default pawn player thingy?
I wasn't, but the host seems to spawn it
I tried to spawn and possess manually but the possess doesn't work, it seems the clients are in spectator mode with spec controls
Are you sure you are spawning it server-side?
They spawn, i can see them on the host
That was not my question
You can spawn it client side on the host and still see it on the host
I spawn them in HandleStartingNewPlayer_Implementation (in game mode) so yes
I hate how they spread out the implementation for by default spawning a pawn ๐
It's just all over the place.
:p
Is there nothing in your logs for the server? Most of this stuff seems to throw some kind of log message.
Mhh nop but i have a problem client side with the pawn to spawn, i think i have a different assets on the server, will check that
how feasible is it to set your game up for p2p multiplayer and later down the line switch to dedicated servers? is there anything i have to keep in mind or that needs to be set up different?
It shouldn't be any different for the most part. If you want some different behavior for one and not the other you got to check ENetMode. Also it's not p2p but listen servers
yeah i meant listen servers
i just dont want to have to rewrite a whole bunch of things when i switch over to dedicated servers later ๐
Yes ofc. That's why you should take this into consideration from now. Still as I said, you aim for both most of the time, as you do HasAuthoirty for example
You generally run stuff on the server with that check, so it doesn't really matter what's the NetMode...
Still there are some cases where you want different behavior but I can't think of any rn
well, as long as i dont have to rewrite major parts i should be fine
this is my first project so im still learning ๐
Good, keep it going!
ive set my gameplay prototype up for multiplayer, and it works so far. i just have to figure how to do lobbies and such now
err, in what bp do i actually start the multiplayer session?
game instance is good
otherwise you can grab the common user plugin
and add a couple of nodes in your widget blueprints
it will handle all oss abstraction for you
oss abstraction?
oh okay. what's the plugin called?
oh so just common user
yeah
you can find it within the engine plugins
its used in Lyra
but its not tied to Lyra
what am i doing wrong?
i found it ๐
err, are you sure its that? common ui seems to have nothing to do with multiplayer https://docs.unrealengine.com/5.0/en-US/common-ui-quickstart-guide-for-unreal-engine/
Yes this
hmm, i guess ill read through it again then
Iโm revisiting projectile based weapons and trying to find some good resources on accurate server authoritative projectiles that look good client side. Iโm currently spawning them replicated server side only and it works but when Iโm introducing 100-200 ping (which is normal) the delay from when you fire and when the projectile spawns is super noticeable. Any ideas where it canโt be hacked easily Iโm down!
Why does Seamless travel fail when using Cast To custom character blueprint?
When I replace Cast To my custom blueprint to Cast To Character it works just fine
This is not A leads to B. No one would figure out travel issues without seeing the logs, and that's where you should be looking
Hi I was wondering how I would go about improving my replication for my game.
Right now if you are on a high ping server, the animations are played after they go through the server
I want it so the animations are replicated client side
How would I do that?
That's called prediction and it's hard
So right now, you do a thing, you need to wait PING ms until you see something happen right?
and you want to do the thing instantly instead
Yeah it's the hardest part of multiplayer.
Lemme guess, jumping is instant?
yes
That's because jumping is predicted, courtesy of the character movement component
for example when I swing an axe, or animation it waits until it catches up with server
Yes that's the exact problem.
https://www.gabrielgambetta.com/client-server-game-architecture.html
Start there.
Shit's hard yo. GAS can help you, but if you're new it's a bit intimidating.
You can always just dumb fire animations on the client and not wait for server, but there's gameplay implications. What if you think you hit the tree, and the server doesn't? Then what.
true
I could try to double the animations, what would be the best way of doing that?
What do you mean by swing your axe
are you chopping a tree?
or attacking another moving player character
All actions
So what you have to remember is that for each client, they are in the FUTURE relative to what the server sees
they're setup to wait for the server atm till you see them executed
I am making like a rust type game
Yeah you're gonna wanna use GAS, have fun lol. It'll be super hard for a one man show
And rust has it so when you swing you see it on client instantly no matter what then the resource is given once server realizes
Yes, and there's thousands of lines of code supporting that
Gotcha, thanks ๐
Doing this is easy.
Input -> Swing Axe -> Tell Server you wanna swing
However you've been doing your Server-Client replication of the animation, just skip the owning client
So I don't need to use GAS to fix?
Well, depends on what you mean by need
I want to replicate Rust and right now it is setup like this
Input -> Wait for Server -> Swing Axe Animation
If you're ok on waiting for the RESULTS of any action you can hack it like that
Show your setup
show the code path from input event to playing the animation clientside
Is it possible to add JoinGame options (i.e. -myoption) to PIE client, so when I click play the first PIE window connects to the server with -myoption1, second window with -myoption2 etc?
Question, what is the typical approach to having a locally controlled character play an animation, but on other clients it plays a different animation instead?
(Like locally the character does a simple jump (to be less disorienting for the player) but on clients does a backflip instead)
Thanks in advance :)
You could still replicate 1 state variable. (let's say EPlayerState) and if EPlayerState == Jumping and is controlled locally, you play one anim and if its not controlled locally (remote proxy) then you play another anim.
Alright, gotcha, that makes sense, I'll play with that some, thanks!
Yes try to keep state replicated and do visuals based on state
you don't replicate AttackAnimation, you replicate the fact that you're attacking. It can look different in different places.
This rule makes a lot of sense (prolly avoids a lot of issues that way)
That feel when you realize your FPS guy is just a transform
I remember watching one of Epics videos back when I was trying to understand all the major systems in unreal, and the guy was showing paragon assets and turned off the animation BP and removed the mesh and was like "all characters are basically just a bird cage controlled by physics" lol
Could anyone help me out with these 2 crash logs? https://pastebin.com/YnK9YhWH
The crash occurs when using seamless travel and object spawned in the level calls Cast To BP_CustomCharacter
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
It says access violation which probably means using nullptr. Did you degut this from the IDE like I suggested?
Simple question :
If I want to spawn an actor and be sure if someone joins later he will see the spawned actor too, what should I use ? Multicast won't work here I think, so what's the solution ?
Spawn it from the server
But spawning the actor on the server won't make it spawn for all the clients to my knowledge, so after spawning it on the server if I use a multicast to spawn it on all the clients, the person joigning the game later won't receive that multicast when the server send it so it won't be there for that client.
You need to mark your actor as replicated
replicated just mean "be exactly the same as the server" but as the client didn't spawn the actor setting it to "replicated" won't change anything I think ๐ค
You are incorrect
explain to me ๐
For starters you keen saying you don't think something will work instead of trying it to confirm it will work
I don't have the editor open but the question popped in my mind ๐ And I'm trying to wrap my head around ๐
Replication doesn't mean "make actor the same as server" it means "tell clients about replication information based on the conditions of each replicated value". When you tell unreal to replicate a property you can set conditions about who gets this property sent to them. When an actor is marked as replicated and spawned from the server every client will have the actor spawned, then the properties will be replicated based on their conditions
Ah ye I can relate to that
but in this case when the server will tell all the clients to spawn the actor the player joigning later isn't there yet so he won't receive that information. So my best guess here is to use RepNotify to spawn the actor so people joigning later will spawn the actor too as RepNotify kinda save stuff happening before but I'm not sure ? ๐ค
That's incorrect. When a late player joins they will replicate everything they are told to, including your spawned actor
So long as the actor is spawned by the server and not a client
Then I don't understand what's the purpose of RepNotify anymore ๐ฆ I'm so confused, I thought I understood most of unreal networking ๐ฆ
Repnotify is for when properties change value
change value on the server ?
yes
Interesting
You are messing things up. Every connection that joins the game gets sent all the net data from server. RepNotify has nothing to do with this. RepNotify means let the client know that property has changed(or more correctly has been set as you're in BP)
On client too
You will get the RepNotify fired
But as a rule of thumb, don't change replicated properties on client
yeah for safety reason
Thanks for the explaination ๐
Nothing to do with safety really. It will get changed as soon as a new replicated value comes in
It just doesn't add up
In cpp, it gets called only when changed from server though
ye but not called on the server, you have to do that yourself
Yeah ofc
So I was right about this :
Yep you was
So "Replicated" kinda override the multicast to handle late joiners (so "Replicated" kinda mean keep this the same between the clients and the server all the time)
What does "resilient" mean ? ๐ค
Well Replication System is one thing and RPCs is some other thing. But yes replication does indeed guarantee that all clients keep in sync with the server
non resilient means not able to withstand
Yes I tried to play with it, but I'm pretty new to this stuff and basically what I did was to open the project in VS, start the debugging process that launched UE editor, from there I did everything like normal Opened 2 standalone windows, and when trying to connect it again crashed like usual, while debugging was still running and didn't catch anything. But I'm pretty sure that I'm doing something wrong with this VS debugging..
if it crashed like normal your debugger would have 100% caught it
were you running with the debugger attached?
this button
Yes the whole process is running, but after both standalone windows crash It doesn't seem to catch anything
both windows?
@fathom aspen @plucky prawn Thank you to both of you for the explainations, it helped my brain wrap around the concept of networking a bit more ๐
the debugger will only catch crashes for the process its attached to
Do you have -debug?
So I can't run Standalone Game? Because that's sort of confusing to me that it opens whole new window and I'm not sure if debugging is still attached to that
probably not if it's not by default
It's not
If I setup build mode to Editor Debug it starts normally. But when I change to Debug I get: โThe global Shader Cache file โlong path to cooked contentโ is missingโ Youโre running a version of the application to load COOKED content only, (โฆ). Well I didnโt suspected that debug version would require COOKED content of me. Could we please get, b...
Also make sure you have the correct solution config
DebugGame Editor it's called
So I do have a DebugGame Editor chosen, then command line looks like this: "$(SolutionDir)MyProject.uproject" -skipcompile -debug, I start the debug process, run standalone game, crash happens but still can't see nothing in VS
Mmm juicy content
I have a listen server and two connecting clients. When I print GetRemoteRole() on the pawn I control on the listen server, I get SimulatedProxy.
Shouldn't it be AutonomousProxy?
void UOverheadWidget::ShowPlayerNetRole(APawn* InPawn)
{
if (InPawn)
{
ENetRole RemoteRole = InPawn->GetRemoteRole();
FString Role;
switch (RemoteRole)
{
case ENetRole::ROLE_Authority:
Role = FString("Authority");
break;
case ENetRole::ROLE_AutonomousProxy:
Role = FString("Autonomous Proxy");
break;
case ENetRole::ROLE_SimulatedProxy:
Role = FString("Simulated Proxy");
break;
case ENetRole::ROLE_None:
Role = FString("None");
break;
default:
Role = FString("Cannot get Remote Role");
break;
}
FString RemoteRoleString = FString::Printf(TEXT("Remote Role: %s"), *Role);
SetDisplayText(RemoteRoleString);
}
}
Looks like this is a known issue: https://forums.unrealengine.com/t/net-roles-are-different-between-pie-listen-server-and-pie-openlevel-listen-server/568662
_ _
@dense egret That post talks about something else though
RemoteRole is SimulatedProxy for them too
And that is fine
LocalRole should be Authority
Their problem is that the RemoteRole is AutonomousProxy when using OpenLevel?listen
Okay, good to know. Thanks for clarifying, Cedric!
I was following a course and they explained how RemoteRole for locally controlled should be AutonomousProxy on the server.
Which it isn't for me, so I got confused
How's this for finding an available session with the lowest ping? is there a better way i couldve done it?
players in lobby is if youre trying to join with friends; i.e. you group up with friends and then actually try to join a hosted lobby. the max amount of connected players is always 5
How does your friend/grouping system work though?
Because this is not going to group up with friends if they run the same functionality on their own device.
yeah i still have to implement that system, but i wanted to include that here so i wont have to go back to it. for now its just for a single person joining the host's lobby
Anyone got a quick and dirty explanation for how to more efficiently package a replicated array of rotators? Something like FFastSerializer or is there something else?
Replicating hand transforms eats the hell out of bandwidth
Depends on how big is the array and how quickly does it change. Fast TArray Replication is usually the way to go for bigger arrays, but there is bookkeeping and some initial boilerplate code
That's probably a good enough sentence for me to research then, thank you!
Already reduced from 140k bits/s to 40k bits/s but that's still too high for hands lmao
Basically if you using just a normal TArray, it replicates the whole thing when it changes. Fast TArray Rep let's you know when item changes.
If you are replicating VR hands with joints, I suspect reducing precision and mitigating axis would be a more efficient approach
hmmm I might not get much out of that then, fingers move every frame so there wouldn't really be a time where it isn't sending to the network. Unless I did something like check if there was a large enough movement, okay right to transform, Fast TArray Rep picks it up
Yeah, maybe I should try ints for joints
if you can live with less precise replicated values
you'll win a lot
take a look at Quantized vectors
also you can normalise your values if they are thresholded
do you know what c++ method I'm looking for for FQuantize?
NetQuantizedVector
tyty
will have to test if that doesn't make hands look wicked jittery or something
I'm extremely confused.
I have a variable set to Replicated in my game state. An array to, however the contents of the array only show to the host client.
For clients, they show a length however they display as nothing when i print contents
What is the array of? Pointers?
I also have a question, I am trying to make Fast Shared Path in Replication Graph work. As written here https://forums.unrealengine.com/t/replication-graph-fast-shared-path-starting-guide/518575
To create a FastShared path for a pawnโs movement data, the first step is to define a custom struct containing all the data needed for the movement update. This struct should define a custom NetSerialize function and support shared serialization (see NetSerialization.h for more info on custom struct serialization).
How would one wrap the character movement data in a ustruct, since it is technically managed by RPC calls in character movement class.
Additionally, one would have to somehow supress those RPC calls in the default character movement comp. I managed to create very simple FastSharedPath, but I have absolutely no idea how to hook it to the character movement.
Player controllers, but I don't think it changes anything
There is your problem, Player controllers exist only on the server. They are not and shouldn't be replicated to clients.
And owning client
Other clients are not aware of other PCs
Oh, I see. What's the best way of storing a user then?
Thanks
It's an array of PlayerStates
Oh. goodie
PlayerState->GetOwner to get the PlayerControler
So the client's GetBlackBoard appears none. Any idea how to fix that? I guess I suppose to tell server to get it for me
Correct. AI related code is run on the server, so clients have no idea they exist
Hi, got from nowhere a hefty Bug. Now when i test the Game (Listen Server and 1 client) i see as Client after a few minutes always the Server/Hostplayer glitching in the floor, it happens only when he stops walking. Hรคlp @fathom aspen
@split siren @pallid mesa Thanks for the help, massive first step in optimization lol
Yesterday vs today:
Congrats!
That's nice, happy it all worked for you
A lot of it was changing 48 transforms into 38 rotators (like...10kb lol), second was the FVector_NetQuantize(). Average packet down from 14kb to 661bit
Not sure if you knew (I didn't until recently) but Unreal Insights have build in net debugger and it's awesome in my opinion. Might be fun experience to try it
the old net profiler provides data net insights doesn't yet have
Ah, right
Yea! That's actually how I got my first path to optimization, not using transforms and using... uh modified rotators lol. Didn't realize a scale in a transform used 96 bits until looking at the packets in Unreal Insights
i always use both ue insights and the ugly net profiler
96*48 is sad networking
yes and i bet these data simplifications work for you
and remember about data bounding
Was only initially concerned because 1cm is kinda close to what hand movement might start to notice
anythinf thresholded can be compressed down to a byte if you dont care much about accurazy
yeah, haven't looked at adding thresholds yet but I need to. This was just client to serv, I'm pretty sure I'm not stoked about the server needing to send out the same size array to 16 clients in an instance lol
AWS fees would eat me alive
can do extreme culling
hands are small anyways
wont need to replicate them at a greater distances
Yeah, I can get away with just hand position for movement at a distance, and then I already have a distance based cull in for healthbars and stuff
Because if there's anything I've learned with the Oculus Quest, it's to hate optimization.
Yeah, I shoulda thought more about that two years ago lmao
Everything looked so good
Until the first time I deployed to the headset (for a year I didn't realize the play in editor didnt utilize the headset hardware)
T_T
Side question, does anyone have a typical feel for a good server outgoing bit/s?
I know I gotta get my server processing down by messing with replication, reduce my waste. But aside from "it really just depends on your server" is there a psuedo recommendation?
If I'm reducing a player's health due to some collision, would I utilise HasAuthority to reduce the health , and have the health variable replicate inside PlayerState?
Would that be the correct way to do it?
Anything health related should be server authoritative. But it sounds like there's two questions: Should the server do it (HasAuthority) and how should health be implemented in MP
Yes essentially.
I can't talk to the latter since I use GAS
Is it a good idea to keep the player health in the player state object?
One 'Status.HP' gameplay tag for each HP duh
My sides
Outside of GAS I like having a health actor component, which implements an interface like IDamageable
I mean you can ways over-engineer stuff :D there are some simple setups like just having it in the Character.
Some might have it in the PlayerState but that's very depending on the game. The Character's health is in most cases not the State of the Player but of the Character.
Thank you for that advice, what variables would you consider being part of the player state?
Would it be things like position and rotation? Or is that still character based?
Everything that is not character relevant that has to persist over the death of the character
Ahh I see
Ping, Name, Team, Kills, Deaths, Assist
Maybe nothing if your game doesn't need any of that
Ping and Name are available by default though
Okay awesome, and I should just replicate the variable and use HasAuthority to alter it?
If the code that reduces the health is running on more than just the Server then yeah
But you can also think a bit about prediction
And additionally do it on the local client anyway so their game feels more responsive
But that's a bit more advance. Doing it only on the server doesn't break anything
Ah I see , like letting the client reduce the health but also verifying it on the server
Then letting the client know if it doesn't match up
Yeah it will correct itself anyway unless the variable replicates somehow faster than the client locally predicts :P
If the client sets it to 5 locally and the server to 7 then the replication of 7 will correct it anyway
The important part is that the client isn't telling the server to reduce the heath
Cause then that opens the door to cheating
But in order to do that it would have to use a server RPC correct?
Yop
And since replication is only done by the server I shouldn't worry too much then
I think
Yup, just making sure cause peeps tend to just do a line trace locally and then server RPC to do the damage
When talking playerinput that results in damage, e.g. a weapon being shot or a spell being casted, one only tells the server about the input. Everything else happens on the server and would if at all be predicted locally
So same concept
Only that collision takes the need for an rpc away
They do the line trace locally to prevent the server being overloaded by line traces?
No they do it wrong
oh lol
:D
You can do the line trace locally to predict
But the server has to do it itself to make sure the target is actually hit
Oh I see what you mean
So essentially,
As long as the variable is replicated
and you aren't doing any server RPC
you're pretty much fine to prevent cheating
since the replication will fix any variables that change
More or less yes.
That all mostly only makes sense when using a dedicated server that is hosted away from the clients
Which costs money etc etc etc
ListenServers are Clients that host, so they can cheat anyway
And Dedicated Servers hosted by players themselves also defeat the purpose
So unless you develop with dedicated servers that you yourself host somewhere in the cloud, you could theoretically ignore cheating cause you can't prevent it anyway
That makes sense yes,
But I guess with the listen server,
If a player really didn't want cheating,
They could host the server themselves
And wait for others to join
but if everyone had that mentality,
Then no one would join servers
Yop
Listen server games usually are also only played in groups of friends
Nothing really competitive
Unfortunatle,y I don't have the resources to use dedicated hosting,
So I have to rely on listen servers
Yeah then I wouldn't worry too much
Okay thank you
Make it feel nice for the client and server and that's it
We didn't care about cheaters in The Ascent either for example
Awesome, will do !
I would just echo the caveat that it really depends on your game. If it's something competitive people will have incentive to find out when they're host and do terrible things to your code. If it's a low-key co-op? No issues. If it's an FPS? Need to look at anti-cheat sw + doing things to make host cheating more difficult.
COD/Halo is an example that comes to mind (at least the old console CODs / Halo)
Anticheat could be a route to take, there's also things that can be addded internally into the client code like checking return address to see if it's within the module. But things like that would go outside the scope of the engine and get into platform dependant territory
Most of the time if one wants to make a competitive game it's done via dedi servers
It's also often backed by progression system that depend on match results and f2p games that have battle passes and such stuff
ListenServer games are better of being kept as a friendly brawler or coop of sorts
Completely agree, just reiterated what you said because I didn't remember reading what kind of game Irelia was making, just that they were forced to go the listen server route. So wanted to make sure the "don't worry about cheating" was entirely scoped ๐
So e.g. Fortnite, Overwatch, League of Legends, any form of competitive shooter, they are all dedicated server based. Even Fall Guys afaik
Yes I think fall guys is dedicated
Which I really don't understand why, I think that could have been better off as a listen server
Since it doesn't seem overly competitive
more friendly type
Cause their progressions system doesn't allow for it to be ListenServers
Yop
Fall guys had a terrible cheater problem at launch
It's their monetization system
iirc they switched to dedicated because of that too?
Especially now that it's free
@pallid canyon I think it was always dedicated but it definitely had a cheater problem
Like why spent money on a dress if you can cheat your character to look like whatever you want
Yes
Doesn't COD use Listen servers?
They used to, new age COD I would suspect dedicated to support warzone
CoD has/had absolute cheater infested lobbies haha
How often I host migrated into cheater lobbies
But that was also a bit before all those matchmaking service type games started blooming I think
Didn't someone do an article that was like, 80/100 in warzone cheat?
oh those ones
At least when I played it last time
yeah
MW 1 or 2
With the nuke 25 kill streak thing
The old ones not the remastered ones
I still remember going back to MW1 years later and flying around because there were so many cheats, people changing your name and doing all kinds of wonky stuff to you lol
Yes Last I played someone gave me I think maximum prestige and level? Giving me all unlocks
The "Good Guy Greg" of cheaters lol
For Honor P2P sucked connection wise, but I don't remember cheating rampant at that time.
Either way, I agree competitive games should have dedicated servers. No question.
Hello guys, I wonder how multiplayer FPS (a real one with first and third person animations) works when it comes to shooting. For example, when an AK47 shoots, is the bullet that does damage is from the first person or the third person. The same question for a melee weapon, do we do a linetrace from the first or third person?
My eyes are bleeding from google. The only way that I know how to mess with data during the replication stage is with replication trees (I haven't implemented this). Is there a different way you were thinking about for threshold?
If all my communication is client tells hand location and hand location is set on server, it doesn't seem like there's a middle spot to jump in and say do it reduced when you replicate this variable to everyone else that's x distance away
I guess thinking about it, the best option is to never send the RPC if over a certain distance for finger rotations
you're overthinking it
if you're replicating your hand positions, that takes exactly the same amount of RPCs, no matter how many clients are involved, just make sure those RPCs are unreliable
and when the Pawn replicates, it will replicate its hand positions as well, it doesn't take any noteable amount of extra resources to do so
I'm not following: I'm looking at it from a server perspective. True I get one RPC from a client saying here are my hands, but if I'm hosting 16 people I'm getting 16 total RPCs aren't I? Each with a bundle of 1KB or w/e
Then the server walks through its rep check and says oh yeah, need to let everyone know about these hands, and sends out 16 replication updates to all players?
I guess that part I'm fuzzy on
What do you mean "do it reduced" ?
UE has 2 options for replication, either replicate it or not. There's no "replicate it half way." That rep or not is based on relevancy.
I wouldn't send 16 RPCs out to the clients to update each others' hand locations, I would set a variable on their player state (or their characters) and have that replicate the normal way to everyone with the Unreliable tag (assuming hand location is updated very often)
The client would send unreliable rpcs to the server, though, to tell the srever where its hands are.
Right, so that's what I'm doing. I have an unreliable rpc for an array of rotators each client is sending every .1 seconds. So 16 RPCs are incoming to the server every .1 seconds. Then the server updates the replicated variable and it's replicated out to everyone during UEs normal processing.
What I guess I'm fuzzy on givin Zlo's statement, is that doesn't this also use the same amount of bandwidth as the initial RPCs would? (without rpc overhead).
What Zlo says seems to imply that you don't ever need to worry about the size of that backend bandwidth for sending clients a replicated variable
Why every 0.1s? Why not just every tick? The data you're sending is miniscule.
No matter how often you update the server, the clients are not necessarily updated at the same speed.
I wish that were true, I'm sending a bunch of bone transforms. I still use up to 90KB/s right now
after quantizing
Per client?
yeah, client to server
19 bones * 60 bits * 2 hands * 10 times a second
22Kb/s without other updates
yeah
3KB/s is nothing
But okay, I guess you don't need every tick updates!
So if you want to update every client with each other's hand position then, yes, you're sending 16 times that data back in the opposite direction - but perhaps a little less frequently than 10 times per second.
No you're right, I'm just concerned about the scaling and if a server would get inundated
That's where relevancy comes into play.
UE has distance-based relevancy (and ways to set other types up.) I'm not sure on the default settings, but there is actually documentation about it.
If people are far away, you can obviously just not send data about the other person and save some bw
Yeah so that's what I had just come up with in my head when I said my last thing before Zlo (ish, it was more I wouldn't update/send rotators to the serv specifically and then UE wouldn't send a replicated variable update to clients since it wouldn't change, though it would still waste hz on checking)
Just wanted to make sure I understood the original response. I think I'm still in the right boat
I wonder how they synced things like levels with listen servers. Did they just send GET/POST request from listen servers to fetch/add exp/achievements? Couldn't have been that simple.
I mean, leaderboards back then were hacked within a week of release like every time. It might have been that simple lmao
data reduction
look
Map Range Clamped
You can normalize thresholded values to 0-255 range
which is a byte
just by clamping? It'll rip off all the 0's?
you just normalize the value to 0, 255 range and compress it on a byte
ofc loosing accuracy
huh, interesting
how do I pass an array of structs to a FArchive in a custom struct NetSerialize implementation? When I'm just doing Ar << MyArray I get a compilation error that says that "binary '<<': no operator found which takes a right-hand operand of type 'FMyStruct' (or there is no acceptable conversion)" Am I really supposed to override that operator in FMyStruct or am I doing something wrong here?
hey, how does the "net cull distance" works? what is it a range to? because im working on a spectator, that is using "view target" of another player and if we died long distance from a new player target then the replication doesnt occur
what else do ineed to do to make replication work?
State who is persitent, or every data, should be repnotify.
Your client (or the server) update the state of X variable.
And this variable, use repnotify.
Cause when an actor became relevant, BeginPlay is call, and iirc also repnotify if it's needed.
I guess, but there is maybe a better way, having a replicated array of dead player, or pulling from the server on the client the list of dead player can do the trick.
i understand this theorhy, but thats not what im tal;king about here
my problem is that when im spectating other player that is far from the place i died, things that are close to him (and to my cmaera now, because i changed view target) are not replicating
like AI movement etc
Oh
iirc replication is around the the actual pawn or the actual position of the controller ?
i mean, the net culling is around*
thats what i would like to know
let me check the source.
Not even need
the golden source speak
check compenduim 75
why can APlayerController:UpdatePing override be not called on NM_Client instances when launching the game in standalone mode? ๐ค
"If the Actor is 'bAlwaysRelevant', is owned by the Pawn or PlayerController, is the Pawn,
or the Pawn is the Instigator of some action like noise or damage, it is relevant" (and other eg)
and that comes to pretty much nothing with a post 2000 internet connection
you're far more likely to have a server time evaluating actors for replication as a chokepoint, then bandwidth
in fact, i only remember one person with bandwidth issue here in last 5 years
i've got one by sending FHitresult every time i shot with a ROF of 2500.
So yeah, pretty large i get.
i still dont understand how this connects with distance problem?
i cant make all actors always relevant
thats insane
Check the whole page.
There is ALL the case.
where an actor is relevant, or not.
by distance, and not.
ok, i will check it, thanks!
and how the distance is calculated.
by what, against what, in different case.
I just give you the sentence to allow you a ctrl + f.
there are techniques to alleviate that
it was a joke.
but ROF 2500 is quite manageable
yeah, but sending FHitResult in a RPC, then multicast it, less.
or at least, when i do the test, i got an bandwith issue on the profiler.
need to get rid of the MC bit
but this is by the way, an horrible way to do this.
its brute force replication, rarely achieves the best results
why the entire FHitResult?
simulated proxies don't need that amount of information
It was my very first attempt to make shooter.
but yeah, sending fhitresult doesn't make sens.
but that how i learned it at least.
Player was strangely freezing when they start to fire with some weapon ๐
that would likely be hitting an ensure
especially if it was just once per editor start
Hum ?
Oh no no, from what i remember, people was just freezing on place.
then when they stop fire, moving again.
but yeah, limit the info of absolute need to re-do the shot + "burst counter" to replicate the shot effect was all it was needed.
i have a top down 8 player coop that has 2500 rpm weapons
i don't even bother replicating shot for shot
i just replicate the (Target Actor, Coolrdinate, FireMode, FirePressed) package
and let simulated proxies guess what just happened
Correct. I made a post about this system: https://wizardcell.com/unreal/spectating-system/
See the section "Fixing the bugs"
i have a problem with RPC Server/Client functions call. By the delay i call PingPongStart function, that should execute server-side function. In That function i want to execute client side function. But it only executes on the client, that is host/lisener. And nothing on connected client
All subsystems don't support networking. What you would do is have an actor that acts as a network manager for that subsystem
Network managers looks great, do you mean any actor? because a random actor is still not owned by the client
I tried setting the random actor owner as my character/controller, but im still failing to RPC on that actor
Ah you won't RPC on that actor, as it won't be owned(or server owned) so you would still want to route your rpcs in the client owned actors, but you will use it to replicate stuff
Yes they won't work the way you want because you are routing them through an actor that isn't owned by the client
Same issue @ancient adder has
I'll try spawn an actor on client side and set the owner on client and try rpc
Route your RPCs through client owned actors, i.e PlayerController, PlayerState, Character...
That's bad
Very bad
Why?
atm im trying to rpc not replicate
You can't even rpc in an non repliacted actor
Read the compendium
Find it in this channel pinned messages
Anyone? ๐
I haven't worked on FPS games before, but if it's an FPS game why would you line trace from the third person mesh
It's only for visuals, isn't it?
what if i use NetMulticast instead of Client?
That has nothing to do wity solving your issue
also, if i have 2 clients with ROLE_AutonomusProxy, will they both execute Client function or only the first one
Well it might work
But you got relevancy issues
If a connection isn't relevant for that actor then you're screwed
that's kinda a point to have phantom server pinger
thank you!
Multicast and client rpcs are one shot events
and if u don't get answer from it - than connection is lost
They aren't stateful
Read this: https://vorixo.github.io/devtricks/stateful-events-multiplayer/ @fervent gorge
Yes he has no idea something changed
Got it, thank u
Roles are for actors. If an actor has that Role then he's probably owned by the controller and yes you can RPC
But don't over complicate it with Roles. Client owned actor -> can RPC, if not then he can't
So its not possible to rpc if its not PlayerController, State,character? im trying to make a plugin that can be added to an existing project without editing existing blueprints/code
Correct
Thats bs xd, why would they do that
Well you can still grab his PC without knowing it's infrastructure
What do u mean
Im sorry i dont understand whats that and how i can use it to achieve my goal
Correct
Character is only when possessed, too
It's fairly good practice, you don't want clients to have dozens of open channels uploading stuff
Normally the only things you need to upload would be player input and local save/user data
Those widely overlap with PC, PS, Pawn
I say its better to let the dev decide that, but im not sure as my experience is very limited
If you have data to upload that is neither player input, or player data, then you can easily create a component that the player will then own
It's literally three lines in the player controller - createdefaultsubobject, uproperty, and replication field
So its impossible to do network in a plugin if you're going to add it to an existing project without editing anything in that project?
Generally speaking, plugins should never change the game just by existing, yes
You would expect users to easily opt into those new features
I think i'll go with component or make a controller and set it as the parent in existing project
An actor component is the most obviously modular option since you could add it to any actor
Why when using seamless travel on Server in Begin Play it correctly outputs Objective variable, but as soon as Rep Notify event is triggered it says that Objective is not valid? (In the same Blueprint)
(Only happens on Host, Clients RepNotify events works like it should)
That BP is already in level by default, the begin play event fires correctly, but as soon as RepNotify event triggers Objective is not valid..
So found out that if I want to use Objective variable I need to set it as "Instance Editable" and then it works with seamless travel, why is that?
2 issues here.
1- Why Objective variable isn't repliacted? Client has no idea what that is on case it was set on server.
2- You make it replicated. You can't guarantee it replicated at same time Taunts variable has repliacted
@fathom aspen im looking for more tutorials from you, im working with UE for so many years and i didint knew about this state in PC!
- Every client will set Objective variable during Parent:Begin Play event manually, on clients it also worked without problems only the host had it set to None
- Objective gets initialized at the very beggining of Begin Play because its already in level prio to seemless travel, this Taunt is basically an ability so if clients want to use it they need to press given key so at that point Objective should be already initialized
Thanks! xD
Yeah I didn't know that either until a few months back. I'm working on a new post, stay tuned! ๐
And the weird thing for me is that Objective variable is being set inside of the same BP, where function Construct Root Objective Collection is an override from its parent BP. So I would think that Objective variable should be set correctly and there is no need for it to be set as Instance Editable.
Then If you are Host in the BeginPlan it still correctly outputs given Objective, but as soon as RepNotify events is triggered it says that Objective is not valid.
I also tried setting it to Replicated and removing Instance Editable checkbox but then it again stopped working
whats the entry point for constructing that objecT?
how does the emulated latency that you set in the editor work? I set it to 50ms for incoming and outgoing traffic but when I launch the game in standalone mode my ping (in both player controller and player state) is ~250. Is it expected behavior?
- Each BP_Quest is present in level by default, and in Begin Play event Quests root objective, and other objectives (child of root objectives) are created, both functions need to be overriden by Child BP_Quests because they Construct different Object class
- BP_Quest_Taunt constructs its root objective and also sets the reference to created Object actor (Objective)
- BP_Quest_Taunt in Begin Play calls parents Begin Play first and then when I try to Print given Objective, it works. But as soon as I try to use this Objective variable inside different event it says its not valid
To my knowledge it should be around the 200. You have both incoming and outgoing traffic set to 50, so it should look like this:
Not sure why it's 250, unless my understanding of it is just wrong.
Ah so there is the extra delay then yeah.
So network latency + processing the actual requests.
this makes sense in theory (and it works like this in PIE mode). but I've set all latencies to 10 and locked project frame rate to 60 (stat fps shows 60 in game) and single client in standalone mode shows 80ms ping ๐ค I get the ping from the playerstate and multiply in by 4, is it correct?
Sorry wrong method. Can you try GetPingInMilliseconds() and see what that returns?
Also I don't think roughly 80ms is wrong in the first place. 60fps is roughly 16ms of processing times roughly two/three for total processing + 40ms of latency
hmm where is that one? I'm using UE 4.26.2
PlayerState.
float APlayerState::GetPingInMilliseconds() const
But I guess it doesn't really matter as it shouldn't be wrong.
doesn't exist ๐
What engine version are you on?
4.26.2. I've checked Lyra project, that method exist in there
but the code inside of it is basically return legacy Ping * 4.f
It was added 10 months ago I think, so may just not exist in 4.26.
But like again, 80ms isn't wrong regardless of the method.
๐
hmm ok ๐ค i was always thinking that those latency editor properties don't take the processing time into account. it's just strange to think that my final ping consist more of processing time than the actual data transfer
Well the lower it goes the more that affects it. It's also not the exact frame time, that's why I was saying 'roughly' because in the end it's not an exact full frame of delay. But processing requests definitely is a part of it.
Just double checking on this: if a player has a replicated TArray<FSomeStruct> property where FSomeStruct has say 5 uint8 properties. If the player changes a single uint8 on a single one of the structs in that array, will only that one uint8 replicate down to other players? (or will the entire struct... or even the entire array?)
Yes, only changed properties will replicate in structs. Same goes for elements in arrays
Hello, I'm stuck on a problem: I would like to be able to retrieve a value from a widget (or a reference to it) on the server side to be able to process information. Basically I have an actor (replicated) when I interact with it, a widget is created on the client side and I would like to be able to retrieve the information from this widget on the server side when the player re-interacts with this actor. Actually I'm only able to get the information on the server on client side my widget ref is empty.
The part of code in my actor to try to get the slider value:
And this is the way I create my widget ref: (Thanks in advance)
Thanks, in this case since it's a single property in an array of structs, which gets replicated? The whole array element or just the changed property in that element?
Yes I know but actually I have a slider (it's a QTE) and when the player press the button I want to send the information to the server with the slider value to check if player succeed or not the QTE, I just thought about this one do you think it's a good idea to store a variable in PC and update this one every time the slider is updated and get the value from this new variable in PC ? (Or there is a better way to do that)
Ok then send the info to the server. Info shouldn't be stored in widgets originally. It would be stored in PlayerState for example and you retrieve your data from there to the other classes
am i still supposed to see the contents of network data bunches in unreal insights after I implemented bool NetSerialize for data structs?
I have no idea what that variable is to know if it's a good practice to put in PC
The variable I'm trying to get is a slider value that is updated with an animation and I would like to send it to the server for processing. (I add a screenshot maybe it will be clearer)
how do i set the IP of my listen server?
It will be your public IP
how would it even know whats the correct IP to use?
You never need to "use" an IP
Your server (the machine) has an IP
The server (software) doesn't need to know it
It doesn't in fact have any easy way of knowing the IP of the machine
so it will just work if i use RAdmin or the likes?
No idea what that is.
I'm just answering the question here - your server doesn't need to know it's IP, and cannot easily know it. It's the client that may need to known the IP of the server, which is what online subsystems do - by using a centralized authority. Steam, EOSD? Xbox, PSN, GOG etc all provide such a service.
im not using a subsystem
just direct connect
so how to actually set the IP on the client so he knows where to connect?
By using an online susbystem, either one that exists or your own
i dont think i need online subsystem to make local multiplayer...
For local multiplayer on LAN, the NULL subsystem works in fact out of the box
so how to change the IP it uses for LAN?
You cannot change the server's IP, that's the IP of the machine
You can however search for sessions on the local network using the NULL subsystem
but i have 2 IPs now...
Server would create a session, then client would search for sessions, and join a session
No IP needed
i dont understand how i should connect to a server that listens on the wrong IP...
i cant fkin use 127.0.0.1
because i have a new LAN with its own IP
You cannot in fact "listen on the wrong IP" because you do not listen to an IP
Servers do not need to know their own IP
It's the client that needs to know the IP of the server - and fortunately, online susbystems solve this!
ok so i just do the networks IP and 7777 as port?