#multiplayer
1 messages ยท Page 79 of 1
You have to workaround it. You can't garauntee the object will even be in a state client-side that it was ever in server-side, so it's up to the client to handle that gracefully
Clients can ultimately get into states for properties that never even existed server-side, due to packet loss etc.
What is the info you are relying on exactly?
Would it make more sense as being sent in an RPC?
I guess my course of action is to have the UI listen to every time the inner objects change and call a delegate for my ui to only use that sub-data that was replicated
nope not really
it's an entire inventory attached to a playercontroller
Callbacks for UI updates do make sense sometimes, but often it's easier to have the UI tick it's own state internally, and just read back the latest state from the object
which has no fixed size - the inventory can have items that contain inventory and the chain goes on for possibly ever
The issue with waiting, is if the UI panel "gets" a property in the meantime, it might still get itself into an unhandled state
I wanted to do that but it felt like it's a bad way for some reason
The way to handle the inventory case is rebuild the panel each time the inventory is modified
now I'll do it, thanks for the heads up
It depends obviously, ticking vs events
If you have to rebuild/reassign many widgets and the event doesn't happen often - events may make more sense
But the UI should be able to rebuild itself at anytime, otherwise if the UI decides to query the inventory for the current state, and can't handle that state, you have an issue
I would simply broadcast the event from the OnRep, and have the UI respond to the current state.. whatever it is
alright
And that way, you know you can create the UI at anytime and it'll just deal with whatever the current data is
so in my current system an item can have an inventory which can have an item which can have an inventory.. and so on
how would I limit the length of this chain
unless the client actually needs to view later into it
the actual data structure is
UItemInstance
|-> TArray<UItemMetadata> (UItemMetadata could be an instance of UInventoryItemMetadata)
|-> InventoryMetadata
|-> Inventory
|-> TArray<UItemInstance>... etc
If you have the structure in a struct you can force the struct to always replicate the entire struct instead of just what changed
This uses more bandwidth but you make sure you never have "half states"
I read that somewhere in the guides but I can't remember
Maybe it was something from wizzardcell?
I'm working on something interesting along those lines
basically a global inventory as a mapping of basically item serial numbers to structs, which can contain contained items serial numbers
bit like a flat database
If ItemStruct looks like:
ItemID
ParentItemID
ChildItemIDs
OtherItemData.....
Then the entire state of the world could be just a sparse array (if ItemID is index) or map (if ItemID is some GUID or something)
You would't want to replicate the entire world state but you can replicate stuff inside actors or on demand (GetChildItemsForID)
when rebuilding a build that you built yesterday and only made a small change to shouldent it be like instant ? or why dose it need to rebuild everything again 3-4 hours ??
or is it me doing something wrong ?
You probably enabled the full rebuild option
yeah i had it on
i want to play a montage over the network, do i play it on my character, then call to server, then do a MC? and if so, do i need to exclude my player from the mc?
What is the biggest contribution to massive amounts of player agents in a networked game? Beyond bandwidth and transport ofcourse.
I suspect its server hardware and the capacity to resolve packet data per CPU cycle. Anyone have more educated guesstimations or knowledge about this ?
Depends on the game. Depends on a lot of factors.
Profile the game. Identify the bottlenecks. Optimize them.
CPU is generally going to be the biggest issue.
@fossil spoke
This was a more theoretical question so humour me. Is the cap on optimized software or in hardware? Lets say the network data to resolve are positions in 3D space. What gives in first? client software, transport layer or server hardware?
those are the 3 key elements as i guesstimate it
Toss a 3 sided coin. That's your result ๐
Depends on where the programming is too thin
If you optimize so clients don't need to use too much CPU, your server would catch fire
If the client does most of the hard work, your client catches fire and also cheats
If you balance the load but don't optimize the network, the network burns
If you do everything perfectly, all three should crash at the same time
That is how you measure balance
It might not be good, but it's balanced. Everything failed at the same time ๐
this was the best line
I've beta tested MO2 (UE4, FPP, Melee, rather detailed ) and been in stress tests for that game that resolved around 400 people in relevance. Not without issue ofcourse.
More recently i tested Foxhole and they have a pretty solid thing going on
The Rยฒ Engine is a custom multiplayer platform that aims to put a thousand players onto a dense battlefield in a persistent online world. Rยฒ Engine will power Siege Camp games in the years to come. Stay tuned!
The Red River Demo, which we ran late 2019 was the first big test for this technology. You can see a video of it in action below.
the r2 engine test video is mostly what prompts me to think about the theoretical limits of network agent relevance
just to make sure I am not allucinating knowledge like a chatbot:
Replicated properties on a component are just extra steps for the engine and it's better to keep the replicated properties in the actors... right? ๐ค
What about RPCs? ๐ค
I have this function void ACardShop::TryBuyCard(AActor* TargetActor, const FCardStruct& CardToBuy) in c++ and i wonder if passing the whole struct is a good idea. I thought about passing a FName which is the ItemID and from there using the FindRow method to retrieve the struct inside of the function. Its mainly because of blueprint issues since I copy the entire struct from the widget to the player controller server rpc
so far my project works fine running in editor, including when set as listen server with another window. This is how i've been running things until now, and no problems:
https://i.imgur.com/UNBDOyU.png
But I am now trying to run a standalone server and client from the command prompt, and bugs are appearing. This is how i'm starting it up:
https://i.imgur.com/Xm1z7Z9.png
There are a few issues, probably all related, but the easiest one to point to is that i have some control inputs in blueprint which call a C++ function
https://i.imgur.com/G4o5mP2.png
In the standalone server, this is not working. The function is never being called, i have a log message at the top of it and nothing appears in the server log
What differences are there between the way i'm running it, and the way that it worked before, which could possibly explain this problem?
(not really a question for unreal but just in general) is it bad practice to use only rpcs and regular functions? Godot has absolutely no docs on the new multiplayer stuff and from what I've heard it's extremely buggy so I'd like to avoid it
Like is it straight up impractical performance wise or something
what do you think an rpc is? ๐ค
A special function that is normally only allowed to be called by the server, it calls to all other clients connected
ok, yes, and it can also refer toa special function that when called by a client it runs on the server
now, your question:
is it bad practice to use only rpcs and regular functions?
as opposed to what?
Unreal and unity and somewhat godot have replicated variables but not sure how they do in terms of performance, are they any more performant?
also @rose sparrow this one's on you mate ๐
do you know anything about replication? like at all? ๐ค
maybe start from scratch? https://cedric-neukirchen.net/docs/category/multiplayer-network-compendium/
This compendium is meant to give you a good start into multiplayer programming for Unreal Engine.
I've already read it
good, so now, which one is "better" performancewise comes down to the exact network implementation of each engine and how the bundle stuff ๐ค
it is not something that works from engine to engine
Ok but that's not what I asked, I asked if using only rpcs we would a terrible idea or not
Performance wise
if using only rpcs we would a terrible idea
Yes. You will need code that doesn't need to run replicated ๐คทโโ๏ธ
and say you only have RPCs and local functions
is it bad practice to use only rpcs and regular functions?
you will need variables at some point
The variable values can be changed via the rpc
yes it would
oooooook, now I get your question:
Would it be better performancewise if I never use replicated properties and only send my values in RPCs?
i think it would be worse networkwise
It's a silly question because there isn't an answer
RPCs vs Properties have different purposes
Whether one or the other is better for "performance" is irrelevant
but you could make an rpc for each property and always call that rpc to change the value of a non replicated property ๐คทโโ๏ธ
you are trying to outsmart the engine
which is silly ๐
And in Unreal that would fail spectacularly
Late join would be broken, relevancy would be broken
Any dropped RPC's would mean permanent unrecoverable desyncs
you have to implement all of that from scratch, that is why trying to outsmart the engine is silly
reliable makes it that doesn't happen right?
If you don't receive a reliable you get kicked
i didn't know that one
It has to. If you drop a reliable, the engine has to assume you have got into an unrecoverable state.
good ol' fubar
Send a handful of reliable RPC's every tick and see how long the game stays up on a real world connection
Good to know then, is there anything else I should know about where crutching rpcs isn't gonna cut it?
Here's literally all you need to know
but why tho?
State = Properties
Events = RPCs
fin.
Sometimes, you might even do events with properties - depending on the context.
You should never modify persistent game state from an RPC, unless it's the client asking the Server to do something for it
Replicated properties in unreal work as intended and as Jambax said you should use them to replicate "state"
If you are working in another engine where the replicated properties are not so working (don't know godot, but it might be roblox, unity, making a homebrew engine), then the way unreal handles RPCs won't apply to that other engine ๐คทโโ๏ธ
for example, a Reliable RPC in unreal might not mean the same thing as a Reliable RPC in roblox or unity ๐คทโโ๏ธ
Hmm, alright, thanks for this info guys
bump ^^^
unreal networking is very robust
we had to make some small tweaks for performance shortly before ship, but we didn't try to ditch anything about the way UE wants to do networking
I guess that you should try to call the less times as possible in any system (my little experience is mostly witn EJB), you don't want the server to spend time on useless stuff (and Godot's networking is similar to UE, the new one is "easy" to use but not documented yet)
your mouse wheel event (only the client has a mouse so it is coming from the client) is calling a local function.
unless you have a server rpc somewhere, not printing in the server is working as intended ๐คทโโ๏ธ
ah good point. It DOES call a server function eventually, but failing before then is a possibility due to one of the other bugs i'm still trying to pin down
is it possible to launch a logged client in this manner?
do what?
so question about like client what cant make it laggy? and like movement wise movement is replicated but unsure what can be causing to be choppy
what's choppy? that looks smooth to me
but you could check the replication tick rate
first one is not the second one
you could also see if the network corrections are angry at you? (if you are using character)
unsure how to do that lol.. new to this also using blueprints
oof, okay, networking from blueprints is rough.
lets see, are you using character? or a custom pawn?
(extending from character is also using character ๐ )
does character do things you'd want a ship to do?
pawn as charecter class
it does network ๐
I don't remember but I'd assume it's doing bipedal type stuff.
character does network, unless you are networking god, you want a character to handle the network ๐
the thing is, you don't have prediction
ok i though it was like fps related or othere stuff lol so its prediction related hmm
either the server trust 100% what the clients says (cheats ajoy!)
or the server has to validate everything you do and that feels laggy and rubberbandy
This seems much more networking than FPS related. Although you could see what the FPS is.
Character Movement Component has a looooooot of trickery to not feel rubberbandy
but you have to play by the rules
im not xD
well then its intresting because its only when rotating the drone or camera "aka yew roll pitch" not movement is laggy just rotations
This is how unreal Character Movement does prediction/reconciliation. It is explained in a very agnostic way https://www.gabrielgambetta.com/client-server-game-architecture.html
This is how figthing games do rollback netcode. This is not implemented in unreal and if you are making a figthing game... good luck ๐
https://bymuno.com/post/rollback
Building on what ElementalCode is saying, clients "predict" what something will do and assume the server is okay with it and do it. The server then gets the instructions, either approves it, in which case the prediction is fine and things carry on smoothly, or it's wrong. Then you have to rollback and the client will undo what the prediction did.
oh, that looks like a great resource
yeah... fighting game netcode is cursed
rolling back on the client is called "correction"
rollback networking usually means rollback in the server to inject the input that the user did and resimulate and let everyone know that you did block that hadouken... is... interesting ๐
a famous rollback lib is called GGPO and can be implemented in unreal
well any help is helpfull so thanks!
Omen of Sorrow (shout outs to chile) did it
wtb fighting game that uses lock step like RTS engines
Okay how about the inverse situation? I now have a client and a server both doing logs, and a log message that should be coming from the server is appearing in the client's log only. That shouldn't happen right? Would the message be in server log only if it were running on the server?
UE logging server/client attribution has always been correct in my experience.
If it says it's logging from the client, it's happening on the client.
C++ or BP?
pretty much ๐
It's so nice that the on screen debug messages are networked and tell you the env.
in PIE at least
i have a sneaking suspicion that this client just isn't connected to the server. Launched using this command....
"C:\Program Files\Epic Games\UE_5.0\Engine\Binaries\Win64\UnrealEditor.exe" "C:\Users\Nanako\Documents\Unreal Projects\Nobility\Nobility.uproject" 192.168.0.20 -game -log
If something was wrong here, say the IP, would this just silently launch a local client instead? how can i tell if it actually connected?
yeah, that IP is... curious
if you are conecting to yourself, 0.0.0.0 should work, wouldn't it?
well its a local ip of course, the server and client are both just on this computer
okay scratch that theory, connection is definitely working, i launched a second client and it popped in
is this the first time you're working/testing networking?
put an RPC or a replicated value on the game state and then log, will answer that
where is this bad log happening?
put a breakpoint there, check the net mode, etc
kind of, yea, i'm new to this. Ive confirmed the connection is working
What appears to be happening here is that functions that are marked to run on the server, are running on the client instead.
"marked to run on the server" ?
UFUNCTION(Server, Reliable, BlueprintCallable, Category = "Weapons")
void EquipWeapon(TSubclassOf<AGunBase> NewWeapon);```
When i do PIE listen server, this function runs on the server as it should.
But in standalone, it is running on the client
listen server is client and server in one
IS there a way to delay seamless travel like with the initial NetTravel ? (GameInstance::DelayPendingNetGameTravel)
1p listen server? will appear like standalone in this situation I believe
I would use "play as client" to test this stuff.
2 player listen server, it works as expected for both of them
My work flow is:
- develop and test with
play as clientto make sure clients are getting all their info over the network and everything the server knows about them is across the network (been burned by "host" cheating and grabbing server stuff directly) - test standalone to ensure it works
- test listen server to ensure it works
the last two steps are necessary generally because OnRep isn't called in C++ for servers, so if you want to do something on the server when a property is replicated, you have to call it manually
Networking is one of those areas where I find being as strict and explicit as possible is good.
alright everything is working normally with play as client too. The only situation the problem is ocurring is standalone clients connected to a standalone server, which i'm launching from a command prompt as detailed earlier.
What could be different about this situation that is making a server function run on the client
this is not exhibiting in PIE? this is only standalone builds?
where you're connecting manually?
correct, only launched through console.
And I have confirmed that the clients are actually connecting, they can see each other
They're connecting, but a server rpc is logging on the client?
yes that is what is happening
and it is not logging on the server, just to be clear
there is another problem, ive got a moving platform, no client owns it. And that thing just vanishes completely on a standalone server, no idea where it went
looking through the server log, do any of these seem like a problem?
https://i.imgur.com/3dXtR0s.png
https://i.imgur.com/Zm1ZXeE.png
perhaps these are also related
but i feel like missing assets would cause a problem in other situations too, no? The gun works fine
I like to clean up errors (and warnings if you can stay on top of them) before investigating issues as they can often hide the underlying reason.
But no, I wouldn't expect any of this to be the cause
although that looks like maybe you've got some blueprints that aren't compiling
what actor are you calling the RPC on?
its compling just fine. I did in the past, change a function which caused it to stop compiling, but i fixed that earlier this week and its been fine since
The player is calling the rpc to spawn and equip a gun for themselves
GunBaseBP compiles if you open and compile it?
it does indeed
I am attempting to paste code here and its giving me an error
https://i.imgur.com/gFkDM1Z.png
so here is a picture of the two relevant functions
https://i.imgur.com/Kt0tjo3.png
cycleweapon is client, equip is server
Can I get the declarations of those functions?
output from the log of the client when i move the mousewheel
https://i.imgur.com/EwJysSC.png
looks like you didn't connect
void CycleWeapon(bool bForward);
//Call this to do the equipping of a weapon on the server
UFUNCTION(Server, Reliable, BlueprintCallable, Category = "Weapons")
void EquipWeapon(TSubclassOf<AGunBase> NewWeapon);```
nope, connection is definitely working, i just launched a second client. They appear on each others screens
i honestly do not know, its not any log message that i put in
but there is certainly a connection here
I assumed it's an engine log.
this situation is quite baffling
yeah
nothing's coming to mind
other RPCs are working then
can you make a simple server RPC on this actor, see if that works?
what about the player controller?
what about client RPCs?
i do not know for sure that any other rpcs are working at all
they very well might all be broken
In situations like this, I like to eliminate variables and test the most basic stuff. If that works, then I can start figuring out what about the complex case causes it to break. And if the basic stuff breaks, then you know it has nothing to do with how this function is set up or called.
i think i am too exhausted to continue this for now, will try to bring it up again tomorrow, need sleeep
@grand kestrel I think I found the solution to // This is a bit weird, but the actual function the adjust the client position doesn't get the MoveResponse, but single variable (https://github.com/Vaei/PredictedMovement/blob/main/Source/PredictedMovement/Private/Stamina/StaminaMovement.cpp#L196)
According to this other doc I found online: https://docs.google.com/document/d/1UO6Ww6Lfpti3YElVdo9uioTUtQJQ9CoSLvd9kF8hvJo/edit (at the very bottom of the doc) when the StaminaMovementComponent does SetMoveResponseDataContainer(StaminaMoveResponseDataContainer); in the constructor, it sets the private StaminaMoveResponseDataContainer as the variable that will always hold the MoveResponse.
Meaning that you should be able to get the MoveData from there and do the logic inside the Adjust position implementation ๐ค
I am not sure of this tho ๐
https://gyazo.com/f648624f08471e86e423b7ed746e2df9
isent this all i have to do to servertravel :/ ? its in the gameinstance
Hm, I think so yeah, why?
hm so the problem was i think that u cant test it on viewport clients, has to be tested in standalone why idnno but
also now im running it on the GameMode
i thought u could run it on the gameinstace :/ ?
why is that
Hi all, random question, regarding Character Movement Component in Unreal.
Is it possible to have more than 1 attached to your character? (I'm wondering if I should create 1 custom one for my specific game needs, or if I could create smaller reusable movement components
e.g. Dash Movement Component that just has the logic to replicate dash/roll to the character to a direction in multiplayer while having the original CharMovComponent?)
I decided to go finally with C++ since BP is pretty buggy when having multiplayer logic with even 100ms latency (rubber banding etc)
any one has any experience in that? ๐ฎ Appreciate any help!!!
@thin stratus
That comment is from @thin stratus 's code, he'd understand it better. At least, I think it is ๐
@queen escarp You can use that in the GameInstance just fine as long as only the Server executes it. If you SEAMLESS ServerTravel then it only works in Standalone. There is a console variable to enable it in PIE, but it crashed for me last time I tried.
@thin stratus ah ok ok, then ill just test it in standalone then
i managed to get seamless travel working in PIE but using the launch flag for multioss
@frank birch
ClientAdjustPosition_Implementation(
MoveResponse.ClientAdjustment.TimeStamp,
MoveResponse.ClientAdjustment.NewLoc,
MoveResponse.ClientAdjustment.NewVel,
MoveResponse.ClientAdjustment.NewBase,
MoveResponse.ClientAdjustment.NewBaseBoneName,
MoveResponse.bHasBase,
MoveResponse.ClientAdjustment.bBaseRelativePosition,
MoveResponse.ClientAdjustment.MovementMode,
MoveResponse.bHasRotation ? MoveResponse.ClientAdjustment.NewRot : TOptional<FRotator>()
);
That's what ClientHandleMoveResponse calls
It just passes all the inner stuff along
Nothing to grab the MoveResponse from or?
SetMoveResponseDataContainer(StaminaMoveResponseDataContainer); puts it into the variable StaminaMoveResponseDataContainer
that variable is like a memory placeholder (I think)
Ah you want to grab the member variable
That might actually be true yeah
I didn't think that far tbh
Was kinda tunnelvisioning on the function and its param
I feel like i've leveled up IRL ๐
However
Let me check something
// Deserialize bits to response data struct.
// We had to wait until now and use the temp bit stream because the RPC doesn't know about the virtual overrides on the possibly custom struct that is our data container.
FCharacterMoveResponseDataContainer& ResponseDataContainer = GetMoveResponseDataContainer();
if (!ResponseDataContainer.Serialize(*this, MoveResponseBitReader, MoveResponseBitReader.PackageMap) || MoveResponseBitReader.IsError())
{
devCode(UE_LOG(LogNetPlayerMovement, Error, TEXT("MoveResponsePacked_ClientReceive: Failed to serialize response data!")));
return;
}
ClientHandleMoveResponse(ResponseDataContainer);
Hm yeah that might actually work
I always thought this was a local variable
queue in the party_manny
Hi! I don't know if anyone has played Black Desert online.
But they have this thing when a skill hits an enemy that the character gets a small delay.
But this is a mmorpg, how do you think they structured it so it does not affects gameplay?
I'm thinking on clientSide do a small time dilation or slow down. But how do you keep the Client up to where the server was without breaking the gameplay?
It's probably some AnimationRate on the pawn
that is, the game isn't slowing down
just animations etc are running slower for a bit
wouldn't that totally desync you with the server?
Like the client is still registering that you are trying to finish an animation, while the server is ready for a new skill.
So your request will trigger a new skill and rubber band your character
you predict all this
time is not slowing down for you
there's just a slowmotion effect that can be applied to anything
@fathom aspen Remember the issue of root motion + rotation not replicating (apparently arbitrary, but directly related with CPU, Network) on client?
I've been testing and found a hack, which is not ideal, but at least temporally fix it and points to the issue.
If you replicate the character movement component, the rotation + location on client will always work. In fact, you can see that the old offenders that stopped to be sync have a tiny server correction (since replication is fighting with client).
What I'm doing is comparing the server-client location delta, and once a threshold is reached I start replicating the movement component as a fall-back.
Hmm this is definitely odd! Like what does replicating the CMC has to do with this? 
I think is related with this:
Storing Replicated Movement Information
When Actors replicate movement, they do not replicate their transforms directly. Instead, all Actors maintain a replicated variable called ReplicatedMovement, which uses the structure FRepMovement.
The boolean bReplicateMovement, represented by the Replicate Movement variable in Blueprint, flags Actors to store movement information in this structure and replicate it to clients. When a client receives updates to ReplicatedMovement, the RepNotify function OnRep_ReplicatedMovement unpacks the stored movement data and performs updates to the Actor's location and velocity accordingly.
Neither ReplicatedMovement or its OnRep are accessible inside of Blueprint, but OnRep_ReplicatedMovement can be overridden in C++, and ReplicatedMovement's replication conditions can also be overridden in GetLifetimeReplicatedProps. This enables you to customize how movement replication behaves in C++ based Actor classes.
When you replicate the CMC
I think you have two groups of variables fighting
the struct of the FRepMovement
and the actual location translation of the component
CMC used to be replicated some time ago, and they disabled replication at some point. So if you guys are using a custom source build, and a bad commit integration happened, then this might explain it
I totally forgot to report back, but what fixed my issue was the commit they did for 5.1.1
The one you reported and they fixed
Ah, there was another bigger one with root motion on top of rotated actors, that was fixed 100%
this is one coming from almost 4.27
or 4.26
and happens in network saturation, or cpu usage
I tested in Vanilla + GAS
and if you force the server machine, it can start happening
I see, yeah that was my assumption since the corrections were being observed only by the third connection, but still shouldn't the network be saturated for all connections equally? Which is something I didn't dig deep into as that commit again fixed my issue
But in such case, I wouldn't call this a bug then
If this happens in a saturated environment, then optimize your network bandwidth ๐
maybe is not network saturation, but CPU use.
the bug is not losing sync, but being unable to resync back
I would vouch for the former, but yeah either one, optimize...
Indeed. Still happening in decent network conditions and cpu usages, just less.
still, that "less" is a lottery can throw a multiplayer experience
so far, fall backs
but will keep an eye on the CMC struct
Indeed, but I highly suspect that if you guys are using a custom source build, and you manually integrate commits, then you might have missed something at some point
Yeah, def will keep checking what is going on.
not using source build at this moment, 5.1.1
Because I don't see many other people ranting over it, but well I couldn't see anyone else talking about that issue with rotated bases you reported a while back, so all options are there on the table
Good to see that you're still looking into it. I'm really curious to know how this will end ๐
Iโve been having an issue with Vr hands getting locked in place while playing my Vr game in multiplayerโฆ does that sound related to what youโre discussing?
When doing play in editor with various kinds of multiclient testing, is there any way to give each client their own log window too?
no
you can add client information to logs, or use tools aside from UE_LOG that add further context (like the visual logger). But there's no way to separate single-process multiplayer PIE UE_LOGs.
Hey @broken shale doesn't sound related, since I imagine your hand SM won't be using root motion.
Thought maybe the same issue could be behind itโฆ anyone have any idea where to start with this issue then? When playing multiplayer the other playerโs hand becomes locked in place randomly. The touch controller still provides input, you can grab something for example, but the hand will no longer move around
This is in Vr using Ue 5.1
Thereโs another issue that may be relatedโฆ I have an object that shoots projectiles and when you tap it against certain cubes it adds 1 to ammo and destroys the cube using an overlap event. Works fine in single player but in multiplayer some of the time it will only perform part of the operation, ie it keeps adding to ammo while the cube is being touched and never destroys it. Itโs almost as if it is only performing half the code and then detecting a new overlap and repeating even though there was only a single overlap event and the cube should be destroyed
Hello gentlemen , is there any out of the box way (or plugin) to get multiple servers sharing the same single multiplayer world instance in a load balancing configuration ?
Would someone mind taking a look at these network profiles and help me understand what to look for and whether there is any indication that network issues are responsible for my character hand freezing in my multiplayer VR game? The larger file is from the PC that was hosting the game and that is the one where the player hand froze. The smaller file is the PC that joined the game and did not experience any issues
Out of the box probably not. UE servers are single instances and worlds. Plugin, maybe. There are some third party services like SpatialOS that hook into UE, but they also cost you a liver.
If you don't want to pay a lot, you might need to code your own. Either fully replacing UEs servers or doing whatever SpatialOS does
so either pay a liver or grow a second liver
Pretty much
So let's say I want to create a classic FPS like Valorant or Overwatch, and I need some sort of system that can handle accounts, player profiles, economy, matchmaking, etc..
What option would be the best? Steamworks? Playfab? Xsolla? Something else?
If you got an answer, plz ping me
what do you mean by "matchmaking"
oh shit, that was quick.
What i mean is
something like dedicated servers, where you get put into a server for a game
idk the correct terminology, but what i'm trying to say is when you join a game, like is TF2 or Overwatch
common sessions from epic has a limited matchmaking support
but not "have someone host, then you join", the other kind
if you are only looking for a server browser kind of thing , steamworks got you covered on that .
But if you want to do some kind of evaluation and matching on player level etc then you will have to go with either PlayFab or write your own custom backend
redpoint matchmaking plugin expands on that, and works well out of the box
what about accounts and account saves for economy and other stuff (say characters)
so just to take stock.
EOS can handle accounts stuff, economy, matchmaking, etc?
matchmaking... not fully on its own
i use both redpoint eos and redpoint matchmaking plugins, with a combined pricetag of about 600 euro
you still need to find a place to host them, and handle docker/kubernetes/agones yourself
i see, so EOS, Redpoint + a place to host
matchmaking with dedicated servers basically comes to dropping a beacon on the levels so they can be found
that's an option, anything else?
check lyra for start
i saw some matchmaking code there
i don't think it works unless you're using sessions though
i mean, other services like Steamworks or Playfab
not quite equivalent here
something like that
fair enough
so you'd be using steamworks (albeit indirectly) anyways
no
it only lists them for you
it won't run any of its own
damn
Learn how to deploy dedicated game servers in a cost effective, scalable way.
give that a read, should answer some or most of your questions
ok so, from my understanding:
- EOS, Redpoint + place to host
- Steamworks + place to host
- I am an idiot
so either way, I will still need a place to host
you don't need to handle steamworks directly at all
Most of the services you mentioned will handle your data , server list and communication . The server will be your responsibility to run outside of those services
EOS is platform agnostic, and its interfaces have specific implementations for steam, ps, xbox... etc
well, from what i know, I will if I want to use it's account data stuff
That clears up alot
thanks
account data stuff you can use with just EOS, and no plugins
so they just offer a system, i still need a place to host it
you do have 2 more options
community ran dedicated servers, so you release DS build and let the players host themselves
and listen servers (not recommended for competitive games)
listen servers?
Does anyone have an idea of what ranges to look for in network profiler to determine if thereโs an issue? For example my Vr character blue print has average size bytes 19.8 and 158 for bits
and waht about session
actually, is there something that explains the differences for the server stuff
one player is both a host and a client in listen server mode
like something that just explains all the shit we just talked about
this costs performance budget on host, and anti cheats are difficult
on the upside, it does not cost money
So my options are:
- Dedicated Servers
- Community Run Servers
- Listen Servers
- Sessions
and for the functions such as matchmaking, accounts, economy. That would require a system such as Steamworks, Playfab, EOS and Redpoint, etc.
wdym
they are a method of connecting, not hosting
alrihgt, very confusion. Do you have some sort of guide that explains all this?
nvm, i figured it out
Alright, so lemme take stock once more. My options for hosting are:
- Dedicated Servers
- Community Run Servers
- Listen Servers
and for functions such as matchmaking, accounts, economy. That would require a system such as Steamworks, Playfab, EOS and Redpoint, etc.
Am I right?
steamworks only works for steam and nothing else
not a problem if your plan is to release on steam only
but otherwise its a significant one
how much do steam online subsystems cost for dedicated servers ?
From my understanding? You are talking about Steamworks, that shit that handles your account stuff and showing servers, you still need a place to host.
But it's free
you just need to sign up to be a Steamworks Partner
thanks
yee
Some NDAs, SDAs and showing your billing stuff, then you in the clear
or something similar to that
but you aren't paying until you are putting your game on steam
fair enough
by this you mean the 100$ publishing fee right?
yep
Quick question: if we set a replicated property to the same value on server and on client before BeginPlay, will a replication occur for that property as part of the initial bunch?
Okay seems to be so
Hey, I did the multiplayer prop lift and rotation, everything works in the editor, but when I export the game, the replication lags. What could be the problem. I do the processing on the server. prop has movement replication
can someone please help? I am having a weird issue where my mesh wont show up on a dedicated server, I tested from the editor and noticed when ever the mesh does not show up I get this error
Hit limit of 96 saved moves (timing out or very bad ping?)
can we use steam sessions and steam dedicated servers both in a same game?
Hello, it's me again ๐
I am learning the CMC, the saved moves, the customFCharacterNetworkMoveData(Client -> Server) and theFCharacterMoveResponseDataContainer` (Server -> Client).
What if / How wrong would it be to add non movement information to the CMC Network Data (Both ways) to piggy back on the CMC?
Say, in this thought experiment, I am making a shooter. one character wants to shoot a raytraced weapon and see if I hit another client character.
How I understood it, I can save the intention to shoot and the predicted target and send it to the server to see if the server agrees with me and get a correction if (due to lag or other things) I missed the target.
This post describes how to make a rewinding shooting component https://vorixo.github.io/devtricks/simple-rewinding/ instead of piggybacking off the CMC.
So... should one ride the CMC as far as possible or is it better to learn from it and spin your own predicted/corrected replication component? ๐ค
(this is not what the AShooterWeapon does, Which is bugged in it's own right as Jambax explained and this post immortalizes: https://vorixo.github.io/devtricks/shootergame-vulnerability/)
also, what if there was a component that has all the replication/correction logic of the CMC (saved moves, timestamps, corrections, etc) but no implementation on the movement. Like a framework...
Is that the fabled abandoned replicated component/plugin?
Iโve been having an issue with my Vr game in which the player hosting has one or both of their hands lock in place. It still generates input (you can move with the thumb stick and grab) but the hand mesh just floats in the same spot and canโt be moved. Any idea what would contribute to this or best way to go about diagnosing? Also having a possibly related issue where cubes that add to ammo on overlap and then are supposed to be destroyed just keep adding to ammo while touched without disappearing
Use breakpoints and select debugging objects to find what is failing
if i define a replicated variable using ReplicatedUsing = RepFunction, the RepFunction doesn't get called on the server right? is it bad to have the server call RepFunction() manually after setting the variable?
Whats the proper way to spawn a series of actors, and assign controllers to them without possessing them straight away?
basically i want to spawn in everyones selected character and only possess them when the match is ready to start
I was thinking of making an array of the spawned characters, (which are spawned on server) with each client's character being at the same index as their respective playerstate's index in the gamestate's PlayerArray.
Do the indices stay the same on the server? assuming no player disconnects
Is that a response to my question? If so, where would I place the breakpoints? Iโm not sure where the bug is coming from, only that itโs causing the hands to lock up at random points during a multiplayer session. I donโt think I can check that in editor because it only happens when there are two players actively playing
It is. You can put the breakpoints within the event that causes the hand to move after input. You can go to the 3 dots next to the play button and change players to 2, to open 2 different windows
If it happens randomly, you may need to just select the debugging object and watch the flow as the game runs, so as to not have to constantly play through a break point
How do you select the debugging object? And to simulate network conditions would I need to toggle launch separate server and/or enable network emulation?
Thereโs a drop-down within that same row. Start the game and select the object, be it an actor or a controller, wherever your problem code is. If you have a host and a join setup, then you just need to run it and host in one window, join from the other.
Now this is kind of an emote that i set in my character bp. I call morphOnServer from my widget BP. Now the set morph target is working etc. The only problem is with the mood set variable. It is always set for both. So if i make a morph target and it goes through the branch as true it is set to true for both
Why so?
Hey, i'm starting to make a little multiplayer game, so i install the Advanced steam session plugin for UE5.1.1, and since i installed it, i can't save anything, i get an error : Failed to save "..." try again or continue without saving, something like taht, anyone has an idea ?
Do you have a second copy of unreal open?
CPP and blueprint have different behaviours
Iirc cpp doesn't call the rep notify on server and blueprint does
thats because BP is masquerading a property changed callback as replication callback
Hey, i have problem with moving the AI multiplayer. I just call MoveTo on behavior tree and it works on server, if there is no clients. So AI moves to location thats it. But when i launch with server and a client, AI doesnt move at all on the client OR the server. BehaviorTree runs to MoveTo and AI plays walking animation but doesnt move, destination is correct also. Client also plays moving animation but just jitters a bit more. I just dont understand what can cause it, as if it would be replication problem, it should atleast move on the server. How da heck just spawning a client can prevent AI from moving on Server also.. Thanks for any ideas if u have some
2 reasons:
AI_MoveTo or SimpleMoveTo?
2nd doesn't replicate movement
or NavmeshWalking movement mode, not replicated, so AI would be falling on clients, need to set it up from say, BeginPlay on their CMC
as navigation mesh is about 30 UU above the ground
i also recommend an approach where you spawn MoveTargetActor for each AI
then you just MoveTo that Actor with GoalTracking enabled
and then you teleport the MoveTarget around when you want them to move, simplifies BTs significantly, as its super easy to do stuff like move and shoot at the same time
this you need to do just once, from outside the BT
Hmm.. I still just dont understand how this would block Moving happening on server also.. As i told, If i only run it server only, it works. With 2 players , listen server and client, its not working on server or client. Shouldnt the server be correct and doesnt care about whats happening on the client
Im using AI_MoveTo, AI collision is hitting the navmesh whole time and movement is replicated, but if there is a client..MoveTo wont work anymore, so confusing as i would expect it still moves atleast on the server
That's actually not that needed anymore. Since Lyra they improved the MoveTo task and you can goal track locations with it now.
Previously it was always finishing the move to location first before you could update the path, so the MoveTargetActor was more or less needed for moving target that aren't actors.
still simplifies BTs as the move doesn't need to be an async task in BT
I worked with MoveTargetActors in internal projects and The Ascent and that was in no where simpler than just using the MoveTo Task
But maybe that's subjective
Good to know about both then
Also not sure why Towwi's movement would break on the server
NavMeshWalking not being properly set is indeed an issue, we had that too. Think we also set that on BeginPlay of the CMC
Aight, i shall take a look on NavMeshWalking! Thanks both
bump on this:
how far should I stretch the movement component replication and what downsides are obvious from this stretching? ๐ค
why do i always get error "trying to access none" trying to read property Callfunc_GetWidget_ReturnValue_1
Depends. It usually means your target returns None
yeah but i dont get WHY ๐ฎ
So it could be where you have it placed in your blueprints, or any number of things
Like for example if you try to run this code before that widget exists
Put a breakpoint on either of those visibility nodes and then hover over the target input pin when it stops
Not sure about component side, but widgets usually require a create widget node to initialize
you know what
i put a 0.01 delay and now it worked, so i guess it was trying to access it before it was created x)
thanks ๐ฎ
Np
also another question
getting exactly the same error from this
im creaing the mode widget at event begin play and then when im overlapping box a play the "show mode"
I donโt see a begin play node, are you calling that custom event both on begin play and elsewhere ?
To show the widget, use the add to viewport, to hide it, remove from parent. Your create widget should only occur once, on begin play
yeah
im only creating it once tho
the "create modewidget" is called from an event begin play once
But that also calls add to viewport
ok so add to viewport is better
Well, if you need to toggle it on and off during runtime, you should probably have it in a separate event, that is
well same error when using viewport instead... so freeking annoying
i mena it "works" as it should but the error always pops
If youโre looking to bypass the error, use isValid? in front of the node
Just keep in mind that masks the error, rather than fix the root cause
Idk if you can create the widget in the construct graph, but that could be a solution if you need it created before runtime
I havenโt tried it myself so idk if it allows that
in this case shouldent matter, im fiering the show widget alot later
oh well nevermind that
now to a more pressing matter ๐
Hey everyone, Iโm pretty new to networking for unreal so forgive my naivety if my question sounds silly and/or wrong.
Iโm currently using general movement component in lieu of character movement component for context. general movement component implements a network clock that is more accurate than character movement component.
I have an AI zombie in my world that is controlled by an animation blueprint which dictates what animations the zombie should play, and blending various other animations together. One of the state machines in my blueprint is responsible for locomotion and thus has an idle state which contains an idle animation sequence player.
The issue that is currently plaguing me is that the idle animation is not synchronized between the server and client, and this is causing line traces that hit on the client to miss on the server. I wish to keep the animations between the server and the client so that the collisions are synced on both sides when a line is being traced. Does anyone know why this happening? It seems my client time is behind the server time. How could I update the animation to catch up to where the server is in terms of animation time?
@icy jetty im trying to implement a basic combat floating text when hitting/getting hit but i cant get it to work on MP,
Are they replicated properly ?
RPC is usually the culprit with this stuff
I think multicast does both clients and servers
erhm i just realized their both playing the same event ๐ฎ
so i dont need to run it on server ? only multicast or viceversa ?
Yeah. Multicast sends to server + all connected clients
yeah im os dumb, it works now hence i removed the cast to server but it would have worked before but i used same event so i was just being dumb ๐
awesume
however.. hm how can i make it so it only shows on the client that "dose the damage and the client recieving the damage"
hmmm
then i cant multicast or multicast with some conditions or ?
tips ?
Multicast Delegates might be what youโre looking for, but I think you have to use C++ to expose them
Search Multicast Delegate see if thatโs a real node, I canโt check right now
delegates don't have anything to do with networking
Hi, I'm trying to get level instancing to work in multiplayer but am not sure how the replication for this works.
Should the instance be created on the server only, and set the visibility through a multicast, should everything be done for each client, or should everything be done on the server only?
It's working for the server but not for the client currently
Just figured I didn't set the multicast to multicast, however when I do and launch the game I get the following error:
hello i'm running into this issue (https://issues.unrealengine.com/issue/UE-78453), where sometimes my OnRep_Controller on the client doesn't get called when the controller it's set to nullptr by the OnRep_Pawn. Any ideas how to fix this?
around 50% of the time it only triggers on the authority
the other 50% it triggers on authority and the client
@winged badger how do u mean ?
@fathom aspen You are guaranteed the value in PostNetInit not in BeginPlay
Could someone help me with my respawn and character selection issue i am having? No matter which character i select and save it in the game inst, i always have the same character of the host of the session. Also when one character dies all players see the death ui and then also all players respawn
I would really appreciate any help! It won't even take long, i followed a few good tutorials and all other replication stuff is working. So it's probably minor things
and spawning happens in my game mode
that HAS a widget
the component is not a widget
it has one
and can display it in 3d in the world
truie
and this is what happens when you select a character before joining. I really don't know why it's not working.
I probably didn't word it quite good, but in my case I was wondering if a replicated property that was unconditionally set in PostInitializeComponents for example to a value of 10 (so its set on both server and client), will be replicated when the initial bunch gets sent?
The answer should be quite interestingly yes, even if it makes little sense!
Basically when a property gets checked for replication, it gets compared against the shadow state of the actor, and in our case, the shadow state is the CDO state. The value of the CDO is 0 in my example, and since 0 != 10, replication will occur. Basically the engine is not smart enough to realize that the client has that value already, and that there is no need to send an update ๐
ahh gotcha, yeah that's different than what I thought you were asking. That makes sense though
my first glance is that your code is running on server and passing "self" as the player pawn owner. that could be why they're all behaving as if they're owned by one player.
now but they are spawning correctly, so it's not like the host is spawning again when a client joins
what do you mean more specifically?
when the host creates a lobby and joins he spawns as usual. Now if another player refreshes and then joins the lobby of the first one, he spawns correctly too (besides having the wrong character). But i mean the host doesn't respawn again unlike when someone dies where all respawn
not sure if i've seen multiple problems in your description or not
on the server side respawn i'd try passing in GetPlayerController, but set the player index parameter to 0,1,2,3 (to match each connected player)
and see if they spawn individually
its not super clear to me how your CharSelectionGameInst, sets the "current character" it's providing
in your secon dscreenshot
get game instance > charselectiongameinst > character > spawnactor
that's the same character var each time, idk if it changes elsewhere
the "easiest next step" would be to make an array of character vars on your charselectiongameinst (one character var for each connected player) and then use the player index number (0,1,2,3,ect) to refer to their personal character var, when you respawn them
but there's probably a more elegant, better way to do that long term
wow yeah sorry, i missed your third screenshot, AgeBPArray is "trying to be" your character array, your GameInst class should have a similar struct and dole out one character for each different type of character that is requested by your spawning player
nah that's the arry that holds all different characters
not the players and their choices
theirn choices are all stored in one game instance variable which is not an array
i thought the gameinst doesn't get replicated thus each player has an own or not?
i underestimated how much imagining people's code over the internet, roasts my brain lol, i need to take a break soon
i need to say a couple lines
each client has their local copy of data, like gameisnt or whatever
but when the Server does something, it's gotta pull from its server copy and assign it to each player
if you want we can ujump to dm and fix this in like half an hour if you have experience with this? I don't think it's huge issues, just minor ones cause the code isn't that big really
and their clientside version gets updated
i can then send you everything you need
i cant promise anything, but sure
alright
I can replicate pointers to UPrimaryDataAssets right?
or TSoftObjectPtr<UPrimaryDataAsset>?
yes
hi guys, bit of a general architecture question, im using the third person character & controller that comes default but also need to make some changes (making a top down wasd mouse rotates the character game) and i need to capture local player mouse input and rotate the character.
the default character and controller are backed by heaps of great network code, so ive created another class top of them to do various things but..
for the mouse rotating the camera in the player controller do i just rotate on the server and replicate it across the network or should i hook into the player controller that exists already re-use some stuff?
how do i cast correctly to the player controller? Here when the client dies only he respawns but when the server dies all players respawn
Well, for starters - you really shouldn't use the level BP
Secondly - using GetPlayerController kismet function is bad practice in a multiplayer game.
To answer you question - you are casting correctly.
Whether it's the actual controller you want - that's a different question really
I think you're mixing up Unreal's Controller and Unity's concept of Controllers
You can do everything in your pawn if you want
pawn can handle input
I would start by making your custom pawn a subclass of Character, not 3rdPersonCharacter (which is sort of crap)
the great network code is in Character / CharacterMovementComponent
Ahhh ok thank you I will try that, yeah I just wanted to make sure to reuse the character movement code cause of all that nice network stuff
Is there a way to "unlock" the transition map ? I noticed beginplay and ticks doesnt works on it, and I cant play an animation sequence in a skeletal mesh too
If you update a variable on the gamestate from the server, and then access that same variable from a client using a run on owning client RPC, will that variable automatically be up to date?
how do i giv ethe actuall controller that i want ?
You need a reference to the pawn and then call the Get Controller method from that
You don't need a get owner call
Just pull off from Other Actor and cast to pawn
Then get controller
Don't make it a pure cast
So you can add a debug message
Sure. Now add a print message if the cast fails
Again - you really don't want to be using the level BP either.
where else can i test for actor overlap?
You can just have a regular ol' volume
I don't recall if the Level BP is replicated or not. This could make it more annoying to actually know which machine is executing the code.
You can throw a HasAuthority check in there. It might work. But again - I don't remember if server creates the Level BP or if each client creates their own.
does it matter really if everything works?
LevelBP should kinda be avoided either way :P
OK now respawning is working. I literally worked 7h yesterday with 2 other people only on this
i mean i am not completely against putting it in a different bp but i fell like testing an overlap should one ly happen if it's in that exact level
i can't imagine a case that is more worthy of being put into the level bp than this lol
because of this. A HUGEEEEE THANK YOU @quasi tide
Just create a BP actor. Add a Box Collision to it. Then put this logic in there. Expose the sound as a variable. Now you can use this logic in many different places.
lol okay, might do that later on haha. Thanks
Can we by any chance hop to dm? I have a few tiny problems like that one too that i haven't fixed for days now. I feel like you know what you are doing ๐
it's like nothing too complex. Not that much code tbh
like 2 screenshots beside the one you have already seen from level bp
Nah - better to ask in this channel
Ok idc really i just thought it would be easier to overlook it there
SO. The level bp is calling respawnPlayer
which is a Player controller function.
can you read this?
that's basically the important part now inside the player controller
now the problem i have is that it is giving me some errors when trying to create the WBDeath
i will screenshot it wait a min
btw spawn player which is called in SR_SpawnPlayer is in game mode. This is it's code:
In a bit we will get to why the clients always have the same character (which is saved in gameinstance) as the server
Well, why would they get different characters
If you just have the Server's GameInstance variable :P
this is what happens when the client dies right now. He respawns instantly and can move already but is still seeing the death ui and after the timer runs out he respawns again
You can't add the Widget to the Screen on the Server if you only create it on the Client
There is no reason for it to magically be a valid reference
You gotta make that call on the Client
There is so much to unpack here ๐
My best advice is to read the pinned posts really. Especially the network compendium
And you need to keep a mental model of what machine the code is executing on
how so? I watched a few vids on basics of multiplayer etc and the respawning is working besides the ui stuff so idk the reason really
below the screenshot i am also handling the rest of the ui from the player controller because the youtuber said that would be best
The Error says that you call AddToViewport on a null pointer
and it's working just fine
So the "WB Death" is not valid when you call RespawnPlayer
only reason could be that at the top the branch is false
An since you create the Widget on BeginPlay, the only reason would be that you call RespawnPlayer on the Server version of a Client's PC
so it's not the local player controller
so do you mean that i should set the respawnPlayer event to run on server?
No
lol
Idk what RespawnPlayer is being called from
But if you call that on the Server version of a Client's PC, then the Widget will be null
WEll
The image you posted of the LevelBP
Shows that you aren't limiting this to anyone
The Overlap will happen on every player
only the one that overlapped no?
That Character exists on every Player though :P
If we both play together, and you run into an Overlap, then I see your puppet Character also run into that overlap
We both get an Overlap even for that Character
Including the Server if that is a Dedicated one
Yeah
- You should limit this to SwitchHasAUTHORITY
- You don't need SpawnPlayer to be a ServerRPC
- You need to tell the Client that they are dead, since this all runs on the Server
For 2. idk if you use SpawnPlayer anywhere else
Then it still doesn't need to be a ServerRPC
although i donรt like the index 0 there too lol
BeginPlay calls on everyone that has an instance of that Actor
So every player
The Server should be the one spawning all Players
A player should not ask the server to spawn (unless via some key input or UI)
Then why is that call there in the level BP? :P
they call sr spawn player which is in player controller and that calls the spawnplayer in gamemode
Yeah bad
the actual spawning happens in gamemode
Absolutely redundant
The GameMode already spawns your Character via the Default Pawn
And even if you need some custom logic
You can do that in PostLogin
no i don't set the defaultpawn
that's common, many youtubers repeat poor implementations
that is a bad approach setting a default pawn
It's not, it depends on your game
my game starts in main menu abnd you can select a character to play with before joining the actual game
thus it makes no sense to set a specific default pawn
Yeah you can use the PostLogin function in the GameMode to kick off all of that
LevelBP is shite
also i don't want a pawn to spawn in the main menu
i have some stuff there too already
Yeah and?
PostLogin calls per Player on the Server
If you really need that shitty "I saved my Character in the GameInstance to move it from MainMenu to Server" then you can do a ClientRPC on the PlayerController here, followed by a ServerRPC that passes the saved Class along and then calls spawn with it
i think that's almost what i am doing right now
You are using the LevelBP's BeginPlay and you aren't passing the class along :P
how else would you save the selected character? The GameInstance does not change, that's why in most tutorials they use that
I wouldn't use BP for Multiplayer to begin with
In C++ I can specify a String that the Client can send along when connecting
Relatively easily actually
the class is being set in the widget bp when you select the specific character. Then it is spawned in gamemode . THe variable is the character one
Which could be an ID that identifies the selected Character
yes but i want to. As long as this is possible in a not too hard manner then this is what i am aiming for as i am a 3D designer and not a programmer or anything like this
Sure, I won't stop you :P It's a terrible idea to do Multiplayer without C++, but everyone learns that the hard way
Either way, you gotta send the Class to the Server
Cause in that Screenshot you are using the same Class for everyone
Cedric, I like the way you give advice and id like to ask a question regarding some basic stuff, but ima wait as to not interrupt this convo
Just ask
This is always the same value that the Server Player saved
well that makes sense yes
how can i do that differently? I made the wrong step that i did everything for single player and now want to switch it over lol
Let's assume you stick with your LevelBP, you have to change the "SpawnPlayer" RPC to also take in a Character class
I can't write with mouse
that's the player controller
The pink line is meant to be an additional "Character Class" pin
And the GameInstance part is meant to be what you are doing in the SpawnPlayer function atm
yes haha i got what you mean
Again pink being an additional Character Class param
The "GAMEINSTANCE" block might be better behind the Delay. I didn't really pay attention to where I drew, just needed space
alright,
I'm trying to replicate control rig functionality - two separate rigs, two separate goals, encased in two separate gameplay abilities. The control rig is driven by values used in their respective replicated ability, and the server is able to pick up the values but this does not get sent back go the clients
I am so sure this is a super basic question, but alas, I am here
Reading "Replicated Ability" (if that is a GameplayAbility from GAS) already makes me shiver
why?
Cause 99% of a time, that's redundant
None of the Abilities in The Ascent are replicated for example
I replicated it by just using the little drop down menu thing in the class defaults, nothing inside the ability itself
Neither did we replicate anything in the MOBA client we are working on
so how did you network the abilities if they're not replicated?
The Ability would need to actively be marked as Replicated
so the game Instance should not be a pure cast?
Either way - I don't really understand the question. Are you having issues reading the values? Issues sending the data?
There usually is no need to network anything
Activation is predicted
So it runs on Server and owning Client
ASC RPCs handle that
VFX and other stuff is handled by GameplayCues
That replicated on their own and are more lightweight
yeah but there's a little box in class defaults that says "replicated?"
GEs are predicted and replicated via the Attributes
and that's what you use to set that, right?
Individual GAs are not replicated for us
Aka they don't have replicated variables or RPCs in them
I'm not sure the problem - Server gets the info, but no clients do
Did I ever say anything about that? :P fwiw I almost never use Pure Casts
ControlRig of a Character?
nah but you said like i was handling it in spawnplayer function and there it was a pure cast
yes
Ah, yeah I don't mind. I don't use Pure Casts, but that's up to you
So not sure what exactly you are animating here but if this is anything like a normal AnimationBP setup, then any variable that needs to replicate for animations should just be in the Character Class. The GAs can set those if needed.
And if your GAs are predicted, then the Rep Condition could even be set to skip autonomous
Animations read data from the actor. So you just update the actor with info and the animation stuff reads in from that.
Ah I see!
What I have are some properly replicated attributes set up in C++, and I use those as boundaries for a random number generator to obtain a recoil value for some procedural recoil (I recognize this is bad, as I should be involving the random seed somehow but that's a problem for another day)
so the actual value fed in needs to be replicated
It's best to see what happens with your GAs and then choose the best place to put your values
Your Player will press a Key
That Key will activate an Ability predictively (at least preferably)
That runs on owning Client and Server
Owning Client can predict any recoil here
Server can do Recoil too then
If you need Recoil on Simulated Clients you can send the require Data for the Recoil via GameplayCue
And then just handle the Recoil in the GC directly
The GC will be predicted on the owning Client and replicate to Simulated Proxies
Hmm that's super interesting. I've done some really basic gameplay cue implementations, but as you're typing that, it definitely seems correct
Although it might not be the best to put the Recoil code that actually modifies aim into a GC
But just the result of it data that then spawns effects
its that last sentence that idk how to do lol. my whole ue5 experience has been in the context of GAS, and im a noob otherwise
Simulated Clients wouldn't need to know about the Recoil data that modifies the weapon shot
But just the result of it fwiw
But I'm sure you have a better idea of what is visual and what is gameplay in your setup
I can run the recoil number generation server side, produce the GC, send it back while also predicting it locally
if in doubt, replicate it through the Character
We have a lot of state stuff in the Character, like "CanWalkThroughPlayers"
That would be the correct approach, yes
You'll end up just shoving a lot of stuff in the character or player controller honestly
@thin stratus Alright now the character selection works perfectly as for now ๐ Thank you very much! Now would you say i should change how i get this player controller on the left here?
There isn't really a way to change that here
I would not use the LevelBP to begin with
But you know that already
by "Predicted" you mean that the activation happens both on local and then on server?
does the GAS have something to correct a misspredicted ability or is up to you? ๐ค
The Activation yes, and Side Effects like GEs, but anything else is up to you
yes okay we can focus on that now. Regarding the actor begin overlap functionality with the respawn we said I can make an own bp for it
what about the stuff here in beginplay?
Yeah, keep in mind the Overlap happens on "everyone"
That's why you make the collision trigger only be spawned on the server ๐ง
if a client calls ActivateAbility does it automagically rpc? or does the client need to manually rpc the server for that activation? ๐ค
In BP only I would move to a
PostLogin on GameMode -> ClientRPC on PlayerController -> Get all Data from GameInstance -> ServerPRC on PlayerController -> SpawnPlayer on GameMode
yes but it is working like this so i could most likely just copy most of it to the other bp i assume? (Regarding the overlap)
Automatically
If the Ability is set to predicted that is
+- terms and conditions
I guess, yeah
You will still have an issue with the Death Widget
but where does i now say when to spawn the pawn as i don't want a pawn to spawn in main menu where the game initially begins
You'd need to limit the Overlap to a LocallyControlled Pawn
It might come to you as a shock, but you usually don't use the same GameMode for MainMenu and Gameplay :P
In a proper setup, you would have some base GameMode class that you can put stuff in that really every GameMode needs (usually very little of anything)
And from that you'd make a BP_GameMode_MainMenu
And a BP_GameMode_Gameplay
And then fwiw Gameplay can have more child classes for different GameModes
now that is a wonderful option right there
Like traditional Deathmatch vs Capture the Flag
Yop, cause that also means that the majority of classes that the GameMode specifies will also be unique to each of those
Having a BP_PlayerController with a BP_PlayerController_MainMenu and _Gameplay
To have one spawn the MainMenu and the other handle Pause menu toggling
etc. etc. etc.
ok now regarding this. FOr now do i just add a is local player controller with a branch after this for the death widget to work?
If you connect IsLocalPlayerController to that GetController node you will get accessed none errors
You are currently silently avoiding them with the cast
Cause the GetController will return null for anyone but the Server and the local player
So better is to call Is Locally Controlled on the Character itself
BP_Ape if that is your character
Did you read the Compendium that is pinned to this channel?
Because that gets you very far if I may say so
And saves all of us a lot of repetitive Q&A
no i did not but thanks for suggesting it! I will get into it in a bit
What in tarnations
I like to have a fully functional example on which i try to understand why it is working
and idk there was such compendium tbh
This doesn't seem to scroll to the correct message for me
Or it doesn't highlight it fwiw
That's because Discord is poop. Click it again.
Idk what you linked
I must have overseen your message i am sorry
This compendium is meant to give you a good start into multiplayer programming for Unreal Engine.
Please read this before you continue asking for help here
Would just be fair towards us :P
For Cedric because his Discord is actin' like Discord currently
It has a dark mode too ;)
Oh that is def a huge plus haha
Ok i guess that would really be fair. I was just eager to like finish this up to a point where it at least does work and then I wanted to clean it up after having a commit to github that has a working version at least. Now that a mod is helping me lol
cause only thing missing is really the death ui
My gripe with this approach is that it is annoying to switch the gamemode when opening the level. And I don't want to have different versions of the level saved as well, just to have different GMs selected ๐
No clue what you mean
You must be imagining things
Eh?
?game=CTF
Tada
Yeah - I know. But that is like 8 characters more than what I want to type.
But that's just part of your code
And the way to choose the GM for one an the same level
Yeah, I know how to switch the GM when opening the level and all that. I just find it annoying.
Fair enough
You probably never had to deal with a game that has 10+ characters
And your Designer telling you that all their Abilities have to support something new.
I reject this notion. I definitely have more than 10 zombies. I've gotten up to 200!
:P You know what I meant
(Jokes aside -I know what you mean though)
I always wanted to add that fancy debug UI stuff to UE
But there is already a plugin for it and then I lost interest
What fancy debug stuff?
Oh - this is neat
It's especially nice to debug Servers I guess
But even with just launching it next to a Client or Singleplayer Game
To have Cheat Menus etc.
There is also this
But I think the one above has that more or less integrated
Sometimes I feel like I really should look more into ImGui - it's been really poppin' off lately
Yeah
How Jurassic ๐
Bro that's a whole lecture haha but I love it. I am currently at Ownership
I've tried to understand how to imgui... I failed ๐
OK so i have read it all now
took me about a little more than an hour and i skipped the c++ parts
I have an actor that is NetLoadOnClient, when I run into relevancy range (150m) properties of the Actor class (like bIsHidden) are replicated, but properties I added to my subclass are not replicated. Replication of changes works fine when I am in relevancy range during the changes. The variable is set to replicate to all clients and has no condition. Is there any reason why new properties I added to my subclass might fail to replicate their values upon a NetLoadOnClient actor becoming relevant?
Worth noting I get my variable replicated fine if I set the actor to always relevant, the issue is purely with not getting the current server state the moment the actor becomes relevant (but only for my subclass properties, properties of the actor class work fine which is why I am super confused)
i can't really follow you on this. Right now the entire Death widget stuff is handled inside the player controller inside the respawnPlayer custom event. Now what exactly does the character itself has to do with the ui? I.e. where shall i put the isLocallyControlled inside the character bp?
Hidden Actors are not relevant to connections by default
Sounds like a relevancy criteria is failing
Check which one is it inside IsNetRelevantFor
Wait, calling SetActorHiddenInGame affects relevancy?
Yep
That definitely gives me another avenue to debug via, I genuinely thought that was a rendering only modifier
Actor becomes not relevant
It's still odd that the hidden boolean will replicate but not my class property, I would have imagined in the tick where things replicate I get everything, but maybe there is some additional logic to handle the case where the actor is hidden
You can change that behavior though if you override IsNetRelevantFor of the said Actor
Thanks, I'll check that out then!
Actors don't replicate atomically
So no, that's not a guarantee
Neither Objects really
I figured that was more in the sense of "your properties can be in different packets" kind of thing, rather than only some variables being replicated on a tick
I now moved the actor begin overlap to an own bp and it works fine, basically the same as before. Now reagarding the begin play i don't quite know what i should do here. The OnPostLogin is already happening on the gamemode so i have the first step done i think. Now regarding the rest i don'r really have an image in mind on which nodes to set up besides the ones i have already.
The last to steps are basically calling the SR Spawn Player that i have on the player controller so that is done too. It would be nice if you or someone else who understood this could give me a further explanation on what to do. Again, this is my begin play in level bp. Now the code after play sound 2d should be coded elsewhere
But again why the level BP?
None of what you're doing has anything to do with it
It also mentions the ominous GetPlayerController(0)
i just said that i want to move it from there
did you read my question
It was not a question, but a note
well i said that i want to move it and don't know how exactly as i didn't understand all steps Credric mentioned
So I still don't know what your question was
i just thought that because this is handling the spawning on begin play basically i will try to make an own game mode for the game level and there just put it into it's own player controller begin play
cause he also said that normally you have an own gamemode and it's classes for each part of the game
BeignPlay of PlayerController indeed guarantees you a valid PlayerController
BeginPlay of Level BP doesn't
yes
i mean it is working as for now but still
btw he also said that this isn't a very good way to handle respawn on collisions because it goes through all actors. How else can i code this?
i think he said something about switch on authority or so
How deep is your knowledge of networking?
not very deep
is it as deep as your love?
i am a beginner as you would say hehe
Or what did you read about networking before you started with it?
nothing is less deep than my love. YOu could say it's shallow
i watched kekdots tutorial series
This channel has a handful of resources pinned that should get you up and running
and read cedrics blog now
Reiterate, and read other resources that it links you
For example the one I sent you above
It talks about Execution Filtering
It would be far easier and better for you to read it, than me writing it for you here ๐
No because without working examples it is nothing more than words put together. I can't memorize all this, but my code doesn't get lost
After I have it working if there are still parts of it I don't understand I dive deep into it
If that's your point of view of articles that are very well recognized by many, then I and many others here will show little interest in helping you
Well it is not that I don't read them
I just read Cedric's Blog which took me more than 1h
But I can't tell you that I understood everything
That's why I need working examples
I read it three times.
And one hour is a drop in a bucket of the time you're going to spend understanding things.
Every once in a while we have someone here that wants to make his game with the community, but every time it ended up in them understanding that they have to count on themselves
No pun intended, but it's the truth
And yeah 1 hour is nothing
Neither a day/week etc.
Well what do you understand under "understanding things"
Cause only thing after reading is trying
And if trying doesn't work you look for help to get people that tell you what you didn't understand
And I know how much effort it takes. My game is almost finished, I already put 600h into it in 3 months
My game is almost finished
I really doubt it with the code I saw earlier
Unless you mean it was made for single player
And now you are all out of a sudden supporting multiplayer
Which is a bad choice with the limited multiplayer knowledge you have
I still reference the various posts that we link. Even as a refresher.
I started and stopped like 10 or so projects just constantly redoing just the initial portion of networking.
One hour is barely anything
Start a whole new project and try to do one or two things in the world of networking.
Once you do that, do another project. Do those things again, but now do another one or two things.
Rinse & repeat.
These don't have to be complete projects mind you. It's more to get you in the comfort zone of the general process
I've been using Unreal for 9 years and I still barely know wtf I'm doing
programmer club
Can confirm. Adriel is constantly lost.
he's now losing his mind over 1D physics
Lol, here we are working on 3D but heโs gone back to the basics
do you imagine how brrr games would be if it was only 1D?
1D is a lot more complicated than you think. These constraints get funky
so much computing wasted for 2 and 3D
You ever try to model a torque converter in a PBD style?
I did not mean that in a pejorative way btw
oh i know lol
๐
I've restarted the network setup 6 times by now
and I am in the seventh because I just realized that I've been using the CMC wrong
close to 2 years of work in what feel slike a false start ๐คฃ
It's kinda funny, the longer I've worked on my projects, the less impressive they look
The initial BP prototypes are hella fun, then the C++ rewrites are basically just black voids right now lol
Oh man - I love starting a project. One of my favorite hobbies.
that's not limited to unreal or hard projects
i've been a videogame programmer for 7ish? years and I look at all the games I made and I hate every one of them ๐
I had a "multiplayer" 3rd person action prototype within like 2 weeks of getting the engine, with some fancy abilities like a mirror image ability that made a copy of yourself that mirrored your actions. Now 9 years later I'm just staring at the output console reading logs lol.
(web games, granted)
Thatโs pretty impressive lol
It was super fun, I wish I still had a video
used the metal man with the cape
My first 2 weeks, I watched this 11h tutorial on how to make an RTS, that didnโt really teach me how to make an RTS properly and used very inefficient ways to accomplish things. I have spent the last few months redoing that code in cleaner ways, still learning how to actually make an RTS lol
I know itโs not ideal for a starter project but yeah
first 2 weeks on UE like... ever? or in the RTS project?
Ever
get ready to scrap the entire thing and start fresh like 5 or 6 times before you actually get something that almost works ๐
(sorry if this sounds too rough or mean, but it's the most likely outcome)
start with small, rts looking games
Iโve pretty much had to do that, with all the times Iโve had to change the code lol