#multiplayer
1 messages Β· Page 559 of 1
if everyone is using a desktop, 33k Actor level is spawned and ready for play in ~12 seconds
fully networked
You are sure I'm guaranteed to have GS within the actor's BeginPlay? Even for join in progress?
we do everything locally, spawn all Actors on a level from a seed, then lie to the engine to get them to behave like they were loaded from package
@winged badger How does the "lie to the engine" part work? Where can I start investigating?
unless you are using GameModeBase
yes, @jolly siren
just check AGameState::OnRep_MatchState
okay awesome, thank you
@floral crow having IsNameStableForNetworking and IsFullNameStableForNetworking returning true on instances of those Actors
setting their bNetLoadOnClient and BNetStartupActor to true during deferred spawn
and ofc spawning them with exact same names on server & clients
via FActorSpawnParameters::Name
Interesting. What are the main benefits of this trick? I see "client never has a nullptr when searching for the object", but what else
procedural generation
we have... prefab assets which is usually a building, city square, etc... which can hold other prefab assets
so we use Actor tags on the prefabs for marking instances that should behave like they are loaded from package
Yeah, but you can do the same without faking that they were loaded from package
we also mark anything inside prefabs as EditorOnly inside the Editor, so you can work on level and it doesn't get cooked then destroyed
yes i can
but then relevancy works differently
What are the benefits that a Loaded from package Actor yield instead of just relying on normal replication
NetStartupActors don't get destroyed when they are not relevant
those with dynamic NetGUID do
they are also all NetAddressable without having to be replicated
something we leverage heavily, replicating 2200 Actors through 16 Actor Channels via FFastArraySerializers
so none of our interactables, pickups, etc... are actually set to replicate via their own ActorChannel
which drops the considered actors number from 2600 to 400, makes server perform far better
we also pre-load all the assets for selected level asynchronously in the lobby
which drops the considered actors number from 2600 to 400, makes server perform far better
Does that yield similar benefits to grouping actors on a replication graph node?
replication graph doesn't do as much, its basically improved relevancy mechanism
it results in server having to evaluate less actors per data channel
but doesn't reduce the number of replicated actors
replication graph is generic though, while our network managers are tailored to fit our interactable actors
It looks like it is actually AGameStateBase::OnRep_ReplicatedHasBegunPlay that calls BeginPlay on actors clientside
ah and AGameState::HandleMatchIsWaitingToStart()
Regardless it looks like GS is indeed guaranteed
Hello, i want to replicate vector. is there a better way to replicate the vector?
can I compress the vector?
Just replicate the vector. What's the problem?
Does it change every frame?
You can set the replication net frequency.
FVector_NetQuantize10 will round to 2 numbers?
We divided the world in a cm by cm Grid, and just send a Grid index (int32) as position. Though this is because our game allows for having those discrete steps in movement instead of the ""continuity"" of floats
This incurs in perf overhead for both client and server so bear that in mind, but we're replicating over 500 permanently moving things so cutting down network bandwith is top priority
Hi all. To properly "network" a physics movement system, would it be enough to properly replicate a Pawns Location & Rotation or would I have to make sure that the Thrusters I'm using are replicated as well? And if someone is willing to answer some multiplayer questions directly please hit me up with a PM.
if (HasAuthority)
{
FVector XShipLocationLocal = GetActorLocation();
FVector_NetQuantize10 XShipLocationLocal;
XShipLocation = XShipLocationLocal; //XShipLocation - Replicated property
}``` it is right?
And has anyone any practical experience with hosting dedicated servers and what the costs for that could be? Which services are you using and why? I read that about 90% of multiplayer games are using AWS / Gamelift.
@grim lintel start by looking at the already existing physics replication system.
@grim lintel there are a lot of tunable parameters there, it's not very well documented, but it works pretty good. It's basically the state synchronization approach, where the simulation runs on both ends, and is periodically corrected from the server to the client
@dark edge Which one do you specifically mean? Would you recommend that for a racing game in general? I've followed a tutorial once where they built the same system.
@dark edge And many thanks for your answers by the way
@grim lintel I haven't messed with it a ton, but I would guess that it would work decently for a racing game, with the probable exception of client to client collisions.
That is, if everyone's local simulation is predicting ahead of the server. if there's no prediction, collisions work just fine
The problem with client to client collision is that both clients see themselves in the future relative to the authoritative server position. You were under the same problem at the race finish line. If you have prediction, two cars can each see themselves win.
Yeah makes sense and on the same time would be a problem since player to player collision would somewhat be a necessity (also in terms of your mentioned problem with the finish line)
@dark edge And sorry to bother you again, but where can I find the specific physics replication system you mentioned?
In project setting search for physic replication settings. Yes, it has that typo, or at least it did
those are the settings that control how things are handled when you have replicate physics to autonomous proxies checked
@dark edge Alright thanks man
how would i make it so that a player could pickup another player like dead by daylight
Hey guys! I'm trying to figure out how to do different gampad input mapping per splitscreen player...
is there something built-in for that?
One thing i don't understand is how input is consumed on the server. Whenever I call GetLastMovementInputVector or GetPendingInputVector on the server it returns zero. How does the server validate moves if this is the case? I know it has the value somewhere to replicate the move but how can I access it?
@grim lintel AWS GameLift can be expensive, but their entire ecosystem is at your disposal. There are cheaper alternatives, like Playfab for example.
Gamelift is relatively straight forward to understand and implement.
AWS Documentation though leaves a lot of "gotchas" lying in wait. But nothing that cant be overcome.
I'd be astonished if anything like 90% are using gamelift specifically
as opposed to using AWS generally
although if you're going to build your own gamelift style services there's cheaper cloud hosts than AWS too, you pay for the ecosystem
AWS is too expensive.
anyone got boost asio io_service working?
anyone know why my gamename is "Unreal Test!" when using a dedicated server? on steam
because you didn't set UE4_PROJECT_STEAMGAMEDESC in your Target.cs
An overview of Online Subsystem Steam, including how to set up your project for distribution on Valve's Steam platform.
@lost inlet thank u!
Hey everyone, just looking for some advice on voice chat. I was looking into Vivox but that seems a bit overkill for my needs. I'm working on a 2 player Co-Op game which uses steam sessions. Just need the two players to be able to talk to each other in-game as there are public lobbies for those that want that. What is the best way to go about that?
C++ or blueprints is fine, just looking for something that's simple and reliable
@limber musk Steam parties support VOIP.
Vivox maybe overkill but it is a very robust solution.
And relatively easy to setup.
It manages everything, its extremely easy to use from a technical perspective.
Hey how do i setup a web browser multiplayer session? I dont want the players tk have a lobby i want them to automatically be assigned a session and enter it
I'll check it out @fossil spoke Thanks! I think I looked into it a while ago but didn't get very far as it seemed to be having some issues
And yeah vivox seems good but I was a bit put off by them saying you need a server to assign tokens
didn't really want to host one just to do that when the actual game is all handled by steam / p2p
I dont think thats a requirement. Its a security measure.
You can issue tokens automatically by the game
yeah true, I'll have a look into it more. Might just be the best option
that might be fine for my game
Can I replicate only part of an actor?
Define part
I have an actor with VehicleMovement component. It has 2 skeletal meshes, one that fits the vehicle, and one person on top of the vehicle. The vehicle is going to be invisible. Do I need to replicate the vehicle to see the movement of the dude on top?
The vehicle needs to be replicated for the movement to work in multiplayer
Dunno if VehicleMovement even supports MP tbh
It does, I've tested
The thing is, there's a really nice vehicle plugin on the Marketplace but it explicitly states:
Network Replicated: Replication, Client side prediction and server reconciliation have not been implemented yet.
In other words, it doesn't work in multiplayer
How much groundwork would be required to convert something like this into multiplayer?
I mean no matter what the plugin is using, shouldn't it be a matter of just replicating the actor location/rotation?
So the non-character movement discussion is a bit of a recurring one in UE4, but here's a short version : movement replication is extremely intricate and difficult, and UE4 only does it for Character right now
There are different possible approaches, though UE4 complicates things by not having a deterministic physics engine
There are two options basically : client-authoritative (keep your physics vehicle and RPC the transform & velocities to the server to be replicated to other clients), and server-authoritative (client RPC inputs to server and simulates, server simulates, client reconciles server sim with his local one using rollback/replay)
Fortnite does #1 with massive cheat detection since it's fundamentally unsafe
Character class does #2
There's a pretty nice Udemy tutorial that teaches #2 in C++
What kind of replication are you talking about though? I don't want anything replicated beyond possibly location/rotation. Think: MarioKart (arcade-style) Instead of full-blown replication of everything that happens with the vehicle
I'm talking about a vehicle moving
Got you
@bitter oriole check this out.
https://poyoworks.github.io/ArcadeVS_DemoProject/
You think replication on something like this would be easier? He doesn't seem to be using Unreal's Vehicle System
ArcadeVS is a code plugin with content. The main Vehicle System is just one C++ class that inherits UE Pawnβs class, itβs self contained
All he's doing is inheriting from Pawn and going from there
What I described was for a simpler case than this
But my question is why would figuring out replication on something like this be difficult? All he's doing is inheriting from Pawn and nothing more
Well, movement is hard
You want no interruption of movement - actually no interruption of velocity
You also want different clients to see the vehicle close to where it is on others
And you have to do this with a physics simulation that behaves differently on each clients, network packets that fail to send for multiple frames at a time, lost packets, cheaters
It is very hard to replicate something as simple as a balloon that has no collision or turning and just moves around with the wind
So of course a physics-based car is not easy at all, especially if it was not built with multiplayer in mind
But you don't need to ask me, the author of your plugin explains it too : https://poyoworks.github.io/ArcadeVS_DemoProject/v11_update.html
Current state is that it works on the server, the remote clients but not the owning client
Which is approach #2 that I described :
client RPC inputs to server and simulates, server simulates, client reconciles server sim with his local one using rollback/replay
The reconcilation here is the hardest part
So maybe wait for the author to complete MP support and don't plan on it in the meantime π
AMasterPlayerState* NewPlayerState = CastChecked<AMasterPlayerState>(NewPlayer->PlayerState);
if (NewPlayerState)
{
const int32 TeamNum = ChooseTeam(NewPlayerState);
NewPlayerState->SetTeamNum(TeamNum);
UE_LOG(LogTemp, Error, TEXT("TEAM NUMBER %d Assigned!"), NewPlayerState->GetTeamNum());
}
Super::PostLogin(NewPlayer);
I am trying to assign the teams when player spawns
it assigns the team on post login but after the player is in map it reset's all to 0
How can I fix it?
It doesnt reset
Your PC instantiates its PS in PostInitializeComponents
Also i dont see you assigned yours
But basically, you want to di stuff when PS is spawned, override PostInitializaComponents on the PC
NewPlayerState->SetTeam(TeamNum);
And where is ir assigned to playervontroller?
Unless its assigned to the PC
That player state you made has lifespan of your postlogin function
As i said, override PostInitializeComponents on the PlayerController, NOT PostLogin for that
ahhh ok
So I shouldn't do this in GameMode?
gotcha
lemme try
So basically I just need to create override function of PostInitializeComponents
and call super::PostInitializeComponents()
in it right?
Hello guys. i have problem with the respawn of the BLU TEAM. In the RED TEAM at the begin the find player work and all player can spawn with different position, when i try to do the same on the blu team, only the fisrt work. I think is a player start/find start problem because if i move the first player spawned on the blu team, a another player can spawn.
GameMode caches first Start it finds in StartSpot variable in the PC
there is a gamemode function ShouldStartAtStartSpot, or soemthing like that
that will by default return true
is find player start?
and basically make you reuse the cached StartSpot every time
its not exposed to BP
so its pretty much, cached (first) start location, c++, or teleport after respawn
i would never do any networking in BP
Zlo, I tried but I still can't figure out how to fix the issue of team not setting up
its so much tidier in c++, and BP only has about 10% of networking tools available
yeah, only GM won't call that function
for respawns
because of this one
why in the red team all is correct and work?
/** Return true if FindPlayerStart should use the StartSpot stored on Player instead of calling ChoosePlayerStart */
virtual bool ShouldSpawnAtStartSpot(AController* Player);
which is, imo one of the most unneccessary engine functions of all times
my guess is because it finds red teams PlayerStarts when it runs first time, probably before you assigned teams
and caches those in the PCs
just a common question, how would i archive something like a global chat for steam sessions? would that basically mean everyone is in the same session?
Good morning. I've learned that RepNotify is for state and Multicast is mostly for instantaneous cosmetics.
If one has a door open, and that door plays a creak sound effect, should I use an OnRep function for setting the door to remain open but a multicast event for playing the animation of the door opening and the creak sound?
Or if I'm using RepNotify, should I just piggyback off that call? But then in that case I need to put in conditional statements so that the creak doesn't play when a new player logs in right?
Any advice would be appreciated. Cheers.
you don't be able to distinguish new player logged in
piggybacking from OnRep usually includes Timestamp and synced network clock
Is piggybacking preferable to calling an OnRep and a Multicast simultaneously?
its less work to do OnRep + Multicast
and blueprint doesn't really have an elegant way to handle timestamps
@winged badger I have try to change the position of the blu team and now it's work. I have leave one player start for team and now all my 4 player can spawn.
Thanks, Zlo.
hey. im not sure it is multiplayer related issue, but..
we running dedicated (game) server on a physical dedicated server and sometimes the dedicated server process not using cpu anymore.. (and even no networking usage)
process still reply and answering so the process itself not frozen, no crash... console just simply stop working and not using cpu at all, no new line in the log..
server os: win
we using steam subsystem / networking.
anyone noticed this weird behaviour or saw something similar?
Are there any guides/documentation on replication on VehicleMovementComponent?
I'm not sure if I'll make sense when I ask this so sorry in advance π but is there a way to use the code from this video https://www.youtube.com/watch?v=09yWANtKmC8&t=653s and make it so people can name their servers, similar to wolf quest? If so are there any easy how to's on it?
Creating a networked multiplayer game isn't easy, but Unreal Engine's gameplay framework is designed to set you up for success. On this episode of Inside Unreal, Technical Writer Michael Prinke will cover fundamentals such as the server-client model, various features of replic...
Hi, I want to spawn separate Server/Client processes so I can attach a debugger to the server one. Any ideas on how to do this?
What I've done so far:
Open 3 visual studio instances. Select DebugGame Server on one of them, and then I tried setting Development Client to the others but it's complaining about some COOKED stuff missing
I'm confused about what I need to cook for Development Client configuration to work, because I've done nothing special for Server and it is working out of the box so...
What you need is cooked content
Alternatively, just use Development Editor with -game parameter
But how can I make them talk to each other
Where do I specify the same 127.0.0.1 address or something
The clients would connect to the server
"open localhost" in console, or use sessions
Hi, so i was trying to google around for something like a global chat (like everyone that plays the game is within the chat). Cant find anything about it.. anyone has a idea?
can i check authority in component?
for example
if (GetOwner()->HasAuthority())
is it possible to get floating pawn movement to replicate
would i need the source version and were is it located
You would need a few weeks of serious multiplayer work implementing prediction/rollback/replay
Source probably not required
It's not like the floating movement is a lot of code to simply copy if you have to
Would I basically use a lot of the same code from CMC net code
If you feel like cherry picking about 15,000 lines of C++ while checking if you need them
I've done basically what you're doing and writing it from scratch was about 2,000 lines instead
You'll need to get a deep understanding of the mechanisms, so might as well write it
Pls is it possible to setup a team death match game mode using only BP?
Now will this break if the game engine is updated
Or will the code stay there
Because I plan on moving to UE5 when it comes out
There is no need for any engine change
The code may or may not need upgrade for UE5, no one knwos about UE5
@slim matrix You're basically just gonna be making your own floating movement. Nothing will break because it's your code, not engine code.
@frozen brook yes
Alternatively, just use Development Editor with -game parameter
@bitter oriole I went with this and it worked. Thanks!
I've realized that when doing a Seamless travel to my InGame map, BeginPlay is called on my LobbyControllers before the AGameModeBase::SwpaPlayerControllers(LobbyController, InGameController) gets called
This is causing my Lobby controllers to never be destroyed. How can I prevent this initial call to BeginPlay from happening? Using GameMode and GameState derivated classes (not GameModeBase/GameStateBase)
They're not being destroyed because of Line 627 returning true
does this add up to be 120 ms RTT, or 60 ms RTT?
@winged badger I'm new on programmer and don't know the c++. I'm just make a prototype for learning ue4 and replication.
I have try to set 1 only start player for team and set the position in the sky and all player can spawn and fall into to the map. I think is a problem with the player start and the collision but I don't understud where is the problem. If a first player move, a another player can spawn. It's not only the problem of one team. In a another map red team and blu team are stuck, but if I set the player on the sky all work. I'm just learn what happened.
I've been trying to use UE4's multiplayer system using blueprints, and have been experiencing an issue with client player controllers coming up with 'none' as their possessed pawn, even though the possession works completely fine on the server side. I've been struggling with this for hours and Google has yielded useless results, so any help would be immensely appreciated
@tiny arch When do they come up with none?
Pretty much as soon as the game runs.
And does it ever fail if you get possessed pawn later? I don't think the possessed pawn is guaranteed to be replicated at begin play
There's some other event that is guaranteed to run last, dont remember what it's called
I've been fiddling around, and I think you are right on that being the issue
I was using the On Possess event on the controller to trigger the reference casts because I figured that wouldn't run until the pawn was replicated and possessed on the client's side, but it doesn't seem to work that way exactly
I switched to using BeginPlay and threw a 0.5 second delay on there before the references are set, and it seems to work now
The engine still throws out a ton of "attempted to access None" errors though
@dark edge thank you for your help btw
@tiny arch ideally, you'd use the override of OnRep_Pawn or SetPawn functions in c++
the reference to your Pawn is set when the controller Possesses it on Server, and unless you did some custom spawn logic for controllers/pawns, the reference to the Pawn is set and replicated by the time controller calls BeginPlay on clients
that does not mean the Pawn itself replicated by that time
oh huh, that's good to know, thanks @winged badger
I do have some custom spawn logic, but it's nothing too fancy
It's just a simple system for giving different players the pawn they chose, and spawning them at the right PlayerStart object
all replicated variables that are set on server on the TIck the Actor is spawned in are replicated in the same bunch as the instnructions to spawn the Actor
and the replicated variables are set, and OnReps called before BeginPlay
that is guaranteed, can't break due to poor network conditions
however if those variables are references to replicated Object that wasn't loaded from Package, there is no guarantee that Object replicated by that time
would the best way to avoid that just be to include a delay on things?
or is there some way I can use events to trigger things in the right order?
so your client instance of replicated Actor got a valid NetGUID, but it can't be resolved yet
there is, but its difficult with BP alone
c++ has a ton of functions that are not exposed in BP
yea I really need to work on learning C++ for Unreal :(
well, even a small code trips can yield significant results
I know a bit of C++, but using it with UE4 seems like such an extra layer of stuff to learn that I've been putting it off, to be honest
say you insert a c++ base for your PC
add
UFUNCTION(BlueprintImplementableEvent, Meta = (DisplayName = "OnRep_Pawn"))
void K2_PawnReceived(APawn* NewPawn);
virtual void OnRep_Pawn() override
{
Super::OnRep_Pawn();
K2_PawnReceived();
}
added that to it, with implementation for the override in .cpp, not .h
your BP controller would get an event called (in blueprint) OnRep_Pawn that would get called as soon as the replicated Pawn variable changes, or its NetGUID is resolved
hm ok
you don't need to be c++ expert to get some benefits
this is slightly going over my head (which is probably part of why I'm struggling with multiplayer so much), but I definitely what to utilize that, thank you!
If a variable is marked as replicated and expose on spawn, when the server spawns that actor should the clients receive the replicated value?
I'd assume that the server would create the actor with the non default variable and then when it's first replicated to clients and they're told to spawn it, it would have the same non default variable. At the very least the next netupdate should have it.
hey guys, what's the best way to replicate player aim in a top-down game? seems like calling a server rpc every frame from the autonomous proxy generates just too much traffic. is there a way to throttle my ServerSetAimLocation() rpc, or maybe there's another way to replicate aim position from owner to server?
@kindred widget - I'm spawning a pawn with a replicated structure (exposed on spawn) but it's sticking to the default values (and I've verified the server is setting this correctly in the Spawn Actor, and I've tried to set them after the actor is spawned using a normal 'set' operation) but they aren't sticking.. I've checked all the idiot stuff (i.e. I'm not overwriting it, etc.)
@pliant belfry Do you mean for stuff such as showing other players which direction a player is facing, or something more like current mouse aiming position?
I have a bunch of stuff tied to 'aim location' - things like aim offset, head and weapon IK rotation etc
so I need a more or less precise vector3
@soft shell So if you set it to expose on spawn and set that when you spawn it(And spawn it on the server), the value is different on the server than it is on the client?
@kindred widget Yeah, the struct is just two bools (default = true), and on the server they are both set to false and that is passed into the Spawn Actor (verified).. then on the client the spawn actor is testing the bools from the replicated structure and they both appear true
Odd. What happens if you set them to true and then after a small amount change them to false? Does the client's update then?
Tried that, stuck a 1 second delay in.. and redid the "set" on the server to the replicated variable and it's still the same.. it's weird
The actor is a pawn.. but I mean it's worked (i.e. replicated) perfectly everything else it's needed too
Just decided to add in some settings to control it's appearance when spawning on server
@kindred widget - hmm.. The structure comes from C++ and the variables are marked as NotReplicated.. probably the issue π€
NotReplicated props in a struct, won't be replicated, so that would be the issue
Yeah; stupid copy and paste issue - working now
So ive got a basic actor with a skeletal mesh that moves, enabled both replicate and replicatemovement
Just setting its location on the server, however on the client its very jaggy
anyone knows why?
@gusty raptor That's perfectly normal, replicated data can't have a nice reliable 60fps update rate, instead some packets are lost, packets arrive in groups, don't arrive for fractions of seconds, etc
"Replicate movement" doesn't work for movement, ironically, it's only viable for replicating a spawn location
If the movement is predetermined (vehicle on track etc) you'd just have the server tell the client when to do the animation and let the client handle the movement entirely
If the movement is, like, player input or AI, then you need a better interpolation method that accounts for velocity, measures the average update rate and interpolates cleanly between net packets
Good morning. If in a shared-view four-player game where everything is relevant to every player all the time I want to play a shake, sound, and particle effect in the event of a player character dying, is there any reason I would use RepNotify for that?
This seems like a use case for a multicast event to me but any advice would be much appreciated.
@waxen socket You would use a multicast for that. You would use rep notify for state updates, like whether or not a door is open, or the state of a flag or whatever
Though arguably, the state of being dead will be sent to the player no matter what, so there is no need for an additional event
Multicasts are useful when there is no replicated state associated, or when the state changes somewhat quicker than replication updates but the event absolutely needs to be sent
Yeah, this specific setup would be kind of an in between.
Hello I have been having a huge problem with multiplayer replication for 1 specific thing for a long time
It also depends on if late join is a thing. if someone joins the game while somebody is dead, do you want to play the event
@uncut schooner well spill it.
Basically when I make a replicated projectile and set its visible part to be at the 3rd persons muzzle so the others can see it
@bitter oriole I prefer to leverage rep notify as much as possible
It only works properly for the server
the clients muzzle position seems static for some reason
Ill get a video
@uncut schooner is the animation working correctly on both sides?
Show us where you tell the projectile where to spawn
Okay
It will take a minute sorry, pc is slow and I gotta delete the mistakes I made to try to fix it
Thanks, Adriel, and Stranger. I'm always wondering if I should split my calls into separate OnReps and Multicasts or just combine them. But I figure one of the advantages of splitting it is that the effects won't play when a new player joins, right?
Its also very laggy, I am such a noob at networking
I watched many tutorials still cant figure it out
@Thomas H.B#536 can't see anything in that video, just post a screenshot of the area where you determine where to spawn the projectile
I was going to release my game today, but I found that the crossplay between Android version from google play store and PC version from Steam store over LAN is not working again. Does this have anything to do with store version numbers?
if it is version numbers, it wouldn't work over the internet either
ah, then it might be
I remember upgrading it to 4.24.3 because 4.21(?) was breaking crossplay on LAN when I did shipping build but not when I did development build
When I upgraded it magically started working
But then when I put out shipping builds it acted like it was dev build
Then I fixed that somehow by trying to build again and now it doesn't work with LAN crossplay.
So anyway what I'm doing now is I upped the Google Play store version one more number higher, rebuilt and about to push it to google play store, but I don't know how to tell the Steam store version to match that.
In the project settings?
unless you manually gave it version number in defaultengine
oh let me check defaultengine.ini --- in project folder?
config folder
no, its one bit of information i never had to use personally
so i just remembered enough to find it if i ever need it later
I don't find anything that isn't already in project settings there, in my project's config folder's defaultengine.ini
Is it related to this?
https://answers.unrealengine.com/questions/162080/view.html
Good afternoon. Should I expect a lot of difficulty replicating the **physics **movement of fifty or fewer static meshes?
It's borderline impossible really
Not until Epic's new internal physics engine is production ready
And only if it holds up as we hope it will
Really? Cause I've read if it's just static meshes, it's not that difficult. Is that not the case?
You're talking about physics
UE4, like a few other engines, uses PhysX which is not deterministic
So the only way you can sync physics is by having the server run physics and all clients run with no physics, reproducing the server movement after a few frames
So it's not going to be interactive
I see. By not interactive, you mean the latency will be too bad to use the objects for any gameplay purposes.
Yes
Dang. I just want some boxes to float across the screen and bump into eachother. π
The other option is to integrate another physics engine into your game, ignore the UE4 physics, and synchronize the state (transform/velocities) of each physics object
Well, it looks like Chaos will have "PhysX parity" by 4.26 so maybe that will be my savior.
My game won't be finished for another year or two so maybe I can just wait for Chaos.
My advice would be to not assume Chaos will solve this
Oh, I see.
Epic does want Chaos to be multiplayer capable, but right now the bar is very low, and what you need is not trivial
So even if Chaos is way better, it's not 100% certain it will work well
Hm. Okay then. I'll look into other physics engines. I'm surprised I saw so much forum talk about replicating static meshes with a couple check boxes. I guess they must have not needed it to be accurate.
You can definitely have a static mesh that teleports to its last know location every few frames with a couple of check boxes
You won't like it though
Basically I've heard that Fortnite vehicles run entirely on the owning client, so the player has perfectly smooth physics, and then the server replicates that result, with massive anticheat checks on top
It's clearly not ideal, but doing better is a tall order
That's a good insight.
I need more or less exact locations as it's a space shooter so players have to see these boxes in the same spot as they float by.
Well, you might get away with something for that case
Run physics on server, keep them off on client, and replicate the transforms & velocity with a nice cubic interp
Assuming the boxes are big enough, the slowness might work in a space context
The boxes are about a twelfth the height of the screen.
Welp
As is the player.
Basically, I'm making this with physics boxes instead of enemies: https://youtu.be/W4ZXyiAvb-I?t=1344
About that scale and pace.
If it's a space shooter, I wouldn't even use physics
Do kinematic movement in a style similar to character movement
But I like the way the boxes collide.
We're back to the "custom physics engine" option, and well, you can write a simple one yourself tbh
Other than that, Chaos I guess
If we're talking about "open space" as in deep space, how often are collisions going to matter realistically
Collisions between players are always going to be screwy whether it be physics or kinematic
Thanks for chiming in, Jambax, I always appreciate your input. I'm afraid I don't know what you mean by "kinematic movement".
I don't need collision between players.
Essentially instead of checking "simulate physics" and applying forces
Just between the boxes themselves.
Just calculate the changes in position/rotation yourself. Run that in your own loop that you can control
That's essentially how character movement works
Thanks for the advice, Stranger.
multiplayer just makes everything 10x more difficult
I'm learning that, yeah.
π
Okay, I'll look into kinematics. Time to brush off my math, I guess.
Jambax, earlier I was asking about RepNotify again. When an event has a cosmetic component, and a stateful component, do you split the execution into an OnRep function and a multicast event or do you do everything in the OnRep event?
It seems to me that when a player dies, I would run an OnRep function to set his status to Dead but I would play the death sound, screen shake, and particle effects in a multicast, no?
I'd just do it in the onrep
Really... okay. I'm surprised because then what if someone reconnects or joins late, wouldn't the OnRep go ahead and play the screen shake and everything again as they synced to the server?
They would but you can protect against that easily by checking the creation time of the actor
if (GetWorld()->TimeSince(CreationTime) <= 0.f) { return; }
Or you can check how recently the player logged in etc.
And that's what you do in your work? You check that stuff all the time? You like it that way because it means your game never misses a beat because a multicast failed to replicate?
Well it just means we don't have to waste bandwidth when the info is already there
We do this for all our muzzle flashes for example (wrote a post about it)
Yes, you shared that with me.
And in a 100-player shooter that's happening quite a lot
If you only have a handful of players it might not be a problem RE bandwidth/performance, but maybe you might run into an obscure issue where a player is playing a "death" effect but the "bIsDead" value hasn't replicated yet or something
Might be okay in that case, but in others you might need the full state to be up to date
Yeah, mine's four-player.
yeah rgr, so for four-player I wouldn't be remotely worried about bandwidth issues
So it's whatever is easier really, and whatever is less prone to error
Oh... now I'm really surprised.
I never thought you'd let me get away with multicasting.
haha well, I generally avoid them. In this case to me if you're already replicating a var, the multicast is wasteful
There is that issue where coming back into relevancy/late join can cause the FX to go off, but that simple check avoids that
Yeah, that's why I'm hesitating. I'm weighing the pros and cons of either multicasting, or putting a bunch of checks everywhere to account for reconnecting and late joining.
The whole OnRep concept is pretty powerful, you can do a lot with it
Googling...
OnRep == rep notify
Oh, you just mean the OnRep function.
yeah
Yeah, I agree. I've been pretty impressed by it. Since you advised me on it, I've been replacing all my multicast events with OnReps.
I just wanna be like you.
Yep. It hasn't been easy. But I'm stubborn.
Thanks for the advice. I'm going to look into implementing CreationTime checks and the like.
Something does irk me about making two calls for one effect so I think I'll like it better that way.
It's worked really well for me doing it this way so far for sure
Cheers, Jambax. Have a great day.
I have doubt that it is possible to make a feature like , In a multiplayer game one person should be able to tag along with another person (Example :- A tour guide shows the places to the tourist) Not like the tourist should the following the tour guide, the tour guide must a have a control to make other player to come along with him. I saw this kind of features in some game like we walk with a NPC which tells us the game's story after that ends we gain the control again and we procced the game. Is it possible to make like this in unreal engine?
I am building this feature for a game where i show the places of a house or something like that to other person.
Hi, I hope you can help me because this has been stumbling block for me along time now and it's demotivating me from starting to learn to make games.
What I want to use is a dedicated server for my games so I could host the server as a standalone solution.
I have read on how to build a dedicated server, that I can google quite easily. What I am struggling with is how do I use blueprints or code to create server-side logic. What I also would like is instructions or examples of what it looks like if I use a dedicated server how the client code would look like and how the server code would look like if I have a shoot functionality for instance or melee abilities for instance.
@eternal kite im no expert, but i feel like thats possible, in that you could have one pawn (character) that the guide owns and controls (along with their camera) and then another camera attached to the pawn, that the tourist owns.. seems totally doable.. you'd just have the tourist "posses" the second camera i think.. or even more so, if you only had a single camera (only see what guide really shows) that would probably be even easier.. but.. you'd probably want two cameras and then give the guide the ability to point the tourist camera at something when needed
@stoic dirge probably want to start with this http://cedric-neukirchen.net/Downloads/Compendium/UE4_Network_Compendium_by_Cedric_eXi_Neukirchen.pdf it talks about the RPCs and what gets run where
I am actually completely new to unreal and i dont know rhe technical terms if you have seen any documention or tutorial abt this can you please share it @teal path
@stoic dirge also this has been updated a lot, and is pretty useful https://docs.unrealengine.com/en-US/Gameplay/Networking/index.html
Setting up networked games for multiplayer.
@eternal kite if you're totally new, i'd say start by reading that Network Copendium i just posted, it gives a good rundown of multiplayer
also on the Learning site (https://learn.unrealengine.com/home/dashboard), there is a "twin stick shooter with blueprint" that coves a good chunk of what you'd need in a generic sense... and it would mostly boil down to attaching two camera's and "posses" calls
Ok thanks
im only like a month or two ahead of you guys, so i've already fumbled through most of this lol
@teal path I feel always I am missing something. The UE4 docs talks about multiplayer etc. But for some reason I get the feeling that docs only applies to listen servers and not client server model? Am I wrong for thing this? or does all that apply to dedicated servers also? If it does I assume when building a dedicated server the compiler would take out the bits of the server code and compile that for your server?
Thanks for the Network_Compendium. This looks super promising.
what i will say is... you might stumble across the "multiplayer shootout" which is in the UE4 docs, and on the UE4 youtube tutorials a "blueprint multiplayer" series... ignore both of those.. at least until you read the other two things i've posted
they are old and misleading
@teal path where is this network compendium actually?
that is by far the best reference i've found yet
also the main difference between "listen server" and "dedicated server" is where it runs
other than that, especially from a blueprint standpoint, its sorta all the same stuff (where it runs settings for events/methods and replication)
the page 9 of that Compendium is SUPER helpful
other than that, especially from a blueprint standpoint, its sorta all the same stuff (where it runs settings for events/methods and replication)
@teal path This answer right here answers all my questions. THANK YOU VERY MUCH. To be honest I have been wanting to do game development on and of for 2 and half years now and I couldn't get a clear answer for.
yeah getting over that first hump is a bit tough
sadly it changes so quickly and a lot of the tutorials take shortcuts... so its hard
Is there anything that prevents me from: inside a MyCustomStruct::NetSerialize(), get a reference of some actor component in MyCustomStruct, and call said ActorComponentReference->MyCustomNetSerialize(Ar, Map, bOutSucess), so that I can basically acquire network polymorphism that's directly handled through the ActorComponentReference (which for all MyCustomStruct cares, just gets a bunch of bits to serialize), and thus avoid having to define middleman structs (to be contained in MyCustomStruct) which I then have to allocate, initialize, etc manually?
that Compendium is what really cleared a lot of it up for me
@teal path LOLZ yes. First of many. I only found the Discord Community server now. So yes, thank you very much.
question, with the Game State -> All Players, what is the proper way to know if/which player state is current/owning player? just get the Player Controller -> Player State, and == it?
Solved
Hey folks, hoping someone can explain why this issue is happening. I have a section of code that executes on the server and sends a client RPC that instructs the client to create a widget(I've unlinked the code on the other end of the client RPC, just the act of it firing breaks the future code). The code that's executing on the server character works fine, but on the client it causes some future code in the sequence to break. If I unlink the client RPC, it works again. Any ideas?
Turns out the answer had to do with how quickly I was attempting to do the step? I just set a 0.2 delay between the previous work I was doing and that section...and it's fixed.
Anyone knows if you can unlock steam player achievements throught the game server?
can't find any documentation
I'm setting the rotation of my AI's mesh to the rotation of the ground below them. It works good but it's "snappy" meaning it does it so fast that bumpy landscape's make the AI look jittery because he's setting his rotation so fast. So I tried using an R-Interp node and it looked great but it isn't updating the rotation for clients correctly unless I set the interp speed to something really high which basically defeats the purpose of the R-Interp node because it's looks "snappy" again. Anyone have ideas on what I should do?
@open quail there's two types of achievements, one is unprotected and the game client can achieve it, and the other is protected meaning only a dedicated game server that's on the app's official dedicated server list will be able to achieve onto the user.
If your not using protected achievements, and no one really does because it's more or less useless imo, than just run everything client side. Or if you want a server side event for something, then tell the client to then add the achievement to themselves
I am under the impression that CharacterMovement is the only thing included with Unreal Engine that has network smoothing and prediction built in. But sometimes I see people talk about other movement components and how they used them to get smooth networked movement. Can they do that?
@winged badger Is it the ProjectVersion you were talking about?
You can always write your own movement component with replication and all the fancy stuff, there's some on the marketplace too i believe. that might be what you see
Hey guys, I have an actor that has a physics simulated enabled mesh, ( its just a wheel ), with replicated enabled and replicated movement; the rotational movement of the actor isn't replicated? any ideas about what I'm missing?
Replicate movement + simulate physics isn't going to work
Guys, what If I want to trust client with some Actors (pawn, for example), do I have to replicate variables to server using RPC events, or there is some way to use variable replication to send values to a server?
Replication is server to clients only
So the only way is sending RPC?
Yes
Hello! I'm kinda new here
I'm trying to spawn players at playerstart objects, but despite the gamemode and default pawn being set in the world settings, only flying spectator thingies spawn for each player
each playerstart auto-possesses a Player (Player 0, 1, 2, etc)
if anyone has an answer or advice, please ping me π
I might be onto something
restarting the player through Event Handle Starting New Player in my gamemode BP works on the playercontroller I plug in!
I could just do it cheap and restart each player controller, but is there any better way to do this?
I'm now trying to make a skeletal mesh only visible on the player pawn it's controlled by, but I can't seem to figure it out
@cloud oriole Use the boolean on the SkeletalMeshComponent. There's two. OwnerNoSee, and OnlyOwnerSee.
Thanks!
@red glade Thanks, yeah that was one idea I had but didn't really know how used it was.
@open quail basically anything you want run on the server to be in control of in terms of the event happening, just get the server to tell the client to do it.
Guys, is it possible to replicate a UObject just to one certain client, not all?
I replicate it using ReplicateSubobjects(), but is it possible to select a client, which I want to replicate the object to?
@wary wyvern you mean without using an RPC? I don't know.
I think it is possible in C++
If you somehow manage to make it non relevant to the rest of the clients then you'll get that behavior
A way that comes to mind is make it be owned by that particular client and then replicate to owner only
I'm getting that error on a new test project I created to learn more about Seamless Travel. I used the TopDown template when creating the project
[2020.08.08-21.31.56:134][ 0]LogLinker: Warning: Unable to load package (E:/developer/UnrealEngine/Engine/Content/Animation/DefaultAnimCurveCompressionSettings.uasset). Package contains EditorOnly data which is not supported by the current build.
Assertion failed: !GEventDrivenLoaderEnabled || LoadPhase > ELoadPhase::WaitingForHeader [File:E:/developer/UnrealEngine/Engine/Source/Runtime/CoreUObject/Private/Serialization/AsyncLoading.cpp] [Line: 7284]
I created a MyGameServer.Target.cs with the following contents:
// Fill out your copyright notice in the Description page of Project Settings.
using UnrealBuildTool;
using System.Collections.Generic;
[SupportedPlatforms(UnrealPlatformClass.Server)]
public class MyGameServerTarget : TargetRules
{
public MyGameServerTarget(TargetInfo Target) : base(Target)
{
Type = TargetType.Server;
ExtraModuleNames.AddRange( new string[] { "MyGame" } );
}
}
And tried running the game through DebugGame Server
How can I sort this out?
@peak star The only way I see, is to replicate them from PlayerController, which only replicates to certain player. But I wanted to know if it is possible to replicate it from another Actor, which replicates to all the players. But I think I will replicate UObject from Player controller. Looks like it suits for my idea better anyway.
Where can I find all the command line arguments available when launching through Visual Studio?
Talking about these (the ones on the far right)
@vestal harbor check replicate physics to autonomous proxies. Also dig into the replication settings in project settings. Your mileage will vary tremendously and prediction is not built in.
should spawning of AI/enemies be in the gamemode or gamestate
When overriding GetNetPriority where does the function actually run? Server, client, both? Trying to figure out how to give the Owner's connection extra priority for a specific actor. Does that work?
@dark edge thanks for the tips, I think I got it working by changing the root component to the mesh component. π
Hi, so might be a simple question, but why is the render text of the server not set on the clients:
you need to port forward port 3306
and use FText#abRender(10.0);
or alternatively FText#acRender(10.0)
The code is within my player pawn, just trying to set a render text above the camera
right but why the server and client rpc?
what is Get player Name? what does it return?
it return the player name from subsystem
what subsystem?
but it should be pulling the name from PlayerState
right, okay
here
just try that
in c++ i would have used OnRep_PlayerState but you don't have that in BP
hhm,so the timer.. is that cause the client is not loaded yet?
the playerstate will be null
till its replicated
its a bit of a hacky solution but it should work
this is on dedicated server
right, okay thanks for that
PlayerName should equal SteamName
A one-off timer of 0.1 is pretty much destined to break though
So make sure you loop like Kaos posted
Lots of peeps delay stuff like it once and then wonder why it breaks with higher ping
If you set a RepNotify variable to the same value on the server (i.e. no change, but you issue the "set" node) - does it get replicated (i.e. remote RepNotify run)?
I could be mistaken, but I'm pretty sure that the set node won't affect anything. There is a netupdate that you more or less register actors with that gets called. If the actor has reached it's update duration time it checks if any of the values of changed on the server's version of the object, if it's the same, I don't think it'll call the notify even if it got set ten times between those netupdates as long as it's the same value when that function checks.
You could always set something's NetUpdateFrequency to like 0.5 so it'll only update every two seconds. Make a little print onrep. Make two keys, one that changes the variable to something different and something that changes it to multiple other values and then back to what it originally was. If it prints after the one that sets it back to the original at the end, there's that answer.
Anyone able to help out with something? Everytime I spawn a projectile on the server after a play montage the spawn location differs from client to server. Added a screenshot of BP to show how I am spawning.
@whole osprey What are you printing?
The world location of the actor as soon as it spawns
What happens if you give it zero velocity? Does the X still change by that much?
@kindred widget - I was just hoping that it internally saw the variable as "not changed" and avoided the network traffic, but I'll test tbh
It very well may. I know that changing a value multiple times in a single function doesn't cause it to send multiple changes. But I'm not exactly sure of the extent of how it checks to send or not.
In one of my projects I have my netupdate frequency of containers at like 0.01. So they more or less almost never update to clients, and I just call a ForceNetUpdate with an RPC to update the client. Works rather well in that specific case.
The general intent of replicated variables is purely to ensure everybody keeps up to date with a fairly recent value of a variable, not to broadcast an event per se, so by intent it shouldn't broadcast a non-change, I think Auth will be right
Good afternoon. Does anyone reading know of a way to have new joiners not spawn a new player controller? I'd like them to possess one of the four existing player controllers I've spawned myself using CreatePlayer. Cheers.
override HandleSStartingNewPlayer in GameMode, do not call Parent
and handle it manually
or put null for default Pawn in GM and hope for the best
Ah, that sounds like the ticket. Thanks, Zlo.
If a game is set to be not joinable after the game starts and a player disconnects, is it impossible for him to rejoin even using AGameModeBase::FindInactivePlayer ?
And is FindInactivePlayer only really intended for games where a player might leave and rejoin a lobby that is joinable for the duration of the match in order to get the same PlayerState properties?
Sorry to be 'that guy' but has anybody had any luck connecting a multiplayer game with Hamachi?
I've tried forwarding port 7777 and giving a 2nd client my external IP (Which works on the same machine but I have a feeling the outbound connection is getting to the router and bouncing straight back (like a local host connection would)).
Whenever somebody on a different network tries to connect, using hamachi or the external ip, no joy at all in setting up a multiplayer session.
Does it matter if I call a "Run on Server" event via the server? It would clean up code quite a bit π And both options work in this specific case
@tranquil thunder It doesn't matter. I do the same thing with some stuff in a listenserver setup. Normal controls make a Run on Server RPC, the server player does the same thing since on a listenserver they're a player as well. It seems to work well. I haven't noticed any problems. I generally just tend to follow the RPC chart. This page is a good reference, about halfway down. https://docs.unrealengine.com/en-US/Gameplay/Networking/Actors/RPCs/index.html
Designating function replication across the network
Hey guys
Since Listen servers with steam don't show ping.... I wanted to at least show country code...
Does anyone know if this is retrievable from steam users?
@kindred widget Thanks!! π
does any feature of epic online services help with making a server or is having a dedicated server still needed
and ofc you will need to host your own dedicated servers
they wouldn't do that for free
Wrong wording
Do the services have a way of making/building a dedicated server, or do build my own with VS as I've been doing
same as you always do it
alright thanks
would being in another country cause connection problems via hamachi?
afaik testing via steam uses region locked servers/ports right?
but hamachi should be direct on a vpn surely?
Alternatively to hamachi, how do international teams usually test their multiplayer projects?
given the steam limitation
i have problem with RPC function
void Server_PassLocationAndRotation(FVector_NetQuantize NewXShipLocation, FRotator NewXShipRotation);
void Server_PassLocationAndRotation_Implementation(FVector_NetQuantize NewXShipLocation, FRotator NewXShipRotation);```
.cpp
```void ACPP_XShipPawn::Server_PassLocationAndRotation(FVector_NetQuantize NewXShipLocation, FRotator NewXShipRotation)
{
}
Steam doesnt have to filter by region
@winged badger Alright - I'll loop back to checking steam out, thanks for the nudge in the right direction π
Cause hamachi is a pain in the ass
We use steam lobbies for connection
Those can be configured to filter or not
Fairly sure servers can as well
that's interesting, I've also read here that I might be able to switch my steam downloads region and trick it into letting the connection through - Some testing needs to be done
Yes
I'm having a pretty bad glitching experience with my AI characters while running a dedicated server (PIE). When I press simulate or play offline, there is no such issue, so it seems to be a networking issue. Maybe a net correction issue?
What could be causing this behaviour with AI controlled characters?
can the properties of structs be replicated?
@sand iris I remember reading somewhere that individual UStruct properties can be replicated instead of the entire UStruct. I do know that it's possible with TArrays per index but that they're not sorted in correct order, but not fully sure about just UStructs.
Hi. Can someone explain how properly make movement for multiplayer, so it sync for all players? I'm trying to make simple sync for Top-Down example. I read 'Unreal Engine 4' Network Compendium, and it says that often you move characters locally (but also send everything to server?):
"Note: To prevent a feeling of βlagβ for the local Client, Coders often, in addition, let this Player directly control
their Character locally, although the Server still might override the Character's Location when the Client starts
cheating! This means, that the Client will (almost) never 'talk' to other Clients directly."
So when i tried to make local movements (basically just run Top-Down example on with server+client and another client. For server+client everything work perfectly, i can move my character and other clients can see his movements pretty smooth (also animations and rotations). But when i click on another clients (that not server+client), it just doesn't work. Then i made server RPC function that move character, and change in playercontroller to use that function, (it just run same function but inside RPC function, so it called from server). After that on server+client everything still perfect and on other clients you can finally move character, but it looks terrible, it's not actually moving but just getting sync from server but position (no rotation, animations, etc), but on server+client his movements looks good (because it run only on server?). When i try to tell client to also move locally it doesn't work, or when i try to do it from RPC Client (inside RPC server), still doesn't work.
I probably misunderstand something completely and can't figure out how it should be.
I use C++
@grave notch I could be mistaken, but I believe in a case like yours that what they generally mean is that you should call the move function on the client at the same time as the RPC. The client will technically move before the server does since there will be a lag between the server and client. You set your server's movement corrections just enough that your server won't always overwrite the fact that the client isn't quite where the server is, but that if the client moved too far, then it would be corrected. It gives the illusion that there is no lag to the client since their character seems to move instantly instead of 80 to 250 milliseconds later depending on RTT latency.
@kindred widget Well that's how i imagine it should be, but i tried to do it, i called SimpleMoveToLocation function just before RPC (that basically just calls the same function), and it doesn't do anything on client. As i understand now, the problem is the function, because if i just use SetActorLocation, it seems that it works, but not SimpleMoveToLocation function. Is it somehow related to authority (so client can't run it even on owning actor?), because that function use Navigation System?
What are you guys doing to debug your MP game?
I'm wondering since I don't want to go through the main menu all the time just to test my game and stuff but due to ServerTravel it seems like I have to
However I recently saw a video riot showcasing some tech of Valorant and they had a bunch of debug tools like custom console commands and also they didn't have to go through the menu and matchmaking and Stuff.
How do you realize something like that because right now it really feels like pain in the ass π
Anyone run into this before? GetLocalRole() throwing EXCEPTION_ACCESS_VIOLATION
the trace is right there =/
no that trace does not point to that
well it does, but it doesn't say why
and you are assuming its GetLocalRole() that is crashing
well true its the underlying script that is called
that would crash if your actor was nullptr, but it shouldn't be cause BeginPlay should only be called on a valid actor
go install the engine symbols
Yeah, i figured this was safe from BeginPlay()
and crash it again
this used to be just Role before the update
correct, Role == GetLocalRole() now
it just returns Role
see
only way that would crash, is if the actor was null
would need to see more code
Well the crash seems to bubble from the MulticastScriptDelegate::Add so i thought there might be some loading clash
gonna boot up the debugger
half the callstack is missing
grab the symbols
also
dw its not a 23gb download
Could someone explain to me why GetLastInputVector() returns null on the server? I'm trying to use it in a Physfunction.
how do you get input on the server then do I need to create a new function to send it
?
What do you think is the best way to replicate it for use in a physfunction?
i would probably send it through the CMC or the actors ReplicatedMovement property
but both require C++
I'm familiar with setting a variable to replicate through GetLifeTime.... and also OnRep which I use on my Character. The CMC is a bit of a beast though. I'm not exactly sure where I'd put it.
@meager spade https://hastebin.com/ehoququnem not much more dsetail that i can find
ScriptDelegates.h:324 is calling CompactInvokationList which looks like a cleanup step
I cant understand why GetLocalRole would call that though
Normally data is sent from the server not to it
Could you briefly explain the implementation of both options?
hmmm looks to be caused by the previous call using AddDynamic but line always matches the next statement, odd.
@mellow geode you get it sorted?
Well commenting out my HealthComp->OnHealthChanged.AddDynamic(this, &ASCharacter::OnHealthChanged); stopped it from blowing up, but i havent figured out why. I havent wrapped my head around the macro enough to fix that yet though
yep, wrapping around if blocks it
constructor
show me
and show me the line in the header file for it
and show me the OnHealthChanged function
probably one of those cached bp desync things?
in header file
UFUNCTION()
void OnHealthChanged(USHealthComponent* HealthComponent, float Health, float HealthDelta, const class UDamageType* DamageType, class AController* InstigatedBy, AActor* DamageCauser);
ok so everything looks good
you didnt compile using the compile button in the editor?
many times heh
yeah hot reload can cause corrupt blueprints
hah so it seems
try creating a new blueprint
for your player
and uncomment that line
and see if it crashes
yeah didnt wanna copy over the stuff i had built in BPs
GC crash wouldn't be consistent that soon, and he seems to be UPROPing them
it seems like working in both BP & c++ has a lot of desync issues
ofc when delegates crash
cause everything else is good
the line reported is usually one below the actuall crash
interesting
yeah i said to him it wasn't GetLocalRole() that was crashing
it was something else before that
yep, when the health comp is null
have you verified its null?
on client or server?
well, just that wrapping in an if caused it not to break
can you put a check(HealthComponent);
ah so its null then
its on beginplay and the component is created in constructor
sounds to me like a corrupt bp honestly
or something
or something overwriting the health component pointer
shrugs plenty of time for that to happen
data breakpoint time
and they get weird crashes
dont think its an accidental overwrite
well, did you hot reload?
nah, done a fresh run
if not put a breakpoint after health component is instantiated in constructor
but maybe doing hot reload causes a lasting break?
actually, rename the component to HealthComponent (change HealthComp)
compile with editor closed
and see if it fixes it
then put a data breakpoint to the health component pointer
and it will trigger a breakpoint, with the callstack, when it becomes null
re-serialize
i honestly think during deserialization of the BP, its setting it to nullptr
not re-initialize
both π
thing with BP's is, it keeps info
if you delete a property, and put it back, it would remember it
that can lead to so many issues
if you made it Editable, then changed it in BP, then removed Edit specifier
it would still be ninja changing your defaults
what have you learnt? π
bps r dum
don't use the compile button in editor π
close editor, compile, reload
enable live coding, while you're at it
it also disables hot reaload
and its reliable as long as you don't change any header files or constructors
even from editor
also, disable auto compile new c++ classes
thats one of the more fail settings on by default
i still don't get that forcing of hot reload by epic
nobody ever shit on it as much as epic programmers when they made it to here
@mellow geode you doing that tom looman course?
can anyone help me with replication?
@meager spade yep, lot of history with networked games in other languages / engines, using this to get a handle on the api surface
yeah shows a lot of the different sync mechanisms
@arctic mesa don't ask to ask, just ask
although i dont really agree with how he structures the server/client flow for some stuff
what you mean?
its intro tho so makes sense its very ad hoc
show me an example
@arctic mesa don't ask to ask, just ask
@meager spade what do you mean?
like how often your evaluating GetLocalRole versus having more distinct pipes of execution on one side or the other
you asked if someone can help you, but you never asked a question
im still working through it so take this with a grain of salt
yeah but that is common practice
you will use GetLocalRole and GetNetMode quite a lot
oh yeah absolutely
and IsLocallyControlled
you need to
but how often the same function is called on server/client which then branches some number of times, versus having the branch happen much earlier in the event
well that depends on the flow tbh
there are techniques that allow you to write more logic that works no matter if server or client
yep
like deferred spawns
without them, if you need to change any replicated variables on the server as its spawned
im used to a lot more client side prediction stuff an less RPCs
you can't have same BeginPlay logic on server and client
also gets worse when you need to deal with Relevancy
as client will have updated values and server won't
as clients will destroy non-relevant actors
and recreate them when they are relevant
which runs BeginPlay again
yeah, there is a lot more magic happening behind the scenes in ues networking than im used to
so if you have say a Monster that plays Spawn Animation on Begin Play
a client becoming relevant to it, would see the spawn animation
π
ah the classic wow stealth bug
even tho its already spawned and alive
so i'm using a package called "Character Skills", i decided to integrate all 11 skills into my project and they aren't replicated, right now i am trying to replicate running/dashing
never assume anyone is familiar with a third party package
the stealth sound that alerts people a rogue just passed by you was accidental, its only supposed to play when the buff is first applied
but network syncing made it so when you see him, the buff was just applied
we had monsters, as you run into relevancy range, get up to play their death animation
i said had
ah ye daoc i think is still like that, as you run into an area of corpses and their bodies flop along the horizon
i still remember the time, a player would see a monster vaulting
no where near a vault
what game yall talkin about?
Red Solstice 2
ah cool
if any of you need to take a look at the running/dashing code so maybe you can help me, just ask me
@arctic mesa the trick is to keep the max walk speed synced at all times between server and client
then done some hacks to the camera manager to fix it π
@arctic mesa dashing is better when you use a RootMotion Source
to do that with owning player, it has to change its speed as it sends the RPC, and you need to skip replication back to it
as it keeps everything synched and predicted
the thing is i don't know the first thing about networking
then go to pinned messages here on this channel
find the network compendium
and read it a few times
but converting Single Player stuff to Multiplayer is going to be a world of hurt
just check replicated right? π
if only it was that simple
we do most of our networking heavily customized
i jest cause that's how it was always advertised when i was doing unity networking
urgh unity and networking
not their networking //shudder//
spawn a 33k actor level procedurally and have it networked and ready for play in ~12 seconds (unless someone is using a laptop, then it takes longer)
native c# impl
yeah 12 seconds(ish) on a high end pc, about 1min on a older pc/laptop. Least you have time to read the stuff on the loading screen π
i managed to make a replicated actor where if the server presses q, it changes the actor's model to stairs, if the client presses q, the actor's model changes to ramps, changes reflected throughout all machines
read the compendium @arctic mesa
i was a fool to think i could re-use the code for a simple actor in such a thing like dashing/running
i am reading it right now
nods
unlikely to have a networking conversation you can follow until you digest at least a part of that
I have a question. I'm redoing my projectile weapons such as rocket launchers etc. My issue is when It comes to radial damage. I do NOT want to apply damage to my teammates, but I DO want to apply damage to myself. Just like most COOP games. What is an optimized way to get all the players? I ask because people will be shooting these weapons a lot. I know I can get all players from the Gamemode but then that would be called every time I shoot. I don't want to ever use "get all actors of class" especially when shooting a lot. Ideas?
Somehow I have to get all the player characters and then just remove myself from the array and connect the array to the actors to ignore pin. I just need to know the best way to get all the players
when the projectile overlaps
run a filter
if (OverlappedActor == Instigator || OverlappedActor->Team != Instigator->Team)
just that simple?
i did it as c++ but the same is true for BP
But that only works for the projectile impact though correct? I did so you can't direct impact teammates. But what if say I shoot a teammate and the projectile explodes, I want the radial damage to hurt me, but not the teammate.
I'm applying impact damage, then radial damage
Ahhh I see where you're going.
Instigator has all the information you need
thats awkward
its server only
lol I forgot about that. I was so tunnel vision on the projectile
and weird function, literally the entire engine uses Pawn as Instigator
except that
something like that could possibly work
Yea that should work. Thank you guys. π
So I was using a Sphere overlap actors node because I hate the built in radial damage lol. But it has no instigator so I was left high and dry. That's why I was asking how to get all players easily lol
Well I guess I could do the same check you did above though to see if the overlapped actors were friendlies. That would work. Ok so I have two options. π
Does anyone know how the ReplicationGraph in the ShooterGame project gets initialized? There doesnt seem to be any mention of it in the Configs...
Is it not enabled by default?
@fossil spoke in DefaultEngine.ini under [/Script/OnlineSubsystemUtils.IpNetDriver] - ReplicationDriverClassName="/Script/Module.ClassName"
I think you can also set that in other Driver config sections as well
e.g [/Script/OnlineSubsystemSteam.SteamNetDriver]
I know thats how to enable it, im asking specifically how ShooterGame does it, it appears that its not enabled by default, unless im mistaken.
I'm trying to figure out if I need to use the Gameplay ability system in my game, why it's more robust than doing it with regular replication?
Well, are you doing a game with multiple "ability" type actions like in a MOBA ?
If yes, then you might find it useful because it has a generic framework for replicating abilities
I am making a sword game, I'll have a few ability (2 per classes) but nothing really intense like a MOBA
I'm wondering if the gameplay ability system would benefit by example a sword swing and such
No, a sword swing is not something I think would benefit from GAS
okay thank you!
I'm really bothered about this, I've been using unreal for 6 years and I never tried that ability system
You can do it with GAS, it kind of fits the purpose
But using a huge, fast-moving plugin for a small use case is likely not a great idea
I see
At the moment I send the swing input to the server which then perform everything and it replicate it to the client. I was aware that if the client has 50ms ping, that mean he won't get his action to start until the next 50ms. To ensure that you don't feel like you are touching someone on your client that is not here I was preferring this option. I realize now that a client with something like 150-200 is really suffering from the lag and I'm not sure if I should launch the event on the client directly when it happen
I'm afraid that if I launch the swing action on the client and you touch someone on your screen, the server won't actually have the same result and that could be more frustrating then the 150ms
what are your thought about this?
@bitter oriole Just in case you are not looking, tell me if you prefer me not pinging you π
What you should usually do is have the client animation run immediately always, but have a separate hit effect that runs when the server confirms the hit
that mean it's inevitably going to make you feel like you should have touch someone but the server say no
(of course, the server should always be the one authoritative toward damage and hit effect)
It's not inevitable really
I'm living a little dilemma, cause the enemy can also launch a blocking action which could result with this:
User A swing sword, touch user B
User B launch blocking and then User A receive the blocking event
(that where it get more complicated)
It doesn't really because it's an age old issue that has mitigations
The usual example is called peek shooting
What happens if you shoot someone that hust hid behind a wall corner ?
Shooter successfully shot (from his POV), target successfully hid (from his POV), but both cannot be right
I know quite well this example, I don't think it apply as well with bladed weapon with swing/blocking, but it's really close of course
It's exactly the same thing, you have to pick a side here and use that side for server-side reconstruction
You can also do middle-ground and pick the server POV
Though that will likely be bad for everyone
The hard part is rewinding time on the server
I was thinking of this at the moment
but I guess that the best thing I can do to ensure better result for both blocker and attacker
Basically when a melee action arrives at the server, it's attackerLatency old; and the location of the target from the attacker POV is 2 * attackerLatency (== attackerPing) old
From the target POV, it's even older (2 * attackerLatency + targetLatency)
So if you apply the "shooter is right" rule in your game, the target is judged ~1.5x the average ping late
There are two ways to have no discrepancy at all, but both have issues
Why my scenario is a bit different it's because we have two shooter, one that is blocking and another that is attacking. But I really consider doing some reconstruction like you suggest considering both POV
First way is to have wind-ups on all actions, so that there is a 200ms un-cancellable animation
You tell the server when it starts and so the server knows 200ms early that youre blocking, and so other clients can known too when the blocking player will actually be blocking
In this case, you can actually have both blocker and shooter be right, which is unfeasible normally
I was doing a technique like this with a custom C++ server for an old project (based on 100ms) I can do this using blueprint you think?
I was not even thinking of this, but it might be just the way!
(specifically cause my attack and block have a pullback animation, which could give me more then the time I need to get this 100-200ms delay)
(it's nothing like bullet that need to be instant)
exactly
So I would go with something like this:
Client A trigger Swing at 0
Server receive Swing 50ms later
Server wait 150ms before launching the pullback then start the pullback with 200ms advance so the state should be very very similar if I'm not wrong
(forgot to mention client B ahah)
Server sent directly input to client B
Client B take 50ms before it receive it, so he launch the animation 100ms in advance (by interpolating of course)
The real deal here it's to know exactly how much time it take before the data travel from client A to server then from server to Client B
Don't forget client A is basing its action on the state of client B that was visible at the time, which is much older
Since that state, from client B originally, is latencyB + latencyA old
When the hit arrives on the server, it's latencyB + pingA old
Yeah, that seem fine and it's part of the "game" when we talk about multiplayer, thing just can't be perfect until we get all super internet speed, so I'm fine with this
what is your best recommendation to know the latency in between the Input of the user swing and the server receiving the call
ping/2
in the past I was using something like UTC now
and it was really not accurate (from 10ms up to 40ms margin error)
I like better the idea of using the ping, it might sound funny, but I have to find the way of doing it now π
Basically how your shield (blue) and shooting (red) can work
Circle is when blocking actually starts, green is the latency of A, etc
Of course in this case, the windup time is way too small
Notice than B can still be killed while shielded
(from his POV)
yes, it's inevitable, the goal is to make this almost impossible under 100ms ping or so
π
I already feel a bit more confident about what I'll put in place π
thank you again!
I was wondering for a generic ping command, but it seem like they only have one regarding their session system, so I'll have to get it directly from my AWS services
or maybe I'm not aware of a generic function to get ping in between client and server
playerstate->ExactPing
I literally found it at that time
I'm trying this in a build tomorrow for sure!
it's seem to be divided by 4, so I guess it's safe to assume that I can just multiply it by 2 so I get the value you were suggesting to me?
probably not
I guess I confuse myself for no reason, just getting half of it is probably the most accurate thing to do
ExactPing * 2 would be the latency, ExactPing * 4 the real ping
excellent, thank you for all your answer and explanation, time for me to run to bed! Have a good day or night π
Regarding my "net correction" issue on AI yesterday. I made some test cases.
52 concurrent AI characters - Game doesn't even start, the whole world stays frozen
37 concurrent AI characters - Glitching like in the gif
15 concurrent AI characters - Seems smooth, I can't see the glitching.
Am I running into Unreal's networking limits or something to that effect? It almost feels like it's trying to optimise the network traffic because it's getting overwhelmed.
How can I spawn a replicated component only on the server and the owning client?
Because if i spawn in game a replicated component it's added to all clients and I don't need it on everyone
You can't do that with components
They're all or nothing
The internal properties of the component can have conditions though, same as regular properties.
@potent cradle hard to say, something else might be clogging it up. Use the Network Profiler to see what's being sent and how often.
Guess I can simply destroy them on the other clients? Anyway, on 4.21 I was able to do that... i was only spawning the component on the server and the owning client, but NOT replicated
In 4.25 trying to to this gives me a net guid error
You'll probably get errors because it'll be trying to replicate properties from the server either way.
And then it won't find a matching object to apply them to
You can spawn a non-replicated component, but obviously it can't have any networking support then.
it kicks me out from the server when I try to interact with the component
Yeah, because the ID's won't match
You can spawn a non-replicated component, but obviously it can't have any networking support then.
@chrome bay but it was working in 4.21, I've used for months XD
It shouldn't have been
I was able to call the server
You can't spawn an object locally, and then use it with the network. It's not stably named nor matched up.
So I guess it was a sort of bug?
If you want to spawn something at runtime that is network-relevant, it has to be replicated from the Server.
Or, already exist in the serialized level / class-default object.
I'll give that a go Jambax, thanks π
Yeah, or a fluke maybe
What are you guys doing to debug your MP game?
I'm wondering since I don't want to go through the main menu all the time just to test my game and stuff but due to ServerTravel it seems like I have to
However I recently saw a video riot showcasing some tech of Valorant and they had a bunch of debug tools like custom console commands and also they didn't have to go through the menu and matchmaking and Stuff.
How do you realize something like that because right now it really feels like pain in the ass π
@lunar root
@lunar root that's impossible to answer because it's game-specific
If you need custom tools or debugging, you have to make it yourself.
Yes, I know that, in fact I found it strange that it worked in 4.21... though I find it should be possible to have components only on server and the owning client
The only conditional object replication you can have is actors only replicating to their owner
Nothing else is supported
And that's only supported at the actor level too
I see... try to change my code to spawn only from authority, thanks Jambax
The thing most curios about is how to test my MP game without going through menu and stuff
It's entirely up to your game
Just using 2 clients in PIE
If the game is setup correctly, most of the time you should just be able to set it up for 2 clients, and hit "play"
Sessions etc. doesn't work in the editor - that kind of thing you have to test in standalone
But somehow I have to skip the menu and character selection when doing this, since ServerTravel isn't working in PIE I won't get out of the menu
So it would be nice to just have a default character which is selected as soon I launch PIE with 2 clients and do t have to go through the entire menu/selection process
hello, which is best for replication? FVector_NetQuantize or FRotator?
That's just something you'll need to setup yourself, it's totally specific to your game
@gritty pelican They both serve different purposes
But during replication, which will replicate faster?
FVector_NetQuantize is smaller, but it won't replicate faster.
FRotator has quantization methods also. See FRepMovement
You just need to wrap it in another struct with a custom NetSerialize() function.
different purpose, so not neccesarily
The size of the NetQuantized vectors changes depending on the values
FVector_NetQuantizeNormal = (1.000)
FVector_NetQuantize = (1. 000 000)
it's true?
Yes
characters have insane replication overhead, you might want to use simpler actors instead
I was working on the assumption that I would be able to have 50-100 at the same time?
that will put a server to its knees
specially if they also have replicated components
plus the cpu overhead of 5 cmcs is huge
Well, fuck π
Many games have like 100 players though right? I wasn't expecting more than that, even 100 from what I heard was tricky, but...not even 50?
100 animated characters is possible but it requires a lot of extremely careful work