#multiplayer
1 messages Β· Page 702 of 1
i was trying to never load it on server, just replicate the "path"
Donβt replicate it, just donβt create the skm component on the server
Replication have nothing to do with that, itβs an asset, your clients has it anyway, replicate it is useless
i need to change the visual when player equips new weapon or armor
thx ill go reading!
Yeah then you need to override an on rep on your skeletal mesh component since this component already handles replication cases
Your asset has nothing to do with that again
SkeletalMesh = Asset
SkeletalMeshComponent = the one you want to replicate
Also this would be a good starting point too(a bit longer though):https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/Networking/Overview/
Iβll show you an example @ashen stone wait a few min
if the server never goes away 'async' gameplay, basic flow is login/auth, find game, load gamemode and state, do turn, end turn, resolve if still connected?
depends if you are running this code on the server ?
yes, on server
then just don't run it on the server π
Also. How do I designate a cpp file is server or client?
This game is online, i need to make everyone see the equipments on their screen
if i do it on client, only the local client will see it
this makes no sense
This is an mmorpg, when player equips "leather helmet" everyone needs to see it on his head
just broadcast it?
yeah then again, just run this code
on clients
i don't see what's wrong
i'm literally doing it for my pickups
How do u do it
Read what I sent you
I'm just doing this stuff in an on_rep
perfect. will do
On rep of what?
of my ItemEntry
Humm
The on_rep get called when i set it there on the server
i'm creating the components at runtime cause my pickups can have either skeletal or static mesh, you might maybe want to do that but slightly different in your case
the server does not need to know about the mesh since it's just cosmetic in this case
Ty
yes, dedicated server, otherwise i wouldn't help you in a "multiplayer" channel π
Is it possible to use my own Authentication System using MySQL and then use EOS for P2P Matchmaking?
Hello, im trying to make a listen server multiplayer game where i need to make the pawn look at the mouse cursor, for that i use convert mouse location to world space, but i need to use get player controller, it works fine in the client event but in the server event gets the server player controller so all the pawns end looking at the server mouse cursor instead of their own mouse cursor
Hey guys, been looking into how to make my player's respawn after being killed. So far I've found a couple tutorials & articles, but they just cover respawning on their death location. I want the players to respawn at their Networked Player Start locations. I'm guessing there should be a way to find these Networked Player Start actors and feeding their transform into the spawn of a player, but I'm not sure how. Could anyone shed some light on this? π
Or would the better option to be to use Steam's GameServers/Relay for Matchmaking
If you mean the regular PlayerStart then use RestartPlayer. If it's some other custom PlayerStart then do a GetAllActorsOfClass.
Show code
This is the code that executes in the server from my pawn
It's because Location is replicated. Make it not replicated
You shouldn't be replicating this. Other players will end up seeing where the server player is looking because movement/rotation is replicated.
that's not the problem there, he's getting the player controller with index 0 on server
he shouldn't even use this node on server
ehhhhhhh
it's not great practice. There's nothing about the API that guarantees that to be the case.
Hey guys, anyone able to help me out with a HUD issue related to replication? Working on respawning, and the respawned player spawns without his HUD. Got 4 screens of the code, but dont wanna flood this chat, so maybe DM unless you guys are fine with it? π
Well I'm not sure where he's getting the player controller from. But yeah I don't use that node that much.
But in his case, it's not the cause of the problem
Fair enough. Discouraging the use of GetPlayerController and related functions is just something I have to do π
Haha, 100% agreed
Lol, I'm actually using GetPlayerController for my code, and I think that's whats causing the issue, although Im not sure as its not working on the server either. Whats an alternative to GetPlayerController?
I'm in a HUD π
Get Owning Player Controller
this is for HUD
This is your lucky day
You can just use GetController in a pawn class
Yep that's the one
that returns you a AController who's getting set when the pawn is possessed
you can even use the templated one i think π€ pretty sure there is one
you can still use what he linked you then
The target for that is a HUD though
Get Owning Player
Oh thank you, will test it out!
this is how i do in my UserWidget base class
There is
Thanks guys! I guess that wasn't the problem for my HUD not refreshing on my respawned players. I'll sleep on it! π
In 90% of cases where you need to know the player controller for something, there's a direct way to access it other than GetPlayerController. And the other 10% is something you can engineer around without using it too.
So don't use GetPlayerController (at least for multiplayer) π
There is one already:
It's even templated
yeah this is literally what i showed above, mine is for AZircoPlayerController tho
^
I tried my best but it didn't worked, maybe the GetPlayerController is the error but i cant find any solution to it
it wasn't at the time i made this :p
or i just wanted some clear functions for my code
Haha I thought for a while you was gonna say to use it for that 10%
don't rly remember lol
lol no
oh no, it was for blueprint !!!!!!!!
so yeah that's why i made this func
I would still make a function wrapper and expose to bp than to reinvent the wheel
yeah idk, i prefer that π
even did the same with TryGetPawn
i could just do a cast from TryGetPawn for sure but i prefer like this, it's more directly readable for people working with me and it's not a biiig function so not a prob
Well one bad thing about this approach is that you might always use this function do unneeded casts, that will make you load unneeded data at runtime which can affect performance.
Sometimes all you care about is AController or APlayerController.
no, i'm using it when needed
that's.. the purpose of it
Well then that's something else. But other devs might be using it without them noticing...
this is documented in the header file
What do you think about this practice @hollow eagle
approve me π

and you don't have to use it in situations you don't need it
Using a function that already does the cast for you, instead of using the engine one
In cases where a templated method already exists I'd use that
but that's because you're just duplicating effort otherwise
But isn't that extra work to implement a new function that has the same implementation in engine already?
i do prefer TryGetZircoPawn than Cast<AZircoPawn>(TryGetOwner())
Not all engine methods have a templated method for cases like this
Well ok this one doesn't
Most do... in cases where you can do GetPawn<AZircoPawn>() I'd just use that but there's still no downside to implementing another method anyway
But this does
it's in the Anim Instance π
Other than extra work I agree
I hadn't really read up on the context, just talking in general.
yeah but the template is not exposed to bp (kinda obv)
still don't get the problem
I just don't have the choice lol π
I wasn't talking BP wise, but ok I get your point
I don't use this function on cpp, my widget classes are just mostly delegates
except some extra things that i do fully in C++ to avoid perf issues
I am currently working on a game and when I host a server everything works fine (ragdoll, shooting, respawning, dashing etc) however on the client that joins the server It can only shoot once on either gun then it doesnt work any more. As far as I can see it replicates on both the server and client but It just wont let the person that joins shoot after the first bullet. Any fixes?
Also on respawn it always another shot to be fired but only one shot
No one here would figure out the fix if they don't see code
Show the code that does the shooting
My bad let me know if this is will suffice
Both Server_XXX aren't server RPCs, are you aware of that?
They are getting called on the client, because that's where input fires
Make them Server RPCs
so this?
Yes
IsCooldownActive isn't replicated
What's Client on Weapon Fire functions? (Show them)
I don't see what's happening to the right...
Also is the code working by now?
Hello, When using Command node for Server Travel ex:
It's true by default iirc
oh ok thank you never mind then haha
Ask in #online-subsystems
Someone? π
My temporary solution consists on simulating for some time... but it's not very elegant per se.
#multiplayer message
#multiplayer message
guys can anyone help me with this ?
yep, that'd be the way
Done it a few times now for subsystem-based managers that need network functionality, just replicate a "State" actor for that system
inb4 UE 5.6 Replicated Subsystems.
Excuse me... I've been looking around for server hosting. Does anyone know any server hosters that have support for ue4?
I'm not able to use Steam for some technical reasons.
steam doesn't host servers for you anyway
i think steam has limited server hosting capabilities no?
No, but it provides functions for a lot of different multiplayer requirements.
not publicly available without talking directly to valve
Such as matchmaking and log-in and leaderboards.
the general features they support do not include server hosting, just relays/lobbies/matchmaking/etc
anyway, playfab and gamelift are the big "managed" services
So, playfab does actually host servers?
playfab does
yes
If you have to ask the question, don't make a dedicated server game IMO.
but for the login part ur probably gonna need to use steam aswell because their services are stateless forthe time being so they would allow 2 players to be logged in at the same time in the same account
you can use literally anything you want for accounts
Doesn't playfab cost a bunch after a certain point?
playfab has integration with pretty much all major platforms, or you can roll your own
pretty much all cloud services do
they changed pricing recently if i remeber correctly
I'm talkin' about ramping up like P4 does though π
nah hes gotta start somewhere
playfab's server pricing is based on azure compute prices iirc. Gamelift is probably similar in that they're based on EC2 pricing.
Hm. Because I was thinking of working with AWS. And I have a plugin I purchased a while back for that.
playfab u pay by the call after a certain point so ye its probably gonna get expensive if ur running a big thing
But the documentation is horrendous. And there appears to be no party systems whatsoever.
i tried AWS, it was a hell
gamelift is built on AWS. But it's not the same API as using AWS yourself.
If you're directly using AWS or azure it's very different than something like playfab or gamelift
ur best bet is using steam with playfab
I can't use steam is the problem.
u cant use anything?
I'm building a game with fricking NFTs. Despicable, I know.
if u cant use anything ur better of just writing ur own backend i think
But man, I have to pay rent.
it depends on what he wants, may not be a good idea
Good luck on the surefire money making venture that is multiplayer gamedev.
It's not surefire, that's for sure.
If they are on that tight of a budget though. This isn't the way to go
i think he was being sarcastic lol
Openid?
Identity Provider on EOS
if u can get away with player hosting do it
just run the blockchain stuff separatedly
Use's JSON Request's I'm pretty sure.
Best option to build up your own authentication method
P2P Sockets would work
u only need port forwarding if ur running server on a local machine
all hosting services that i saw have that setup already
u just use the ports that they tell u
Yep, but EOS doesn't do hosting.
ur not gonna need portforwarding for logins
You can use Player Hosting with P2P Socket's
Personally what I am doing to avoid the expense
EOS is the same as steam i think although not as mature
Your hosting and identity provider are not the same thing.
I'm totally unsure but I think Dedicated Server's do not utilize P2P
Unreal doesn't support P2P period.
Listen servers are not P2P, before someone tries to say otherwise...
if u are 100% that u need a backend service go with playfab and write something for the logins so that u cant have multiple logins at the same time
the confusion is from listen servers using steam/eos p2p relays
well the ability for them to
Welp. Maybe I'm better off trying to get a party system with AWS...
theres parties in playfab aswell but if rememeber correctly they are a bit early
playfab already provides integration with most game identity platforms. There's no need to "write something for the logins" unless you specifically want to roll your own.
never tested them myself
he cant use steam
Is playfab compatible with AWS?
playfab doesn't have anything to do with steam
Doesn't EOS Introduce that though?
steam is just one identity platform it supports.
no
transport level p2p has nothing to do with unreal's networking model.
as far as unreal is concerned you aren't p2p.
yes i know, but he cant use outside stuff from what i understood
because hes working with nft's or something
yeah, all you're using eos p2p for is the NAT punchthrough, it's still client/server
Sooooo..... Still port-forwarding needed
what
theres no need to use aws if ur going with playfab
I just said NAT punchthrough lmao
Playfab would be your hosting provider. The equivalent for AWS is gamelift.
i think they do the same thing give or take a feature
I'm now getting confused
You do not manage servers manually with playfab or gamelift.
They allocate servers on top of azure or AWS as necessary.
playfab is built on azure, gamelift is built on aws
Oh... I get it
Yep. Okay, so it's Playfab, which does have a team system, or AWS, which doesn't.
However...
a client still hosts a listen server, it can use EOS P2P for transport which also allows for NAT punchthrough and it won't disclose the IP address of the user either
playfab's documentation was also a million times better the last time i checked
What's kind of weird, is the fact that Playfab has almost no documentation though.
Where?
Really all I care for is NAT punch through
Very little of that is actually targeted at ue4. And there's no tutorials on actually getting something like this up and running.
well, thats the best ur gonna get
because a lot of the concepts are game engine agnostic
If you're wanting to paint by numbers throught a tutorial to make an NFT game then you're gonna have a bad time.
u can check the function names in c++ on the cosumentation and call them with the plugin
they have a free plugin in the marketplace
Yuck, this project was bad enough as it was.
i have writen a small tut on the playfab forums on how to do matchmaking
so if u need that, that part is already done
it was a pain in the ass
Dang, okay, thanks guys. I think I'm just going to tell this guy to fuck off, and I'm going to make single player games.
it is hard to do online stuff
^
Eh not really. AWS only took a few days to get simple creating and joining matches. And Steam's a cake-walk. It's when you have to use poorly-documented less mainstream solutions.
That it actually gets bad.
Just rip steam out and slap EOS in and you're off to the races. EOS is less mature but it works enough I think.
Hmmm, but Epic Games EOS plugin sucks.
Or roll your own ID, or go all in on blockchain stuff. Surely you don't need some other ID provider for a game with an in-place global settlement layer in it already.
Barely functions in 4.27
Why can't my ID just be 0xb794f5ea0ba39494ce839613fffba74279579268
I mean if you're going blockchain, you got an ID right here
https://decentralized-id.com/blockchain/ethereum/
Hang on, trying to understand what you wrote... so you mean that your subsystem will instance a replicated actor that holds a fast array serializer... what do you put in said fast array serializer?
So I have a multiplayer project and the clients pawn is a defaultpawn (and the servers). The server can move and it replicates and the client sees it but the client cannot move.
well, show code ?
Replication Graph question - I noticed InitConnectionGraphNodes() is called to create nodes per connection. Is there a function that's called to cleanup a connection?
Best cloud service for just hosting a small dedicated server?
you could home host it for "free"
otherwise maybe AWS or something
theres also OVH or Vultr. dont go through/for a "game" server host but for general purpose VPS
an actual dedicated server will cost you a small fortune, like $300+/mo
Yea I was interested in which of the big 3 people had the most experience with
the cloud server providers are pretty much indistinguishable from each other anyway
well the reputable ones anyway
Agreed, I was mainly looking for "I tried AWS but I found GCP much easier to setup"
you'll probably get the same level of service/performance from AWS/GCP/Azure
since all you're really doing is spinning up a linux VM, and then you do with that what you want
if i run enablecheats on the client through the console, does it actually RPC or does it just do nothing? its not saying anything in the server console that enablecheats was run, but when i try to run a cheat command, the server console says the command is not found
so you have multiple fast array serializers? Or just one with stuff... like... I'm confused... and when it replicates u find a function mapping an ID and what do you do with it????
yes
ah so... the fast array serializer holds a struct with a primary key and a bunch of data?
so its indeed one fast array srlzr for object type, right? Unless this struct is somewhat generic and supports many different updatable objects
ye i know but u need to have the data
right?
not trying to get to any point
trying to understand it haha
so u have objects in your client that need to update certain properties, say u want to set a boolean to false in one of them
Just a general question. Port triggering is essentially port forwarding just only on when required
yes but where does the updated bool come from? in this case
so this arrayserializer holds a struct with the updatable data
so if you have different object types u need different arrayserializers
right?
ahhh oki hahah
i understand it now :3
i was so confused
because i though u were Only storing IDs in the array serializer
and I was like: "well.. that's..."
π ty for clarifying it
lmk how the implememtation goes cause I feel there'll be some gotchas
is there any definite way I should set up a lobby system so anyone within a lobby joins a session when available?
Actually to be more specific how would i differentiate lobby sessions vs game sessions
Hi, is it possible to make multiplayer over different wifi connections using only Unreal Engine, or for that do I need a third party software?
It's very possible
Thanks. Is it possible if the players are using VR headsets? I want to make them be able to see each other in a VR environment. Trying to make a simple VR multiplayer where 4 people can see each other and move around in a room.
Very simple goal. 2-4 players each with their own VR headset, be able to exist in the same room and see each other.
I've not done anything with vr but ive run by a bunch of documentation including it so I can't imagine its impossible
I think multiplayer side stuff would remain the same, no? whether its WASD input or VR input, VR apps are android apks after all
I actually am currently trying to make VR multiplayer using Oculus's development stuff but its way too complicated
I can just make Unreal Multiplayer where upto 4 people connect to someone with their IP address or something.
technically you can do that with a vpn but I just use the steam sdk
why would I require a VPN? Can you please tell me
unreal doesnt natively connect over the internet
only lan
so you can either fake a lan by using a vpn, and make unreal think its a lan
Oh, I see, That's what my original question was. So it DOES need some third party like Steam
or you can use an online subystem
Okay. Thank you. I am using Oculus Subsystem since my headgears are Oculus Quests. But it is far too complicated to get it to work. So I was think if native unreal connects over the internet
I mean you dont NEED to use steam theres other subsystems, they can just be a bit difficult lol
If you dont wanna use a subsystem, id recommend looking into connecting through a vpn
thank you very much. any resource for this?
and if I was to use an Online Subsystem, which one is good? I think Steam only works on HTC Vive headsets or something.
Its a bit confusing.
look into the null subsystem
its like a testing subsystem used for lan matches
but if you connect with your friends over vpn
you can connect to that ip address
thank you very much I appreciate your help. The most important thing I needed to know was if its possible to have multiplayer over different wifis natively. thanks
In the long run, what you are dealing with is Crossplatform Gaming
Where the EOS might help you
thank you for this suggestion, do you think I can use EOS to get a simple 4 player VR multiplayer set up and working?
Well, here is the thing
Do you need this to run between multiple platforms or not?
If you target only Oculus, then you should use the Oculus Subsystem
If that's too complicated for you to set up, then I have no real suggestion
Not now, but in the future I might
Hi guys, does anyone know how to exchange inventory items between two clients (two players )?
depends entirely on your inventory system
For now i just want to exchange an item in an array
Obviously the server would have to make the exchange, so whichever client wants to give the inventory away should be the one making the request
But the implementation details depends on your system
Mmm thanks
Depends if you're okay with people modifying their save data with notepad
Anyone here experienced in VR multiplayer?
Doesn't necessarily need to be a database. But as always it depends on the details^^ If you have multiple game servers you want a database / or a backend service that takes in the updates from the servers.
But if you just have one server for simplicity you could also just dump everything into files as start
Im trying to do the exact same thing, need to do it over different Wifis. Did you have any luck?
Just like clients, If the server runs an event that is not replicated it'll be reliable 100% of the time right?
Reliable only has a meaning for replicated events
Basically I mean I can definitely rely on it to fire the event
Reliable mean "ensure received in order over the network" + "re-send if the network loses it"
If it doesn't go on the network it's a regular function
And it'll be called 100% of the time right?
Events are always called 100% of the time
If/how they arrive on a client is a network consideration
No network, no problem
awesome, thanks
Hey, how are you all doing?
I had a question about Pickups, Lets say there is 200 ms of latency,
and I am a client who interacts with a pickup, but lets say 50 ms later another client with 200 ms of latency also interacts with the
same pickup, How do I handle this, becuase if I run the script locally, lets say its a instant consumable, And it increases health locally first,
When the second client recives the thumbs down, should it roll back their health, and
more importantly if it was an inventory item like a weapon, just dissapear?
It seems like it would be happening frequently if people with high latency play and their on the same team. And if it was a weapon it could cause
other problems like the second player would change weapons locally but then rollback to not being able to so they could've been using their one already eqquiped.
Would this be the correct approach or is there other ways?
Reason why I am asking is becuase on online multiplayer games, I don't really notice this happening. So I am not sure what to do..
You have a choice between client prediction + rollback (both players see they have picked up the item but then one loses it) and latency (players have to wait confirmation and only one does)
One common way to handle this is a hold-to-pickup action where you hold for one second. Server replicates who is current trying to pick up the item, and if someone is picking up you can't start / your progress is cancelled
Interesting, that would make things easier
Although, for a fast paced shooter, it'd mean you gotta risk standing still for a second
Obviously that solution is of the "latency" category yes
If you want fast-paced you probably want prediction and rollback
The only issue then is if two people from different teams want to grab the same gun, then it locally pulls it out and one guy gets rolled back, but could've been using melee or firing with his other weapon
I don't understand, Because in other games I don't see this happening
Like in Apex (Although tbh haven't played it much) or other FPS games where you can pickup a weapon
There's more than one way to hide the problem - the simplest version is the delay where every player are gonna press E or something, and then after 200ms one player will see "got it" and the other will see nothing
That's what you get by doing nothing at all - just replicating the owner of the weapon
It's not a horrible solution to the problem and most of the time will be quite invisible (200 ping is nearly unplayable)
The only issue is that you have a 200ms window, for a max-ping player, where nothing happens
There's also one method I used once where the server simply grants whoever is closer the pickup - which is something that can actually be predicted
On the server, if any player is gonna be in pick up range in 200ms (that being the max latency of all nearby players), then grant it
Only works well if there's no action needed of course
Hey guys, I've implemented this tutorial series into my game, adding Steamworks API to the project: https://www.youtube.com/watch?v=BLKn_yJfLxc&list=PLL0cLF8gjBpqCe9pzVWyW9Jk2lY4qioFr&index=9
I have port forwarded my port to 7777, and my friends are unable to join. If I close Steam completely, Im able to see my server session on a secondary client, but not if Im connected to Steam. This does not affect my friend's visibility of the server though. Do you have any suggestions as to figuring out how they can join my server?
Hey there Virtus Hub, in this video we introduce you to some basic replication using Unreal Engine to make sure all clients see the right information when they need to.
You will need:
http://bit.ly/2JvO4Fm
http://bit.ly/2VMI2lj
Instructor Partner: Ryan Hobbs
https://ryanhobbs.myportfolio.com/
βΊ Virtus Hub Clothing: http://www.Virtus Hubmerch....
Opening ports is in no way useful when using Steam, so you can forget that. make sure the Steam overlay works for both of you
But it only works on sessin host, and not on the client
what am i doing wrong?
i tought this would work out of the box
The Steam Overlay works for both of us
Do you have a dedicated server? Is it running Steam too?
I dont have a dedicated server, as for now I was thinking players would host their own servers. The tutorial above goes through making a HostServer setup using Advanced Session, which would take care of hosting afaik
Also, using dedicated servers requires a source build right?
So - dedicated server = one machine hosts and doesn't play, source build required, etc
Listen server = one player hosts while playing
Yup! π Listen server is the approach Im taking for now
Dedicated servers seem a bit out of reach for me right now :p
But yeah, trying to join my game etc does not work, along with finding sessions
So if both players have a valid Steam account, the same build, the Steam overlay is working, no one is playing in the Unreal editor - it should work
Assuming one player started a session etc
Wait, I cant have my Editor open?
No, editor completely disables sessions
Oh okay. I had it open while testing the .exe, but yeah, still doesn't work after that
But 7777 is the correct port to have open, right, or what do you mean by open ports not being important when using Steam? The tutorial above doesnt actually include a "Server IP Join"-input, so there's no IP's or port options when choosing what server to join - it should just pop up in the serverlist
There is no need to open any port.
There is also no need to use any IP address
You are joining a session
What happens underneath is Steam's business
Hmm, okay. Damn, must be something wrong in my code then..
is it confirmed that they will be doing this?
Fortnite shipped with UE5 like 4 months ago
So yeah it's confirmed
Oh wow I had no idea, thank you!
I thought UE5 isn't yet ready for live builds of video games like Fortnite
Okay, wow. My friend hosted a server and I was able to join him. When Im hosting a server, it does not work though. Got any ideas what could be causing that? Firewall maybe?
Firewall could possibly be an explanation, make sure in Windows firewall options to whitelist your game
Whether UE5 is ready for your game is a function of A) how many UE5 features you need (for Fortnite it's zero right now) and B) how much engineering you can throw at engine issues (for Epic it's all of them)
I would say that right now the engine is quite viable for production, though I'd hesitate to actually release a game right now
Fair enough, its awesome for Epic that they have built such an incredible engine in-house so they can benefit from it
Seems like thats the issue, my server appeared when I turned my firewall off
Good to read its solved, im currently trying to get multiplayer working in VR over the internet and its a pain in the
What are Pawns and PlayerController remoterole and role supposed to be?
Depends.
For owning client
and server
and other clients
lol
i just wanna know how ue works
i think the pawn is supposed to be authority
I guess the thing is there might be chance that its showing false to server do print string.
It's not that
the valid one??
i did print string, scale is being fed to add input movement node
yes, that's all valid
Alright
might be something on the character movement component, some setting
or the actor itself
Yha! you can have a look on that I guess
i'm not sure how to troubleshoot
.
I will assume, that the pawn is possessed by the player controller and owned by it. Thus the answer for both not gonna differ, and I will refer to both as the "player".
On the server, the Role/LocalRole is Authority for my player and for other players. The RemoteRole is AutonomousProxy for my player and SimulatedProxy for other players.
On the client, the Role/LocalRole is AutonomousProxy for my player and SimulatedProxy for other players. The RemoteRole is Authority for my player and for other players.
Hey guys.
In my project my players can kill eachother. If they kill eachother plenty of times, the server begins to lag. Clients don't lag, but the gameplay mechanics obviously lag due to the server being lagged out. What could be causing this?
How would I go about UWorld::ServerTravel in blueprint?
Execute Console Command
Can I simply type -servertravel levelname?
ya
do the absolute path of the level tho
this is for non seamless
Every guide I look at is aimed at seamless as it seems to be a difficulty people have, but it's difficult finding info on non-seamless
And the documentation says you must use non seamless in certain situations like opening a level for the first time
Looks like there's a ton I don't understand and most people resort to C++ here. I am running my logic in gamestate (I know game mode has a 'seamlesstravel' option but I am doing non seamless)
And it's a host:client model not dedicated
Hi all, I'm trying to assign joining client player pawns a color. Does the following approach make sense, or am I doing something fundamentally wrong here?
- Colors are assigned in the game mode in the OnPostLogin event. I set the newly joined player's color as a field in their player state there.
- In the player pawn BeginPlay Method I call a BlueprintImplementableEvent "SetColor" and set the color via a Blueprint that changes the material instance properties accordingly * this accesses the player state which I assume should be valid at this point
- The color changing stuff works on it's own, I'm just having problems with reliably setting the colors. This seems to sometimes (randomly?) work, but there's probably a few things I'm missing.
Oh I saw on a Q&A somewhere online that server travel only works in packaged? IN which case I should worry about this stage later.
How are you setting the colours? I remember I had trouble assigning colours to players but got it sorted in the end
You should be setting the color on the server. Event BeginPlay fires on both the server and the client. So put a SwitchHasAuhority there and use the Authority pin to set the color
Seamless or not is based on the GameMode you are on
Also I guess the event for setting the color shouldn't be a BlueprintImplementableEvent you should use a Multicast RPC
Seamless only works outside pie. So standalone or packaged
Normal servertravel as well as hard travels for connecting/disconnecting work in pie too
This can give you some insights: https://forums.unrealengine.com/t/changing-mesh-color-material-on-network/294685
Hi there, Iβm currently trying to implement a small class system, which basically just defines the default startup items for a specific character. Iβve created an Enumeration to define the different classes (atm Doc & Technician) and put a Key-Input into my Pawnβs class waiting for the player to press β1β or β2β. Upon that event a Custom Event...
That's also not correct
The color should be an OnRep property
And you set the material color property in the OnRep function of the property
No rpcs needed for something like this
Set the Color on Post Login on the PlayerController and if needed also on the PlayerState
In the Character, use On possessed to grab the color and set the OnRep variable
That's all
The variable in the PlayerState can be a normal replicated variable if you don't need the event
Ok thanks - here's my logic if you could maybe offer any insight into what I am doing wrong - hard to diagnose because I am not sure if I'm doing something fundamentally wrong, or just having syntax errors
Also if I need to type in the URL of the map, I am not sure if it should be the URL as it appears in the UE editor, or as it appears in file explorer
Ignoring the PlayerControlls stuff, this seems fine
Can't tell you what's wrong without knowing the error or your log (:
My error is, the level simply doesn't load. If I do open level on server (or try multicasting) only the host travels
You don't need to multicast
And open level is wrong for hosts that need to change levels
Open level will literally disconnect everyone and turn the host back into a standalone client
ok, noted
ServerTravel MapName should work fine. Only thing I can imaging is that you don't have the Map in the Maps folder, which should be visible by the log saying it can't find the map you try to browse.
Or you are trying this with Seamless enabled in PIE
Which is not supported
I notice you say ServerTravel not servertravel, does syntax matter that much? I am always paranoid I made a syntax error
Not sure
How would I turn off seamless in PIE?
Seamless is a boolean on your GameMode and it's a bad idea to turn it off
The whole flow of code execution is different
E.g. Seamless traveling doesn't call PostLogin on the GameMode
So you would need to code for both cases. Just test the traveling in standalone
Right-click UProject file and hit Launch Game
Is there a clean way to send everyone in one server to another server. then destroy the old one? Or would you have to iterate through the connected clients and host and do client travel on each
Can HUD warning errors generate lag? Killing players generates a HUD "accessed none", as it still tries to reference the player character, which is destroyed. Ive tried to remove the widget from parent upon death, but that does not alleviate the problem. Getting extreme FPS drops after 10-15 kills online. Any takes guys? π
wherever you reference the hud just do an is valid check first
Yeah Ive added IsValid reference checks for the demo character in the HUD, but that leaves me with one error, which comes from the UberGraph, and when I click it no nodes are selected for troubleshooting. Im guessing its the On Initialize, and as such Im checking there, and still getting the error π Thanks for the reply!
Maybe unparent before player death?
What was not correct for this to be also not correct π€
It's correct, it's just less efficient π
not supported in editor yet? o_O
This is what I've got so far for the death logic: https://gyazo.com/fdd6a84de36b6b740f25f2b32c84db2d
Oh, thats pretty bad resolution..
its ok i can see
log is not reporting anything, simply level doesn't open - though if I exit the server window, the two clients teleport the the default map 
@dusky yokecan i see the error
oh wait it is working, it's just very, very slow to respond
This happens when the server kills the client, not the other way around. When the server is killed, it only generates a "accessed none" to the HUD, not all the extra warnings
I.e client killing the server:
its probably a replication error. If the server kills it and it's not replicated, the clients will still try to reference it but wont get anything
right before the remove from parent do an IsValid on the reference
Yeah its printing not valid π€
That death event is executed by Event AnyDamage tho, which should run on the server right?
yeah but then you have to multicast it
so set that custom event to run on server
then make another that runs on multicast
and hook that into your logic
and hook the server function to call the multicast
Wow, okay that removed alot of the errors indeed! The IsValid still prints invalid though - removing the IsValid left me with just these errors (server killing client, and client killing server):
if it works as expected just leave the IsValid and have it do nothing when its not valid
Okay π The RemoveFromParent node still generates errors, but alas - much better than before! π Alas, I am still getting those huge FPS drops though. Every time I kill the other player the FPS drops by 3-5 ish
Is it possible the parent is getting destroyed too
what are you parenting the widget to
You shouldnβt put this logic on the pawn anyway.
You first put this logic in your widget (a function or whatever), you might want to have an AHUD also that will spawn ur widgets, and have a reference of them, then you call those HUD functions on your PC.
The death event? Whew, it's from a networking tutorial π
To use a Multicast for the Color is not correct
And then whoever made this tutorial doesnβt know the basics π
Ooh, the widget stuff! Hmm, got'cha. That's from a networked asset I bought, so figured it was common practice. I guess I gotta customize this quite a bit π
So I should be spawning the HUD in this case, and the HUD has reference to all the widgets? (atm on BeginPlay the HUD User Widget is being added to viewport)
If not correct means doesn't work then I don't agree. If it means not a good practice then I agree.
AHUD is creating by the PC, you just need to specify the class
What's next, put everything on tick cause it works?
A Multicast for a State Property is wrong
It literally causes bugs
Next player that joins or comes into relevancy range won't see the color on the clients.
But this is not a good practice lol, rpc has no guaranteed chance to reach all players
There is usecases for Multicasts and there is usecases for OnReps
You could say it's not efficient. Not correct means something else.
Oh okay, cheers. I gotta investigate this further!
Also if someone joins later, good luck
Replication is also reliable
What bugs?
...................
Things I said above
Do you even know the difference between Multicast and OnRep?
Also if someone joins later, good luck
And why they exist?
But you guys think the HUD reference issues are related to my framedrops?
No
Profile your code
Yes. It's not good for late joiners
"Not good". It breaks the "state" of the Actor for them
And also for already connected clients that are out of relevancy range
Which can't be fixed with Multicasts
OnRep is a must for persistent states
You use OnRep variables for this
Multicast is good for stuff you don't care to be persistent
If you think you can do it with both solutions and one is just a bit less efficient, then please read up on the difference again and don't teach peeps wrong things.
Next week they come back and ask why their color isn't visible for people that join later
And not even joined later, this will probably not even work for the people that move servers
Cause all time an actor enter in the relevancy range of another he gets the relevancy actor properties replicated on its own (so executing OnRep etc)
What do you mean by profiling my code? π
And RPC are not reliable
The first Client to arrive from a ServerTravel will receive the Multicast, and every other one won't
You never use RPCs for cosmetic stuffs.
Has nothing todo with Cosmetic stuff either
Spawning an Explosion VFX is cosmetic, yet it's an RPC
I use OnRep or GC for that
It's a matter of State vs not a State.
Lol if for one "not good" answer you say I'm teaching wrong things, then I invite you to fix me each time I post an answer ππ»
But yeah it depends, new clients doesnβt need to know about an explosion that is during 2sec, same for non relevancy actors
I was talking about persistant cosmetics like the first thing u was talking about (mesh Color)
Barrel explodes:
-> Explosion Sound and VFX, etc. is an RPC (if Clients can't predict it)
-> Barrel Mesh being broken and looping fire vfx ontop is an OnRep
I've been trying to "fix" this for a long time. There are too many sources of faulty knowledge, starting with Epic Games' Lobby Tutorial..
Yeah I know, just misexplained my thing π
Was posting that in general, not only for you :P dw
And yt tutorials etc etc
It got a lot less since the Compendium is out
But I fully understand peeps would rather go to an official tutorial
Only things I saw explaining the good uses of RPCvsOnRep when I was learning was some post on the UE4 community wiki
But it has been killed since
All old posts are unreachable 
That's good. After all we're all here to learn. Believe me I don't post answers here because I learned Unreal a week ago. Sometimes I give answers because that what came at the top of my head. It's not the end of the world if it was not a good one though!
Also thank you for the Compendium helped me a lot
No worries, glad it helps
Don't worry, I probably sound very harsh over chat. I meant no evil
Haha, it's ok man, I'm happy that I was corrected!
eXi you've been using GAS at all?
Yeah, roughly two years for The Ascent, and recently in some Singleplayer Projects.
π GAS Compendium?
That's already a thing from Tranek/Dan :P
So I know this has been a few minutes but, is the Possessed Event on the pawn / player character called after PostLogin on the GameMode?
Yeah - but it's not all neat and pretty and digestible like "eXi's don't fuckin' do this dumb shit network compendium" π
Hm, I think it should, yes, why?
it's a tough read. I had to re-read it a few time and still have to go in every now and then. But he has more examples than I do.
still trying to debug why my color is now reliably replicated to blue.. for every player π I know you suggested setting the color choice in the PostLogin in the Controller, but logically I liked it better in the game mode, hope that is not terribly wrong
Yeah - GAS has a huge steep learning curve. More of a hill than a curve π€£
The idea is to use both
In concept - it can be kind of simple. But in practice - eek.
GameMode::OnPostLogin can set the Color on the PlayerController.
Pawn::OnPossessed can retrieve the Color from the PlayerController (it gets passed in via the Event) and set a OnRep Color Variable.
That way you can also destroy the Character and respawn it and the color is persisted
And you can move the Color between SeamlessTraveling via OnSwapPlayerControllers in the GameMode.
Yeah, I have the color in a OnRep variable in the player pawn now, as well as the player state for the case when it's destroyed
You can also additional retrieve the Color from the PlayerController in the BeginPlay of the PlayerState (SwitchHasAuthority)
If you need it for UI or so
I can't comment on it being Blue for all for you, sorry
GetLocalRole == AUTHORITY should be pretty much the same as the SwitchHasAuthority node, right?
Yes. Use HasAuthority() though
Yeah, I know, that's a bit too specific, and I won't bother with pasting a bunch of code unless that's not too much of a bother in here
The setup should be relatively simple and straight forward. If you always get blue, try to print the variable in every place you can and see if it's always blue or if the info gets lost somewhere.
I'm trying to understand the bigger picture.. Structure wise your network compendium doc really helped, but in practice I'm still learning a lot (or better worded, making a lot of mistakes :D)
That's fine. Just keep at it. It'll come eventually.
(I still fight with getting some UI elements states set up properly at the start of a map when dealing with networking π )
Yeah thanks, I know. I used to do web frontend stuff for a while and js frameworks aren't really known for their longevity.. So I'm used to feeling like a beginner all the time π
Does that somehow help?
Structure wise?
The OnRep ServerSide is only important if this is a ListenServer
Also I'm pretty sure some British person just lost it reading this
just one tiny little silly detail: in C++ onreps don't get called on the server uwu (so be aware that this is different in BPs!)
Oh wow, a custom overview π Thanks! That seems to make sense, I'll adjust it as follows. So just another question: Setting the variable in player state from game mode is not valid? I should set it in the controller first?
Ah, you could set it from the GameMode, but this way you don't have to call it on two classes
And the PLayerController is the Owner of the PS anyway
Makes it easy to have one source of truth
But that's just specifics. You can do that however you want. The PS should be valid on the Server when PostLogin calls, cause the PC creates the PS
Client-side, things might be a bit trickier :P cause replication can take time, but you are only performing replication with the Color variable ,so that's fine
Wasn't there another call on the GM that happens after PostLogin but does get called on map travel π€
And yes, C++ doesn't call OnRep for the Server, BPs do cause they are not actually OnReps but rather "The Variable has changed."
Feel like someone told me before about it before.
You have 2-3 different ones, depending on what you need
PostLogin calls on Connection
it gets called even if it hasn't changed last I saw o_O
HandleSeamlessTravelPlayer calls after seamless traveling
And Something something InitGenericPlayer or so calls for both
Can't come up with the name
But Blueprints might not have access to those
For the Color it's kinda okay to just set it once on login
And then drag it through the level changes with OnSwapPlayerControllers (GameMode) and OnCopyProperties (PlayerState)
Unless you wish to always reassign it
But Multiplayer with C++ is also a nightmare :P
Yes, I exposed the first, and the other was already there I think
But Multiplayer
with C++is also a nightmare π
Fixed it
ole! good to know, didn't know... too dependent on C++ π
OnOverrideWith was also exposed alongside CopyProperties
But that was ages ago
Can't even recall which PR
gosh darn it. The strikethrough ain't workin'
what's OnOverrideWith for?
Eh, I thiiiiiink for reconnecting
But I said that wrong once
So not sure
When you leave your PS is put into Inactive Mode for x seconds (unless otherwise setup)
If you reconnect it tries to find the PS again
And then calls OverrideWith
And that one was super confusing,
Ahh - there. Got the strikethrough to work
Cause it gives you the old PlayerState back
And then calls OverrideWith on that, passing in the new one from you just having joined
Which caused me some hours of headache and debugging cause I expect to keep the new one and to have OverrideWith being called on that with the old one being passed in to take any info I want to keep from the inactive one
so it gives you back the properties from the old ps?
Yeah + the change to override properties of the old one with the properties from the new one
Which I haven't yet figured out a usecase for :D
@thin stratus HandleStartingNewPlayer is the other PostLogin-esq function I was thinking about.
#multiplayer message
aham XD good good
Maybe if you get a new Team Assigned on rejoining
And you want to override the old playerState that you then getb ack with the correct team
Otherwise you still run around with the team you had when you left, but that's just an idea
ye I see
Yeah that's calling for both Seamless and Connection
Cause PostLogin won'tcall again if you SeamlessTravel when ServerTraveling (and you should always do that)
Hi!
I have a question about Multiplayer and replication of destroying actors.
I have a custom event which executes on owning client.
- Before it finishes it calls another event with actor parameter the event is executed on the server.
- The server event then calls a multicast event to destroy the actor parameter that is referenced in the server event.
I am not sure as to why this would not destroy the actor on both owning client and all the other clients.
Can anyone give me some pointer?
Shouldn't need the multi-cast to destroy the actor on clients (as long as the server is the only one who spawned actors). Simply destroying it on the server should be sufficient.
Hmm ok I guess I must be spawning wrong. I am also multicasting that -_-"
Only have the server spawn actors - then it'll automatically replicate to clients (as long as you have the actor set to replicate).
Same with destroying an actor.
Ok I'll go check another tutorial for multiplayer spawning since I am not sure as to why it doesn't spawn on the client even though it is set to replicate on the class defaults
Thanks @quasi tide π
Usually cause you forgot to mark it as replicated :P
@thin stratus Not really the case here but thanks for the suggestion π
My FText is replicating but the text is Text. When I modify the text it changes on the server not the client.
Show code π€·ββοΈ
@thin stratus just wanted to say thanks for your help! It works now! Somewhere the chain of the many nested calls I forgot to set the value from the parameter π€¦ββοΈ
Show code π€·ββοΈ
The person with the code is not currently online
How can I check with Advanced Sessions if a player has force quit the game? Need to destroy the player's actor in that case
The pawn is already destroyed when quitting a server
If you are talking about pawn owned actors like weapons, then yes you need to handle that on your own, generally EndPlay is the place to do that
Destroying the actor and any peripheral actors will be replicated.
Thanks guys π
How does destroying the actor get replicated like in ue4 source?
Destroying actors isn't replicated now?
Doesn't make what I said wrong, though.
"Destroying the actor and any peripheral actors will be replicated." this is not true at all, if your weapon owner is your pawn you still need to destroy it apart of your pawn
Awesome (:
I was unclear on what I meant. I meant that just destroying the actors will be replicated, not that destroying the pawn will destroy everything.
then that is literally what i also said before your message π
EndPlay happens naturally on every Actor for various reason, one being "Destroyed".
It's not directly replicated, but since the Instance on the Clients also gets destroyed (this part is replicated) it will call EndPlay for them.
So if you want to destroy and clean up other replicated actors that you spawned for the pawn/character, you want to guard and check for authority on EndPlay
It wasn't. I was replying to the "is endplay replicated?" message, I took from that that she might be thinking of needing to destroy other actors on more than just the server, which you don't.
Unless they're local actors, ofc.
It really reads like you wanted to say that additional actors will automatically be cleaned up too :P
Haters gonna say it's fake
Thanks alot !
Ok so weird question. I am implementing a sort of "downed state" in the game I'm making by swapping meshes. However, the original skeletal mesh's physics asset is still there after using SetVisibility(false). How can I go about making sure that the physics asset is "gone" without destroying it? Do I just need to disable collision on it temporarily?
pretty much
call SetCollisionEnabled(ECollisionEnabled::NoCollision) on it.
If you want to change it back, call SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics) (or whatever it used to be)
Just saw your name and I really wanna thank you so soo much for creating the Network Compendium!
Its my bread & butter whenever i start on multiplayer projects and always the first resource that i check out when troubleshooting. I love how it is highly in depth but at the same time super fast and easy to understand. Can't imagine the amount of hours that went into it.
My first real unreal coding project was a little fps game in university when I was only an 3d artist and we lost out coder, the network compendium was a huge help in getting a grasp of how multiplayer works, and trough that project I got really interested in the coding(bp) side of unreal without you I probably would have never chosen that path. So really big thanks from my side.
Hope you're having a great day! Keep being Unreal!
I'm glad to hear it's having a positive impact on your game dev career (: thanks for the kind words!
I do the exact same thing π . "This isn't working - what did exi say?"
Good night, yeah I'm from germanytoo, I shouldnt make too long either ^^
@dark edge Thanks for your help bruv! I'm going to learn a lot more about AWS and figure out how to get some of my own systems working! Gotta get dat knowledge.
If I have code to alter the skeletal mesh and the materials before a character is spawned by the server shouldn't those things replicate? What would I need to change to get that to work? I have a function that runs only on the server as well as calling a client function but in PIE the clients cant see one another but the server can
Define alter
Are you actually changing mesh properties or just changing which mesh is used?
I have a base character blueprint which has empty variables for the skeletal mesh and I change the mesh depending on what the player selects as their character. The server spawns deferred, updates all the data (the mesh, the materials, the anim instance) and then I call FinishSpawning the server is proper the client is still empty
Does anyone know about this?
This channel is probably the better place to post this question
Looks like it's used in postlogin
anyone know an easy way to set up simple multiplayer in your project to play with your friend?
nothing fancy, Im just a 3D artist thats really bad at coding lmao
RepNotify MyMesh and MyMaterial
What is single multiplayer?
Easiest approach will be to forward the port for Unreal (7777 i think?) and have a button to call open YourIPAddress
or just use the console to do that
that's the bare minimum to get your buddy playing on your screen or vice versa
I didnt understand a single word but thanks for the help!
Then don't do multiplayer lol
gotta try somehow
If you're just wanting to mess around, that'll be enough to get a connection. You won't need to deal with port forwarding if you use Steam or whatever but that's not Day 1 territory
I did something like that. So the information that is updating my character is from a replicable data asset. I used a rep notify on it and now im able to see myself on my own client. However I still cant see the other clients but I can see them interacting with the world. Mind you the server is still running all of the logic that updates the mesh, materials and animinstance so shouldn't they show up?
fair enough
@pastel fableYou on the same LAN or over the internet?
Internet
You'll have to get good at code pretty fast but it's doable. I started knowing nothing beyond a single Java course in college, now I got a game in development on Steam and am fairly comfortable in C++ and really good in BP.
ive been learning coding for 3 years now, and trust me I keep trying but I have a hard time understanding even the basic concepts. Thanks for the support though!
You might just be getting ahead of yourself. If you've been trying for three years and are still fuzzy on the basics, maybe go back and focus on the basics
I think I'm doing something wrong
Summoning a Pet-
Event is trigger -> Run Server event
Server -> Run Client event
Client -> Run the summon a pet
Client can see their own pet and the server pet but they can't see other client and server don't see any client pet.
What I'm doing wrong?
Hey guys,
I got a little tank arena game in the making and strugeling to find an optimal way for custom movement replication.
This is the system i currently have in place.
Basically I start a timed function on an input action, that moves the player locally for everybody, when the input action is released the timer stops and the location gets updated with the server location.
I had no luck yet getting some sort of smoothing system on top of that to work, and I already tried to add some more server location updates regulary but without smoothing its stuttering a lot & i dont wanna send to often over the server.
I am also not sure if rpc calls are the way to go here or if maybe some sort of repnotify event would be better, or if c++ is the only realistic way to go for a simple custom movement replication.
Try a multicast on the CLT_SummonPet, and make sure to check reliable on replicated events
Server spawns actors - not clients. When you do it on the server, it'll automatically replicate for all clients.
Only the owning client has knowledge that an actor spawned. Neither the server, 'nor other clients know that something needed to be created.
My issue now is that if the client spawn it the pet will follow the server pawn
I'd recommend reading through the network compendium by exi. It's in the pinned comments.
will do thanks
https://www.youtube.com/watch?v=RfVHSXCEcsY Why am I getting this stutter?
What's the Correctβ’ way to do a dash or knockback in the context of the CMC?
Is a dash a movement mode or something on top of walking?
Is there any way to debug it?
i created a sprint ability for multiplayer movement but it is snapping
maybe this settings can make it bad?
Set it both on the server and on the client, this will fix the issue of your character rubber banding when changing speeds.
but i`m doing it
it is not always this problem ;/
The change is happening on a Local Predicted Gameplay Ability System, it happens on both sid
Not sure if GAS can cover it for you, sprinting is more complicated than just setting max walk speed.
https://www.youtube.com/watch?v=RtQRMcupJs0
Support the channel through donations. Crypto accepted!
PayPal: https://paypal.me/reidschannel?locale.x=en_US
Patreon: https://www.patreon.com/reidschannel
Bitcoin: 1JFwWHr4X6uAeoZadukzqKjzFBj3Qjy7Sk
Ethereum: 0x2B2Bc108F1Cc0fF899959dEF3226637787d8C3dE
Dogecoin: DNQ33YnhpWoTBokBNVkZP5ub8KTLkpyjpv
Join our community discord!
Discord: https://dis...
@dark edge thank you, much better now even at 200 ms
are any of the world times replicated? like TimeSeconds?
Game state has a shared time
but it's actually not that accurate as it relies on Property replication which can basically happen any time^^ So I'd look for a better solution if you have system rely on timings.
I like to bounce RPC's back and forth myself, I find it tends to be a bit more accurate
Similar idea though
Personally I have my own shared time that's guaranteed continuous and stable - essentially the clients handle their own time but with a slight dilation to aim for (last replicated server time - current ping)
Works wonders, since usually you care a lot more about time being continuous rather than complete synchronism
hm, im just trying to display a round timer :L
awesome thanks
Just replicate a timestamp of when the match will end (counting down) or when it started (counting up)
ye thats what im doing now
but im using GetWorld()->GetTimeSeconds() as my clock which doesnt work at all
there is easily 10s of seconds difference
yeah that time is local to when your local world started
oh
GameState has a GetServerWorldTimeSeconds() which is sort of what the current server world time is
It's good enough if you don't need something that's uber accurate
nah. not sure what sort of expectations but even if its like half a second either way should be fine
i dont know if thats too much to ask
nah that's fine
on client one player 2 shrinks, but on client 2 player 2 doesnt shrink, how would i replicate that, run on server multicast before shrink code doesnt work
You maybe should provide a bit more context^^
i'll post some screenshots
when the big guy touches a normal sized guy they shrink, and it's working on the right screen, but on the left screen they stay normal size
i dont know how to replicate this code so the size changes on all clients
If it is fine its simulated you just need to replicate the initial event to start the shrink, then the clients simulate what needs to be done to shrink your actor
usually run on server into multicast will replicate but its not working for this
Well then I'd start debugging if the RPC is received at all
only client 1 is print stringing the event
Is your timeline replicated?
then your RPC is either not setup correctly or its not called from the server
i dont see an option to replicate the timeline, but if the event before the timeline is replicated nothing happens
with a print string after the overlap event client 1 is the only one that says it
the overlap event is a physics event, not an RPC
is there a way to make the overlap event an rpc?
Overlap events occur on all machines
You double-click the Timeline node in the blueprint and it opens the Timeline editor. The Replicated checkbox is toward the top right
That's why he should probably do a SwitchHasAuthority there
@hallow summit make it state driven. Either use replicate movement which I think can replicate scale? Or repnotify a variable.
Whenever you can, make things state driven and not reliant on events.
It is in the state of being shrunk, not so much that a shrink event happened to it.
Onrep bIsShrunk -> do shrinking/unshrinking stuff
i got it working finally thanks for the help
guys I have problem with saving name in player state π I want to save name in menu to player state name its variable made by me and then in lobby i want to load this names of all joined players and make a table of them with ready or unready status and I just set name over cast to player state and nothing happens.. i dont know how to make it can someone help me ?
Quick question: Is the Actor visibility / bSetHiddenInGame replicated by default if replication is enabled for said actor? It seems to me that it's not, when I call ResetLevel() the Actors' visibility gets reset for the server but stay hidden for the clients
Oh, I guess actually the visibility is part of the UStaticMeshComponent soo that is probably not reset with the actor then, right?
bHidden is replicated on the actor by default
Component-level hidden states are not
I'd be surprised if ResetLevel even works properly in a multiplayer environment
The default Reset implementation doesn't do anything btw
I don't know about "properly", but for now it seems to do it's job - what could be the gotchas here?
just calls the BP event
Well the main thing is the Reset is only called server-side, so only replicated properties will take effect on clients.
Does OnRep not fire when singleplayer?
Can I make it fire? o-o
no
You can call it yourself, but that's not considered good practice
Usually if you have some logic that must be done after a value changes it's a separate function
The OnRep is purely a networking concept
{
Bar = false;
OnBarChanged();
}
void OnRep_Bar()
{
OnBarChanged();
}
void OnBarChanged()
{
// do stuff
}```
Blueprint OnReps do their own thing because they're stupid and not really OnReps
I might have to check then if there are going to be any issues.. In my practice project I ResetLevel() and RestartPlayer() for each player after the match ends. Destructable Actors in the game environment are set to hidden and (at least now) reset their state properly - I did however override the Reset() method to reset visibility
Well looking at the implementation of it, all it does is call a Reset() function on every actor in the level. But it will only call it Server-Side
And the default implementation on AActor does nothing other than call the BP function
So as long as I stick to replicated properties I should be fine then
yeah
Cool, thanks
omg why is everyone ignoring me...
I bet no one ignores you, maybe we just don't know the answer \o/ Or you might need to give more information.
Is there a way to make blueprint class derived from UObject replicate?
With C++, yes
https://jambax.co.uk/replicating-uobjects/
Not in BP
They must also be an actor subobject
Thanks! I guess I should expand on my question regarding what I'm trying to accomplish
Since server RPCs can only be called from owned actors (i.e. controller or pawn), I'm trying to make a somewhat abstract system to enable me to implement the RPC logic in the affected actor itself, rather than creating a million different functions/events on the pawn for each actor I want to interact with.
The first screenshot is from my pawn class. I created a ServerInteract event that should ideally just call the respective function on the actor that needs to be interacted with.
And that is all good for a generic Interact event that doesn't accept any parameters. But since I sometimes need to pass parameters, or Data from the client (depending on the actor etc) I wanted to create a system where I would have only one event on the pawn, that would take any Data (basically any UObject subclass) and just pass it back to the actor that needs to be interacted with (second screenshot).
Is there any way to achieve this? Right now BP_PhoneColor is a blueprint class derived from UObject but replication doesn't seem to work for that.
If I went with structs instead, there's no way to have an any struct parameter and then downcast to it...
So how can we actually deal with this other than creating RPC events for all interactable actors in the pawn itself which I'd really like to avoid if possible?
There is a way to have such structs, but I think that is utterly cursed and even breaks with RPCs
I had someone on The Ascent how tried that for BP functions and the data that came back was kinda garbage
Think it was like only parsing the parent struct class in the end and all the child data got lost
I don't remember
But yeah, the UObject through RPC won't replicate
In theory this is possible, you need a struct to wrap a byte array and then you need to take care of serializing / de serializing it but I don't think this is smth you actually want to do, but it would work^^
Is there ANY other way to avoid having all RPC events on the pawn/controller then? π any "best practices"?
Good time of a day to everyone! I have a problem with my "Destroy Actor" replicating, would you mind to help me solve it?
Components?
"Actor to destroy" goes from a functions`s output value and then write it to variable with replication, so very this one i wanna destroy. But it still on the scene..
You got it backwards, only server can destroy
@bitter oriole could you please expand on that? Either here or in PM
is the actor replicated? Looks like, shouldn't it be enouhg to delete in on the server?
Not sure on what - if you don't want too many RPCs in an actor, use components
Will need C++ though
So what exactly i have to do? π
To be clear, you can write UFUNCTIONs with RPC logic also in Components, they don't even need to be set to replicated for it
Literally just call DestroyActor in the Destroy - Server event
It needs to be called from a server?
Replicated actors can only be destroyed on the server
Destroying them on clients does nothing
You don't need to do the multicast, you can destroy the actor on the server and its replicated
Yup, that'll fix it
Every action which server does immidiatly goes to all clients?
If your actor is replicated
For sure
Hello guys I have question I am making multiplayer game and want to majke lobby where I can see player names and if they are ready then coutdown and start map but i have problem I want to save their nicknames into playerstate I made I am using editable text where player can put name I created also name variable (text) in playerstate which I am setting inside blueprint in firt widget but it will never save there I dont know why.... so then If i try to print names I see only "none" because its default for Name in playerstate can someone help me ? here is how i have it now but it doesnt work
well, that's not how it works xD
No, destroying actor does
you should hook your control flow into that what your getName event is calling
so its totally bad ? π
it simply can't work
i thought that if I have variable name ticket as replicated its good
hm wait, I miss smth
but idea of savings name etc inside customplayerstate for multiplayer is good ?
or better to save it in player character ?
blueprint
i am newbie in it soo....
the idea it self is fine
sorry for dumb questions π
I think the issue is, that you need to send an RPC to the server
as property replication is Server -> client not the other way around
so you should call an RPC to the server after your input is done
so custom event run on server and then call custom event which multicast for all?
or its not like this
if the name is replicated it should be enought, if the server updates the value
tbh I wouldn't start with a multiplayer game^^
i still dont get when need to multicast , or run on server
i have done one singeplayer game before , but now I am trying this hh be honest i am not trying this is my task XD
we are learning this
multicast: Message from server to all clients.
Server: message from client to server, if you "own" the actor
i go to try i just dont clearly understand multiplayer logic or I am just not used to multiplayer stuff
I have done before score for players same way but i see I had there RPC ohhh my gosh
π
Me and 16 friends are playing a multiplayer game (made in unreal 4.27). Here is a bug I can't crack:
15 people are running on the primary start point down a street before turning left toward a distant park. everyone sees everyone's 'name' above the avatar. however, once i run outside the main street and toward the park - all their names disappear. Once I turn around and run back toward them (i'm on the main street again), their avatars are no longer the different characters they pre-selected and are instead the SAME avatar. And so am I.
so idk if when I get too far away, and the names of everyone else far away squish and causes too much for replication that it breaks it
or something about turning that one corner on that one block that breaks things.
Despawning is distance based.
Why the models change I don't know, you need to check where these get set
and @marble gazelle I have some other problem I have done dedicated local server on pc and I can run my game over icon or also inside editor if I run it inside editor everytime I see copy of first spawned player on map
dont know why
from folder its ok but sometimes its lagging not my window But if we are 2 there I see other one in hard lags but he is not lagging
Iβm playing it too. And each player sets a name and picks an avatar at the beginning. But when you move to far from other players, when you go back to them, their names are gone and they all look like the default character on my end. And Then I look like the dealer Character to themb Even though they look like themselves on their end.
Well, I have no idea? Don't you have the source code?
Could you get in a bit more detail pls?
i can show photo of first problem
Yeah but the devs donβt know what caused it.
Does anyone have replication experience that might know whatβs happening?
oO what do you expect from us? Using a marble? π
this literately can have a lot of reasons. For the despawn this is the simplest thing, just increase the distance, currently can't remember the property name.
For the visuals, this really is an implementation detail I don't know. In my game we replicate this with the player state and the actors just read the visuals it needs to load from there
@marble gazelle or I recorded it if you can check videos π
No, I don't download anything from public discords
you could just explain in a bit more detail
I see thanks! Iβll share a little more context if it helps:
Each player can select their own avatar. When people join the game and select their avatar, if they look at players that joined before them, those players are all the default avatar; any players that join after them can be seen with the proper avatars.
We added a bug patch that addressed that, so all people see all the proper avatars, but now those visuals disappear once there is enough distance between them.
Does that help? Maybe show a fracture in how it works?
No. The only thing that can help is, if the Devs ask question on the issues with more implementation details.
Ok thanks π
here is first problem if i start game from editor I see copy of fist spawned
first player doesnt see it
but others yes
do you have a player character placed in your level?
what do you spawn over blueprints?
hm could be related^^
its done like this π