#multiplayer
1 messages ยท Page 131 of 1
Playerstates BeginPlay could be the spot to do it.
I dont see why not but something tethered to player character like health. I would dump that in player state
I am trying to do it that way... I am currently binding the OnPawnSet event in the begin play and when the player is possessed... I am calling a server method to call the multicast method in the game state which can replicate the data to all the clients
That sounds way more complicated than it needs to be. What exactly is the problem you have right now?
If you just want to update the UI when a player joins, just update UI on the begin play of player state.
No need for any run-on server events or multicast or any of that stuff
One problem you might have is that certain other actors aren't well formed at that time, like maybe the player state is there but the pawn isn't. But that's a different matter
There isnt many instance where multicast should be used.
A dev even said he went as far as shipping the game w.o a single multicast rpc
That sounds silly. Use a multicast if it fits the criteria
Yes, use multicast for transient events, rely on replication for stateful stuff. Mostly anyway.
He said it creates problem most of the time. Even spaghetti cant fix it
Sounds like they used it incorrectly then
Edge case usage of multicast is probably like chat massages
Where u dont care about late joiners
I would certainly multicast a grenade explosion.
The game flow:
The Controller is spawned by the game mode with a spectator pawn...
The controller spawns the Team Choosing widget where it triggers an interface from the HUD class.
On Button click, the Controller spawns the pawn and possess it...
The Overhead widget updates like in the picture:
The new player joins and the widget updates for them as well...
The problem is that the overhead widget wont update for the other players on the client and only the server can see that
atm the thing is working for me because I am doing it from the game state... but I dont feel this is the correct way to do it
Maybe but i get where he is coming from because late joiners and relevancy add complication.
But then maybe i dont know any better
Since the pawn is spawned much later, the player state is already spawned by than
Show your code for when and how the problem widget is updating
Update UI on begin play of the pawn then too
So it sounds like he was using RPCs for stateful stuff. So no wonder they incorrectly attribute the problem to multicast.
Are you saying that the terrorist/counter terrorist widget isn't updating?
exactly
the game state:
the game mode:
Where does that data live, in the player state or in the pawn?
its in the player state
the player:
Then it should update on repnotify of the variable AND on begin play of the pawn
Possibly on possession too
but if I were to get the player state from the controller, how will I get it since the Possess is called later
Update on possess as well.
@quasi tideno I haven't yet. Was focusing on something else meanwhile. I checked everything, it should be fine in principle. In practice it doesn't work though. Before I start digging into the source code, maybe you/someone else know the answer.
It's definitely weird. Double check for that one setting I mentioned. It only happens with listen server setups if I recall correctly.
It's like bTickSkeletalAnimationOnClient or something like that
@quasi tideI believe it is this which you are referring to:
/** True if calling TickPose() from Autonomous networking updates. See ACharacter. */
UPROPERTY(Transient)
uint8 bIsAutonomousTickPose : 1;
Need to check how it is used. On the other hand it refers to ACharacter, so it may not apply to APawn.
It might not, but Epic be Epic. So who knows if it could have some weird side effect
But the character class could also be switching that in its class.
But I've seen this kind of issue be solved because of this. But most people use Character, so it might not be the same.
ABP not ticking on client though, is what leads me to this.
That's what I would need to check
Hello !!
Im working on a project with UE5.3 and I have concerns about replication.
My game mode store a information I will need in the PC. (TSubClassOf<>)
So my flow is :
- Set it in the game mode blueprint
- in AGameMode::InitGameState, I set the member store in the game state, this one is written as replicated, since I want it available on client's PC.
- I want to use is in APlayerController::PostInitializerComponent, but my GameState is still nullptr, so I want to use in BeginPlay for example, and so it's working.
My concerns is : Ok, I test it on me pc it's working, but, can I be sure at 100% that a replicated member set in AGameMode::InitGameState() with be replicated on client Game State before the call of APlayerController::beginPlay ?
Thanks by advances !
Did some modifications to my project, now all the AnimBP's are ticking also on the client side but no update to the animation on clients. Still missing something to make it work...
are pawns easy to replicate? i cannot see them on screen at the moment (fully custom pawn)
The root of my pawn is a skeletal mesh and I can see it properly on both server and client, struggling to replicate the animations at the moment
@green delta but in general it works
R u playing on stand alone?
But they cant see each other?
Speaking of cameras, how do you guys tackle camera looking at 0,0,0 before possesing a pawn?
Its more evident when lag is higher
I planned to just keep showing the loading screen until a player posses a pawn but would like to know alternative ways
when learning about multiplayer/replication, at what point do i need to consider whether im gonna use eos or steam?
Chosing which platform to use have nothing to do with your learning?
I just realized here after some debugging that my client has the role of authority when im checking it like this, anyone has any idea how that occurs? Its a component attached to a player client. The listenserver has role authority AND role simulatedproxy, and the client has role authority, im a bit confused how this can occur at the moment, would appreciate any help.
Its 2 characters derived from ACharacter and spawned in the world with the playerstart
Im debugging in the editor with 2 clients open, and 1 is the listenserver
@opal fox Maybe you know that and so my answer is not the good one, but you still have 3 PlayerController leaving in the server side, and they all will have the authority! 2 other PC are leaving in local,instance, one in the client instance 1 and one in the client instance 2. and these two will not have authority ! I'm not 100% sure of this, and so you should wait for other people to answer you !
That's mostly involved in all the stuff BUT the gameplay
It depends on the game really, if it's just a server that people join then it's fairly simple. If you want to have parties etc then it's a bit more complicated.
@sullen fern thanks yeah i guess the controllers should have authority, but i thought im checking the PlayerCharacter Actor, which i thuoght didnt have authority if its just a client connecting to the server
when i check authority on listenserver it says simualtedproxy and authority which makes sense, but i would expect other client to say simulatedproxy
Hi, basic question, in a tower defense of sorts game where each player place their own towers, do I need to replicate the bullets that are being shot by the towers, or just calling a RPC with the action of placing a tower is enough?
Depends
If you make the game deterministic enough you can avoid that but it all depends on how you do things
There's a middle ground, you can replicate the act of firing. Basically a multicast with the tower and the target
"Hey everyone, Tower 23 shot at Enemy 854"
in my specific case the "bullets" kind of travel along a path, then hit a target when they reach its end.
or other "bullets" from the enemy player.
Can they miss? I mean, are they aimed or always hit the target like WoW?
You want to replicate the minimum amount of data required to end up with the same result on everyones machines
no, they are shot in a direction, if they encounter other bullets they sort of cancel each other out
It should be enough to just replicate "Tower 32 just shot in yaw 239"
but you'll have to make sure your timing is tight so the end results are predictable
right, thing is, what if some random slow happens and the bullets slow down
You'll have to replicate that too
How many bullets in flight at any given time do you think?
100+?
yeh easily
yeah it's gonna be hard to get it all synced up well
but the bullets will never accumulate
meaning, they will always die against something
I would start by just replicating each shot and go from there
What are the players pawns, characters? Are they predicted or no?
players are like, not really players, its more like a chess game of sorts
so 2 players without characters or anything
ingame at least
that's good, you shouldn't need any prediction
Basically, whatever happens on the server is what the client sees, just delayed in time by their ping
yeh
so you are saying that in the eventuality I have 10k "bullets" I shouldnt be too worried about it since I shouldnt need to replicate them
only the initial trigger actions
Yeah it all depends on how/when they are spawned but just replicating each shot should be good enough
thats good to hear
you shouldn't have to replicate the movement after the shot as that should all be deterministic
are you sure about that
I mean it depends on how complex your mechanics get and whether or not stuff can bounce etc
I had a version of this game working with a different engine before and I had terrible desyncs problems
nothing like bouncing or anything
The clients view of the world should be cosmetic only anyway, so even if a bullet barely misses on their screen but hits on the server, it should still kill the thing it hit
That should be rare though, if it happens at all
so the action of a bullet damaging something should be replicated
not every tick of movement, for example
Yeah the data from server to client about 1 bullet should be something like:
Bullet spawned at x location going in y direction
OK it hit Dude32
I'd start by just replicating the spawning and see how it behaves
you'll want to make sure your math is right for your projectile system
right
the initial position of the bullet should be random (in a specific range), Im guessing that gets replicated to the clients
makes sense
start with zero randomness and just the timing of shots and see how it lines up on both screens, then proceed
you probably don't want bullets as actors if you're gonna have 10k of them
yeah no, wont use actors, the towers probably will be though
I've had good luck with a subsystem and projectiles as structs doing line traces but for projectile/projectile hits you'll have to have sphere colliders probably
in my very specific case I wont use collisions like that, it will be like.. emm.. tile based of sorts.
very cheap
so basically if a bullet occupies a tile, it will check if enemy bullets exist there too, in that case "fight"
something like that
but that comes after, first I will test basic MP functionality I guess
thanks for the help
oh yeah that'd be easy
Anyone got a clue for why multicast RPCs aren't recorded in replays in 5.3, when recorded in a (non-networked) standalone game?
Hey folks, I am looking to implement the network for my game based on Rocket League (Its Rocket Science GDC talk).
Just like rocket league, I have 6 boxes(players) and the ball. That enables me to send all my physics world state into one packet.
The idea is for both the server and the client to send the full world state into one packet, e.g. {FrameId = 1, SimulationTime = 0.2, StepTime = 0.2, Bodies[] = {position, velocity, ...}}.
I am new in Unreal, so its not clear for me how I would achieve that.
I am thinking that I need to have one Actor that owns all the custom physics state for all objects, then send RPC from this actor after each simulation frame together with the frame id.
Doesnt feel like I should be using replicated properties for this at all, but I am not sure.
I am also afraid of fighting the engine too much with this approach.
Hopefully someone here can help me get into the right train of thought.
Thank you.
Have you watched the Rocket League netcode talk?
yes
You probably want a subsystem with an actor to network through or just an actor really
If it's all custom physics it won't be too insanely complicated. If you're trying to get the engine's physics to play nice with predicted multiplayer movement then it'll be a doozy
How are you planning to handle prediction?
yes, I am okay with writting my own physics and simplifying a lot. I am considering integrating bullet just like rocket league.
for prediction, also like rocket league. Both client and server runs the simulation, both snapshot the world state each simulation frame, the clients record and send the input for each simulation frame, then the server issues corrections, by using rollback/replay.
my dedicated server is stuck on this message:
[2023.11.20-17.13.58:101][ 49]LogOnlineSession: Display: OSS: Session creation completed. Automatic start is turned on, starting session now.
My packaging process is being blocked by OwningObject not appearing in my fast array
From what I can tell, this is what is causing it
#if WITH_PUSH_MODEL
// Object that is replicating this fast array
UObject* OwningObject;
// Property index of this array in the owning object's replication layout
int32 RepIndex;
#endif // WITH_PUSH_MODEL
How can I define WITH_PUSH_MODEL to allow it to go through packaging?
Never mind, I'll do a small refactor to add an additional object ref
Just a humble question. Does anyone know or have experience how lyra (more specifically inventory system) will perform in a MMO game? I am thinking about building on top of it as it has already so many features built in that I could use but I am not sure about all the details as I am not deep dived on it yet.
it is possible for it to work, but its a very advanced setup to run EOS on a dedicated server and get everything flowing smoothly
Good to know!๐๐ฝ
In most tutorial code, including Tom Looman's stuff, it seems like people just handle their server code with their client code by just checking HasAuthority. Is this the best way to do it? Or in the real world do people actually split their server and client code so that on the server, you're only running code where you can assume HasAuthority == true?
Both, you might be overthinking it a little
Has authority is great for situations where client and server need to fire the same event, but there's no reason to create a whole new event dedicated to server or client
An example I can give is a multicast event always fires on server and clients, but sometimes you don't want the following logic to fire on the server, there's no way to avoid it other then to check for authority
TL;DR it's totally fine and acceptable to split your code using has authority checks. It's a super common thing
In CPP it's theoretically also possible, not sure how common, to complete kick out code that runs on server only, by wrapping it into WITH_SERVER so it isn't included in Client builds
Different use case though than the HasAuthority check
I see, okay fair enough. Yeah I was probably overthinking it. I guess in the context of UE5 there's no point in having someone be a "server engineer" vs "client engineer". You're just a "gameplay engineer" that makes sure stuff works on both client and server. And there's not much "server" work because all the networking stuff is done for you I suppose heh
That is correct. You don't usually code two applications for your average multiplayer game in UE.
Even the WITH_SERVER stuff is barely used, mainly only to hide some stuff from clients for cheating etc. reasons
got it, makes sense. Thanks ๐
I didn't realize you could do that, so it's used to 'compile out' sections of the code so that the client executable doesn't ship with it, so that decompilers (are those a thing) won't be able to see said code?
Could someone help me with my steam hosting and joining not being able to find each other the internet?
You're using 2 Steam accounts?
You're using a packaged or standalone version?
it seams to be able to find each other over lan if I host it in the editor new editor pie
Im trying to open 2 standalone games in client
But they cant find each other
It won't work if you use one account and one machine
Both
Because you're technically using the same Steam account
Oh
How come it works in the editor?
Let me clarify something
when you test in standalone/Packaged, Steam is being initialized? You get the Steam overlay with Shift+Tab?
Yes
Then you can't test on a single machine because at that point both clients connect to one Steam account
in editor it just emulates multiple clients
I see
in editor for example you don't get the steam overlay/user info/etc
Hmm then I probable need a friend to help me?
I haven't looked into ways to do it apart from just using 2 machines or asking someone yeah
I see only if I had someone to help me ๐ฆ
lol
๐ or a different PC
Ya LOL
or maybe there's some way of cheating it inside a single PC I don't know tbh
I have people they just wont be on for awhile
Maybe who knows
Ill find a way thank you! ๐
No worries
Trying to ask again since I made some steps forward, but it still doesn't animate on the clients. UE5.3.2. I have a Pawn based actor (helicopter) with a Skeletal Mesh as root and an AnimBP which animates the two rotors. When playing in multiplayer all the movements work fine, both on client and listen server (or clients), but the SkM only animates on the listen server. All the variables necessary for the animation are replicated. When debugging I see the EventGraph and AnimGraph properly ticking for all the clients, but no animation is visible on the client. What did I miss?
Wait shouldent the server atleast pop up tho?
Could you show ss from the replication
@jaunty palm
Love it! can I see the code where you replicate?
@jaunty palmin this case would be the AnimBP using variables which are replicated as basid for the animation
In fact it ticks both on Server and Client, but on the client the animation is not applied to the SkM and I cannot figure out if this is normal (so I need to check how the Character/CMC does it and copy it) or if I simply forgot something
You need to make server function that replicates those variables to all clients
Like a different client set?
And assign them on Rep_Notifies?
That would also mean I need a different AnimBP for the clients, sounds weird
No no. You make funtion that only runs on server and replicates some variables in the pawn, then you set animBP local variables to those replicated variables
So sorry to @ your just the only one Ive talked to that seamed to know this how could I test if steam servers work online without 2 people?
@jaunty palmyep, that's exactly what I am doing already and I see the values of the local animation variables being set in the Event Graph of the client, but not in the AnimGraph for some reasons.
@jaunty palmclient EventGraph (doesn't change anything if the local vars are simulated or not)
You can see the values changing, so the replication works
In the AnimGraph, nothing
Do you need to replicate Rotation, Can you not have start boolean replicate and all the rotation will happen on Client ?
I think for this issue you want to create local variable, but not sure why your variables are replicated inside Animation Blueprint
Without 2 ppl? You need at least 2 machine to test. One to host and the other to join.
I used my laptop and computer to test the game
Local to the ANimation Blueprint
@tranquil yokethese are not animations or inputs to a state machine, I am just transforming bones
Understood, but do you actually need to relay on a float parameter which is coming from Server ?
Can you not calculate the Rotation locally on Clients, When you tell Helicopter to Start Engine or something, Only StartEngine should be replicated
@tranquil yokethe rotation of the rotor depends on the input which is passed to the server, so logically I would calculate on the server side and then replicate to the client
Make the tail rot angle as local variable and do not replicate it
okay understand, then in that case save it in a local Var
create a float parameter inside Animation Blueprint, Called LocalRot something, Then using your replicated Parameter calculate and store inside LocalRot, and use LocalRot inside AnimGraph
@jaunty palmtried both, doesn't make any difference. I believe the problem is with the AnimGraph but I need to figure out why. Everything works fine all the way to the Event Graph of the client
@tranquil yokeexactly what I am doing, see here: #multiplayer message
I see thank you! ๐
And I can see those locals vars being updated also on the client, but not in the AnimGaph
If I opened my game twice and hosted on one it would not pop up for the other?
Unless those Transform (Modify) bone nodes are not working on the client for some reasons
I don't think you can do that
Ask Ur friend to join
Alr all of my friends are offline at the moment lol
Use Ur other laptop or pc
Can I use the same steam account?
Otherwise I don't know. Go sleep and wait for weekend I guess
Don't think so
little confused because here it is using replicated parameter.
Ok thank you! ๐
@tranquil yokeso client gets input --> passes it to server --> server calculates the various speeds and replicates them to client --> client uses the various speeds to calculate the rotor speed and applies them to the SkM
This last part does not work, rest works fine
I am getting off in 20 mins, wanna do a call then ?
Finally!! I managed to find the problem... it was not the replication problem but the widget took awhile to initialise... its like the clients knew about the player tag but that wasnt initialised on their instances๐คง
you cant set replicated variable from client. When you did try to change the tail rotor variable to local one did you also replace those getters on the transform bone?
@jaunty palmyes I know, in fact I am setting them on the server and the Event Graph for the client shows the local variable are updated correctly. I am starting to suspect the problem is with the AnimGraph and the functions I am using in it
@tranquil yokeAppreciate the offer but I am multi-tasking while in a meeting ๐
in this you are setting from client
Hello everyone,
If we have let's say Actor A set to replicate and it's placed in the level, this actor comes with a replicated actor component Component A who has ownership of that component then? the server?
Issue is, I am calling a multicast RPC on server-side of Component A and it only triggers for server ๐ค
@jaunty palmhere?
not it looks good
This should happen inside PawnActor and PawnActor Should have OwningClient
Client_SendInputToServer() -> Server_Calculate_And_SetReplicatedSpeed()
InsideClientsOnly->
AnimTick -> Calculate_LocalRotationFromReplicatedSpeedAndSetLocalSpeed()
LocalSpeed should be float inside ANimation Blueprint.
AnimGraph->Use LocalSpeed to set RotatingBone.
now use those two things that you have set where ever you need in the anim bp
alright and dont work?
Which produces the animation on the server but not on the client
alright now show me the helicopter pawn code
So I think the issue is with the two nodes
Input handling on server from the client
can you print the value for MainRotAngle inside EventGraph after setting, i wonder if it is getting 0 1, 0 1 something like that
RPC's' called from the Player Controller
Tick on the server, with multicast call at the end
Multicast to update clients (engine sound)
I even forced the Anim on the SkM via a custom BP Lib Function
if you think the anim Graph is not working, Just update this code to directly set the value like form 0 to 180, dont use it from pawn.
if the node is working correclty, it will rotate for everyone, by default
yes I could try to tweak it to test
but the 2 rot variable in the event graph are set properly, I see them changing when I debug, so the only explanation is that the AnimGraph cannot use them or it can but the Transform (Modify) Bone nodes are failing
This on the client, on the server works fine
so try what i said above, because if that is true, it should still behave the same
Tried this
Works on server, not on clients
Had to disable multithreaded update to make it work as the random float are not multi-thread safe
So the problem is with the animgraph on the clients
I wonder if an animation asset would work
Or a control Rig
I wonder if it is some ListenServer bug, where Server is doing something and client is also doing something
That's also possible yes
I can confirm that those nodes work
@jaunty palmcool, good to know. How did you test?
maybe do it like this
I just tested this and it seems to work, not sure what is wrong with his setup
copied from you and it will run on server and clients when the state is triggered
I got the server to pop up on my second game but when I join it on my other game it crashes both games but probable cause I'm on the same pc and steam account right?
yeah I just made it inside already ready locomotion state
ok need to try that as well
the state is only changing when this happens
idk atleast my helicopters are working XD
Mesh Space Ref pose is also working, you should try printing the values, i hope you are not getting 0 1 kind of state.
Bumping my question ๐
@jaunty palm@tranquil yoke appreciate your help, will do some more tests once I am out of this meeting and let you know
Anytime.
RPC only going to work, if Actor is owned by OwningClient, which is playerController.
Is that the case with actors placed in the level as well?
Read pinned article that cover ownership
@jaunty palmsorry did you test with a Character or a Pawn?
Because a Character has an own handling of the replication, including animations
I am using a Pawn for the helicopter
@dark parcel Sorry for the @ but when I host a server it works but the second someone joins we both crash why?
So you can see your match?
Yes
Hosted session*
Yes
No my friend is connecting and when he joins the server we both instantly crash?
No idea, maybe test with basic level and fresh game mode
Just to make sure it's not one of your logic that caused the crash
I am ๐
Well I guess not completly okaay ill tryy that
Also the ip must be working cause on steam it launches space wars
Wdym by ip must be working
I did now yes and it is working as the same way
I created new BP pawn and copied all components and the small code from character except CMC
App id != ip
x)
U can use app id 480 space war and connects
That's what I used before I get my own app id
Hello
I have an problem with replications
My callback (COND_OwnerOnly) is called on server too
@jaunty palmok thanks for checking. then it is a mistery while mine doesn't seem to work
but it shouldn't
I would delete all forced multicasts for setting the pose what you had there if I remember and just make the whole flying thing as a state and take the values from the replicated variables for clients.
That's a replication condition, namely the variable would be replicated to the owner of the actor only, rather than say everyone that has the actor relevant.
If you're talking about an OnRep function, OnReps in C++ do not fire on the server unless called directly.
I have widget which shows on collision spehere overlap event
When I trigger overlap as server widget is visible
Then I trigger it as client
Both players see that widget
But when client leaves sphere, it also hides on server
The overlap happend in all machines
Are you able to show some code? It's not exactly clear what you mean by "work the other way" or "client can't hide widget for server player".
Widgets don't replicate, so whatever is happening is local to the machine that is creating and removing the widgets.
AWeapon::AWeapon() {
bReplicates = true;
// ...
}
void AWeapon::OnSphereBeginOverlap(/*...*/) {
if (const auto PlayerCharacter = Cast<AGameCharacter>(OtherActor)) {
PlayerCharacter->SetOverlappingWeapon(this);
}
}
void AWeapon::ShowPickupWidget(bool Visibility) const noexcept {
PickupWidget->SetVisibility(Visibility);
}
UCLASS()
class MULTIPLAYERSHOOTER_API AGameCharacter : public ACharacter {
// ...
private:
UPROPERTY(ReplicatedUsing = OnRep_OverlappingWeapon)
AWeapon* OverlappingWeapon;
UFUNCTION()
void OnRep_OverlappingWeapon(AWeapon* PreviousWeapon);
};```
void AGameCharacter::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const {
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
DOREPLIFETIME_CONDITION(AGameCharacter, OverlappingWeapon, COND_OwnerOnly);
}
void AGameCharacter::SetOverlappingWeapon(AWeapon* Weapon) noexcept {
if(OverlappingWeapon)
OverlappingWeapon->ShowPickupWidget(false);
OverlappingWeapon = Weapon;
if (IsLocallyControlled() && OverlappingWeapon)
OverlappingWeapon->ShowPickupWidget(true);
}
void AGameCharacter::OnRep_OverlappingWeapon(AWeapon* PreviousWeapon) {
if (OverlappingWeapon)
OverlappingWeapon->ShowPickupWidget(true);
if (PreviousWeapon)
PreviousWeapon->ShowPickupWidget(false);
}
I just started learning how to make multiplayer games and I don't know much
Does anybody know what I could have done wrong that can cause my game to crash when both player join it? steam
Is your goal to show the pickup widget on both, or do you want it to only show on the computer whose player is overlapping the weapon?
Only on overlapping player's machine
Ok, so you shouldn't need to worry about OnReps for doing something like that and can do it entirely locally.
void AWeapon::OnSphereBeginOverlap(/*...*/) {
if (const auto PlayerCharacter = Cast<AGameCharacter>(OtherActor)) {
if (PlayerCharacter->IsLocallyControlled())
PickupWidget->SetVisibility(true); // Will only show the widget if the actor overlapping is locally controlled.
if (HasAuthority())
PlayerCharacter->SetOverlappingWeapon(this); // Sets the overlapping weapon only on the authority.
}
}
void AWeapon::OnSphereEndOverlap(/*...*/) {
if (const auto PlayerCharacter = Cast<AGameCharacter>(OtherActor)) {
if (PlayerCharacter->IsLocallyControlled())
PickupWidget->SetVisibility(false); // Will only hide the widget if the actor overlapping is locally controlled.
if (HasAuthority())
PlayerCharacter->SetOverlappingWeapon(nullptr); // Clears the overlapping weapon only on the authority.
}
}
void AGameCharacter::SetOverlappingWeapon(AWeapon* Weapon) noexcept {
OverlappingWeapon = Weapon;
}
OverlappingWeapon doesn't need to be replicated at all and you can use it just for a state on the server so your client can call a simple RPC like "PickupOverlappedWeapon" passing in no arguments and the server can then know immediately which weapon to pick up.
If you want the client to know specifically about what weapon any characters are overlapping, you can just remove the HasAuthority() checks, then each side will be keeping track themselves what weapon they're overlapping currently.
thank you
@jaunty palm@tranquil yoke fixed! Stupid me had derived my custom game mode from GameMode instead of GameModeBase, which made everything work except the animations on the client. Need to investigate why by looking through the source code.
Many thanks for thinking along and your tests as well.
I'm definitely interested in w/e findings you may find
(I really enjoyed typing that sentence out ๐ )
why am I unable to join my dedicated server when others can?
Finally
This is very very very very very weird that simply changing from AGameMode to AGameModeBase fixes this.
I would've never led you down that path yesterday ๐
Because it just doesn't make sense
does it have something to do with the ports?
Hello I made a function in C++ that I call in a blueprint but whenever I click the button the exectution stops right before calling the said function, any idea on why it does that ? (I have no related errors on the console)
function is server player is ready btw
cast failes
@fathom aspen Have you heard of this before? Marco has an APawn whose skeletal animations weren't playing on the client. They changed from AGameMode to AGameModeBase and now it works
oh you're probably right I assumed it would have popped an error
thanks a lot
Really strange ๐ but good that it is fixed now tho
I know. Weird but now it works flawlessly.
Same code. I just changed the base class of my custom Game Mode.
Just need to summon the high council of WizardCell, Cedric, Jambax, and Zlo
is there an Iris tutorial or good example anywhere? I need to do some delta state syncing stuff and I think it'll be cleaner to just use Iris for it
Strange things can happen if you're using GameMode with GameStateBase or GameModeBase with GameState.
Ahh, right right. Completely forgot to even ask about the game state class. @urban palm
I just always have them match so they slip my brain
Yes it is very likely that they were not matching, let me check
Indeed, Game Mode was AGameMode and Game State was AGameStateBase.
May also mean that if I switch both to be the same GameMode and GameState it would work?
Let me try
Yep
GameMode I think has some additional logic pertaining to spawning and stuff in it though? I'm not sure.
Yeah, like I said, I just literally always make them the same so them mismatching is not something that even registers for me. Just one of those things where you've done it so much that it is like breathing so you kinda forget about it.
I don't do much multiplayer, just getting my feet wet with it
Yep confirmed. Using GameMode + GameStateBase blocks the animations on the clients.
Yeah, but you do the lords work by holding down the fort in the physics channels ๐
Doing my best, but want to improve on multiplayer too so I can be with the cool kids ๐
Might as well rename it from "chaos-physics" to "physics-with-marco"
The community of physics practitioners has actually grown
Need to try reversing game mode and game state
So GameModeBase + GameState, now the animaton is gone on the server too
But I removed my custom code which was forcing the animation tick
GameModeBase + GameStateBase everything works perfectly
Wonder if there were some log events complaining about the mismatch
Red means good, right? ๐คฃ
I wonder if it'd be better to just...crash actually.
Like assert that they're the same or something
That would have been less painful
Also because everything works but the animations on the client
The weird thing is that when you reparent to GameMode the GameState class is automatically changed, at least in the override
Tested with 4 choppers
All I can think about is the Fortunate Son song ๐
All I can think is the Wall by Pink Floyd
Just randomize the color. No longer The Wall
Yeah, let's do that
Marco is about to be doing networked physics tutorials with chaos
Lol, what the hell. As mentioned, if you mix the baseless GameState with basefull GameMode, or the other way around, wrong things happen, and it even yells at you
Wish I had checked the log more in details before spending a lot of time debugging it.
Anyway, learned the lesson.
Also searching online/forum etc. for "multiplayer skeletal mesh animations working on server but not on client" does not lead to any suggestion regarding GameBase/GameState wrong mix
how do I make it so when testing 2 players, I can have 2 equally sized windows occupying half the screen
instead of this sort of modal window popping up
Are you asking how to make something like split screen as in Mario Kart? Two players using the same device? or are you testing two separate clients in a multiplayer using PIE?
nono, just testing a listenserver for connecting eventually with another player online
currently running both instances on my PC
I just use PIE and then drag the windows to the edge of my monitor and windows snaps them over to become half the screen
I think there's some settings you can adjust to set the default PIE window sizes as well
yeah I spent some time inside the editor preferences and I thought it would be faster to ask
btw, if I understand correctly, it is possible to host a session and other player to connect to me through an IP address right
for testing purposes only
How come I can host a server but the second my client joins it crashes? I tried it with another player character and it works fine but I disconnect event tick and begin play and it still wont work on my main character why? ๐
Steam servers
How should we know? Its your game. You need to debug it?
You havent provided any information that would help us help you.
Have you checked the Logs?
Was a Crash Reporter with a Stack Trace produced?
If so, did you read it to find out what line of code is crashing?
I'm sorry your right just wondered if anybody has simuler issues but do you under stand this error?
Assertion failed: this->PropertyClass [File:Runtime\CoreUObject\Public\UObject/UnrealType.h] [Line: 2234]
0x00007ffa3a9a531c KERNELBASE.dll!UnknownFunction []
But have an amazing night/day! ๐ god bless you all! ๐ jesus loves you! ๐
anyone know this?
It says it right in the log, Connection Timeout.
is there a reason?
None that can be determined by what you have shown.
You can but the host will need to portforward
Hi guys, what is the best way to handle RPC in standalone and listen server mode. Currently when in client RPC, I have to check if IsNetMode(NM_Standalone) then skip because the logic already run.
I know they aren't supposed to mix but that's so weird, why the hell would mode/state have anything to do with animations at all?
Why do you have to skip? It should just work the same whether standalone or client
What's the actual order of your logic?
The order is FuncA() -> Call Client RPC -> Client_RPC() -> FuncA();
Method FuncA will be call twice.
Without looking I would assume that the non-base version casts to the other non-base version and fails. And to not have that crash they silently return in lots of places, potentially stopping BeginPlay from happening and more.
ok so this is sorta like a simple prediction method?
@pseudo wagon That's what you kinda do. You would just not RPC if the caller Has Authority
I'd instead branch clientside and call FuncA logic locally if not server, that should cover all paths
I think we're saying the same thing
Jop
The pseudocode is like:
void ChangeParam(float Value)
{
DoChange(Value);
Client_ChangeParam(Value);
}
void Client_ChangeParam_Imple(float Value)
{
DoChange(Value);
}
In standalone mode, it will be called twice.
Just don't do the rpc if you have authority
or don't do the local change if you don't have authority
depending on what you want the default path to be
In standalone, HasAuthority alway return true. So I have to check IsNetMode(NM_Standalone) ?
Entry
if !HasAuthority
TellServerToDoThing
DoThing
TellServerToDoThing
DoThing
My RPC is from Server -> Client.
oh in that case just do that all the time and it should work in all cases
er, sec
Is this a single client rpc or multicast?
It is single client,
yeah your best bet will to be to gate by that or if netmode is dedicated or listen
depending on if a client can ever reach this code
If it's a Client RPC then you would have the same problem with ListenServer
The check for authority would then go into the client RPC instead
every tutorial on the CMC says to update the movement values on "OnMovementUpdated()", why is it done there an not on "Tick()" for example?
Well, Tick is used to split between all the different proxies that can run the code. There is a lot that happens between Tick and when you might actually want to do your stuff.
Basically, Tick might be way too early
There is prediction somewhere in between, and also parts where you might not want SimProxies to even call your code
thats very interesting, so is there any scenario that u can think of that you might wanna do it inside tick istead of OnMovementUpdated? or should i just do everything inside OnMovementUpdated as a rule?
can i consider OnMovementUpdated to be like a second tick?
Hello,
Is checking IsLocallyControlled the proper way to identify if a pawn is a proxy or not?
i think that a pawn is always a proxy, its either gonna be remote or simulated, unless ur on the server in which case its authority
if its ur pawn, the one that is locally controlled then its an autonomous proxy, if it is someone elses than its a remote proxy
there are probably some edge cases where that is not true but im not sure
i thinks its safe to assume what i just told u
unless some one else wants to add anything to that explanation, im not an expert by any means
I feel like you're correct and when I said proxy I did mean an autonomous proxy ie a client controlled pawn
Hello, does anyone know whether there's an event that is present both server and client sides to notify anytime a player enter/leaves the game?
is gamestate and playerstate just there to encourage a specific game structure? It doesnt do any server-to-client replication on its own?
OnPostLogin() in conjunction with gamemode class/blueprint
oh not client
hmm
GM exists server-side only, hence it wouldn't be notified client-side
The gamemode doesn't exist on clients yeah ๐
yeah forgor ๐ that part
I think the gamestate has a certain event, Tony. One sec.
I actually forgot to write an answer I found. GameState has Add/Remove PS functions, and it can be used for that. Initially I thought it is called server-side only, as nothing mentions anything about clients, but apparently it does
That's the one I was thinking of yeah.
It runs on the client as well as all it does is register it self whenever a playerstate gets created or replicated ๐
Apparently it's called from here:
void APlayerState::PostInitializeComponents()
{
Super::PostInitializeComponents();
UWorld* World = GetWorld();
AGameStateBase* GameStateBase = World->GetGameState();
// register this PlayerState with the game state
if (GameStateBase != nullptr )
{
GameStateBase->AddPlayerState(this);
}
So yeah, it must work client-side
nice
kind of what i was asking as well lol
so playerstate has special events relating to server connection
and gamestate has special events relating to players connecting
?
The playerstate is mostly for as the name suggests storing data for a player, by default I don't think it stores much. I think it stores the player ping by default.
As I said, game state knows the connecting/disconnecting players, as the related player state (that is always relevant) notifies the game state about that
awesome ty
But yeah, they are there to encourage a certain way to interact with Unreal's framework ๐
Technically you can work just fine without them but I would say it's definitely good practice to use them.
yea its cool, moving from unity to unreal, u dont have to do a lot of boilerplate work. The structure is there, its just, now you gotta spend time learning it instead of having to implement your own
I do like the way Unreal does these things yeah. The ones that allow you to optionally use extra stuff are great as well, sometimes you want more control versus something that might already be there. Obviously not everything Epic makes is going to work for all games or situations ๐
Hello,
does a component need to check "Component Replicated", when using events like these? Asking because it seems to work without it checked.
Hi, I just found out that animation montages (especially for root animation) its automatically networked for other clients too by unreal engine. Is there any known drawbacks to using them extensively? since they are automatically replicated to the other users?
Hello,
I'm in a strange usecase where I need a certain object with collision can be visible/collision enbaled on Client only, but obviously Character movement is replicated and it feels that it is server authoritative, which makes my Client character be able to go through that object
Is there any way of making movement more client based?
or basically take into account what the client-side character is colliding with
Does anybody know what could cause my game to crash when the second client joins the server steam advanced servers it seamed to work when I tried another starting character but I have no clue why my main one wont work? I tried disconnecting event begin plays and ticks and everything it still wont work does anybody have any clue why any help would be so amazing thank you!!!! so much! ๐ god bless you all! ๐ jesus loves you! ๐
We agree that Net Culling Distance is calculated from posseded pawn to other actors, correct ?
Could any of these cause it to crash when 2 people join?
Crash log
@arctic minnow Would need more than that. Do you have any Callstack?
The last thing that I see is AGameModeBase::HandleStartingNewPlayer
But not what line or what followed
Sorry I'm kinda new wdym call stacks also could steam vr cause the crash by any chance?
I see my bad
No clue, my ๐ฎ is broken
Would need the callstack to say more
The log doesn't seem to have any
No worrys just wondered if you ever encountered the issue sorry to waste you time ill look into it, have an amazing night/day! ๐ god bless you! ๐ jesus loves you! ๐
You can check if there are any additional files in the Saved folder related to crashes
Or if you can repro this maybe in Standalone
Does this crash in a packaged build or what are you doing here?
Ehhh
I would actually say: Depends
It uses
/** Where the viewer is looking from */
UPROPERTY()
FVector ViewLocation;
So a Third Person Character might be calculated based on the Camera Location
First Person would give the idea of it being the Pawn Location, since they are mostly the same
Kinda
If you don't change anything, then you will get corrections
Cause the Server won't run against the object of course
There is a boolean to ignore client corrections or so
That you could toggle
But that is of ocurse a free card for cheating
Hmm what I would prefer actually is to make movement client-side
Because im basically working on a chunk system
So the server knows about the chunk but i dont want the player hosting necessarily to load those object
Hum... that interessing.
Thanks.
So this is ViewLocation who determine that.
FNetViewer::FNetViewer(UNetConnection* InConnection, float DeltaSeconds) :
Connection(InConnection),
InViewer(InConnection->PlayerController ? InConnection->PlayerController : InConnection->OwningActor),
ViewTarget(InConnection->ViewTarget),
ViewLocation(ForceInit),
ViewDir(ForceInit)
{
check(InConnection->OwningActor);
check(!InConnection->PlayerController || (InConnection->PlayerController == InConnection->OwningActor));
APlayerController* ViewingController = InConnection->PlayerController;
// Get viewer coordinates.
ViewLocation = ViewTarget->GetActorLocation();
if (ViewingController)
{
FRotator ViewRotation = ViewingController->GetControlRotation();
ViewingController->GetPlayerViewPoint(ViewLocation, ViewRotation);
ViewDir = ViewRotation.Vector();
}
}
ViewingController->GetPlayerViewPoint(ViewLocation, ViewRotation); returns the CameraViewPoint
At least in some cases
Best to read the code yourself
Thanks yeah, was mostly trying to found a starting point about that.
Hey folks, I am trying to replicate movement on my pawn (not ACharacter and ACharacterMovement).
My game is LAN multiplayer, so I am trying to do everything on the Server, and not account for lag at all.
On the client side, I just send the raw user inputs, like a direction from AWSD.
On the server, I receive this input and move the pawn.
The server also has a pawn. (listen server)
On the server instance, I see both pawns moving as expected, so the input from the client is working.
But on the client instance, I see only the server pawn moving.
OnRep_ReplicatedMovement never gets called for the client pawn.
Replicates and ReplicatedMovement is all turned on, as well as AlwaysRelevant.
I am not finding whats the issue, and not finding anything online.
I have been putting breakpoints on the engine source, but still no luck.
Does anyone know what I am missing?
Thank you!
i know this sounds like a silly idea but do non-player controllers have a playerstate of their own? because it sure would be nice and could solve some design problems
They can have
Otherwise UT bots would have a problem :P
Oh? thats awesome, so here's a question, why is the AActor's Instigator member a pawn and not a playerstate?
FDoRepLifetimeParams ReplicatedMovementParams{COND_SimulatedOrPhysics, REPNOTIFY_Always, bUsePushModel};
DOREPLIFETIME_WITH_PARAMS_FAST(AActor, ReplicatedMovement, ReplicatedMovementParams);
a pawn is transient, it can die and stuff
I assume this is marked as Sim Only
That's mostly Epic's ties to UT
The PlayerState didn't instigated e.g. a Weapon firing
The PlayerState is available to APlayerController and AAIController
But the function to spawn one is available to AController
So you could also inherit from that and simply call InitPlayerState on the Server inside PostInitializeComponents
For AIController you simply need to flip bWantsPlayerState to true
That already exists and is set up
Thats good to know, thank you ๐
What is the correct way to load into a listen server map? CommonSessionSubsystem calls GetWorld()->ServerTravel(PendingTravelURL); but this doesn't actually tell the NetDriver to start listening
@twin juniper Well, the thing is, you just shouldn't use Physics in Multiplayer as you said
Applying a Force via the CMC also works
You could just mimic what OpenLevel does
void UCharacterMovementComponent::ApplyAccumulatedForces(float DeltaSeconds)
{
const FVector GravityRelativePendingImpulseToApply = RotateWorldToGravity(PendingImpulseToApply);
const FVector GravityRelativePendingForceToApply = RotateWorldToGravity(PendingForceToApply);
if (GravityRelativePendingImpulseToApply.Z != 0.0 || GravityRelativePendingForceToApply.Z != 0.0)
{
// check to see if applied momentum is enough to overcome gravity
if ( IsMovingOnGround() && (GravityRelativePendingImpulseToApply.Z + (GravityRelativePendingForceToApply.Z * DeltaSeconds) + (GetGravityZ() * DeltaSeconds) > UE_SMALL_NUMBER))
{
SetMovementMode(MOVE_Falling);
}
}
Velocity += PendingImpulseToApply + (PendingForceToApply * DeltaSeconds);
// Don't call ClearAccumulatedForces() because it could affect launch velocity
PendingImpulseToApply = FVector::ZeroVector;
PendingForceToApply = FVector::ZeroVector;
}
This is being called by the CMC
void UCharacterMovementComponent::AddForce( FVector Force )
{
if (!Force.IsZero() && (MovementMode != MOVE_None) && IsActive() && HasValidData())
{
if (Mass > UE_SMALL_NUMBER)
{
PendingForceToApply += Force / Mass;
}
else
{
UE_LOG(LogCharacterMovement, Warning, TEXT("Attempt to apply force to zero or negative Mass in CharacterMovement"));
}
}
}
void UCharacterMovementComponent::AddImpulse( FVector Impulse, bool bVelocityChange )
{
if (!Impulse.IsZero() && (MovementMode != MOVE_None) && IsActive() && HasValidData())
{
// handle scaling by mass
FVector FinalImpulse = Impulse;
if ( !bVelocityChange )
{
if (Mass > UE_SMALL_NUMBER)
{
FinalImpulse = FinalImpulse / Mass;
}
else
{
UE_LOG(LogCharacterMovement, Warning, TEXT("Attempt to apply impulse to zero or negative Mass in CharacterMovement"));
}
}
PendingImpulseToApply += FinalImpulse;
}
}
Will of course cause corrections if not done on Server and Client in the same timestamp, but that's as usual
Yea, I just wasn't sure if there was a built in "correct" way
Pretty sure that's fine
UEngine::SetClientTravel does some extra checks to not connect to yourself etc.
So you can use that
I would even go as far as just using OpenLevel
No, I usually dump info
You can see the function names
They are even BP exposed
/**
* Add impulse to character. Impulses are accumulated each tick and applied together
* so multiple calls to this function will accumulate.
* An impulse is an instantaneous force, usually applied once. If you want to continually apply
* forces each frame, use AddForce().
* Note that changing the momentum of characters like this can change the movement mode.
*
* @param Impulse Impulse to apply.
* @param bVelocityChange Whether or not the impulse is relative to mass.
*/
UFUNCTION(BlueprintCallable, Category="Pawn|Components|CharacterMovement")
ENGINE_API virtual void AddImpulse( FVector Impulse, bool bVelocityChange = false );
/**
* Add force to character. Forces are accumulated each tick and applied together
* so multiple calls to this function will accumulate.
* Forces are scaled depending on timestep, so they can be applied each frame. If you want an
* instantaneous force, use AddImpulse.
* Adding a force always takes the actor's mass into account.
* Note that changing the momentum of characters like this can change the movement mode.
*
* @param Force Force to apply.
*/
UFUNCTION(BlueprintCallable, Category="Pawn|Components|CharacterMovement")
ENGINE_API virtual void AddForce( FVector Force );
Velocity += PendingImpulseToApply + (PendingForceToApply * DeltaSeconds);
Math behind it
I was gonna do that but the options string is already constructed so I'll use the UEngine version
Don't think that's a thing for the CMC
If you are planning on rotating the Character by applying upwards force offset from the center or so, you might need to start coding your own :D
If you can use C++, I would suggest you add a custom MovementMode
They usually, in Swim or PhysFlying, call this SafeMoveUpdatedComponent(Delta, UpdatedComponent->GetComponentQuat(), true, Hit);
That allows passing in a Rotation
Back when I coded my own I used that to rotate a 360ยฐ hover drone
But that needed a lot more code so I don#t think you need your own, but just a child class
You could then add your own AddForce functions that apply a force offset to the center and calculate the resulting rotation quat
Should totally be possible
Just needs a bit of work :D
And since it's a Quat, you should not have problems with gimbal lock
Unless Quat defeat you, like they did me a couple of times already
Ah so, you don't need to rotate the character?
Or at least not pitch and roll?
I mean
The CMC doesn't rotate the Character on pitch and roll via the applied force
That's why it just passes the current Quat to the function
It only moves it
Eh :D I'm not sure that matters match given that the CMC is not physics
All it does is applyed a Velocity (not rotational) to the Character's Location
Or rather its root component
While keeping the Rotation the same
Yeah...
Usually people rotate the character via the ControlRotation
Which might also affect all 3 axis
but if you only need Z and thus not care about gimbal, you could try to apply it by hand locally via the ControlRotation
It will replicated to the server then
Ya then you could only modify the Rotation of the Actor directly
I would go with the CMC child :P
Yeah, CMC Child -> Custom Movement Mode -> Calculate Quat and Location offset yourself, call SafeMoveUpdatedComponent with those values
Everything Physics is shite for Multiplayer
So yes
Def not Physics haha
They modified the physics so much that they basically made their own version of CMC
I mean there's not really a super strict divide between a movement component and physics. It's still simulating physics, just with different code and different rules, and doesn't really interface with the "real" physics scene
You could think of the CMC as its own physics engine
The sim isn't the hard part, it's the prediction and reconciliation that is
a local multiplayer Rocket League would be super easy
CMC isn't really its own physics engine, but I get why you would say that
yup.
A character is a capsule with these rules to move around that somewhat simulate Newtonian physics with the modifications you come to expect from character movement.
I'm doing physics + multiplayer but I'm very glad I'm not having to do prediction
But in general you want to stick to silly little vector math
Physics + multiplayer = hard but doable. //World of Tanks is here
Physics + multiplayer + prediction = hell naw //Rocket League is here
Maybe ยฏ_(ใ)_/ยฏ
But I'm not here to discuss that. I think you have enough on your hands to get that stuff working with the CMC :P
thank you Cedric. You are awesome!
I got a doubt, Im reading the multiplayer compendium, and trying to simulate a simple chess-ish game where both players can create new pieces and place them on the board, it works if I just RPC on the server to the client, both get the newly added piece, but when I try on the client it doesn't.
Obviously Im not understanding something, what is the right way to tell the server to create an actor for both listen-server and client, from either of these instances?
You want to use replicated actors and spawn them only on the server. This means if you want to allow a client to tell the server to spawn an actor, you must send a server RPC with some details about what the client wants and when running on the server spawn the actor as desired. No need for any special listen server specific code for this as they can just use the same inputs that call the server RPC and spawn the actors.
Im currently using blueprints, and this is what I have:
this works only server -> client, what piece of the puzzle Im missing to complete the other side of things?
Is that piece actor marked as replicated?
Also where are you calling this in?
What is "Main"
@true stream
yes
level blueprint
You can't call Server RPCs in there
You need a client owned actor
Your puzzle piece is Ownership
Which the compendium has a page or so about
yeh Im currently reading that
The RPC has to be in e.g. the PlayerController or the Pawn/Character if you have one possessed. Or the PlayerState but that makes no sense here
PlayerController probably makes the most sense at this point
so whats the context/scope/ownership of the level blueprint?
Server is the owner in theory
That's what it's like with most single actors where only one exists per march
GameState too
alright, so I will bring this logic to playerController and try again
Yus
I dont have a "Pawn" in this chess-ish game, no character either.
Yeah then PC
No, doesn't make sense if you don't need one
k
I think you always DO have one, but it doesnt need to do anything. The PlayerController can be your interface with a strategy game. Some people like to put the camera in the pawn but you don't have to.
I have a TArray of FMyCustomGameEvent* which represents events that happen in the game and I want to replicate to all clients via the game state. these game events are polymorphic so there's a like FUserScoredPointsEvent etc. that I create on via NewObject and then just put a pointer into the TArray
do I need to do anything special to replicate that via GameState so it comes out identical on the other end? if so, what?
As well as what Cedric was recommending, hit result under cursor only triggers on the client, so you can't get the value from a client while running on the server. You'd have to pass the information as an input on your RPC so the server receives it - you should only need to pass the hit result location that you're using rather than the full hit result data.
Yeah I've found that out
the actors were being set at 0,0,0
btw, if I want 2 actors to collide only when they are from different "teams", meaning, spawned by from different clients, is this a mechanic already there in UE or I have to figure it out on my own
You can do that with collision channels
Probably can with ignorecollision too but I'd lean towards channels if you're gonna have a lot of stuff but not a ton of teams
is that for actors only or I can have my own lightweight object (bullet) in the future and still use that
Yeah you can trace vs whatever channels you want
Anything that exists in the game world is going to be an actor. If you are doing line traces then you can have those traces checking for specific channels.
Instead of a collision channel Pawn, you might have RedTeam and BlueTeam which are the same except they don't collide with their own team.
and a red person shooting a bullet will be tracing for hits vs BlueTeam but ignore RedTeam
So even a super simple projectile bullet will be an actor you say
no
it doesn't have to be
but something somewhere will be the actor
what does that mean
maybe it's your ProjectileManagerActor which handles all "bullets"
ah
If you were making ARMA you could just have bullets that exist as data only and have nothing renderable, but you usually want to see yours
so the pooling would happen inside a manager actor
yeah, or a subsystem (that's my approach)
but I'll still need something to do the visualization for all the bullets in the world which would have to be an actor somewhere
now if you need bullets to hit bullets thats another matter
because collisions only work for actors?
mostly because there's nothing to hit
a line trace hits things in the world
the "bullet" isn't in the world, it's just data that says where to trace each frame and what to do if you hit something.
you could have that same manager move colliders around for you for the certain projectiles that need to be hittable
Yeh, it will depend on my very specific use case
Bottom line is, I can have a visual representation of the "bullet", and detect collisions through different methods
without them being an actor
Say you wanted bullets and grenades to be handled by the same system, but a grenade should be able to be hit by a bullet and destroyed:
struct Projectile
Position
Velocity
OnHitEffect
bHittable
MyProjectileManager.Tick
for each ProjectileStruct
Update Velocity
Trace
if Hit
Do Hit logic
Update Position
If bHittable
Move a SphereCollider there
You don't always have one
Pawns are fully optional
TIL
thats defined in the gamemode right
I don't think you can replicate struct pointers
And replicating them with the base class will of course object slice them
You should have a look at the FInstancedStruct
Both for replication and for the polymorphic stuff
Having some slight issues with seeing characters and projectiles in my game. A listen server spawns and can see the health bar of a client far across the map and knows where he is and sees the projectiles he fires from there. The client, can't see the health bar of the listen server character nor his projectiles until he gets close enough. Which variable am I to mess with to make sure the distance is greater for seeing such things? It's not net cull distance is it? Or is it a rendering distance elsewhere?
Sounds like relevancy.
Yep, seems to be net cull distance squared not being high enough. Not sure what the repercussions are for greatly increasing this on players and actors
Its an optimization.
The higher it is, the further from that Actor you need to be for it to removed from "relevancy".
Relevancy is basically something like, "Am I to far away to matter to who might be viewing me".
Right. Makes total sense. I guess I'll play with the values now that I know the real issue and try to get something that makes sense for my game type.
Thanks!
The Listen Server can see everything at all times, because its the Server.
Anyone understand this?
AGameModeBase::HandleStartingNewPlayer
Its a function in C++
I see so is something wrong with it?
Well without more context, it's impossible to tell
https://forums.unrealengine.com/t/dedicated-server-crash-gamemodebase-handlestartingnewplayer/258958/1 Seams as if this person had a issue kinda the same but mine is with steam
Hello everybody, my dedicated server crash when the first player is joining. The only output in log is the following: โLogOutputDevice: Warning: Script Stack (1 frames): GameModeBase.HandleStartingNewPlayerโ โLogWindows: Windows GetLastError: The operation completed successfully. (0)โ โLog file closed, 11/02/21 15:56:41โ No callstack is pre...
Yes, so what's the callstack? This is the BP callstack so not really applicable
Wdym callstack?
A list of function calls in reverse order. It's usually part of the crash log, or if you're debugging through VS/Rider then it'll halt execution there and show the issue with more info
Not really enough info here, is this a BP only game?
?
This also shows up in almost everyone's log and can be ignored
Assertion failed: this->PropertyClass [File:Runtime\CoreUObject\Public\UObject/UnrealType.h] [Line: 2234]
Is also right there
Ya
@arctic minnow I think there is still bug in the steam subsystem. You can try to add these to your game's defaultengine.ini:
[ConsoleVariables]
net.CurrentHandshakeVersion=2
net.MinHandshakeVersion=2
Where would I put them? and ya I'm in 4.27 but the weird thing is my game hosting and joining works for the demo character and probable all the other ones just not my main character for some reason I tried disconnecting like event tick ect still will not work on my main character ๐
Ah sorry didnt see this. You need to handle the spawing yourself when you override it, otherwise the player spaws as spectator
I'm not sure I understand instancing/replicating TArrays of UObjects
I have a dynamic TArray on the server and I want it to contain UMyGenericClass* which has lots of different overriding classes. this should then replicate down to the client
I declared UMyGenericClass with UCLASS(Abstract, EditInlineNew, BlueprintType, DefaultToInstanced) and marked the TArray and instanced (?)
but I just get an array of NULLs on the other side
UObjects are not replicated by default. You need to set that up yourself.
Only AActors are replicated.
mb I kinda worded that wrong I ment when I host the server with the normal character everything works fine but if I use mine the second the client joins the server instantly crashes and they get disconnected?
I have a bunch of UObjects that derive from a parent class and I just want their UPROPERTY's to pop out on the other end -- is there a good generic way to declare that?
I am not familiar with steam as I donโt use it but this seems to be problem in your gamemode base as you need to handle the spawning by yourself
Oh I see thank you! ๐ have an amazing day! ๐ god bless you! ๐ jesus loves you! ๐
hmm, I'm not sure I understand. how do I do this for a TArray<UMyGenericClass*>? I need to register the TArray as a replicated subobject?
Also should parent class for my gamemode be gamemode or gamemodebase?
Read the code samples on the page.
Everytime you call NewObject to create your next UMyGenericClass object, you need to add that object as a replicated subobject
You would do this before adding it to the TArray
ooooooh I see I see
Read the page I linked, its rather straightforward.
ok then one more question before I go this route: if I use FInstancedStruct instead for this, will it do smart things with GUIDs if I have a pointer to e.g. a player state in my struct?
FInstancedStruct seems a bit lighter weight for what I'm doing since these objects won't change after they're created
Actors are always referenced by a NetGUID once they have been initially resolved.
It doesnt matter if its inside of a Struct or another Actor
A Struct sounds like a better choice for you if all you are doing is passing around a pointer to another Actor
You also shouldnt need an instanced struct
A regular struct would be fine
Unless you plan on taking advantage of the instanced struct functionality.
my TArray has generics in it. it's a big log of everything that's happened in the game, so it's a TArray of UMyGameEvent* and those can be arbitrary subclasses (UPlayerDiedGameEvent*, etc.)
Why on earth are you replicating that?
it's a board game ๐ much easier to do it this way vs. lots of individual properties that move around
I had it as individual properties + onreps but things got crazy when I added bots because they would take multiple actions really quickly and the user would just get one on rep. so they wouldn't see the individual actions that led to the end state and they couldn't animate everything properly on the client side without a ton of hacks
this way they can see "bot rolled a 5", "bot purchased a house", etc. and animate everything in order
If its turn based why not just pack all of that into the turn state. Why do you need a replicated historical log? That seems extremely silly.
not sure I follow "turn state" -- you're saying you create a turn object with what the player did and replicate that out?
also, there's going to be a literal timeline at the bottom so you can see what happened in the game
there are only about 60 turns and I can only sync the new stuff if it's actually a problem but I doubt I'll be bandwidth limited on this... turns can take like 10 seconds+
You record everything a Player (or Bot) does in their "turn", then when their turn is done, all that turn information is sent to the others (probably should be via an RPC). Those Players can then just hold a local copy of that Players turn for historical data.
what if someone joins (e.g. as a spectator) in the middle of the game?
or disconnect/reconnect
Current state would still be handled by individual actors etc
The โturnโ state would probably only notify Players of what actions were taken. Not what the new gamestate is.
A system like this is far more involved than what i can explain here
There is a lot to consider when designing systems for multiplayer.
hmm yeah I think because of the disconnect/reconnect and spectator thing + that I want users to be able to see the history of all actions (it's important for this game) I'll just rep the history
since it's append-only, my worst-case is I'll do some custom delta serialization thing to only send over the new events. but I doubt I'll be bandwidth limited on this
thanks -- this helped me understand UObject replication a lot better!
is there any scenario that you might wanna do logic inside tick istead of OnMovementUpdated in the CMC? or should i just do everything inside OnMovementUpdated as a rule? can i consider OnMovementUpdated to be like a second tick?
Getting this fatal error on the Client after seamlessly travelling from 1 map to another, any idea what it could be from/how to fix? I saw this bug tracker which I think may be what it is... but not sure https://issues.unrealengine.com/issue/UE-200510
Assertion failed: NumDormantObjectsPerConnectionRef > 0 [File:D:\build++UE5\Sync\Engine\Source\Runtime\Engine\Private\NetworkObjectList.cpp] [Line: 350]
*Also using SteamCore pro.
The bug tracker has a link to the commit that fixed it. Needs a small change in Engine/Source/Runtime/Engine/Private/NetworkObjectList.cpp which would mean compiling the engine.
Hmm okay so it is fixed in 5.4 then if its the same bug. Thanks again ๐
Fairly certain that is the issue. The line you're crashing on is the one referenced in the bug report which is line 350 that is contained in the FnetworkOjectList::MarkActiveInternal:
check(NumDormantObjectsPerConnectionRef > 0) hit in FNetworkObjectList::MarkActiveInternal
Awesome, yea, I need to just get source one of these days lol. So annoying tho ๐ฆ
when is "PrepMoveFor()" called in the CMC?
It looks like it's called in ClientUpdatePositionAfterServerUpdate() and during a loop:
// Replay moves that have not yet been acked.
UE_LOG(LogNetPlayerMovement, Verbose, TEXT("ClientUpdatePositionAfterServerUpdate Replaying %d Moves, starting at Timestamp %f"), ClientData->SavedMoves.Num(), ClientData->SavedMoves[0]->TimeStamp);
for (int32 i=0; i<ClientData->SavedMoves.Num(); i++)
{
Based on what I'm seeing here, I'm guessing it gets called if there is any saved moves that the client has sent but haven't been acknowledged by the server and there was a correction received from the server. Not 100% on that tho.
At the moment when a player gains some resource I use a Client RPC on the player controller to show a little number at the place the resource was gained. Naturally there have become quite a few ways to gain resource and as such is leading to fairly consistent stream of RPCs. Is there a better way to do this with a property or is it fine just sending a bunch of unreliable RPCs?
Cheers in advance
u should use replicated variables if possible instead of RPC's
when ur actor "loses" a resource you can have that variable replicate and make the effect show on a rep_notify
that would be the least expensive way i belive
so it happens sporadicly and not in any specific order i would assume?
Well these are by definition one off events though basically. It's not exactly a "state" to keep in sync. I thought about how to use a property but it could get overriden by the next resource gain and trample the value that was in the middle of sending.
I guess I don't really know how much back and forth happens to "sync" a replicated prop vs fire a RPC and forget about it.
I could see RPCs being cheaper somehow depending how they're coded
that is indeed true, but ur unreliable RPC's also are not garanteed to arrive in bad conditions so u could run into the same issue
honestly it will depend greatly on what ur doing
if ur gattering resources rly fast u could possibly fake that resource gathered visual "pop" with a change in state and a timer
say for example, u have a var " ResourcesAreBeingGathered" that u can turn on and off
it turns on in the server, replicates to the client and on a timer u do the "pop" animation
locally
Yea that's possible with regular resource gains
it all depends on ur project
Some aren't as regular so that wouldn't work but maybe that's enough to just make the timed ones simulate it
is cheating an issue?
Could be a little weird if it's out of sync and the popup happens not when the resource incrreases but it's worth an investigate
how many players are u looking to support per server?
We want to be server authoritative
if ur not gonna have many people play at the same time just let the RPC's be lol
its not worth the trouble
Not that many, maybe 6-8 with a few spectators?
At the moment it's more like 4 or less
im by no means an expert, but ive been running tests on my game which is 3v3 and i have yet to have issues with rpc's
Given no clearly better thing has leaped out at me it's probably just best to leave it until it shows up in a profile as a networking issue
ClientUpdatePositionAfterServerUpdate() is called on tick of the CMC under certain conditions (looks like it would be only on the owning client of the character and if there was some data sent back from the server indicating that there was an update to their position)
const bool bIsClient = (CharacterOwner->GetLocalRole() == ROLE_AutonomousProxy && IsNetMode(NM_Client));
if (bIsClient)
{
FNetworkPredictionData_Client_Character* ClientData = GetPredictionData_Client_Character();
if (ClientData && ClientData->bUpdatePosition)
{
ClientUpdatePositionAfterServerUpdate();
}
}
RPCs for one time events that show some UI with how much was gained are theoretically fine. The main resource should of course be a Variable and not an RPC.
If you are worried about too many RPCs, you can add some central object, like a component on the PlayerController, which collects all the requests and sends an array of data instead of multiple RPCs if you get more than one event per frame.
@abstract pike
other question that i asked earlier but didnt get a response:
is there any scenario that you might wanna do logic inside tick istead of OnMovementUpdated in the CMC? or should i just do everything inside OnMovementUpdated as a rule? can i consider OnMovementUpdated to be like a second tick?
Thanks so much for the reply!
Yea I think early game the chances of multiple per frame are pretty low but perhaps late game there could be a few. In terms of "maintaining" that arrayy. When would you clear it? Just on tick? Because then if it fails to replicate due to a dropped packet or whatever then those will just be lost right?
Didn't I already answer that tick question yesterday or 2 days ago or so
i mightve missed it but i dont think so, u answered one before
You simply sent the array via one RPC and clear it then
i will do a quick search to see if i missed it
In theory there is nothing to place into tick in the cmc
Oh duh, you meant an RPC array not a property ๐ ๐คฆ
An RPC with an Array Param, yes
The CMC splits a lot of logic in tick, between all the proxies, between reconciliation and prediction etc. You should always use the functions matching your needs, especially if you do predicted movement. Tick is basically too early
I know very little about the overheads involved, when would you say it's "worth it"?
Like would 10 RPCs per frame be worth combining into one RPC with an array param? 5? 3?
I still feel it's basically the same question haha
I would just set up the system to always use the array solution
And then only sent when the array has an entry
Then you don't have to worry in the future
Epic does RPC batching for their systems too
Such as Gameplay Ability System
You can also not do it now and later refactor if you notice bandwidth issues or similar
I was going to say it could be worth it, but it's also like pre-optimizing before knowing there's an actual problem.
I think it's probably justifiable already and saves revisiting it down the track and going through the problem solving again.
Thanks so much for the help!
say i want to do timed speed increase in the CMC so that i have replication, i set my bool in the "SavedMoves" like ur suposed to, than based on that bool i do a timer to turn it off to end the speed increased in the "OnMovementUpdated". Is this a thing that you can do that wont break the prediction? if yes, is it a good or "correct" way to do timed moves in the cmc? anything that i should look out for when using timers in the CMC?
Usually yes but sending anything 'per frame' is going to get you eventually. Should always try to cap the send rate to something sensible.
Anyone else seeing a lot of this spam after upgrading to 5.3?
LogNetPlayerMovement: Error: FCharacterNetworkSerializationPackedBits::NetSerialize: Dropping move due to NumBits (4398) exceeding allowable limit (4096). See NetPackedMovementMaxBits.
We have a custom CMC, but we only have 4 extra bits added to the savedmove struct ๐ค .
Game seems to work fine, no obvious corrections etc.
General question if im unsure whether i want to do multiplayer because of general lack of experience and knowledge with mp stuff Do i need to decide right at the start of my project to make a multiplayer game?
100% you need to decide very early and focus on that.
Generally not recommended for beginners as multiplayer is a lot more complex than single.
is it possible to make an actor/component only tick on the client? i guess disabling tick initially then enabling it on beginplay if its locally controlled or the owner is locally controller
is there any difference in replicating a Anim Montage than a Anim Sequence?
Like, they should both work, right?
i dont think animation stuff is replicated at all
well at least animation blueprints arent
Well because I have tried to replicate the animation sequence of firing a pistol. Here's how I've done it:
I've followed through with breakpoints and prints and all nodes are valid (as in they are recieving data) but It keeps giving me a null error when it fires too.
Blueprint Runtime Error: "Accessed None trying to read property K2Node_CustomEvent_Target_Multicast". Node: Play Animation Multicast Graph: Server Function: Execute Ubergraph BP Third Person Character Blueprint: BP_ThirdPersonCharacter
Like I'm so confused lmao
I've done the same replication of Anim Montages as in the screenshot above, which works somehow (?) ๐
but maybe these kinda anims are not usually played in online games, something I haven't actually thought about nor paid attention to
Though the principle I've usually followed is replicate the data necessary to reproduce animation on each client
Though this node is odd, the client sends an RPC to the server and then the server multicasts the event. Why all the target parameters?
looking at my c++ code ur suposed to get the animation instance in the mesh
are u doing that?
something like this
im trying to do a dash in the CMC but im a bit stuck as to how i would pash the dash direction to the class and how that would work with replication
i mean, i can set the flag locally and it will replicate to the server CMC but how would the direction even be processed?
Hi folks
I am struggling with ISM for the clients.
How do you replicate AddInstance ()?
Does anybody know some common causes for this? when a client connects to server, the server will crash immediately. 4.27 steam advanced sessions.
Anything you add to the CMC must be done via the SavedMove struct, so it handles rollback etc. Override the CMC in your own code, make your own struct that overrides FSavedMove_Character and add your own data to it.
ok so if i can just pass that info in the struct what are the flags for?
you might use Cusom_0 to indicate that your dash direction was set for example
but what would be the advantage of that if i can just pass a bool for example?
im just so confused with the CMC
sorry I don't really have time to talk you through it.
I skimmed this tutorial and it seems pretty good, goes through the saved moves etc.
https://www.youtube.com/watch?v=17D4SzewYZ0
he does it for sprint but the same concept applies for anything you want the character to do
thats exactly the tutorial that i am following
and while he does half of what i need i still have questions
Question, I got a listen server and a client, the server player start camera is working fine, but the client doesnt seem to care about the second player start camera, not sure why, any ideas?
basically the angle the client is looking at is reset to 0.
while the server follows the playerstart properties correctly
must be a setting somewhere I cant find
Hi, just wanted to ask, cause i cant find the answer anywhere. I wanted to make a game for my friends and its like a murder mystery / among us / deceit in one. 5 players, 1 is a deadly creature, but acts as a normal player so people have to guess who it is and do everything to stop the creature. Exactly like secret neighbour. So, the question here is What replication type should I use for this game? I thought about listen server, but I get too confused about all of these types, so thats why Im asking here. Im kind of new in making multiplayer games, so any advice will be ultra helpful. Thx to all of you in advance, have an awesome day ;>
(Also im using blueprints)
how do i get a FUniqueNetId from a FUniqueNetIdRepl
There's no true Peer-to-peer mode in Unreal so you have to use Listen Server or Dedicated. For most casual games Listen server is the way to go to avoid having to get source build and host servers etc.
Thanks, Is listen server good for this type of game?
yeah it's fine
just means one player is the 'host'
all gamelogic runs on the host and is replicated to the other clients
I think it's to do with compression. If you send a bool every frame, you're sending 1 byte. If you use the flag, you're sending 1 bit. It's explained around 8:30 in the video.
so its just there for eficiency, in theory they are not needed?
Yes. The reason for using the flags is because this data is replicated every frame, and multiplied by the number of characters that are using this movement component.
So if you're sending that 1 byte for 10 characters, at 60 FPS, that's 600 bytes of data that has to be replicated to all the players every second vs what could be 75 bytes if you were to only send that bool as a flag. And the fact is, regardless, that 1 byte being used for the flags is already always sent, so there's no additional overhead by you utilizing what is there, but there is if you're sending your own variables in the structure.
Thx a lot!
seems a bit redundant unless u are doing something with a ton of players no?
i mean for ur regular 10 or so players game its not gonna make a diference right?
If I remember right, Unreal was designed to run on dial up connections, where you may only have maybe a max of about 6KB/s available so any bandwidth savings is good and allows your game to be played by those even with lower bandwidth connections and it can help facilitate a higher amount of players - only about 20% of the world is using broadband, and only about 40% if you only count developed parts of the world. Imagine using an additional 1% of available bandwidth per character just to indicate whether they're sprinting or not. Even if your bool isn't set true, it's still going to be sending its value every frame.
If anything adding an additional byte is redundant as the engine is already sending the flags byte regardless if you decide to turn on another bit within it. If you're sending another byte when all you need to send is a bit, why send the byte? It is an optimization, sure, but it's already built in, so you may as well use it.
Hello everyone, I want to learn how networking works and its basics in Unreal Engine. I know about Layer 4 networking, I'm currently unhappy with the netcode of the game I'm developing and I'm sure there's something I'm missing. Can you recommend comprehensive texts about Unreal Engine networking that I can read, apart from the documentation?
Read the pinned resources in this channel
Hey guys,
I am sending an Unreliable RPC to the Client on every tick.
If I mark this RPC as Client, it is called in the client at high rate like expected.
However if I mark it as NetMulticast, it is called in the client at a much lower rate.
Both tests running with only 1 client connected.
Is this the intended behavior?
How can I get the Unreliable NetMulticast RPC to get called at high frequency?
Thank you.
Okay, I just run more tests and got different results with the NetMulticast:
- If I run the server in the editor and the client on standalone, the client runs the rpc at slow rate.
- If I run the client on the editor and the server on standalone, the client runs the rpc at high rate.
- If I run both on standalone, the client runs the rpc at high rate as well.
So it seems like its a problem only when I run the server on the editor. But again, if I change the RPC to be Client instead of NetMulticast, then even when I run the server in the editor I get high rate updates on the client.
I'm trying to join a server though the IP, when I try connecting it doesn't allow me to join and gives me this error. When the server provider tested it however they were able to.
@flat halo calling multicast rpc on client is useless and will just get dropped
Not that i ever tried joining via ip but have you portforward?
Does the body of input handling functions, for example Move() or Look() in Third Person Template, registered with UEnhancedInputComponent::BindAction() run only on the owning client?
It depends on where you call it. If it's something the server executes, it'll try doing it on the server and likely result in either odd behavior or an error. Read the question wrong. I thought you meant if you tried to bindaction on the server.
There is absolutely no networking with input
I don't think I need to since this is a game server
Via Pingperfect
Might need more info here, are both the client and server built with the same online subsystem configuration (looks like null OSS here) and from the same commit?
They're both supposed to be using steam
If earlier you did a dev or test build, and this is shipping then you might need to do the Target.cs setup
But it'd be good to know the setup
I see. That is why in the code below I don't see any network mode check used in the input handling function.
// it is a function decorated with UFUNCTION(server) in the header file
void AMyCharacter::Server_HandleFire_Implementation()
{
// ...
GetWorld()->SpawnActor<ABomb>(...);
UE_LOG(LogTemp, Warning, TEXT(__FUNCTION__));
}
// No network mode check is used. It means that this body is always executed on the owning client, right?
void AMyCharacter::Fire(const FInputActionValue& Value)
{
// ...
Server_HandleFire();
}
Yes, input actions will only be run on the controlling client. Input components are only created on clients
good idea
I am not calling it from the client, I am calling it from the server.
to clarify and summarize:
- I am sending the RPC from the Server to the Client.
- The RPC is Unreliable.
- I am sending it on Tick.
- If I mark the RPC as Client, the client will have the _Implementation called at a high rate as expected.
- If I mark the RPC as NetMulticast, the client will have the _Implementation called at a much lower rate.
- The issue occurs only when using NetMulticast and running the Server on the editor.
and what is the difference?
I built the servertarget.cs as shipping
so did you build a game/client target with the same settings?
do I need a clienttarget.cs?
well if you make a dedicated client, then yes. but you need either a game or client target with matching settings
so these settings?
yes
Why doesn't UHT automatically define the body of GetLifetimeReplicatedProps()? It seems UHT can do it automatically based on specifiers we pass to UPROPERTY().
that explains it then lol
well they'd have to add something where you could define conditions and enable push model through a UPROPERTY() specifier then
What does " enable push model" mean?
push model is where you explicitly invalidate properties for replication rather than a comparison happening on each net update deciding it instead
see PushModel.h
What can we infer from each of the following cases? GetLocalRole() returns ROLE_Authority but GetRemoteRole() returns
case 1: ROLE_None (I guess it is a pawn that is not replicated)
case 2: ROLE_SimulatedProxy (I guess it is a pawn spawned on a listen server and controlled by it)
case 3: ROLE_Authority ( I have no idea)
It seems it is impossible for both local and remote roles to be ROLE_Authority.
None: Correct, non-replicated actor.
SimulatedProxy can be any actor that is replicated from the server where AutonomousProxy would be a replicated actor that is player controlled (eg. their player controller or possessed pawn).
You can't have both a local and remote role of authority.
Hello, how do I persist data stored in player state when using seamless travel?
I have searched around and found that I had to override CopyProperties and OverrideWith and grab the values from there
But the function doesnt seem to be called when I travel to new map, is there something that I might have missed or overlooked? Or my approach can be done better? Thanks!
What are non-replicated actors available only on the clients when the game starts?

the hud (widgets)?
Im kinda new too but u can get more information here
https://youtu.be/Hsr6mbNKBLU?si=qoB0Dqgm9VUL3mOE&t=654
๐จโ๐ซ My Patreon link:
https://www.patreon.com/kekdot
Download Project Files | Premium Tutorials | Courses
๐ฆ Get our Game on Steam | Kekdot Center:
https://store.steampowered.com/app/1487180/Kekdot_Center/
๐ง๐ปโ๐Support us on our ๐ฒPatreon for awesome benefits: https://www.patreon.com/kekdot
In this video we talk about the Unreal Engine Multi...
AHUD is created locally by the player controller
though I'm not sure of the context of the question. technically the game state (an actual replicated actor) is guaranteed to be valid by the time BeginPlay is called on pre-existing actors
World settings might be non replicated? I'm not sure on that one.
I think it's probably local only.
Oddly enough it is
The level script actor also is
World gravity and time dilation are replicated properties in AWorldSettings
I see. I guess those can change!
What is the blueprint equivalent for GetNetMode()?
Depends what you're using it for, I guess?
I want to print the net mode in the begin play.
This is the closest I know of.
Too complicated in blueprint. ๐
Inclusion of standalone for completeness ๐
ok so lets imagine for sake sake of understanding the CMC better that i throw optimisation and best practices out of the window and that i have unlimited bandwwith, could i just ignore the bit flags alltogether and just pass a bunch of variables in the SavedMoves struct and it would work the same? i could simple ignore the function "GetCompressedFlags" and not override it at all then?
if i run out of bit flags, does the engine have support for me to make my own or do i just switch to regular variables?
why is my server not showing on the steam playtest?
Right, i misunderstood mb
@fair latch so, I found out is not something specific with the multicast RPC. I tried with the replicated property and it also has low frequency. I think the problem is something related to playing as the server from the editor, maybe something specific on PIE, that is limitting the rate of this messages. In standalone it works as expected. I havent changed any editor config, I have all on default. I will dig more into it.
From where can I set bReplicates of the level actor to false?
The level actor has bReplicates=true by default. I want to change it.
It might be too late if I set it from Begin Play.
I made a new level script actor in blueprint with bReplicates=false. Now I cannot change the default level script actor to mine. How to do this?
I really can't answer a question like this as I myself have limited exposure to the CMC and haven't done tons of research in to how it works.
If you modify the flags, then it's relatively simple as the CMC is already set up to read and pass along that byte, and check things based on the values in that byte. That's about the extent I even know about the CMC.
From my understanding of Unreal and the CMC, what you're saying would seem correct. If it's a structure of data being sent and if you are creating your own child version of the structure and adding more variables to it and sending that structure instead, then it should theoretically be received by the server. I would think the difficult part is having all the parts of the CMC decipher the new data of that custom structure and apply it appropriately by overriding anything that needs to interpret that data (I don't know what does) and that the server could appropriately play back and handle corrections of the moves based on that new structure data (I wouldn't know how to do this really) and also ensuring that any moves based on the new data of the structure are appropriately replicated to other clients.
thank you
Click on "Class Defaults" at the top, there'll be a replicates option on there.
Is it possible to check if an AActor is owned by local player controller without actually knowing what the Actor is? Like directly getting the top of the ownership chain to see if it's local player controller?
Hmm I believe AActor::IsOwnedBy() would work?
theres a function for that