#multiplayer
1 messages ยท Page 171 of 1
Most likely yeah, before any network data gets created for it
yay new problem I think, spawn deferred doesnt take spawn params
stopping me setting its name
Would it be hacky to just do what it does and set its name though
its basically just spawn actor but creates the params for you
{
if( Owner )
{
check(this==Owner->GetWorld());
}
FActorSpawnParameters SpawnInfo;
SpawnInfo.SpawnCollisionHandlingOverride = CollisionHandlingOverride;
SpawnInfo.TransformScaleMethod = TransformScaleMethod;
SpawnInfo.Owner = Owner;
SpawnInfo.Instigator = Instigator;
SpawnInfo.bDeferConstruction = true;
return (Class != nullptr) ? Cast<T>(SpawnActor(Class, &Transform, SpawnInfo)) : nullptr;
}
Seems to have done the trick
I have a widget being created for the client, and the client clicks a button which is supposed to send information to it's pawn. However the information flow always seems to stop at the client trying to relate to the server. Does this have to do with using a widget on the client PC? should I use an in game widget or interface for this instead?
or am i misunderstanding the flow entirely?
widgets cant directly talk to server
that explains a lot
so any RPC must go through a client owner actor
typical flow is through player controller or player pawn
is it possible to have a widget produced for the actor instead of the PC to same effect?
Sounds like a untraditional attempt around the problem I'd say
oh i think i have it right, im just not RPC'ing
keep in mind you cant RPC in the widget
no it sends it to the pawn
then you're all set
ty so so much
So i have a character that i want to rotate left/right based on the keys A or D.
But im not sure how to do that correctly, just modifying the rotation of the character doesnt seem to replicate to other clients.
Calling the function on server side and then replicating it down to other clients kinda feels wrong.
I'd highly appreciate it if someone could help me with this
Same way you do it with a mouse, AddControllerYawInput. Just instead of using MouseX, you use A or D to drive a -1 to 1 value.
yeah i've also thought about that, but i dont want my character to use the ControlRotation since i need to use it seperately for my camera
Then you'll need to handle the rotation replication manually. Cause normally control rotation handles that. That said you could drive your camera through your camera manager instead of control rotation too.
never tried driving the camera through the camera manager tbh
Lyra has a camera mode system that makes it a bit more dynamic too. But it's largely using the BlueprintUpdateCamera function. That said you can also override the view target's AActor::CalcCamera. Many different ways to drive it.
well i dont really see how i could rotate my camera without using the control rotation tbh
Hey, I'm wondering whether or not it is common to replicate the bullet impact decals and effects from other players. It would obviously make sense from a gameplay perspective but thats a lot of objects to replicate. Does anyone know how this is usually handled in multiplayer games and if there are ways to make it cheaper on the server.
It happens locally
Don't replicate it
Client tells server it shot - server tells everyone else they shot. Logic is ran locally
It's being called in GM_Core (the parent class of the gamemode GM_Werwolf) in the Event OnSwapPlayerControllers. And for the second thind I don't know what you're referring to because there's no property like that in my BPCharacter
You just maintain the state in the view target or the camera manager and do the vector math to set the camera where you need. And your inputs change the variables used in that math.
but as far as im aware that only changes how the camera renders and does not affect the actual Camera Position.
How could i get the correct aim rotation then if i need to access that
Hmm wouldnt that introduce problems with cheating though if the shooting logic is handeled on the client? Currently Im using this tutorial https://www.youtube.com/watch?v=OhrijWnJdyE&list=PLzykqv-wgIQXompUswD5iHllUHxGY7w0q&index=13 as a framework and it runs the weapon logic on the server. For me the client says to shoot and then the server runs the logic, sharing the result (Hit Result) with all clients. Then it calls a WeaponEffects function which is ran by each client using the hit result. The picture below shows the setup, with green being run on client, blue on server and yellow multicasts. I'm planning to replace all the multicasts with repNotify.
Check out my Patreon: https://www.patreon.com/user?u=60713904 Join the {GDR}; Discord server and download my free project files: https://discord.gg/dUm3ZtYDuV
Buy me a coffee: https://ko-fi.com/bluntstuffy
Follow me on Twitter: https://twitter.com/BluntZombie
This tutorial is mostly about how to setup a multiplayer framework in Unreal Engine 5,...
hello i'm learning GAS with Tranek doc and i tried to simulate high ping and packet loss(on client side), my fireball sometimes doesn't launch on client side , i just wanted to know if this behaviour was normal and if so how can i do to fix this
What should i expect about Iris netcode? player count on a dedicated server using only default character movement without anything else adding overhead?
(No AI, no Actors, except static geometry)
how do you spawn the fire ball?
I have generic RPC events I use throughout my project. I want to minimize code duplication.
For example:
Server_Spawn_Actor
Multicast_Spawn_Particle
Multicast_Play_AnimMontage
Client_Play_Sound
Client_Shake_Gamepad
Client_Shake_Camera
Basically a collection of generic events.
I need these to be:
- Implemented in one spot
- Easily accessible anywhere
- Works with RPC Server/Client/Multicast
One solution (which I'm currently using) is I have a BP_Generic.
Then in GameInstance, I have a variable of BP_Generic. This way it is accessible anywhere.
It works but I feel this is messy and I'm looking for an alternative.
I know there exists Subsystems but I think that's also going to run into the same issue since Subsystems don't replicate?
If the CMC is replaying SavedMoves from the client and the client has also called an RPC for playing a montage....
It seems the CMC will many times apply the movement of the animation before finish/playing the actual animation.
Are most games relying on games simply not having enough latency for the differences to be notable?
I've hooked montage replication into the CMC which seems to work for me~~ but I'm curious on what other people are doing
you call the gameplay event through an animation notify is that right?
Yes
I had the same issue once, i fixed it with changing the Montage Tick Type to Branching Point in the Attack Montage
^^sick color theme
๐ thanks, its an OLED theme and i enjoy it much more than the default one
@quartz star it's working perfectly wtff , how did you find that ?
nice to hear,
Well I dont wanna say something wrong but the animation notifies are default set to be Qeued which is less reliable, its used when the notify is not gameplay relevant and (only) for cosmetic, but in your case its spawning the projectile which is indeed gameplay relevant so it needs to be set to branching point
Just gonna tuck that away in my vault of random knowledge I'll likely need some day and will forget by then. ๐
haha yeah, always good to have a vault of all the bug fixes you encountered in your journey
Ok thank you verry much, by the way what is the proper way to handle collision effect ? can i do it localy ?
i'm talking about he visual part
Because i wan't my fireball to stop moving when reaching a certain range so it doesn't disapear instantly and and it has a nice trail fading effect (so it has a bit of gameplay logic in the visual part)
Well yes you could handle the collision event locally to modify your cosmetics of that fireball, but you'd still need the server to verify the collision.
If the server doesnt verify the hit, it could look like you hit something but you actually didnt (Hit Reg)
If you just want the trail to fade away you could detach it from your projectile, let the particle finish and destroy it after
Ok thank you verry much dude !
glad i could help
Anyone know why the default network interpolation for my actors in unreal is so bad? Are there some magic numbers to make this look good? Frequently there will be weird teleports / other jank with physics objects over the network.
Default physics replication settings are very strict
loosen them up
there's a lot of tunable parameters
Curious where these parameters youโre referring to would be found?
project settings, physic replication settings
physic is a typo but it's still there lol
Dope going to mess w these. Would there be something like this when it comes to movement lol Iโm always trying to figure out how to help the movement in networked environments for unreal
regarding VisibilityBasedAnimTickOption whats does "tick pose" mean? does that fire anim notifies? I assume refresh bones mean to actually do the bone movement
my game server only needs to move bones during montages. has anyone done something similar before?
essentially: "tick pose and refresh bones during montages only"
Are there any default settings that would be good for the above use case? I'm trying different settings but I'm just getting worse results. I'm surprised this isn't more obvious out of the box
Why there are 4 players spawning instead of only 2 as I launched the test with 2 players ๐ค ?
Hey all. I have a dedicated server packaged up for my game, but when launching the server, it is listening on 0.0.0.0:7777 so external clients can't connect. How does one change it to stop listening on the loopback, and listen for external connections?
for clarity; the dedi is hosted on a baremetal linux box in a data center, with a windows VM hosting the gameserver; both the firewall on the linux host and the windows VM are allowing 7777
Show what you got
If itโs in a data center did you make sure to forward it on the network level? Like for example if your using AWS did you forward it on the portal. Usually forwarding the host firewall isnโt enough
There's no additional configuration on Unreal's end as far as I'm aware. The port is the important part, and as long as you know your network traffic is appropriately forwarded from the port from your external IP address, external clients should be able to connect to the external IP address at your defined port number and be directed to the internal IP address of the server running on that port.
Also 0.0.0.0 is a โlisten anywhere addressโ
which for testing is likely what you want
@worthy oak It's a gift to us from someone. I do not have access to the portal. Good thought, I do think it's network level. I'll dig deeper.
Yeah you would need to configure it in your network firewall. Tracking it down from your public IP all the way down the host ๐
Physics settings and actor settings. Pretty much default
lower error per linear and angular difference
try like 0.1 for each
Why my characters spawn properly but i can't control it and my camera is on the floor ?
Failed possession?
I'm having a bit of trouble getting a transforming actor to replicate and I'm wondering if I'm misunderstanding something about how replicated movement works
I have a gameplay ability that allows the player to pick up and move an actor (unit) around a board. I've since attempted to move it to the Player Controller, but the results have been the same
When the server picks up and moves a unit, the X and Y position is replicated to the client, but the Z and rotation are not
When the client picks up and moves a unit, the Z is replicated to the server, but the X and Y position are not
The first clip is of the server character executing the ability on server, second is the client's view, third is the client executing on its machine, fourth is the server's view
seems to me that the xy is being replicated, but to some other value. also seems like the z and xy components are being replicated by 2 different things (components?). maybe they are stepping on each other.
can you call a server function from a client's game instance?
i know you can call from an object that has a player controller as owner. but i dont know about game instances. i think there's one on the client as well.
How do i know if it's possessed or not ? Because the prints are called
the print is called so it's technically possessed
make it a habbit to print some more contextual info
append the pawn name
but yes it does seem like possession happens
what does the logs say ?ร
Is there an equilivant of GPlayInEditorContextString for UE_LOG?
So that way I can see which client/server is outputting something on a UE_LOG in the console in real time?
Oh I see what you mean, the Z is a SetRelativeLocationAndRotation of the mesh to make it look like it's being raised while the X and Y are with SetActorLocation. Interesting that they don't replicate in the same manner. I'll try to have everything set to SetActorLocation and report back
if you do not wanna mess up with it just buy smooth sync plugin, it's cheap. I used it in Unity, now I am using in Unreal and it gets the job done
i wouldn't assume that everything works the same way. in any context. and i've worked with ppl who ~kills~ insisted on making everything work the same way always.
maybe you're assuming how ue works. and i dont know enough. but iirc ue does a lot of compression of data. e.g. send delta info and not the actual value.
the fact that you're changing the pos in 2 places seems like a way to step on yourself.
moving all into setactorlocation seems like a good idea.
btw. usually calling setrelativelocationandrotation is more performant than setting location and rotation separately. i think for network it would be the better choice too (but im not certain). not sure how it affects replication to set them separately.
Valid and active cameras? What does the logs say?
I'm not sure to understand what you mean ? ๐ค
You got a camera on the char? Is it set to auto activate ?
these are the logs
I guess it not we'd be stuck at center of char
This is not all the logs?
This is just your bits
yeah those are all my logos (printed by me), you want other logs ?
the FPS camera is set to auto activate but the TPS no
What did you change when this stopped working anyways
there are so many logs, you want me to send all of it to you through a texte file ?
I want to see anything suggesting something going wrong or being invalid I guess
player / spawn / camera / related
To make it work I have to have the node Event Handle Starting New Player in GM_Core and in GM_Werewolf I must use Event OnSwapPlayerControllers,
To make what work exactly
to not have the issue of not being able to control the character and the camera not being in the floor. Here are all the logs if the picture above isn't enough
Inputmode UI Only
LogPlayerController: Error: InputMode:UIOnly - Attempting to focus Non-Focusable widget SObjectWidget [Widget.cpp(954)]!
Cant find much in here I guess
no errors that strikes me as related to this
somehow I can't see the logs anymore in the output log somehow ๐ค Even if everything is checked to true
Did you clear the logs ๐
Hey I'm having an issue with 5.3 where all clients are printing as client 0 and was wondering if anyone knew a fix for this? ๐
i restarted the editor and I have all the logs back again but I don't have LogPlayerController: Error: InputMode:UIOnly - Attempting to focus Non-Focusable widget SObjectWidget [Widget.cpp(954)]! anymore ๐
Woop woop ๐คช
i'm getting crazy I think
as i don't have the error now but still have thise issue with the character and the camera, I guess the error above isn't the issue ๐ So do you have something else to suggest ? ๐
Nah im out of time
Reduce changes, see what broke it , backtrack
Start a new project, do one thing at the time
Was gonna suggest the same.
Recreate the connection to gameplay process in a fresh project. Like Squize said, do one thing at a time, and ensure it works before moving on. Keep stuff as simple as possible.
If it works, you can always adapt the new system to the old one.
How can I make the Menu part where I create a session and the other client can join me, etc... Because that part was painfull to setup, isn't there a shortcut to skip that part ? ๐ญ
Ignore that part for now
You could duplicate the project and redo just the other parts.
Do simple direct connect
That's fine too.
To be fair, I don't think you need the connection right now, just test locally inside Unreal. Isn't that what you're already doing?
Yeah true
what do you mean by "locally" ? Because there's a player joining another player and I'm in "listen server - Standalone Game (as in PIE the server travel doesn't work)"
Well, I believe you are using Steam Online Subsystem, but when you connect, you're not logged in as a Steam user? The player's have your machine name?
Yepp
Anyway you could just set that stuff up if its necessary, it doesn't take long the second time ๐
I'm using Advanced Session
Poteto tomato
Does it work if you start directly in the dev level?
In PIE?
(I never start from main menu unless im doing packaged test or right before it)
yes it does
net.AllowPIESeamlessTravel did you set this ?
nope what's that ?
where do I check if it's set to true ?
you can open the console and run it without a value it should show you the current value.
im not sure how well PIE seamless travel is working at the moment, didn't work in the past at all.
it's set to false
that's what I had the last week it was not working, so someone told me that I had to test my stuff in "Standalone Game" instead of "New Window (PIE)"
but now for some reason it works
But you still have the same problem, even if you start inside the gameplay level without travelling there?
I don't have the problem anymore and I'm starting in the lobby level to test the travel and everything works perfectly
let me try directy from the level itself
except 1 thing that isn't working
which is this "Set IsInputEnabled" to disable the movement of the player when they join somehow it doesn't work and not being called
let me check if the prints before are being called
These are the prints
and GM_Werewolf isn't called nor the EventOnSwapPlayerControllers in it
when hovering over it it says : "Called when a player controller is swapped to a new one during seamless travel"
And you got a pc_lobby and some pc_game right?
yeah, PC_Lobby and PC_Werewolf
the only check is old and new isvalid
and player is valid
usure what player is atm
I'm not sure to understand what you mean here ๐ค
/** UPlayer associated with this PlayerController. Could be a local player or a net connection. */
sounds like this would generally be valid
Ok but what am I supposed to do ? ๐
GM_Core and GM_Werewolf
in the new one (GM_Werewolf) I first call the parent (so GM_Core's OnSwapPlayerControllers Event) then I add the other stuff to it like the isEnabledInput to disable the player's input.
what do you mean "that's nothing" ? ๐ค I have all this logic that needs to be executed on Werewolf level
Calling parent function onswapplayercontroller is an event that doesnt exist
its a BPIE
a what ?
blueprintimplementableEvent
basically a pure Blueprint event
Oh right
you call the core implementation.
gotcha.
I call it like this
yepp
yeah ๐
so whats the rest of the GM werewolf implementation?
Just some printing to be sure it's being called and the IsInputEnabled Set Notify to disable player's movement when players traveled from the other level
but Swap isn't called ?
nope
the print is supposed to be red, so none of those are that print
But when coming back to "Standalone Game" it's being called by my character isn't spawned and my camera is in the floor (and somehow now it's only doing that for the host, and the client doesn't even travel to the new level ๐คทโโ๏ธ
I feel like there's logic here we're not shown either
i'd suggest starting a new project, as before
do one step at the time
and see what breaks , if it even breaks
Some mention bug with GetPlayerController, hopefully you're not using that anywhere
in multiplayerprojects thats a big no no
what does it mean ?
ARe you using that node anywhere?
GetPlayerController(0) will always refer to the first player
it's kind of okay for clientside stuff if you don't have to factor splitscreen/local MP
it will return the old controller and not the new one
havnt verified this but
generally i never use it
and in a character, there's no reason to
I don't know why you would use GetPlayerController(0) when you can get the controller that possesses a character though
^
in my case i use if for instance to deal with player's on rep health
This is bullshit. It's probably them using it improperly like in that screenshot
And this is not usually how you use delegates in UI code
since you're creating a dependency on the HUD from the character BP
Its someone debugging through the c++ code of it
idk, havn't verified but i wouldnt dismiss it so fast
well I would because it gets plenty of use
UWorld::GetControllerList was the function in question in that post.
anyways, was mostly a remark. I suggest avoiding it regardless, as there's more often than not a valid reference to the actual owner anyways
someone somewhere 7 years ago debugged an engine function and that means it's broken
though actually that wouldn't surprise me too much with Unreal
(they dont have a good trackrecord of fixing old bugs ๐ )
so ? ๐
Guys I have poblem I was using eos with Source build of ue when I packaged game I was able use EOS and now when I package game I cant join SESSION idk what problem it is, on another pc its working any ideas?
Does it work without seamless travel?
how to disable seamless travel ?
How'd you enable it lol
I disable that on GM_Core or only in the GM_Werewolf ?
Both ig
I like the way mr Snrub thinks
What are some tips for replicating a montage - I would rather not multicast but its for single shot shooting events so a replicated int or something that had an OnRep reaction could work but I feel it would be slow and delayed.
What are you guys thoughts for something like that?
I have done very basic โclient side predictionโ for things like this where the client will do a client side animation and the onrep (or multicast that excludes the player that triggered it) after the server event.
Why are you avoiding the multicast tho?
That was going to be my question too
I was under the impression netmulticasts for something like shooting was a no no due to bandwidth saturation, think 4 players all shooting full auto weapons
unreliable multicast is essentially the same as property replication really
is that you would do then in an actual production project? Im not asking for in depth step by step stuff but just genuine advice from someone with network experience and how it would be handled reliably and cheaply (In terms of server bandwidth cost)
I've always use a replicated counter to trigger remote firing FX:
https://jambax.co.uk/better-burst-counters/
But it's worth noting that if you were doing this with gameplay abilities or something, it'd probably be doen via a gameplay cue which is essentially a multicast with a budgeting system on top
alright good to know, i was originally considering a replicated counter that just triggered stuff like that
Main difference with the counter is that you want some amount of budgeting, but you don't want fire events to be dropped. Better late than never kind of approach.
Unreliable multicasts would still be budgeted, but unless they are sent right away, you never get that firing event
From a player perspective I figure they would complain if people think they're getting shot without anybody around them firing.
I have a struct called Data which I store on every item in the game, would setting this Data to Replicate be expensive?
Tmap wont replicate will it
negative
So not so big ๐
With the new UE_LOGFMT - is it possible to always have a string pre-pend if we overloaded UE_LOGFMT somehow? So that every string started with GetDebugStringForWorld(GetWorld()) - rather than having to put that in each ourselves - so all logs are like "Client 1: I did something", "Dedicated Server: it was me"
i.e. rather than write:
UE_LOGFMT(LogTemp, Warning, "{0}: Spawned container component for: {1}", GetDebugStringForWorld(GetWorld()), GetOwner()->GetName());
I'd rather write:
UE_LOGFMT(LogTemp, Warning, "Spawned container component for: {0}", GetOwner()->GetName());
At the moment I'm probably just going to make a helper class that does it old school style - but was hoping to overload the actual UE_LOGFMT somehow - but I cant get my head around some of the template stuff
At least the GetDebugString part is working...
Do you guys have a smart way of handling this issue?
I have a float Health and MaxHealth. I have various objects in the level that I place with different health. In BeginPlay I do this
if (HasAuthority())
{
Health = MaxHealth;
OnTakeAnyDamage.AddDynamic(this, &AHayStack::ReceiveDamage);
}
so that the BP sets the right health at the start. But in my Receive hit I have this:
void AHayStack::ReceiveDamage(AActor* DamagedActor, float Damage, const UDamageType* DamageType,
AController* InstigatorController, AActor* DamageCauser)
{
Health = FMath::Clamp(Health - Damage, 0.f, MaxHealth);
if (Health > 0)
{
GettingHit();
}
and the GettingHit plays some animations, sfx and vfx
the issue is that on start, the OnRep function plays
void AHayStack::OnRep_Health()
{
if (Health > 0)
{
GettingHit();
}
}
and does all the stuff in GettingHit. Which I do not want. But I am not sure how to bypass this. I made it work on my Character in a very roundable way by getting a value from the GameMode and setting it through the Controller, but it feels quite redundant. Is there some other way you'd do this?
Check old health
You can include that in the onRep
OnRep_,Health(const float OldHealth)
@flat night
Yeah, I am looking at it, but I am not sure exactly how to check that OldHealth
I am not super familiar with all the OnRep stuff yet
If Health > OldHealth
( Gained HP)
Else
( Lost HP)
Or if OldHealth == 0 -> Init Health (or -1.0 to be very explicit)
looking for suggestions on how to do an in game score board that displays to all players. i was currently attempting Widgets being sent to players but having difficulty with updating the client to the score. Would it make more sense to maybe use an in game actor, attach a widget to it and have it present to the players?
PlayerStates could keep their scores
Gamestate could have an array of the sorting
And clients just react to that array updating, along with binding to playerstate changes for each player
GameState -> OnRep_LeaderBoard
PlayerState -> OnRep_Score
@hoary spear got it working! Thanks!!
Map doesn't get replicated ?
No
Its just not supported/implemented
There is probably a backend reason
Not really
Hello all, I'm currently setting up the Animation Budget Allocator, but the plugin seems to not take effect on Dedicated Servers. It does it job very well on Listen Servers and Clients, but it seems to be deactivated by default when I run a dedicated server.
I've never used the ABA before and I'm not experienced with dedicated servers. Could someone point me in the right direction? Docs were not helpful in this regard and I can't seem to find any forums posts.
They do, it's important for bone transform calculations.
Think melee combat
I'm interested in knowing more about the Budget Allocator not working on dedicated servers, though. It's a behavior that is not explicited anywhere on the docs or anywhere else on the plugin.
Fair enough, just figured it was related and due to anims not normally running on dedicated..
yeah - animations arnt the same on dedicated as listen servers
I think you might need to enable "always tick pose" or something like that?
Alright, but they run on my dedicated servers because the nature of my project requires so, guys. My question is about the ABA, not about running animations on dedicated servers.
Like I said, everything I need in regards to animations is working, mate. I just need to get the ABA working on dedicated servers.
Dedicated Servers don't run the rendering pipeline, how would they handle animations?
Animations are ran on the dedicated servers, otherwise my entire project wouldn't be working. I just need to understand how to enable the ABA on dedicated servers.
No, animations don't run on dedicated servers. As I said, there's no rendering pipeline on a dedicated server; they are fully headless. What you are claiming is probably that animations mutate scene data, thus the dedicated server is aware of.
If the server is authoritative over replicated scene objects - say, a sword - and said objects are mutated by animations - say, an SKM to which the sword is attached - and the server simulates the animations in such a way that the objects mutate accordingly, that's running the animations as far as I'm concerned. It's not some client doing so.
Yes, you're right; but still, the server does not have an animation blueprint running on it because there is no rendering pipeline in that realm. That aside, the gameplay logic you have bound to the transformations of your bones has to go through the network some other way, just like you can't get footsteps fully working on a dedicated server based on animnotifies.
Oh, I was looking @ the plugin configs themselves, but it's the budgeted SKM that's the issue. Awesome. Thanka a lot, @woven basin.
Sorry mate, that's simply not the case and your knowledge is either outdated or wrong. We have a pretty complex melee combate system meant to support dedicated servers and we rely heavily on ABPs and Anim Notifies.
Either way, my issue is solved. Thanks again
Care to share how you solved it ?
Right ok
So their motivation was prob due to anims normally not running on dedicated
Could've said in docu tho.
Im surprised theres no built method to just run the notify track on dedi servers tho..
And skip the actual animations. Do some quick lookup on bone locations when asked for
They do...
Are you guys using 4.0 or smth?
lol
You even have a "Trigger on Dedicated Servers" flag
Why would they have that in Anim Montages if they didn't run on dedicated servers?
You have simulations. Not the physical thing.
You mean not the actual mesh deformation? Sure, that's true. But the bones are still moving and updating. It really doesn't matter if the mesh is there or not for what I was discussing.
So yeah, anim data is run on dedicated servers
Yeah, partially why I'm struggling to optimize and resorting to ABA.
AFAIR, this wasn't a thing back in 2018 when we shipped a game with dedicated servers.
We had to simulate footstep sounds based on movement start/stop. Was a nightmare.
Yeah, we had a similar solution back in Unity working with Photon tech. The current version of Unreal is taking a lot of work out of our backs tho
So, as I said, I'm surprised theres no way to just grab the notify track and play only that
Sounds like a very useful thing
Havnt gotten to this part yet tho so maybe ill discover why its not possible (or that it is, and im just blind)
I guess you can do that manually, I haven't done that exactly yet, but I'd imagine the same way you can add new notifies to tracks runtime, you should also be able to retrieve them and fire them manually. Sounds rather tedious tho.
I'll probably dive into the inner workings of montages and see if there's something i can do about it
I'd be super interested so please do let me know if you find something
Squize, what do you mean? You only want bone transform data at the time of the notify?
Because otherwise, the server is basically just treating the montage as a timeline, unless you continously tick mesh transforms.
Except it includes Updating bone transforms, right ?
Not if you disable them, which they are by default.
Guess thats 90% of the way then
I want them purely calculated if they're read , thinking that'd be cheaper
Definitely.
It's useful to tick the transforms if you have traces attached to sockets and such. It can be turned on and off during runtime, but it's not immediate.
Well, it's probably pretty fast, I didn't test it much.
and is there a way to only update certain bones (or up to certain bones, idk if transforms are updated as a chain), lets say you only need the root for root motion but dont care about the rest?
aights thanks tho ๐ซ
ah yeah, restricting bones to be updated
It is "I wish there was more documentation about this feature" time again. Tonight lets talk about voice chat.
How in the world can a server be receiving voice chat data over the network, if the client isnt sending any (according to stat net debugging)?
Also, is there a specific testing setup required to test voice chat? Right now I launch 2 standalones on the same pc, connect them to eachother through advancedsessions. Is this a valid test case, or am I supposed to have 2 separate packaged builds, or 2 separate pc's entirely?
Eh, I think that is valid if it works, but obviously you can't be 100% certain until you test it in the environment your game will actually run. E.g. a packaged build using two user accounts over a wireless connection.
Right okay, that sucks a tiny little bit to be honest, but I suppose there are technical reasons as to why it works this way
I will start testing it in a packaged setup on 2 separate machines
thanks for the help
Hello there,
I got a problem with getting data from player state.
- I have all me player related data in player state and some of it is settings on the game start.
- I have multiple levels but when the player moves to different level then all the data in player state is removed.
is there any way I can get all the data from player state which is set in the different map but do not want to use game instance. As it is a multiplayer game.
Check out the persistent data compendium in the pins. Pretty sure it has a section in there about transitioning data from a playerstate when moving between levels.
Generally speaking you should be saving a player's data into savegame stuff to persist level loads.
The one exception to this might be seamless travelling where you can copy properties from the old to new playerstate using CopyProperties override. But even then it wouldn't persist logouts etc.
what the difference between these two Rep_Conditions?
DOREPLIFETIME_CONDITION_NOTIFY(ATSLCharacterBase, bCrouching, COND_None , REPNOTIFY_Always);
DOREPLIFETIME_CONDITION(ATSLCharacterBase, bCrouching, COND_SimulatedOnly);
so COND_SimulatedOnly will only replicate to other clients and will not replicate back to me
i have to run the crouch logic locally for me partially
Tried still doesn't work ๐คทโโ๏ธ
COND_None has no condition on Replication
COND_SimulatedOnly will only replicate changes to the variable to Simulated Proxies
The REPNOTIFY_Always is changing how an OnRep that might be attached to the variable gets called.
It will always be called when the value of the variable is sent to the Client, whether it changed or not.
REPNOTIFY_xxx is not a "condition" its a "notify" as the name implies.
COND_None is the "condition"
so the property change notification will always be triggered which is (REPNOTIFY_Always) to all clients connected to server, right?
but on dedicated server i noticed that we need to call the trigger function manually
If you are in C++ you must always call it manually for the Server
hmm, for listen servers also?
Is a Listen Server a type of Server?
The answer is yes.
So yes, you must call it manually on Listen Server as well
To clarify this - REPNOTIFY_ALWAYS sends the notify to all clients on the condition per the condition, not all clients automatically.
It is the CONDITION to determine which clients get the rep notify
Thank You very much for the lesson, i will keep this in mind
how many types of clients do we have?
So CONDITION is "who gets it" - REPNOTIFY_X is "when" do they get it
OWNER, ALL, SIMULATED - umm... 1 sec, let me check source - cant remember
so in summary, DOREPLIFETIME_CONDITION_NOTIFY replicates a property based on a condition and triggers property change notifications, while DOREPLIFETIME_CONDITION replicates a property based on a condition without triggering property change notifications
This is covered here a bit more too: https://cedric-neukirchen.net/docs/multiplayer-compendium/remote-procedure-calls
Other ways for Replication are so-called โRPCโs. Short form for โRemote Procedure Callโ.
If you look at UnrealNetwork.h and CoreNetTypes.h
That has a better source version of the CONDs available
DOREPLIFETIME(MyCharacter, bMyVariable)
is the same thing as writing
DOREPLIFETIME(MyCharacter, bMyVariable, COND_None)
and both of these are the same thing as
DOREPLICATE_CONDITION_NOTIFY(MyCharacter, bMyVariable, COND_None, REPNOTIFY_OnChanged)
So if you are happy with COND_None and REPNOTIFY_OnChanged - you just use DOREPLIFETIME.
Or you can change them using a function with additional options.
Or you can always just use DOREPLICATE_CONDITION_NOTIFY() and always explicity show COND_None etc - to help future you reading the code.
Most importantly is that REPNOTIFY_OnChanged is the default - not REPNOTIFY_Always. This specific part is saying - hey, for each connection that I want to send the notify to, should I? The "should" is if the old variable is 5 and the new variable is 5, REPNOTIFY_OnChanged wont send anything.
But REPNOTIFY_Always will always send the 5 variable even though it didnt change.
Does that help/make sense @nocturne quail ?
of course it helps alot thank You very much, i was afk feeding my cat so didn't read your message ๐
One last part is - regards of all those - we are only talking about COND sending to clients. the server will never get its own Notify. You have to do that manually in c++. I'm sure that is covered in eXi's link about it, and that is what Matt was talking about earlier.
yeah i was already told about this by Matt
FYI - I did some testing on the FastArray callbacks. They function same as OnRep - i.e. only clients get the callback, not the server.
So if I was running a listen server, and I wanted to hook the UI into the callback, I guess anywhere I do MarkDirty() I should do a check for IsListenServer and if so, broadcast the UI change there for the listenserver itself?
I dont see any obvious way outside of that looking at the source code - unless someone knows of a better/cleaner option
Yes
That is correct
ok - thanks @fossil spoke
However you probably dont need to do any checks for the Server
Since only the Server should be calling MarkDirty anyway
But I dont want to call UI broadcast on Dedicated? Although maybe I handle that in the UI hud that gets stubbed out
i.e. if my game supports both Listen and Dedicated
Well you probably shouldnt be making a call to anything that specific
Instead you should just emit a generic delegate or something
OnItemAdded or whatever
yep - understood - your right (as usual) - thanks
That way external systems can decide what specifically they need to do, like updating UI
appreciate the time - thanks
๐
thanks for the help,
I will look into it.
If I set an actor's owner to the player's playerstate, will that actor then become relevant to all players regardless of cull?
(Assuming NetUseOwnerRelevancy=True) .. I think the answer is "yes".
If you have enabled bNetUseOwnerRelevancy then yes, that is how that works, so the Actor would always be relevant because the PlayerState is.
Any saviour that could finally help me solve the issue of the client not having his character spawn nor controlled please ? ๐ #blueprint message
anyone have issues with VOIP with steamdecks? they seem to behave like their input is like 100 times too high and its just distorted terrible noise
I don't suppose anyone has some convenient links on lyra and iris?
I am unable to join a server in my game. This is using the Steam Online subsystem. I cannot figure out why it does not connect. Please help.
Using Mover? Uggghhh. I hate the API of mover so far.
But this is a solid commit ๐
anyone please ? โ๏ธ
When is it safe to call GetLocalRole() in a newly spawned Actor or Character? Can I do it in the constructor, or do I need to use one of the later hooks?
ok - so its definitely not the constructor - I'm searching the code where its handled
what does your gamemode look like?
which one ? The Parent one or the child one ?
the one you have in your gamemode override
sorry i was doing smth
also what does it show when you try test playing
yeah but I have 2 levels, 1 being the lobby having a gamemode called "GM_Core" and 1 being the gameplay level that I travel to from the lobby having a gamemode called " GM_Werewolf" which derives from "GM_Core"
does it mess up in both or?
nope only in the GM_Werewolf / Game level
do anyone know why does 2 window doesn't work when I start my game in multiplayer only 1 screen work perfectly other screen button's don't work
how is the best way to call these events to be reuplicated to others? calling them via OnRep ? Multicast will be not always relevant if client is too far
It will handle level blueprint logic, for example what will happen when player pushes the button etc.
OnRep for states otherwise RPCs for immediate or one off events (unless its client requesting a state change then it would be serverRPC but you get my point)
pushes a button sounds like it could be a OnRep + variable
it should also handle late joiners, so onreps + vars should get the job done?
Thats literally the only way that would work in that case
Late joiners would miss the RPC
ok I just wanted to be sure if there isn't an other way to do this
There are other ways ofcourse, you could send an RPC to each client as they join with the current state to ensure but the correct way is to use OnRep and variable
Why should I do it other way than proper way 
you shouldn't - I answered wanted to be sure if there isn't an other way to do this
PostNetInit?
ok o k
I'm sure that's a thing
but I noticed the proble with that way is initializating variables. Events get called when for example door variable default state is closed. How to do it it would not be called on initialize?
Just so you know, if something isn't relevant for RPCs, it also won't be relevant for regular replication (and thus no onrep events)
Can somebody explain to me the online subsystem? Does it automatically synchronize players when I start a session or do I need netcode?
OnReps only trigger if the new received value differs from yours locally
If they both start in the same state you wont get the OnRep
Nvm, I learned that I need to use Unreal's networking API too
Sure maybe I will give a more specific example:
I have a door which has "flag" IsLocked which I can check in editor to have this door locked on start, uproperty with EditInstanceOnly has default value false, so you are right it will be called because player which will join the game must update the door state so it is get called, and I am wondering how to prevent it in that specific case
OSS is just a wrapper for different backends
you can take the same value you are replicating as a param in the function and check yourself,
void OnRep_SomeFoo(bool b)
{
if(b != myb)
// stuff
}
although it kinda defeats the purpose of a replicated variable? Which is to replicate state of the value
yeah, that's the reason I must find a workaround to skip executing event only at first val replication
I mean, you have access to ELifetimeCondition enums for the replication condition, you could also do a custom condition and go that route but idk, I would do this properly from the start, if something is locked then all clients should see the same state if thats your intention
so I would have then make a seperate actors for door locked, door unlocked and If I want to havge door locked then use door locked actor instead of ticking, unticking the checkbox
I am so confused but each door should have their own state yes, if I understand you correctly. You can do things like bit packing to save bandwidth if thats what you are worried about
When joining a game, does unreal direcly replicate the accurate initial state of an object, or will onreps be called?
(that's what I'm seeing, wasn't expected)
How do you then distinguish between initial state (as you perceive it), and something that changed while you were playing?
OnRep will be called if the received value differs from the default serialized value of that object
You can detect "initial" OnReps by checking the current time vs the spawn time:
GetWorld->TimeSince(CreationTime) <= 0.f
Only works for things spawned at runtime, and not for dormant actors
OK thanks... seems like a weak mechanism
Seems like a lot of onreps would need that test
Real question is why does it matter in this case?
So, I have a team that has an IsDefeated repl variable. When it changes, I announce the defeat. But when joining I don't want to see it.
Am I supposed to use replicated variable AND RPC?
Hi . I have this roomscale movement system for VR that moves the player in the direction the RL player moves , works great, But trying to make it work in multiplayer but its not moving and just stutters
For things like that, you usually need to use the above mechanism or something similar.
ok thanks @chrome bay. seems like there should have been a less hacky solution.
Since in this case it's regarding joining, you can just check whether the world time is above a certain threshold
I actually love it, itโs just a fancy wrapper around NPP really, it saves so much headaches
I also tried this but it stopped working completely
well the problem is you can't distinguish an initial replication due to join, or due to relevancy change etc.
You can use it, it just means that if Id comes knocking on ur door asking for the modifications you made to their code, you have to give them up
but I meaaaaan
The entire industry really is built on that GPL so personally it never bothered me, also itโs only the quake code in that repo that is gpl, not my code, any file affected by gpl is marked with the specific license
Yeah but they could have designed it to handle that scenario.
I wonder if they expect you to split the implementation into stateful and stateless aspects (use replicated variable + RPC for the message)
Oh you are saying relevancy complicates the whole thing since the object may not be reflected immediately
I meant more with Epic.
anyone? why is this working in single player but not on client?
the multiplayer options menu?
What about it with Epic? their licence applies if you use Unreal Engine, so obviously you can't use this code in non-unreal engine code
but Epic doesn't use GPL they have a custom licence
but it's an implementation for Mover so i mean, why would you
Something about the gpl licence requiring transference to things it's used with. Honestly, I don't know anything about licences, I just know there are some that are entirely incompatible with UE stuff.
Because of Epic's EULA.
This means, for example, that you may not combine the Licensed Technology with code or content that is licensed under any of the following licenses: GNU General Public License (GPL), Lesser GPL (LGPL) (unless you are merely dynamically linking a shared library), or Creative Commons Attribution-ShareAlike License.
It even says it in there.
hmmmm shit
was CC ShareAlike always there
So I looked at all the docs about Actor 'lifecycles' - none of them make reference to this. The docs just say "Always called immediately after spawning and reading in replicated properties"
Any idea where in the lifecycle of an actor it actually occurs?
which is a guess a workaround
You aren't doing that with ue though... I think?
Honestly I'm not sure, I haven't done any multiplayer stuff in ages ๐ฆ
I'm not, but maybe i will have to put the quake helpers in a seperate module
that's really god damn annoying
Yeah. That might work. A third party separately compiled thing.
And have 2 licences on your repo.
yep
Though that only counts if the quake stuff is LGPL, not full GPL.
All good - looks like it is after "OnActorSpawned" and is actually the step responsible for triggering BeginPlay for a replicated actor...
Neat!
You're right... that's so annoying!
My use case is attaching a storage component to a Pawn. I only want it on owner+server. The clients shouldnt have storage of the simulated proxies - so just working out when to do that check and attach the storage.
So you deadass just can't use GPL code with the UE -__-
Well I did rewrite it myself but it's obviously still inspired by Quake3
you can argue it's transformative
You could just set the component's uproperty to only replicate to the owner.
but idk
And this is where my licence-fu hits a roadblock. I'm sure somebody will know for sure.
I am almost certain that you can't argue it's transformative in this case, so it's fucked basically
that's really really annoying
Sorry ๐ฆ
all good! thanks for letting me know!
But I'd still need to wait till after PostNetInit to do the HasAuthority check for the server to create it (so it can replicate down) ?
Is PostNetInit even called on the server?
I thought it was just for replicated objects.
so where then - beginplay?
Yeah.
The other option is, now that I think about it, I do have the fastarray notifications only going to the COND_Owner, so I guess it doesnt matter if everyone is running around with an empty inventory...
maybe I just keep it simple...
Why does this work as listen server, standalone But Not as client .
One reason might be that you're calling an rpc on a actor you don't own as a client.
You can't call server rpcs on the game state or other players or random world actors.
The picture is a little too low res to see any more. But that might just be my phone.
Unless you're already on the server.
Do you guys run multiple machines or sandbox for testing?
Both
Any sandbox you prefer?
Yeah, that part, sure. But if I just wanna make a simple thing, with no worry about networking, trying to find the right methods I'm supposed to override and then the how to actually do the movement...that's the annoying part.
Actually tracing what calls what and how it happens is ๐คข
quick question, if i wanted to add a collision sphere to a multiplayer map that grants any player inside of it xp that dynamically moves during the match where should I store that functionality, im thinking the sphere and its information should be an actor created by the gamestate and the score should be handled through the gamestate
In the actor. You can even have it as a server actor only.
Player overlaps -> grant XP -> change locations
Of course, if you want them to be able to actually see the zone, it has to be replicated
Hello there
so i got a question
in my game i want to teleport my character to other levels
i did search on using async but the thing is idk if that comes already replicated or not and how would that work
i tried to search for any other info but i got none
so can anyone help explaining it a bit
i can get in a voice channel if anyone wants to so it would be easer to explain
thanks in advance โค๏ธ
Look up seamless travel. Everyone has to go at once though - UE doesnt support people been on different maps at the same time
There's some guides pinned in this channel about it
yeah they wont be at more then one map at the time
its like a portal the player would get in it and go to the next level
Once again, i am turning to your expertise, i am trying to create a replicated PlayerList in my game, and so far i have the following
GAMEMODE (Picture 1):
Using Event Post Login to update a playerlist. Game mode calls a function on the Gamestate called Update Player List
GAMESTATE (Picture 2):
Passing the connecting player state, and updating my Connected players array(Repnotify) with the GameState Player Array Variable
NOTIFY(Picture 3):
Here i test if the Connecting player, already exists within the Player Array, and if so it should add a new item to a list, and if not it should create an entire new list of players
ISSUE:
All of this runs on Server and on Client 0, but nothing really happens on Client 1. I only get messages from Server and Client 0....
I cant seem to figure out if it has to do with the FIND function i am using to test if player already exists in the player array....
One other thing is that it looks like the "adding new player" happens multiple time.... hmmmm...
Sorry for the wall of text....
For a mechanic like controlling another player's character, I was considering to unposses both characters and possess the target character with the new controller and setting the viewtarget on the new controller client, so both clients would see from the same player, while one is just a spectator and the other is controlling their character. But I'm concerned this might cause bugs in the future as it breaks the linkage of original controller-state-pawn objects. Would anyone like to add any input or suggest ideas about this before me actually trying it?
For example I also would like to make the original controller try to resist to the movement input from other player. Which I believe can't work with this way
Fair enough, but for that you never really needed Mover in the first place
even for single player i donโt think itโs that complex tbh, I think ppl just dunno how to use it yet is all
thereโs pretty much a grand total of 2 functions to be overridden
I was exploring the API on preview release. It was a headache trying to actually figure out how it all connects up. I have 0 experience with NPP btw. At least with the current movement components, you can keep control clicking some fairly obvious spots ๐
I don't have the time to keep exploring it though. Need to focus on my game.
you have pretty much modes, layered moves, mover component, sync state, blackboard, input cmd
those are the main things
most important is modes, sync state, input cmd
Another lure of Mover 2.0 though, outside of the network stuff, is that it is supposed to be extendable by BP. So BP-only peeps can actually make a movement thing. Regardless if that is a good idea or bad idea ๐
But one of the gripes I hear from my friends coming over from Unity or Godot is that actually moving your actor, through a custom movement component is annoying because it requires C++ in order to even create a movement component.
Yea iโm not the biggest fan of that bit tbh, but it makes sense for layered moves I think
ah fair, iโm not the biggest fan of BP in the first place so I guess I never cared
It really is a pain point of the engine imo. Because then you get these cursed friggin' solutions from BP-only people ๐ญ
The PlayerState automatically manages the "Player Array", there is no need to replicate a second array with a list of playerstates.
To appropriately know when a player joins a game on both the client and server, you can use the Begin Play of the playerstate. You can have that begin play call a dispatcher in the GameState that passes along a reference to the PlayerState that joined which can create or update any UI necessary.
The game state does.
Both do, actually
!!! I REALLY - want to thank you for making that compendium!!!!! So well described, simple and to the point. Jesus u deserve som respect ๐
How do you guys separate Serverside and Clientside code? I'm coming from a classic Frontend + Backend perspective feels weird to just slap on an annotation parameter and have a Serverside only code.
Do you think it would make sense to move all Server/Client logic for an actor in Components or something?
Hello, does anyone know whether Epic changed how they handle widgets on seamless travel?
I always knew that they are persistent (https://wizardcell.com/unreal/persistent-data/#should-userwidgets-persist-seamless-travel), however, it doesn't look to be the case anymore. I have made a bare example with seamless travel (screenshot), but upon it the widget gets removed mid-travelling (on transition map). I have checked the SeamlessTravel in GM.
Upon executing the console command, this is triggered
void UEngine::TickWorldTravel(FWorldContext& Context, float DeltaSeconds)
{
if (Context.SeamlessTravelHandler.IsInTransition())
Context.SeamlessTravelHandler.Tick(); // <<< Following the chain, it calls UGameViewportSubsystem::HandleRemoveWorld
// ...
}
and then
void UGameViewportSubsystem::HandleRemoveWorld(UWorld* InWorld)
{
// Gather all widgets...
for (UWidget* Widget : WidgetsToRemove)
{
Widget->RemoveFromParent();
}
}
They likely did. Because that was a huge glaring bug in 4. You should always expect widgets to be removed when travelling, and if you have a specific widget that you don't want removed, then you can override that yourself in the widget.
In 4.x you did this by overriding AddToScreen and removing the world delegate binding. with FWorldDelegates::LevelRemovedFromWorld.RemoveAll(this); I personally even eventually hacked the system to gather all of the viewport widgets and remove them because handling every single userwidget removal is a daunting and never ending task.
It looks like in 5.x normally added widgets are done through the new GameViewportSubsystem. Which calls the UGameViewportSubsystem::AddToScreen, populating the list used in the HandleRemoveWorld you posted above.
You can circumvent this easily by adding the widget you don't want auto removed directly to the GameViewportClient. There is code in CommonLoadingScreen that showcases this. Which adds a widget without using the subsystem.
// Add to the viewport at a high ZOrder to make sure it is on top of most things
UGameViewportClient* GameViewportClient = LocalGameInstance->GetGameViewportClient();
GameViewportClient->AddViewportWidgetContent(LoadingScreenWidget.ToSharedRef(), Settings->LoadingScreenZOrder);```
Would a cover system (like gears of war) require a custom CMC, or do we think we can get away with just using RPC's to 'stick' to walls? ๐ค
Wall running for instance requires a custom CMC, but those kinds of implementations usually use their own physics and such, which is not the case for cover. Hmm.
Hm, interesting. However, there is no way of doing that solemnly within BPs, right?
Initially I want to say no. Sec
All the calls you posted are not BlueprintCallable, so I would imagine that it is the case, unless there's some Kismet wrapper I don't know about
Yeah, not really. GameViewportClient isn't really BP exposed at all.
Generally you don't want to run AI on the client.
I only see that AddViewportWidgetContent() is called within the UGameViewportSubsystem::AddToScreen(), but only if the argument ULocalPlayer* Player is nullptr
Surprising to me that Wizard posts about them persisting, cause iirc that was removed in very early 4.x versions (below 10). So either they still persist in some cases, or that is really outdated.
@lime coyote Relatively sure that whole stuff is AIController bound, and AIControllers are Server-only fwiw
@kindred widget Does CommonLoadingScreen use UUserWidgets or Slate?
Technically both. It uses a UserWidget, but calls Takewidget on it to pass it to the ViewportClient
Hm, sounds it that would have the same problem with nothing being able to tick in the Widget
okay so im really lost now
i really can't find any clue how i would use the seamless travel with blueprint and also to only just teleport one of the player to another map not all of the player
is there is clue to that please
i searched really everything on the seamless travel and async
i would really love to get some help with that any kind of guide will be so appreciated
my game is a dedicated server based game too just in case that would make a difference
Let's go over that one by one
Did you check this post by Wizard? https://wizardcell.com/unreal/persistent-data/
- Seamless Travel with Blueprints is relatively simple:
You need to ensure the GameMode that you Travel FROM, has bSeamlessTravel enabled.
As well as ensure the Server is the one calling ServerTravel, no one else.
And last that you do this either outside of the Editor (Standalone or Packaged), or you try the experimental console variable to also allow it in the Editor, but that might crash.
i did
It should tick fine? It's the paint calls that tick it. Sec, let me test, but I'm 99.9999% sure the CommonLoadingScreen widget ticks.
And to clarify - one player cannot teleport to another map - its everyone goes (unless you want the one player to go to a menu map style thing)
- also to only just teleport one of the player to another map not all of the player
That is not possible. In a game where players are connected to a Server, you can only ever move all Players. If a player moves alone, they disconnect.
Unreal doesnt support multiple maps on one server
What would that do for you? Then you get a local copy of a PlayerState?
AIController::PostInitializeComponents() is called server-side only either way
As far as I know, UUserWidgets won't tick and thus won't animate. And the result of that being that one has to use Slate.
That has been the case for the past years.
However, that is when using the MoviePlayer. That's why I'm asking what CommonLoadingScreen is doing
then the only way i guess is to make all the maps in just one level and load them using the portals
would that be the only way or you might have a better idea
as i have a really huge maps
or what is the approach that you might consider in this case
You're meaning during a level load?
Possibly WorldPartition, but I haven't used that with Multiplayer yet.
im already using worldpartiton but still can't figure out a way with it
Level streaming
They still paint and tick. The issue is that people do unspeakable horrors most of the time and don't async load enough which causes gamethread stalls, so no paint calls. Movieplayer just circumvents that by running the slate paint from another thread.
can't use it with world partition
Yeah MoviePlayer is horrible in general in that regard, cause it stalls the GameThread completely.
Or rather
yeah - so dont use world partition - use streamed levels for different areas. Its an alternative option (but has different pro's/con's)
It ticks it manually.., but it doesn't correctly progress
It's also crashy. At least in 4.27 it has some exceptionally hard to track down bugs related to it.
What you can't do for exmaple is manually trigger the MoviePlayer and have it be removed after some Steam CreateSession callback :D
Cause the Steam Thread is waiting
I will need to test the CommonLoadingScreen stuff with some animated UUserWidget and see if that actually works. would be nice
Current project I'm working on internally has 0 level loads, so will take a bit :P
+- the first one
the thing is i know a way to do it with level streaming but that would mean i have to load a 32k map which is really not performance friendly only if there is another way to load and unload chunks of the terrain that would work then
There is always a good chance that whatever you are trying to make in UE with its existing Level/Partition and Server architecture just won't work
another option is Voxel plugin - it handles this type of stuff (world chunks etc etc).
i will check that thanks a lot โค๏ธ
Hello guys , i'm making a top down arena game (battlerite-like moving with z q s d), i'm trying to find the best way to do client prediction with the launch of a slow paced fireball. For moving my character i use the charactermovementcomponent built in which comes with a verry good client prediction, but for my projectile i have 0 prediction so my fireball spawns far away from my character when i emulate bad network. i've heard about spawning a fireball localy and then syncing it with the server one but i can't imagine any good way to sync them smoothly since it's a slow projectile (i'm using gas)
It works well enough. And doesn't randomly crash at times due to careless threading. ๐ The main thing is just to build your level transition systems to run async and don't stall your gamethread with heavy functions and don't run heavy LoadSynchronous calls during initialization. AsyncMixin plugin has a lot of good tools that help with that too.
Does anyone know what might be a good super early virtual for playercontroller initialization where RPCs would be fine? I just need a place I can start bouncing RPCs to get and set some state.
Hello
do you lways have to set GetLifetimeReplicatedProps when replicating properties ?
in c++, yep
its half the reason you use c++ for multiplayer - to get the right control and conditions over the replication
okay ty
did you figure out if mesh pointers were replicated through path? if anyone else knows this, i would love to know too
i want to know if mesh pointers for static mesh/skeletal mesh have async load enabled for inbuilt replication like how data assets have async load ini settings
Not really sure about the whole, using Playerstate beginplay versus OnPostLogin.
So i would make an event dispatcher on the PlayerState class and call it in BeginPlay, and how would I subscribe to it on the GameState?
Ignore the dispatcher for a second. The idea here is that "Begin Play" will fire on the server or on a client when that playerstate starts existing. The playerstate is created by the playercontroller, which is created from the gamemode when a player joins the game. That means you can use that begin play event on the playerstate to know that someone joined the game without needing to send any RPCs or use any replicated variables.
The trouble with using BegIn Play of a PlayerState to signal changes to UI, is that it's hard for the playerstate to know about any existing UI, and really, it shouldn't be the responsibiilty of the playerstate to manage UI. So instead, you can have a dispatcher on some other actor, like the GameState or perhaps even the HUD class, that your UI can bind to in order to know that a PlayerState has become active, and you have your PlayerState call that dispatcher on BeginPlay. If you include a PlayerState input on the dispatcher, then you can easily pass through the reference to the PlayerState that is calling the dispatcher to know exactly which PlayerState is joining. Your bound event in your UI then can utilize the dispatcher to know that someone joined, and what their playerstate is.
OH so you create the dispatcher on the Gamestate, and call it from Playerstate, and then lastly binds to it on the UI BP.
I was thinking to bind to it via my HUD class, And let the HUD class do all the logic - But i can see why you would do it directly on the widget (less referencing)
No one could help out?
I don't think anyone really has an answer to that. I assume those are both Standalone instances. You will need to debug this yourself a bit.
alright then ill give it a try
And just like that... It magically works... A little bit of springle here, and a little bit here.. and boom...
Jesus you can really overcomplicate stuff, when you do not know all the build in stuff in UE
Now i'm just a tad curoius, when playing as a Listen Server, all dedicated Clients gets the expected result, however the Client/Server does not? I would expect the "Window" to still be a Client, thus recieving a Playerstate etc... Maybe It has....
UPDATE AS I'M WRITING..
If i Delay the inital Call to the dispatcher, from PlayerState it works as intended, but i am not keen of relying on that .5 sec delay ๐
Nah thats unreliable^^
Are you limited to BP only?
Theres a few hooks to look at if not
I've developed a multiplayer server outside of Unreal. I'm connecting to it through an unreal client, and I'm using it mainly as a renderer/interface, with the main game logic happening on the server. It's a normal MMO approach. I'm currently looking into how I can represent geometry on the server - any good ideas? I need to calculate line of sight and do different raycasts etc. I've seen older MMOs use chunked geodata, but I'd love to know if better approaches has been developed since then. Or does unreal have a way of exporting terrain data for a server setup like mine?
Why is it that when im destroying an actor. It only destroys it about 30-40% of the time
Destroy() happens on the server and the actor is set to be replicated
And I know that the Destroy() is being called every single time but it does the actual destroying only sometimes whenever it feels like doing it
The actor is used as a physics constraint
hello there
so is there a way to show and object or actor or landscapes for only one player not the others
lets say i have 2 island on the same level and i want to hide one of them from all the players and only show it when i teleport to it
and would only be visible to the guys who teleported there
here is a video shows what i mean
its maybe not the right way to do this and wont be performance friendly but im really stuck at this point
i can't use data layers in world partition to load and unload terrain same i can't only teleport one player to another level in the server or that's what i know until this moment
maybe there is a way that im not yet aware of
i would really love if someone join me in a voice chat and see my project and if there is a way and he can at least just guide me or show the way that would really be so helpful
and im willing to pay if its needed
i just really need help right now
Hi everyone, I have a quick question. I have a TArray containing USTRUCTS. If the TArray is Replicated and I modify a member in one of the structs, will the entire TArray replicate? Will the entire struct replicate? Or will only the modified member replicate?
Yes and no. I don't specifically remember if the whole stuct is sent again or just the delta property within the struct.
But as far as the array, only the array's size and the changed entries are sent.
To clarify with a somewhat strange example, say you have an array of 32 entries, and it's currently synced on the client and host. You delete the entire array on the client and have 0 entries. If you then change entry 17 on the host, you will get a replication of only index 17, and the array size. So when the replication happens the array will resize itself back to 32 with all default entries and a correct value in index 17 only. The rest won't be updated until the next time the server replicates as you've only sent the data for index 17 and the array size.
Okay thanks. Thats what I needed.
i just got another idea which is
to make the other levels as separate servers
and the player would teleport to them or join that server from the main map which should be the main server they join from the server screen in the main menu
idk if that makes sense but is that possible
ARK: Survival Evolved does this. Each map is a separate server instance on the same machine with a "cluster" name. Each cluster can communicate with each other, I assume via beacons or sockets. But they largely save the character data to a local drive where the server runs and then the player connects to the new host and is set back up via that savegame data.
but in UE, one loaded map equals one server
so to do a system like that you need some third party
You do not.
?
I just outlined how to do it. ARK is done in Unreal Engine 4.
i asked this question a few weeks ago and got this answer
Then I'm sorry that someone is not well informed and is answering questions they shouldn't be.
yes, but there is some backend that wasnt made by unreal ?
You are mostly correct. Each server is one map. You need multiple server instances for multiple maps. But they can still communicate with each other via beacons or net sockets
matchmaking systems like fortnite are proabaly not run on unreal but some API hosted outside of a unreal server
but thats intersting
If you're C++ capable, I'd check out beacons. I think there are some articles on them around Gears of War... 3? They're basically actors that allow RPCs without a full blown connection. Meaning the player doesn't have to travel to the same map to send and receive RPCs to the server.
thanks for the great info guys i will try to look on that
and if i end stuck i will just go hire a network pro to make it ๐
one last thing is there a way to show an object or a terrain to only one client or multiple clients but not for all
Hey does anybody know if there is a specific way to force a "spawn order" of sorts? For example if you have 4 Player Starts, could you have those spawns be used in a specific order. First player to join spawns at this one,second player to join spawns at that one, and so on and so forth.
which is great!
can't wait to use this
I did it for Red Solstice to replace some SteamSocket stuff. We have a hotjoin lobby where the player is in the same session but not the same map as the host. But when they're picking stuff, they need feedback about whether they can still join the game with their selections or not. So they need to request data from the server when changing their loadouts. We were using Steamsockets, but I swapped that over to Beacons. Client requests a beacon through the host's session address and on connect binds some delegates and starts making requests.
I think GOW3 or 4 did it for their matchmaking. Basically creating beacons for servers via found session info to find the best place to matchmake a player into.
Extend your PlayerStart class and add something like a priority integer or something to it.
Then override your game mode places where it finds the correct player start, and instead get a list of your custom ones and sort them via their priority. Maintain an array of the used ones and filter those out too before selection and add the selected one to the array. When you run out of points empty the array so it restarts.
Cheers mate!
does this mean i still can get the player to another map while still connected to the same server ?
AFAIK that will just break your networking if mishandled.
The thing is that you can't really be connected to a server, and have the full replication stuff going without being on the same map. At least if memory serves replication does not work with beacons. Maybe it does and I'm mistaken but from my personal knowledge replication doesn't work through beacons.
ARK does this by having multiple server instances running. You literally have multiple individual processes running on the same machine. Each of these are a session in themselves running on the same IP under different ports. When you join a map, you join a new session. When you travel from map to map, you disconnect from one server and join another.
You largely do the same thing with MMOs just that their systems are much more sophisticated and their game client is set up to mange it better. You exit one area and enter another and you're moved to a different server instance or process. Systems are in place to manage this by keeping your persistent data in their backend servers and to facilitate data transfer from server instances smoothly. ARK does this via SaveGame info. It saves to the server machine, which has other instances of the server running that can access the same data. The player disconnects from one server, and connects to another where that new second server can look up the data for that player from the savegame data and initialize their stuff correctly.
Beacons in this regard allow you to send messages to other servers you're not connected to. ARK doesn't do this but they could make a cluster wide chat for example if they wanted to. But they can use beacons to manage transfers between clusters more smoothly. Request access and mark a spot for a player so that no one joins in the middle of their transfer and steals the spot for instance.
lots of valuable info
i will try to run some test ask here and there and check the docs more and see what i will end up making
but as my game is already gonna be dedicated server based i might do as what ark did
and have the other dimensions as independent servers that would get created based on a player request when he interacts with the portal
and as he wont be there all the day i will see if there would be a way to make it timed by that i mean each dimension portal or lets say the server would run for like 12h then the game would send a request to close the server and i would force the player to teleport back to the main server/map before that happens if he was on that server
i think that wont be the best option but that will work and should be performance friendly as each map would be independent
any thoughts on that?
does that seem like a good idea?
Possibly could work. In theory your main hub map could act as a place to fix up the data if say a player logs off in a dimension. It would save their data and if they reconnect, would try to reconnect them back to their dimension session and map. Else it would leave them on the hub where you'd have to get their data saved from the dimension they disconnected from and you'd just fix it up and do whatever they normally do in the hub.
Then you can do whatever with dimension sessions without much hassle I think if you just handle gracefully saving associated player's data with it whenever killing the server so that you can fix them back up on the hub.
Then you just wouldn't really allow sessions from the dimensions to be shown on the server lists. You'd only show your hub servers. Dimensions servers would be managed internally in each hub it's connected do.
This said, I don't know what you need to do to spin up a new process, I've never done that one personally. Makes sense in theory though.
yep it kinda makes sense but would need more digging
anyways thanks a lot mate that helped a lot โค๏ธ
@orchid eagle - there are 1-2 mods that also enable multiple worlds on one server. I have no idea if they are any good/work/etc
https://www.unrealengine.com/marketplace/en-US/product/multiworld
that is really amazing
it would also work perfectly
the other worlds i can make them to be single player or self hosted
in case the players want to play with friends
i will give it another look and then consider what is the best for the project
thanks buddy 
That plugin doesnt support replication.
If it cant handle networking the separate worlds independently whats even the point?
299.99$ For something I can make in a couple of weeks is insane
$300 for something that LevelStreaming already does?
lol
I cant see any reason why it would be useful without networking/replication.
maybe I linked the wrong one
there is one that does multiplayer
I've seen it around before - let me see if I can find it
(no idea if it is actually good or not)
eh - my google skills fail me. or maybe it was this one all along.
But I agree with everything you said - I personally wouldnt use it either. I think there's other options. Plus, if your going down that path, it sounds like a complicated project, so there's that to consider for people relative to their skill
why is character jittering if connected to dedicated server?
void ATSLCharacterBase::MoveForward(float Value)
{
AddMovementInput(GetActorForwardVector(), Value * WalkSpeed);
}
i was thinking my animations are broken, but playing as standalone works fine ๐คทโโ๏ธ
legs are jittering when start move forward
checking these two options fixed the issue
Worth noting tho that this makes ur character movement entirely client auth so people can teleport hack if they want
dunno if ur game is the kind of thing where u care about that kinda thing, but just mentioning incase
i know about this stuff, now i am researching to find a permanent fix since CMC is a shit we all know this
i have costum cmc in my other project which is specially made for that project
will not support this one
You can just use Mover if ur on 5.4
i am on 4.27
ah then rip
๐ yeah
are u stuck on 4.27?
can't go up to 5 ever?
because an alternative to Mover is to just write ur Movement on NPP directly
5 got its own issues which ue4 doesn't have
and that will work in UE4
Like which? :)
In which regard? I actually found the opposite, big performance boost going into UE5 (so long as you turn off the new stuff like GI and VSM)
Ah I mean that's fair but i'd probably say it's not worth having plugins if you can't maintain them
can't you migrate them up to 5 yourself?
it will needs lots of code changing in the plugins and most of them are not open source, they are compiled for ue4
Ah ok fair enough
UE5 is barely different to UE4 on the GameFramework side of things to be honest
getting them will be easy, since this is all C++
:)
Hello guys, a question, how many clients can the unreal server support? the server that offers the native system?
That depends entirely on your game and how well it performs.
No body but you can answer that question.
i have an issue in my multiplayer project that when the host is running low FPS, important game logic triggered by anim notify events sometimes arent happening. Seemingly due to the event being skipped entirely because of low framerate? This issue has been resolved by replacing my Wait Gameplay Event nodes with simple Delay nodes, but that workaround is pretty undesirable IMO. Does anyone know of a way to make anim notifies more reliable, or a different workaround that isn't as wonky?
I've pushed it to some pretty ridiculous and absurd numbers
With heavy modification to the ue server most of the times
I dont doubt you can get some pretty high player counts. But I never spoke to that specifically.
C++ or bp?
Its also largely based on tradeoffs
Oh ye, I'm agreeing with you. Some people have projects that can hardly get 4 and some have projects that get 400
Yeah, which is my point, it really depends on your game.
Yup, I always recommend people start ground up doing their features for multiplayer and avoiding tick
Ive been prototyping in a blueprint class of a gameplay ability, but i also use c++
But the Wait Gameplay Event nodes i replaced were all bp
Multithreading and ASync might be something you should look into if your game is lagging a bit to the point events and such are skipping.
If you're already in cpp, it should not be to difficult to get it setup.
Unreal is really good at MT and most multiplayer titles make use of it given the optimization needs for networked games.
I guess the issue here would be that because the event im interested in is an anim notify living on the timeline of an anim montage, in low FPS settings that event simply never gets triggered, so why would a separate thread here help?
Or do you think that the issue is that the main gameplay thread is overloaded in a low fps setting and thus isnt receiving the event or something?
1st option: optimize a little and see if you can get it running at a stable FPS on a potato PC, offload some game events and such to runnable threads.
2nd option is to fake it: if you know how long the animation will take to reach the notiff and anim is a separate thread; have a game time check that gets Now()+time from start of anim until the notiff is supposed to occur and do once fire the event if the time is at or over the now()+time
And check on your heartbeat
Or tick if you do not have heartbeat(highly rec using heartbeat logic)
For option 1, the game runs pretty smooth, im just trying to think of more stable code. I imagine even in relatively normal framerate performance situations, the chances of missing an anim notify are not 0, and that doesnt sit well with me.
Option two seems pretty similar to what the Delay node workaround im doing right now, but its incredibly wonky. Having to know all of your animation timing ahead of time in the code just sucks and makes your code a lot less flexible
So im hoping theres some other way
Multiplayer is usually filled with little trucks to get things working. The trick of option two is that you can use it without a delay structure and just a check with world game time.
One option is to also find a way to determine when to run that event independent of the animation, no need to know the timing of the animation but will require a little eyeballing the event sync to get it right
I guess there could be a data driven approach here by coupling some sort of animation timing asset with each animation montage, effectively making your own anim notify system. But itโs kind of crazy to me that unreals anim notify would be this unreliable, maybe im missing something?
That's a solution and animation is not my strongest point so I wouldn't know if there's a better solution related to anim tools; animation chat might know!
In an example event I have an animation for multiplayer game that's an attack sword swing; my separate thread looper will be passed an int and data of how many loops it will have count before it starts an event that records box positions and draws a hit pattern in and between the boxes to calculate a hit.
Passing in a 12 means I want the event to fire after .2 seconds into the animation network wise regardless of where the play animation is.
And why did you implement it this way, rather than having the timing be driven by an animation asset? Did you run into a similar issue?
More I had a feel that rendering and animation thread could and would run behind the game thread/could dump/skip frames
I must sleep now but ill get back to you. Thereโs probably more than one way to have the animation drive events and i should look into it more
Yes, there is definitely something I'm sure other devs know of or an extension exists since there is no "my way or highway" when it comes to development thankfully
Like animation chat has some geniuses in it that have saved my ass
Those devils
I've seen magic pop out of that chat lol
Funnily enough that example of multiplayer sword swing and timing collision logic is literally my exact same scenario haha
Btw i use DidItHit plugin, is pretty nice
Nice! I just saw how fromsoft did theirs when they showed some debug gameplay and tried to recreate it a bit
is there a way to lessen the time it takes for NetRelevancy to take effect? Once my actor isnt net relevant for a client it takes 2 or 3 seconds to stop replicating
This is by design.
There is a grace period before it stops replicating, incase it comes back into relevancy within that period. Its so if you as the Player are on the edge of Relevancy Distance for that Actor, it doesnt constantly try to Open/Close its Actor Channel over and over and over again.
You do not want to change this behavior.
I shouldnt even shorten the delay? i think its too long for what im trying to do
I would be surprised if its able to be changed without actually modifying the Engine.
hm. well thank you appreciate it
@heady python I did change that in a moba game a few months ago. It needs engine changes, yes.
There is a global variable you can adjust. I think via ini file. But the lowest you can go is 1 or 1.5 seconds or so. Setting it to 0 breaks stuff, cause there is more going in the background.
oh, i think youve already done what im trying to do, not replicate stuff thats in the fog of war. thanks for the guidance!
Anyone using AWS Gamelift for hosting server?
Is anyone aware of a virtual that runs on clients after both the Player's Controller and GameState are valid? Kind of looking for something like the PlayerController's Beginplay, but also something that isn't reliant on ReadyToStartMatch being true. Can make it myself with a couple of events but wondering if there's something native I'm missing.
Yeah. :/ Was hopeful, but I just made my own.
Is there any reason that a ClientRPC would not run on a listenserver owned playercontroller? O.o
They run just fine for me ๐ฎ
Hmm.. This is a bit baffling. Maybe it's somehow too early, but I don't understand how that's the case on the same machine.
Yet when debugging... If I run in Listenserver with 3 instances, 1 server 2 client.
I get three breaks for the ClientRPC call on the server. Once for Controller0 and once for Controller1, once for Controller2.
I get two breaks in the ClientRPC function, which is for the two client controllers.
try adding the global check as part of the break to confirm which machine is actually been caught
I can see which machine it is through their playerstate's player names. Both of the running controllers have a remote role of authority. That doesn't change the fact that it's a reliable client RPC ran on three controllers, with only two calls making it through.
Any logging saying anything useful?
Seems ur not alone
Bit special case but still
Apparently it won't run if ran too soon. I just hacked it up with a timer for next tick and I'm getting 3 breaks in the function now. :/
where were you calling it? before begin play or later?
When passing, let's say, my Playerstate through an Event dispatcher. Can't i access selfmade variables i have made on that PlayerState, where i bind and event to the Event dispatcher?
Update:
Nevermind.... I just need to think, and pass a reference of the right type, and not just the generic PlayerState:D
probably because controller swap hasn't happened yet
controllers are constructed predictively and then swapped via a control channel message iirc
it's like the only class that does this in the engine, so probably it can't route the RPC
I'm not seeing anything about the swap code except for seamless travel? Where is that used outside of that?
Whoops, wrong mention.
But no, I was trying it on PostInitComponents. Trying not to rely on beginplay.
try PostRegisterAllComponents
PostInitComponents is basically straight after the constructor
iirc
definitely do GetWorld()->IsPlayWorld() if you do that tho, that function also runs in editor
Or infact it might be more appropriate in this case to override OnActorChannelOpened
Allows for a specific response from the actor when the actor channel is opened (client side)
Oh, I overlooked that. That one looks promising. ๐
Except that it only runs on clients and not the listenserver. Erg.
rip lol
like which?
What would be a good approach to let 2 players control a single character? I want to do something like a player "possessing" another player's character and messing with the possessed player's movement
Does someone know if I have non UPROPERTY members in a replicated USTRUCT if those take space in the transmitted data but with default value or if they are not part of the replicated data at all?
e.g. does it make sense to make a new, smaller struct only containing the replicated UPROPERTY?
no, they take no space as they are not part of the transmitted packet
Ok thanks!
By default itโs the reflected stuff, you can either mark it as NotReplicated or override the NetSerialize stuff with struct traits
To have more control like bit packing
Hey all. I have a dedicated server set up for a Lyra based game, however, even after setting MaxNetTickRate=60 within of DefaultEngine.ini โ[/Script/OnlineSubsystemUtils.IpNetDriver] based on https://forums.unrealengine.com/t/max-server-and-client-tick-rate-in-defaultengine-ini-cant-be-more-than-30/1228138/10
I am still getting the damn server rate of 30 (sometimes it even dips lower than 30) for server ping, and it's causing noticable gameplay issues on high framerates.
Thanks a lot, i didnโt know about the log thing, it is helping me to solve another issue where the game crashes when compiled on windows but now i know from where the trouble is coming (and i also feel like a hacker ๐ ). However, the first โtickโ i can find is before the game is opened on a session, it says : Bringing world โbla bla blaโ (max ...
NetServerMaxTickRate <--- is this what I am missing mayhaps? About to try lol
did โLanServerMaxTickRate=60โ to the ini work? are you testing locally?
@coral badger not locally, hosted on remote baremetal.
-NetServerMaxTickRate=60 tried adding this via bat file / startup option, rather than compile into DefaultEngine.ini, just for testing until I figure this out -- No effect
gonna compile it in and see if it works that way...it should.
If you say it dips lower than 30, maybe your performance is just bad?
Shouldn't be, it's hosted on a monster, and is pretty well optimized (clients can hit 100+FPS on lower end hardware, like GTX 1080 + ryzen 3500)
Netcode is default Lyra, so unless that's trash, should be fine.
I had a post while back where I had noticeable ping (100+ms) by default whenever I ran literally any UE5 project dedicated or listen mode in standalone. I'm interested in how it goes for you.
When connecting to a host in a closer region, I ping 50-60 last I tested (can test again in ~30 mins) -- Currently testing against a server hosted farther away (eu vs na) and pinging about 120. Will tag you later when I figure out the tickrate issue, and let you know final pings too (not likely to be too related, but I'll pass on the info anyway!)
That makes sense at least.
Yep, pretty standard pings so far from my observation -- just having serious tickrate related issues.
Why does my "Create" button create a session for both players instead of only the one who pressed the create button so I can later join him with the other player window ? I'm in "listen server", 2 players, Standalone Game.
for anyone else having the same issue, the fix is to add .1 cubic interpolation to your blend space.
- |
GetCharacterMovement()->bUseSeparateBrakingFriction = true;
doing this two things fixed the jittering problems everywhere +now animations got very smooth and beauty effects
Here are the logs, when I click create it definitly created a session as the logs suggest. (The last message is because I pressed the Create button again)
CreateSession is not the same as being connected to each other
If you select "ListenServer" and "2 Players" you start the game already connected.
Is that possible Send UObject Client to Server? (Not Replicated)
If it's not possible, Do I have to convert UObject to UStruct and send RPC?
You want to ensure that you use the Play As Standalone (not the same thing as selecting Standalone for the actualy game process).
Runtime created UObjects would need to be properly replicated to do that.
Other forms of UObjects, that are known to both sides upfront and are stabely named, such as any kind of Asset, would work fine.
If you need to send runtime ones and you don't want to set up replication, then yes, a Struct is needed.
Thank you. I thought It's possible using serialization
I think I misunderstood something
I mean, you could serialize the data into a byte array and send that
But then you are sending a byte array and not a UObject :P so technically I'm still right with what I said before
Oh, that's right. Thank you I'm now fully understand
struggling a little trying to get widget text to update on the client. the server handles the calculation, how would I then pass the info to the client to alter the values of their Widget? between possibly passing it to the pawn, the player state or even the game state and any combination thereof I feel a bit confused.
What text is the widget meant to display? How does it relate to your gameplay classes?
literally nothing more than a number change
I am trying to add damage to players in my multiplayer game, but the damage is just not showing on the clients or the server. What do I do to replicate the damage? Here is my current code.
character cpp: https://dpaste.org/ysXoA
character h: https://dpaste.org/afATA
projectile cpp: https://dpaste.org/nS1Zq
projectile h: https://dpaste.org/WT3aP
Generally speaking your number should just be placed into a replicated property. Then you make that property OnRep, which gives you a function that'll run when it changes on the client and that gameplay class has a delegate it sends out which client's local UI can listen to.
That said you can also just make it normally replicated, and tick the widget's display too for quick testing.
I think a lot of people just multicast the damage done to display floating health numbers. Unless you are meaning some other damage display?
I already have a widget to show health if that's what you mean by other damage display.
Sorry, I just want to clarify, are you trying to update a healthbar or show floating damage numbers?
a health bar
I already made the function to do it called UpdateHUDHealth in the character class, but the problem is the ReceiveDamage function is not working. I already tried to print a string when I was supposed to take damage, but the string never printed
Do you get breaks in the OnHit of the fireball?
And it makes it down to ApplyDamage through those if statements?
Actually I think the OwnerCharacter is null so it doesn't go through the if statement
the first one*
I initialized the OwnerCharacter again, but it is still null
ACharacter* OwnerCharacter = Cast<ACharacter>(GetOwner());
if (OwnerCharacter) {
AController* OwnerController = OwnerCharacter->Controller;
if (OwnerController) {
UGameplayStatics::ApplyDamage(OtherActor, Damage, OwnerController, this, UDamageType::StaticClass());
}
else {
UKismetSystemLibrary::PrintString(this, "OwnerController");
}
}
else {
OwnerCharacter = Cast<ACharacter>(GetOwner());
UKismetSystemLibrary::PrintString(this, "OwnerChar");
}
Super::OnHit(HitComponent, OtherActor, OtherComp, NormalImpulse, Hit);
UKismetSystemLibrary::PrintString(this, OtherActor->GetName());
}
Do I need to do any port forwarding when using Advanced Sessions on steam? I've gotten to the point where I can "Join Game" via the friends list, but the Join Session node fails.
Ive made the variable on rep notify, though im not sure why i want it to fire when the client changes? Does the onrep notify need code in its function?
The notify would normally contain a delegate/event dispatcher. You widget would get the thing with the delegate and bind a function to it.
This causes the widget to run it's update when the server replicates that variable to the client.
So in total. The server does stuff, sets that property. Along comes replication and sends it to the client. If the value has changed from what the client has, it'll run the OnRep which causes the delegate to run, which causes the bound widget to update.
When using steam how can I get client remote ip? (from server or from client)
Usually you shouldn't need their IP. What are you requiring it for?
EOS voice chat requires the client ip in order to generate token for the closet client room
That feels strange. Why doesn't it just work through the normal voice chat system like every other platform? O.o
does the dispatcher need to be replicated or on rep notify?
No, you can't replicate dispatchers. They're local to the machine. Only the number property needs to be replicated.
"The player IP address is optional, however for the best user experience, we recommend including this data. This is because a server close to a player's location has low network latency during the voice session.
@hollow bridge From what I'm reading, it's optional. That said, I'm 99% sure you can't grab the IP address from Steam itself, whether server or client. You could have the client make a call to an external REST API through VaREST or something to retrieve their public IP if you really wanted the IP address.
yes that's probably what I'm going to do
Sorry, do I also need a replication condition for the variable? Thanks for all the responses, I'm sure I'll get it eventually
You're running this in blueprint?
And what class is the property in? Character, GameState, etc?
blueprint class is in game mode
That will be part of your issue. You need to move the property to the GameState. GameMode does not exist on clients and therefor cannot replicate anything.
so the number variable needing replication needs to be created in the game state?
or just pass through it
Correct. You can only replicate properties through a replicated actor. The GameMode is not replicated.
This is what your stuff in GameState should look like.
Then you can bind that in your widget as so.
Helloooo,
I'm currently facing an issue in a multiplayer setup where the server does not recognize the client's character selection. Specifically, the client joins the session after the server/host and selects a character, but the server seems to override or fail to recognize this choice and incorrectly reflects a default or its own selection on the client's character even though I have set the rep notifies on updating the character materials and mesh. This problem persists across sessions and seems to be related to the order in which the server and clients join and initialize.
Has anyone encountered a similar issue or have insights on why the server might not be recognising the client's character choice? Any tips on how to ensure that the server correctly handles and replicates the client's selection when they join after the server?
Thank you in advance for your help!
Here you can see the implemented code snippets
Replication is one way, server to clients, and the game instance only exists on the instance of the game where the code is running (Eg. server has its own game instance, and each client has their own), so grabbing the game instance and setting a rep notify variable would only technically work on the server and not for clients.
If you want your client to tell the server their choices, you'd send a "Run on Server" RPC with those particular choices. When running on the server, you'd then set a replicated variable w/ notify in something that can store that value permanently so you don't have to continually send the RPC from the client. I'd recommend creating a structure that contains both the outfit and the gender so that you don't run into race conditions if you require both parts of these to properly set someone up.
When the character "Begins Play" it can read that PlayerState structure to then set up the visuals on the character.
When the OnRep of the structure happens on the PlayerState, you can have it call to the pawn of the playerstate, and if it is valid, again, set up the visuals on the character.
Ill check this and let you know. THANKS!
@woeful jacinth looks like selecting a Montage Tick Type of Branching Point instead of Queued seems to do the trick. this option is available on the instance of anim notify
In multiplayer would you generally put game functions and operations in the game mode or game state?
Depends, that's tricky
I like to use game state to hold state and game mode to modify that state (and others) but it's up to you
ive put my games operations in the game mode. im finding im having troubles pulling information from it to pass around
Gamemode is private to the server only, gamestate is replicated
Playerstate* Winner belongs on gamestate
yeah so i feel have to move everything from my game mode to game state
I think I have a solution and understand my mistake. thanks for the responses
Nice! Glad that there was smoother option!
from my expereince, anytime a join or host session fails, 95% of the time it's because there's already a session active that needs to be destroyed
Oh. All clients make their own session on startup. So you're saying I need to close the client's own session before joining someone else?
well it should never fail on the first join
unless you tried to join multiple times in quick succession
Hmm. Unless both my events are firing, then... Well, I should definitely check that. And the multiple sessions thing is a really good lead. Thanks! That helps a lot!
Also invite received is pretty useless if you're using steam
My theory was that steam triggers one, epic triggers the other. But I haven't gotten around to verifying that yet.
I'm pretty sure it's there for other services like EOS
Advanced Sessions is no longer Strictly limited to Steam, so some of functionality doesn't work for / wasn't intended for steam
The idea is to support both. Hopefully that won't be too problematic in terms of builds and configs.
correct, but that means that some things will require additional knowledge and needs to be further implemented yourself
I gotta say, I'm surprised I actually needed a third party plugin for this to be anywhere in the vicinity of painless.
I believe that is the case for Invite Recieved
Will be interesting to see if I'll need to dust off visual studio or not. I'm having fun with the visual nature of blueprints.
Is there a 'best practice' for the local prediction of asset creation to be linked after replication?
i.e. Client throws an item on the floor from inventory. Locally I can show it instantly with a local client actor spawned. Meanwhile Client send RPC to server, server 'actually' creates item on floor, deducts from inventory etc. Server then replicates that new item actor to all clients so they see it.
For the original client, how does it know the new actor been replicated "back" is the one it has already created? Do I need to suggest a 'name' to the server in advance, so that it uses the same stable name, and thus the actor is replication linked in advance to be the same object?
I cant just skip replicating the new actor back to the client because whilst the original client wont have a duplicate, the item on the client wont actually be the replicated linked item?
The other option I thought of is I add a prediction key to the actor been spawned locally, and include the key on the Client RPC to server. Then server includes the prediction key in the actor been replicated, So when server replices to all clients, the original client can see "hey, there is a new actor with same key as the local one I have, ok I'll delete local one and just use the server one now"?
In my opinion and in games Iโve seen, clients donโt predict actor spawn. At least not the exact same actor. An โimpostorโ can be used for visuals
The server-spawned actor can probably look up the impostor once itโs replicated and destroy it
and as a safety set a lifetime on the impostor just in case the real doesnโt get replicated
if the real doesnt get replicated, i.e. the server decides to not accept the client RPC, it can RPC the client to advise, so the client can destroy the imposter. Although a lifetime backup makes sense as well.
I do know for some things people suggest just do local client for an effect/montage to make it 'feel' instant, and I will do that as well for most things. There are just 1-2 things I need something to basically appear instantly...
But surely there is a way with c++ to spawn an actor that is then spawned on the server and "linked"? Something about "stable names"? Which I know is for static assets, but if you passed a name with the RPC, then the server could use that name, so the client knows its the same in advance?
@woven basin From memory, UT would use the position of the Actor as a means to find its "master".
I donโt know of anything out of the box. But I think you just need a unique ID that the client sends to the server. gameplay abilityโs prediction key could work IF you use WaitNetSync before spawning on server to guarantee the prediction key is there
then when the server spawns the actor, attach the prediction key to it
When a Projectile that was predicted would be spawned via Replication, it would find its predicted representation by find the closest in location to it.
Alternatively, you can just generate a GUID, which the Client sends to the Server, that the Server then applies to the replicated Actor
So when its replicated, it can link to the predicted representation
really? location?
That seems... subject to risk? If the client is saying "hey, make me X", then just use a unique identifier?
Yeah, pretty odd solution I know.
Might have been first iteration ๐คท
UT was never finished
Its also very old
lol
I'll go look how it does that, cause I could swap out that check for location to just use a GUID there as 'the check' instead
thanks
I'm probably missing something stupid. I have capsule component set up for collision. So I've bound OnComponentBeginOverlap for that component.
When my player character begins overlapping, OnComponentBeginOverlap is called on both the server and my client.
When my AI character (same class) begins overlapping, OnComponentBeginOverlap is only called on the client. Not on the server.
Any idea what I'm missing?
Is this capsule attached to the root and doesnโt get affected by animation?
Yeah
Where was the binding done?
Binding was done in the C++ constructor
Oh then how to properly do what I want to do ?
In my game state I have an array of references to 'BP Team Managers' this array is set to replicated
Each Team manager itself is also set to replicated
When one or more teams already exist on the server, and a new client joins the team managers are replicated to them, but the list in game state has empty references
In the team manager begin play (when local) I did add a temp solution of 'delay -> add to list if not in there' but I'd rather have a more permanent fix.
All done in blueprints
Start with 2 players as standalone (not as listen server or client). Have one create the session. Have the other attempt to join.
tried still doesn't work
NVM fixed it
Begin Play is only called after replication is complete, however rather than using Begin Play of the Team Managers, use Begin Play on the Game state, and reconstruct the array on the client ended up working for me (using the Get all actors of Class function )
For some reason, the engine keeps opening the main menu level even when I selected my game level in the editor ๐ค why is that ?
fixed the issue
Now I need to know how to make my player connect to the host without having to set up a full sever browser system. I just want to type 127.0.0.1 in the IP box then use that to connect. But I can't find anything related to IP in "Join Session Advanced" node to do that ๐ค
Got it ๐
Sessions are supposed to take care of that. You don't want players to have to use IP addresses anymore as that usually also means you'd need to have server hosts configure their network to port forward properly, or for players to even know what their external IP address is, which most won't.
One solution would be to use a "Room ID" system which you generate a room ID to insert into the session data when you create the session. A joining player can input the ID and clicks join, which then you'd use the same search for sessions but then filters the session list returned based on that ID, and joins the session with the matching room ID.
I know but as I don't want to create a whole setup with the server list and stuff, I just wanted something to test quickly some stuff as this project is my "Playground" project where I only do tests in it. As I need to find the reason of why I have an issue on the other project for 3 weeks now, so I need to reproduce the same setup as that project in this one ๐
What I just explained shouldn't require a sever list.
I'm guessing you're using Steam, in which case, if you're using the test app ID, then it should be no more difficult than having the first instance create the session and start as a listen server, and having the "client" search for all sessions and just join the first one it finds.
If testing on the same machine, open 127.0.0.1
yeah that's what I did, thanks ๐
So I don't need to go throug the main menu all the time ?
You'd just need some way of triggering the required logic.
I'm not sure to understand ๐ค
If what you're wanting to do is join a session, you need some way to trigger the logic to join a session. It doesn't have to be on the main menu, but you'd need the logic to join the session somewhere.
Here's an example, the top part is starting the test session and launching a listen server, the bottom is joining that test session. How I decide to trigger these can be a button press on the player controller or a button on a widget that I add to the screen, it can literally be any event you want.
If you're testing locally, then using the "open 127.0.0.1" console command is probably easier, but it's not really "joining the session" the same way as what a client would likely do in a launched game, so it may not be an accurate test for what you're trying to troubleshoot.
Alright I did that, thank you so much ๐
I keep getting an error in my PC_MainMenu saying that my widget is "None" so it can't add it to the viewport but the widget is shown without any problem so I'm kinda confused ๐ค
If you're launching as dedicated server (playing as client) the server can't create widgets, so the return value is always null.
so what's the proper way of doing that ? ๐ค
Seeing as this is your "Main Menu" controller, you probably shouldn't be launching as clients as that means the dedicated server in the background will also be launching on your "main menu" level.
Launch as standalone. Have one of your windows start the session/listen server, then have the other join it.
If for some reason you still want to launch a dedicated server (Play as client), then you shouldn't be creating widgets on it to prevent the errors, which means not using the Begin Play of the player controller to create the widgets without some checks to ensure the dedicated server isn't creating them.
Hi,
How worthwhile is it to make linux dedicated servers these days? How's the performance and hosting cost comparison?
Thx
Depends on where you host and how much your game needs. Usually no one here will be able to answer this