#multiplayer
1 messages · Page 734 of 1
well it wont move on the client, it will move on the server and then correct when u set them back
those options are usefull for stuff like dashing
for example
you could try for example, when u hit something in the client u set those flags for like a second or half a second, do ur bumping thing and then set them back
Cheers I'll give it a go 👍
Some of PlayerState
For each connected player
There's a method you can override to add more
That's on the server, of course
is it possible to create an AIController that does not need to be owned by the server?
A client-owned AI would need to send every single pawn command by RPC through he pawn itself
You probably don't want that
Even tho its a character pawn?
Yes
AI should normally be a completely server side affair
Yeah. ok. well my main problem is that i have a free flying camera pawn that is possesd by the player controller. Then my PlayerCharacter is possesed by an AI Controller since my playerController cant possess both pawns at the same time. This creates a problem where all the actions on the player character needs to go trough the server since the server owns the AI Controller. It messes up the GameplayAbilitySystem a bit since all abilities needs to execute on the server. Does anyone have any ideas i could try?
i'm having a similar problem. Best solution i found so far is explained in here
https://www.youtube.com/watch?v=8ToVKyiVDAg
This is my first Unreal 4 Tutorial series of videos, there will be 3 in total. This video will serve as an intro briefly going over what it is I hope to accomplish with this tutorial for anyone who wants to learn how to make a top down controller that replicates over a multiplayer network.
basically AI owns the Pawn and PlayerController goes through that when input is received, really messed up but it's the only solution i found
The other one would be to:
On input from playercontroller, do RPC and implement custom logic to navigate
PC and AI Controller are unrelated, both controllers but siblings with no relation
i mean i tried to interpert the answer from, Acrisio "basically AI owns the Pawn and PlayerController goes through that when input is received"
Either one AI controller or one PC owns a given Pawn
So the client have a local Controller and pawn, and the local controller relays the input to the server?
Clients have a client-owned, replicated PC+Pawn
And yeah, various input goes through RPC to the server through both classes, depending on the game
Yeah ok. my gut feeling is that it could potentially be some hassle to get GAS to work with that.
Yeah, you probably will have to do some modification to gas.
The owner of the pawn will be AI, the PC will have a ref to the AI and when input is received, you do a RPC and pass that input to the AI.
ok thats basically what i have now. So there will be a delay from the local input until the server has replicated to the clients.
you always have that no matter what, your delay to the server is always there.
I mean to the local client pawn
Nvm i think we missunderstand each other. But the setup you sent in the video could be worth looking into. thanks!
can a rep notify be called on a different actor?
RepNotify will trigger on the actor that has the variable. You can use the RepNotify function to call other actor functions/events.
if an actor is dormant but value has changed and client was not relevant, is there a way to force an update for a client when they become relevant?
How can I make "casting system" in replicated game? Current approach is that when player is interacting with an item event repeats itself with delay 0.01 and on each repeat 0.01 progress is added to the item. I tought that should be just fine and when setting total progress to 5.0 it should take 5 seconds for it to complete, but it's taking around 5.35 seconds on average. Why is that
I mean they are still dormant, and maybe say net frequency is 0, but I guess that wouldnt change much since it is dormant. So the only times it needs update is when it becomes relevant for that specific client, and on force net update for relevant clients
Why do you need to possess the camera?
Its An AR game
What do you mean by casting system? What is the actual problem you have?
Dou you mean like spells with a cast time?
Yes, the best example would be engine repairing from Dead By Daylight, because the more people are repairing it, the faster it goes. So for 1 player it takes lets say 30 seconds, for 2 15s, etc.
And I'm not sure why repeating this "repair" action with delay and then adding players progress to the engine with the amount the delay had to wait is not very precise and I really doubt that it takes some time for the nodes to compile (for 5s repair its off by like 0,35s)
This is very much not a delay thing. You don't want delay anywhere near this.
Just tick and increase value by rate times Delta seconds.
More builders equals higher rate
You can use a timer or a timeline to accomplish a temporary tick but same idea.
So in tick when using times delta seconds it makes it frame independent?
I was also playing with timer by event but the results were pretty much the same, maybe was just doing it the wrong way.
Rate = numbuilders
Value += Rate x DeltaSeconds
Yes. Or use a f interp to constant if you don't wanna do the math yourself
The constant is the rate.
Sweet, thanks a lot!
Start with just having it sit there ticking then later you can decide if a temporary tick is worth it or not.
Hi! does anyone know the dif between "Is local controller" and HasAuthority ->Remote ?
Do you mean is locally controlled?
Controlled only has a meaning in the context of a pawn. What are you trying to do?
I was setting something on the pawn to get the AI working correctly for movement and saw that node. Nothing important
Anyway, to get to the real concept of if you're locally controlled or authority, you can be both and/or neither.
Listen server pawn is both
How do you get the player character from within the playerstate? It seems to always get the first client but not the others. My scenario is that I’m trying to assign teams for each client at beginplay. Half team A and other half team B, but the result is only first client is assigned to team A and others don’t have any team.
APlayerState.PawnPrivate
Is there a way to add simulated network latency while playing in editor?
I know there's a file somewhere that I can edit, but is there a way to do it from inside the editor in ue5?
ty
Yeah go to three dots near play button, search for net, look for Multiplayer options
Advanced settings, network emulation
Correct
NetFrequency of 0 just breaks the networking rules and chaos starts taking over
FlushNetDormancy would do the job I guess
That's the singularity, never go full god.
i would not even keep an actor with that replication requirement as replicated
but would instead replicate it via another actor that handles all the occasional replications
just need to make it net addressable
Okey i got the client side moving for this problem, i found an easier method (which i don't know for sure if works 100%)
Remove the default Pawn from GameMode, Spawn it on **PlayerState **and posses it by one **AIController **that you just spawned. Grab a ref for **PlayerController **and **Pawn **for each other.
When in need of move the pawn, tell the **PlayerController **and pass that message to the PawnRef. The pawnRef handles it with the AIController.
With the camera problem, on the **PlayerController **do "OnOwningClient" ->Set view from blend and use the pawn Ref to grab it's camera.
Hope it helps if someone has a similar problem, it's easier than the suggested solutions i found online
that is just too complicated to be robust
there's no other way if you want "Move to location"
override AGameMode::HandleStartingNewPlayer
no simplier way* that i found
you have a PC reference there, and PS already exists
and has copied properties in case of seamless travel already, too
alright what if it was 0.01? How would I call flush net dormancy or force net update for a specific client? or at least when a new client becomes relevant
oh i forgot that you can override that, that's actually a good idea
do not call Super, as that will call RestartPlayer() which will spawn the Pawn
and just implement its logic/spawning and construct your entire object graph there
I'm gonna change it for that later, i'm trying to solve this now.
For some reason the Pawn on client (it can move ok) its always floating and falling through the floor (on server i see it okey)
Not that I tried it, but check if it's a new connection inside IsNetRelevantFor
fair guess its using NavMeshWalking on server and Walking on client
that one doesn't replicate out of the box, the CMC MovementMode
Is that the uncompleted part of vori's article? Cause it talks about actors placed in level.
it's not even walking, it's doing the "falling" animation. And if it stops moving, it falls through the floor (on the client).
I'm gonna check the AnimationBP variables
there are several ways to make Actors NetAddressable and not Replicated
if it falls through the floor, then your collisions are fucked
Correct, I guess those spawned at runtime are handled this way then
with extra option that you spawned something with static/mobile mismatch inside another object, as that can completely break the physics engine
making a spawned actor net addressable and not replicated is a but complicated
you need to deterministically name it and spawn it separately on all machines
But I'm wondering how they are replicating to clients so they show to them?
Ah ok
and its IsFullNameSupportedForNetworking() would need to return true for that instance
that is basically how preplaced Actors are net addressable
their Names are serialized with the Level, so they are deterministic and same on every machine
and that function will return true if it has RF_WasLoaded UObject flag
which Actors loaded from level do
Wow, so you literally recreate that behavior
Nice ^^
@pallid mesa take notes please 🗒️
you can go one step further and make them replicate too, although that takes extra care
it its bNetStartupActor is true
engine will assign static NetGUID (you can tell static/dynamic by the last bit)
but
if you turn the replication on, the server will require clients to Ack the NetGUID immediately
and if they can't do it because they, say, didn't spawn that Actor yet, the Ack will fail and ActorChannel won't open
it was indeed this, the ClientSide static mesh components (the hexagones) where missing the default collision preset.
I was trusting that was okey because it was the default, don't know why it changed.
thanks!
Oh good to know. Too many things to keep in mind and it's so easy to mess it up
(NavMesh)Walking mismatch generally results in severe Jitter that includes falling
This is a one time thing right?
but it won't make it through the floor
yes, but if they can't Ack right then, you won't be able to open the ActorChannel later
So you have to kinda do it on intervals until it opens?
so in this scenario you can't let the Actor spawned on clients and server separately try to replicate until you are sure it already exists on clients
and it still has to meet all NetAddressable requirements
so far, i find it practical for procedural generation and little, if anything, else
Always good to know the use cases, will keep it in mind if I go down that road 🛤️
Thanks Zlo!
after the game starts
its too much of a pain in the arse handling cases where packets arrive out of order to be worth the hassle
Should a variable that you as a developer never plan on changing still be replicated for security if it impacts gameplay? Stamina regen rate for example.
I don't find it worth the hassle, not till now at least ^^
it can be defined in static data, or on the CDO
replicating it initially provides no security whatsoever
class default object
ohh
okay so it if there's no custom events that change this stamina regen rate value, it shouldn't matter if its replciated or not?
as server never changes its value, it will never replicate to correct the client, if they client hacks it to some other value
only the first time, just before BeginPlay
if i were you, i would pull the static... attributes of your characters into a data asset or a data table
makes it far easier to tweak the values later
all stuff neatly in one place and all
and the data asset/table is packaged and same on all machines
So if its on my character BP as a default private variable can a client still hack to something else and change their stamina regen?
note: they will try to hack your data assets sooner or later, if you have enough players
Would it be best to keep that variable on GameMode?
Then all the characters that share the same value can read it from there?
so you override PreSave on it, to create a Hash from all important values in the data asset
and save/package it along with the data asset, no blueprint exposed preferably
and then you can at any time you please verify if your DataAsset's Hash function returns the same value as the Hash you saved prior to packaging
if it doesn't you know someone hacked some values there, and then you can be mean 😄
I saw this the other day and wanted to make sure I get it right.
Does that mean any actor can access GameState on client without being worried of it being null? Cause someone had the issue of it being null in another actor game framework class. I also remember seeing that issue on some thread from 2016. That's why I'm asking...
it can from BeginPlay and after
Can you point me in source code where I can see that in action
GameState has to replicate that its time for World to BeginPlay in order for clients to start calling BeginPlay on their Actors
so it has to be there already
Ah yeah right, I remember seeing that
only exception to this rule is if you call BeginPlay on an Actor manually before that happens
So this solved the issue that sometimes the client will not change the camera correctly because the rep was no there yet.
Ty x2
Last question for the night, bare with me ^^
So with transient you mean non transient properties right?
Cause for example PlayerState itself is RF_Transient. So I'm wondering how it's saved upon reconnection then? The InactivePlayerArray its saved in belongs to the server I guess that's why? Or because the array is a UPROPERTY?
APlayerState* APlayerState::Duplicate()
{
FActorSpawnParameters SpawnInfo;
SpawnInfo.Instigator = GetInstigator();
SpawnInfo.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
SpawnInfo.ObjectFlags |= RF_Transient; // We never want to save player states into a map
APlayerState* NewPlayerState = GetWorld()->SpawnActor<APlayerState>(GetClass(), SpawnInfo );
// Can fail in case of multiplayer PIE teardown
if (NewPlayerState)
{
DispatchCopyProperties(NewPlayerState);
}
return NewPlayerState;
}
Ah I see what you mean, yeah makes sense
A bit off topic, but what does the RF mean?
F would stand for flag. What's R?
Not sure how to ask this... I'll us pictures 😋 Is there a possibility a client could run a function before a server gets done running a function even if its called after?
I called an event for the server to update a value. After the loop I called the client hud to update. The HUD seems to update before the server update the value though. This only happens on the client
If the RPCs are marked reliable then they could be queuing, so yes it's possible that HUD event is called before they all finished executing
I think what you're doing is dangerous as you can't guarantee they replicated in time you call that HUD event
That's why you use OnReps
Called RepNotifys in BP
You will save yourself a lot of headaches if you use OnRep to trigger UI updates.
What's the optimal flow for controlling player spawns? I have overridden HandleStartingNewPlayer_Implementation to prevent initial player spawning, but this only works on the client in a network settings, the listen server host spawns in regardless. I did some debugging and found that ClientRestart_Implementation is called when the level starts which dispatches a Restart, but I couldn't go any further up the chain and figure out what was calling ClientRestart to begin with.
i don't let my GameMode call HandleStartingNewPlayer until i want them to spawn
Where does it get called from?
I mean i've overridden it and it's literally just an empty function, but somehow the listen server host still spawns in
I did that 1 hour ago and it removed the spawn of the pawns.
Are you sure your level is using that GameMode you are modifying?
Yes 😄
The only thing that works so far for me setting the default pawn class to none, but that's not ideal, it breaks the functionality for several functions
gottcha! I experimented with them a bit but didn't fully wrap my head around it. Looks like its back to the "LearnMultiplayer" project for a bit😁
in my case i did set DefaultPawn to none, that may be the reason. I don't know why, the method should stop it from spawning in the first place.
Maybe check if the pawn is spawning before the GameMode even calls that.
Yeah it's odd. I looked into how Lyra did it and they did the same thing, but they also have a default pawn class 🤷
in my case i'm not calling super, as per indications of zlo
If I do my crouch this way, if anyone joins the game later will he see me crouching or not ? Or do I need to go through a RepNotify too ?
Please ping me if any answer 🙂
you should set a variable that determinates if it's crouched and OnRep apply the functionality, if you do it that way, when others get a RepNot with the last state, they will update their remote actors to that state
Thank you. That means alot of youtube tutorials do things in the wrong way when shsowing multiplayer tutorials 😦
This one gives a good visual explanation of how replication works
https://www.youtube.com/watch?v=KsORRtBOJYc&list=WL&index=1
📹 Part 4 of our replication series unlocks limitless potential with Multicast and RepNotify! In this video, we dive deeper about how Unreal Engine's Actor Replication really works as well as introduce ourselves to a variable replication and how combining the power of variable replication with an event driven design can help us build a multiplaye...
Yeah already watched it multiple times and it's the best one I found. Other tutorials all show multicast for this kind of situation
I have no idea if this is the same problem, but it may help
I’m setting the sequence’s start and end playback section bounds manually, but often at least one (start or end) is being pushed back or forward a preset “time snapping interval” (see picture). I disabled that function in settings but it keeps happening which is annoying because my scene either is automatically reset to start before the zero po...
Isn't crouching already a state on Character / CharacterMovementComponent?
Replicate state. Multicast transient events
crouch is state
Yes it is.
I don't understand what you mean by this
Also I want to make my character have his head rotate towards where he's looking (and it needs to be compatible with multiplayer, so it needs to be seen by others too), how would I go about that please ? 🙂
Get one thing working instead of 2 things not working
But I didn't undestand your sentence above
Can get bIsCrouched in the AnimBP from the character already, it's inherited.
Tutorials aren't necessarily bad, there's just a lot of different ways to do things and you might not really understand the why. Well, and they might not understand the why. But still 😄
Do you have enough player starts?
You can try opening your character BP and searching for spawn collision handling or so and set it to always spawn
Where and when are you possessing them?
why would you override ChoosePlayerStart to return nothing?
and if you're spawning them by hand (not calling Super/Parent) of HandleStartingNewPlayer
you also need to manually possess them there
Hi, I am wondering about hardware requirements for dedicated servers, I understand everything is cpu based so the faster the cpu the better but what can I expect for memory profiles? I assume textures etc aren't required? And is it possible to make a smaller bundle to make server deployment easier?
Oh I should have just asked one question
hey all, what would be the best way to lerp a characters position between 2 points in a replicated way? should I disable char movement, run the interp on client and server, then reenable when interpolation is over?
I'm assuming charmovement replication isnt designed for SetActorLocation() like this
but maybe im wrong?
The package will usually be smaller as sounds and most textures will not be packaged for example. Memory is usually much lower too, but you have to remember that the entire world must be loaded on the server, along with navmesh, all actors etc, so it can add up.
My client gets kicked from server with error: "ActorChannelFailure"
This only happens when my client is on a shipping build but they're not kicked with other builds like debug.
I actually prefer to use event dispatchers for this. Instead of the AnimBP's graph.
is it possible to launch another instance of a server locally through c++ without having to package the game
i need it for debugging
@quasi tide Any particular reason? 🤔
Don't have to check every tick of Update Animation. Only updates the state when I tell it to.
So when I crouch for example, my player code broadcasts the event dispatcher. My AnimBP is set up to listen for it. So once it happens, it'll execute the code to update the AnimBP's bool to track crouching.
Hi guys, where should I store my joined player controllers? In the GameMode? Or maybe in the GameState? Can someone help me? ( LAN, only up to 2 player)
They are already there
Sry, but then how can i access them?
I just wanted to keep track of all the playerControllers for later use...
There's a list of player controllers somewhere. Maybe on the world?!
But just use the playerstate array and GetOuter()
Is it standard to send client to server RPC, and then from the server, send a NetMulticast? Or is there a better way to share new data with all clients from the owner? I need this after input callbacks for example, which the server doesn't get.
Yes you send a server RPC though you don't NetMulticast in server, but you set the replicated property
Thank you very much! Yeah I know properties usually better fit the task, but my case requires an event.
any useful resources for implementing mobile patching utility?
Ask yourself, do you care that late joiners know what happened?
Non relevant players too?
If the answer is yes you need to replicate a boolean property for example bDoThisEvent
That executes ThisEvent
Oh right that's important! Though I don't think I'm going to allow late joiners.
When replicated back to clients
Yeah that's an alternative that lets late joiners be updated.
Thank you for your help! I'll consider the options and pick the one that best fits my game architecture.
Idk try asking here 
What exactly are you trying to do?
Just update data according to input events. For example, when crouching.
I'd repnotify that but it's already a predicted state on Character
Right! Forgot about it! It's a code I wrote a while a go and now I return to it to replicate it. Forgot I used the Character's bIsCrouched
Does anyone know how i can check "array size" in bytes?
I want to make my character have his head rotate towards where he's looking (and it needs to be compatible with multiplayer, so it needs to be seen by others too), how would I go about that please ?
Could you link me to a ressource or a tutorial showing how to do that please ?
It's too vague to me I need to see / follow a tutorial to learn from it
Why not just bash your head against a wall for a few hours, that's always a good learning experience. lol
Thank you
Ahaha not funny 👀
Kinda not joking, understanding your failures is good experience. The above video is good, it's basically the same thing but you'd need to use the full Rotation depending on how you want the head to look around, and change the bone to Head
That's not how I learn, I need to see someone doing it in front of me and from that understand what each steps are before doing it myself that's how I learn, that's how I learned everything I know today and that's the way I'm confortable with
Would also suggest a cutoff for head rotation to turn the body, or you're gonna be an owl
Also, also need to force body Rot on forward movement or you'll be walking sideways. But idk what you're trying to do. Maybe you wanna be an owl walking sideways 🤣
I just have this character and I want others to see where the other players are looking at like in Minecraft 🙂
It's already the case but when the player is looking down or up the character doesn't move his head which is problematic
that's why I need the head to follow where the player is looking at
Like I don't like how to player rotates on himself when looking around
In which BP, and where in that BP
Is AActor::GetOwner() returns a valid owner, only when AActor::IsLocallyControlled is true?
Nope. Example: Listen server pawn player is locally controlled server side, but when calling GetOwner client side you get a valid owner
But with dedicated server?
Same idea. Pawn sever side calls is locally controlled, it returns false. Calling GetOwner returns a valid owner
It should also work unless you have an actor that is either not replicated - then on client side it will be null or you spawn an actor client-side - then on server it will be null.
Literally many examples to why it's not correct
anyone else having issues with UE5 play in editor multiplayer?
Be more specific
Thanks, but I think I didn't phrase myself correctly. I have a replicated character (I'll call it the player). Now each player spawns (passing FActorSpawnParametrs::Owner = this) a gun which is also replicated. My question is whether each gun's GetOwner() return their "REAL" owner (the one who ACTUALLY spawned them)? Will it be the replicated player on their machine? Or will it be just nullptr (separate from the one who is spawned on the same machine the "REAL" player is in).
Yeah it should be valid. As long as you spawn the weapon on the server and replicate it, then yes
Great! Thank you very much for your support today! I really appreciate it, it helps me a lot!
sizeof(one_element) * number_of_elements
How can i debug if a c++ function really is running on the server?
Check NetMode
AActor::GetNetMode?
thanks il try that
Literally just debug and find what's going on. By the sounds of it, it seems that the player pawns are being spawned close to one another, resulting in such issue. One of the things ChoosePlayerStart does is that it check for encroaching stuff on spawn, and there are then it doesn't let the player pawn spawn, unless there is no other PlayerStart but that. It also probably tries spawning it so it doesn't encroach too much
Debugging would tell you what's going on, though overriding ChoosePlayerStart so it returns null sounds weird
UE_LOG(LogType, Warning, TEXT("NetMode %s"), *UEnum::GetValueAsString(GetWorld()->GetNetMode())); i cant do this like with normal enums?
unresolved external symbol "class UEnum * __cdecl StaticEnum<enum ENetMode>(void)" (??$StaticEnum@W4ENetMode@@@@YAPEAVUEnum@@XZ) referenced in function "public: virtual void __cdecl ULocalTargetingSystem::ServerTargetActorSelectionSuccess_Implementation(struct FHitResult)" (?ServerTargetActorSelectionSuccess_Implementation@ULocalTargetingSystem@@UEAAXUFHitResult@@@Z)
FinishRestartPlayer is what possesses your pawns. It doesn't possess them until they are not valid. Breakpoint that, see what's going on. I would even breakpoint the whole procedure from the beginning
I have no idea how your code looks like so I can't say what you're doing wrong
So if i have a function with UPROPERTY(Server, Reliable) and when it runs the GetWorld()->GetNetMode() == NM_Client is true. That should not be the case right?
or have i missunderstood NetMode?
To start with, start by thinking about your 2 rotations. What drives the head/look rotation, and what drives the body yaw?
I like to have control rotation drive head/look, and movement direction drive body/yaw
Control rotation is NOT synced to other clients
You'll want to use GetBaseAimRotation for everywhere
Or one of those other stupidly named functions
Shouldn't be the case. Unless you forgot to make your actor replicate?
Or it was falsely spawned client side?
ohhh. wait. im creating a c++ component to handle some work for my playerController. Do i need to set that component to be replicated?
Yes
OK so back up, do you see how you have TWO rotations in play, not just one?
unless you want the head to not be able to rotate in yaw relative to the body
damn if this works il buy you a coffey!
So I need one for the head and one for the body I think
Do you want 1 rotation or 2?
is strafing a thing
See how there's 2 directions?
You manually spawning them right?
if you're standing still and look right then down, does just the head move, or the entire body rotate?
Yes, I think I have it working now
But I haven't tested in production
Where is SetPawn()? It's not on the PC or in GM.

// Try to create a pawn to use of the default class for this player
APawn* NewPawn = SpawnDefaultPawnFor(NewPlayer, StartSpot);
if (IsValid(NewPawn))
{
NewPlayer->SetPawn(NewPawn);
}
Inside AGameModeBase::RestartPlayerAtPlayerStart
Is the PlayerController fully ready to start on EventHandleStartingNewPlayer? I believe I had the delay because I was using PostLogin before switching to seamless travel.
I want it like this https://youtu.be/R5P3dMVHYXw?t=49
this is only a resource pack not addon you can play this on your survival world this is not cheating
download: https://mcpedl.com/the-ty-els-settings-overlay-ui-pack/
Yes
I'm not using the built in playerstarts. + default pawn. For some reason it's only spawning the server using it.
Forget the name
It's part of the procedure
/** Setter for Pawn. Normally should only be used internally when possessing/unpossessing a Pawn. */
virtual void SetPawn(APawn* InPawn);
Just rotate the neck bone as I showed above using the player's Pitch.
That's 2 rotations
Relatively simple.
- some slight rotation when turning to the side if I see that correctly. Just multiply the yaw by a smaller factor and set the neck bone yaw.
But where exactly in the Character BP, I need precise instruction otherwise I don't understand
Not in the character BP
in an animation blueprint
assigned to your player's skeletal mesh
Assuming you want ControlRotation to be your aim/view direction:
HeadRot = GetBaseAimRotation()
BodyYaw = SomeFunction(BodyYaw, Velocity, etc). You can probably do it with Orient Rotation to Movement but that won't just hand you the turn-in-place.
By his example he wants yaw too but yeah start with pitch only
I have this in my AnimBP; what should I do next ?
For some reason the default player spawning/possessing procedure doesn't work. Works perfectly for the host, then nothing else happens for the others.
Have you confirmed that HeadRotation is correct?
Heu nope how to "confirm" the HeadRotation is correct ?
Well it would help to have an understanding of rotators and such.
However you want. Have it move a static mesh around, draw a debug arrow, print it, whatever.
Note if it wasn't created at runtime, i.e attached to the actor at compile time then it doesn't need to be replicating as long as the actor is replicating
then you can get the baseaimrotation in the eventupdateblueprintanimation.
and assign that to the pitch
or head rotation or whatever
and modify the bone
but multiply by -1 to inverse the pitch
I have this in my BP_Character, is this what you're talking about ?
No, it needs to be done in the animbp eventgraph
Yeah it is static. but i do pass in some variables at runtime
Then I still don't understand what to do, could you give me instructions in steps like this please ?
step 1 - Do something
step 2 - Do something else
step 3 - Do ...
Read up on AnimBP
AnimBP event graph copies data from Pawn to its own variables.
Then the AnimBP animation graph uses its own variables.
Show your animbp event graph
Do the same but for the pawn's base aim rotation pitch, multiply by -1, and set it to a variable
create a pitch variable in the animbp
Done, next step ?
But i should be able to call a server function from inside an client function right? and it should still run on the server
I just said the steps.
You don't need aim rotation as a variable.
Watch the tutorial I linked above earlier.
It will guide you through exactly what you want.
I think the tutorial above uses the Tick() function, is it good ? Because I learned to avoid Tick() function as much as possible and go through events instead (except if it's really not possible otherwise)
This is all on the anim bp
and something like updating something based on aim IS a thing that would be on tick.
Event Blueprint Update Animation is sorta like the AnimBP's Tick
You could make a black box at 0,0,0 and add some loading sprite inside there, then just make sure the rest of your level is positioned above 0,0,0.
Or hide 0,0,0 inside some rock or something
omfg.. found the issue. i was calling ServerTargetActorSelectionSuccess_Implementation instead of ServerTargetActorSelectionSuccess. Apperently it runs on the client then
jeeeesssseee. atleast i will be able to go to sleep now
I had doubts. Well no you never call _implementation unless you override it
Yeah it was just a stupid copy and paste misstake
Anyways, thanks for helping me along the way. going to bed, cya!
Hi! i think i'm running into some troubles by using soft objects references
i'm using this Structure to hold the info about some tiles (the floor)
i have one array of those Structure , that OnRep i use to update the static mesh of all the tiles on the client
i was thinking on use "Soft object ref" because if i use the direct ref, the array gets really big in size extremelly quickly and fails to replicate
the problem with the "Soft object ref" is that even if the resolve is okey, it fails.
This gets fired "OnRep" works okey if i use the "Object ref" but fails to update the static mesh if i use "soft object ref"
not sure why is this happening (the soft ref resolves fine) or how to workaround it, any suggestion?
what would be the basic method to store teams of players, and also to change gameplay attributes based on the team something originates from? An example would be how in Overwatch, some vfx are reduced in intensity if they originate from the same team as the local player
I'm thinking something like using the player state array's onrep to map each player state to an int, representing the team number. Then you can just call that from your game mode when needed for things like material functions
Yes an int on playerstate would be pretty good
Pawn can get from playerstate, and most things have Instigator attached so you can trace up to originating pawn
I was initially thinking I'd create a map on the game mode but I remember now that it's not replicated
I'd like to avoid casting the player state every time I need to get the team number. Maybe I'm just overthinking it though
I found a workaround by not passing the ref and using "get child at index(x)". But i'm getting some replication race problem for those childs
You can have pawn carry team too
Or even have a teamcomponent
Can particles read from Parameter Collection?
I'm fairly certain they can, in that case, put TeamInt on a material parameter collection too
I'm liking the idea of a team component. That's something I don't think to use enough
I succeed making the head of the character rotate with the camera but of course only the client can see that, I tried to set the "HeadRotation" variable to be replicated to see if others will see the head rotate and they don't. I'm stuck now https://i.gyazo.com/3238da878b67517b59b7d01dfc0f560e.mp4
Just in case anyone has a similar problem, i solved this by adding one ActorComponent for each tile that holds the references and its set to replicate.
The static mesh references is set to replicate OnRep and you trigger that one OnBeginPlay.
that way each component handles the update to the Clients when they spawn and you don't need to store the StaticMesh reference in one array
what is the control rotation at this point? There probably isn't one set if it's not the local player, as there isn't a replicated controller
I don't understand your question
breakpoint and see what this value is if not locally controlled
i know am late but thank you 
is there a method to set player controller properly? the server can read everything except for is Input Key Down from player controller
player controller doesn't replicate, so that would be your issue if you're acting as if it would
Hold on, do I have to set up something for the "if not locally controlled" part ? And I can't put a breakpoint on that node as it's a pure function I think
you would breakpoint the thing that calls it if it's a pure node
So here then ?
also, you can't use control rotation iirc because that is set directly by the controller
make the local player set a replicated value, and its onrep can also send that to the anim BP
I don't know how to do that, tell me steps to do that please
those are the steps
@elder sage what would i use instead of player controller?
do i have to assign each player to a controller before run time?
It's not clear for me
that happens automatically when the game mode starts the players. You cannot replicate player controllers. You need to get that value locally and then store it in the player state or something
just run this on local only and rpc the server to set that value. Most of your setup is correct
another part of your issue is probably that a client can't set something and expect it to replicate. The server is authoritative and will have to do that if you don't want it to be corrected
So running "on local" you mean run 1 player ?
"is locally controlled"
because the local player has a player controller
then you rpc the server to set that rotation
The tutorial I followed he used Tick() and I'm not confortable the way he did it as I think there's a better way to do it
somebody else already said it, but this is the kind of thing you do on tick
what do you want to do, not update this value in real time?
like update it when the mouse moves, isn't it a better idea ?
you can also do that
it kinda doesn't matter because the mouse would be moving so much
however, those axis events fire constantly, even if there isn't an update to the value
oh then it's the same as the tick()
@elder sage does get player state, then get player controller work?
basically, yes
the player controller is not replicated. It does not exist for those who it isn't replicated to. Any attempts to get its value will return "None", because there is nothing to reference
do what you want with that information
aight ty
you should read the Cedric network compendium if you haven't already
read it all the way through, skip c++ stuff if you want, and then reference it often
alright time to start reading
I have a component, in which i have a replicated Variable
bool bHasParent;```
for some reason, whenever i update this parameter on server, it is not replicating to Simulated Proxies.
I have no idea why this is happening.
on the other hand this seems to work
``` UPROPERTY(EditDefaultsOnly, ReplicatedUsing = OnRep_ReplicatedTransform, Category = "RepComponent|Networking")
FCustomTransform ReplicatedTransform;
Server Functions :-
Sending bool
{
if (Comp)
{
Comp->bHasParent = hasParent;
Comp->GetOwner()->ForceNetUpdate();
}
}
Sending CustomTransform
void APlayerController::Server_SendTransform_Implementation(URepComponent* Comp, FCustomTransform NewTransform)
{
if (Comp)
{
Comp->ReplicatedTransform = NewTransform;
Comp->GetOwner()->ForceNetUpdate();
if (Comp->bUpdateOnServer)
Comp->OnRep_ReplicatedTransform();
}
}
tyty
@elder sage I did this for now, is it good ? What do I have to do next ?
Input is local only
@dark edge i see ty ill figure some other way
What are you trying to do?
check hold down duration
Input can only get to the server through run on server events
So you'll have to either send button down and up as events or send held duration with the up or however you wanna do it.
Some stuff is automagically synced through components or Character but that's all run on server events behind the scenes.
yeah it works now!
i called the event to server too early before
thanks mate @dark edge still got alot of reading to do lol
I'm experiencing such a weird issue
I have a replicated LinearColor, just the usual
It works like 90% of the time and the color is correct but sometimes it's black for some reason
I added print statements and noticed the color values are correctly replicated but for some reason sometimes the alpha value is NOT replicated?
For why reason is it that the RGB is correctly replicated, but not the alpha? And why only sometimes it doesn't work?
@pure mango are you 100% sure you don't have a 0 alpha somewhere in your setup?
Hm, I do have a tick that by default sets it to 0,0,0,0 if nothing interesting is happening
So actually if I change the default to 0,0,0,1
Then it now works
However interestingly, if I set the default to 1,1,1,1 (white)
Then occasionally the color will be like 1,1,0.617366,1... when it should've been 0,0,0.617366,1
So what this means is.. it's like.. partially replicated which is really strange. I'd figure you replicate it all or none of the LinearColor variable
PlayerController is replicated to owning client only. It's null on simulated
FLinearColor doesn't replicate atomically so with packet loss, there's a good chance that changes to it's internal properties will arrive out of order
but if the variable inside a Component, which is available on Autonomous, Server and Simulated. we send the state via RPC on Server, it should automatically replicate to Autonoumous and simulated, right ?
and RPC is happening, via PlayerController.
hi
I am making online game that have mini board games
I want to create session on server that has 2 players on it
anyone have any idea how i should do that??
Hello people! I am new to ue4 networking and am just curious about something. I need my game to have a 100 players in a match, but I doubt unreal editor or even after building my projects client, my pc will be able to handle that many game instances. Any way I could do this stuff so that my pc does not die?
You will pretty much need to test this in real-world conditions. Test with two machines connected to one server, and if everything works well, you can move on to real-world testing with your user base.
Remember, 100 players is insane
Very difficult to optimize, and almost impossible to get the players
Hi guys, if I want to test multiplayer through Advanced steam session with 2 Pc's , I always need to package my project, and than pass it to the other desktop? Isn't it enough to just copy the project files to my other desktop and launch it as Standalone? Thanks in advance!
Huh, interesting
Strange there's packet loss though since this was done locally in UE Editor during development
anyone?
Hello i developed my dedicated server and if i use IPV4 adress for Open level node. It works for the same LAN
But i want to make connectable for different LAN's so i changed the IPV4 adress with my computers IP but it's not working now. How can i do my ggoal
You have to forward ports in your router
@supple vessel if you want I can show you how to do that, we can go voice
i am not available not now can you send a video or something ?
Guys, any idea why server doesn't get client movement replication anymore when client is attached to other actor? (Attached on server and all clients) (I use acharacter for movement)
Not really, what router do you have?
Im from turkey and im using turktelekom as router
you have to open your default router address (something like 192.168.1.1 probably) and look there to forward your ports
in router adress i created a port (7777) then i changed open level as
myipadress:7777
did i do something wrong ?
Seems alright, but I need to see that to tell you 100%
Im at the school rn if you want i can send the photos tonight
sure
how do I check if ClientTravel has failed?
looking to make sure the ip the user enters is valid before putting it into the clienttravel or if it fails let the user know
Im a bit confused by the documentation. If i have a playerController that should have a Replicated character reference. What do i put in the DOREPLIFETIME and why?
But i want to understand whats going on. What is the first argument. could it be something else then the current class in some special cases?
It's a macro that generates code and needs the class name + variable name
Here's what it does.
#define DOREPLIFETIME_WITH_PARAMS_FAST(c,v,params) \
{ \
static const bool bIsValid_##c_##v = ValidateReplicatedClassInheritance(StaticClass(), c::StaticClass(), TEXT(#v)); \
const TCHAR* DoRepPropertyName_##c_##v(TEXT(#v)); \
const NetworkingPrivate::FRepPropertyDescriptor PropertyDescriptor_##c_##v(DoRepPropertyName_##c_##v, (int32)c::ENetFields_Private::v, 1); \
RegisterReplicatedLifetimeProperty(PropertyDescriptor_##c_##v, OutLifetimeProps, params); \
}
Replace c, ##c, v and ##v in that code and you have valid C++
okay so basically. Everytime i want a replicated variable i allways use the current class name and the varible?
Pretty much
Alright. thanks man
and playerControllers are replicated by default so i dont have to set the bReplicates = true
My custom GameState class Tick function is not working. I created a timer on the server side, i want to show remaining time in the UI. Can anyone help?
Can I strive to make a game that supports both Listen Server and Dedicated Server? Or do I need to make two projects and adjust each one's code for its server-mode?
It's very doable, yes
Though arguably if your game works with listen why bother
I have an issue with execution order, where I need to know what calls first: APawn::SetupPlayerInputComonent() or APawn::BeginPlay.
And in the order is different between these modes.
You probably don't need to know
SetupPlayerInputComponent should only bind a bunch of functions
I do, because I need to bind my anim instance to some actions, and it is initialized only in begin play according to the gun the client chooses.
Do you think it's bad practice and instead I should bind it to the pawn, and then from pawn callback, call a function on the anim instance?
SetupPlayerInputComponent should just be a list of bindings actions to pawn functions
Your anim instance should normally be entirely read-only, with its Blueprint graph pulling the pawn's state
Alright! That does solve the coupling between the two. And any other actor that needs input (like a gun), should just be a pawn, instead of relaying on the main pawn's input?
A gun should probably be a component and read input from pawn
Yeah, but my gun system is very big and modular, so components are not enough. I need an actual actor.
Still want to read from the pawn
But then the problem returns. They will subscribe in in their AActor::BeginPlay after spawned from the APawn::BeginPlay, and will subscribe to the pawn's input, meanwhile the input component might not have been initialized, since APawn::SetupPlayerInputComponent was not called yet.
They will subscribe in in their AActor::BeginPlay after spawned from the APawn::BeginPlay, and will subscribe to the pawn's input
No, they will not have any input code
They will check for an owner, cats it to your pawn class, and then read the input state with some getter
So the pawn will have it's own delegates (or variables) which will share input data with the guns?
getters
Cool! Thank you man very much for your advices! That cleared my mind!
Why my seamless travel doesn't work?
I made such function:
void UMiscFunctions::ClientTravelTest(APlayerController* PlayerController, const FString& IP)
{
PlayerController->ClientTravel(IP, ETravelType::TRAVEL_Relative, true);
}
And I'm calling it in blueprints, but it doesn't teleport me to another server. It just shows black screen. Everything works fine if I use OpenWOrld instead of ClientTravel, so this isn't a problem with my connection
Not sure what you're doing here but you can never seamless travel between servers
Can I?
UE4's site: https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/Networking/Travelling/ says:
"If called from a client, will travel to a new server"
Seamless travel is only for a client, connected to one server, when the server switches levels
From that page:
There are three ways in which a non-seamless travel must occur:
When loading a map for the first time
When connecting to a server for the first time as a client
When you want to end a multiplayer game, and start a new one
Hmm... ok
Then, I guess I can travel non-seamlessly to a new server, right?
If so, what's the difference between non-seamless travel and open level node?
The documentation page you link explains that
With the added data that the open level node should be UEngine::Browse
I think the open level node will disconnect everyone?
nope, if called from the client, it connects to a server
When called from a server then.
It doesn't take the clients with it.
And since a client has no clients, what I said still stands :/
What's a good way to solve latency issues? I host a session & my friends movement goes crazy.
Design around them.
bump
Are you sure?
You in BP or C++?
I have. I’ve used RTCs to server & multicast via switch authority. But every time I package the game it lags. However on the editor no lag
Do you test in editor with lag simulation?
I have. And it lagged again
P R E D I C T I O N
Hello everyone, oddly enough I have a security related question for ya!
I am currently working on a game that uses listener servers for cooperative play. My team and I would like to add some retention systems (no purchases mind you, just cool stuff people can unlock during multiple play sessions). Right now, we use the OSS's user cloud storage in order to make this happen. When a play session ends, the host sends the session score results to each client, and then they modify their user cloud storage with those results. My concern is that because we are using listener servers, the host code that authoritatively handles things like scoring and retention rewards isn't trustable considering it occurs on one of the clients. We know this is largely unavoidable considering the nature of listener servers in general, but I was wondering if there were any techniques we could take advantage of to make the process of modifying these results at least harder? My initial thought was to independently verify the session score results on each client, since we send that data to each client anyways.
Thank you for your time!
Hi! I would really appreciate your help with this. Let's say I have a class AOwner which, server side, spawns a class AChild so that every client gets a AChild spawned. Now, I need each AOwner to get access (pointer) to the AChild that was spawned on his connection (essentially the AChild that he owns). However, only the server can access the child he spawned. So how can I get this to happen? Thanks! 🙂
But I explained my desired behavior, not my attempted solutions.
A) If you are spawning one AChild for every Client on server side, you can get an array or some list.
B) If you are spawning one AChild for every Client on Client Side Only, you have no way to access it with a pointer from the server.
What you can do on B is execute whatever you need with a RPC(OnOwningClient) and run your logic, you can access the reference to the client from there
Your desired behaviour is an attempted solution to a problem.
Store ref to child in owner when spawned
Owner and child are replicated actors right?
I already do
yeah
You're replicating every actor to every client, regardless of who "owns" it?
The problem is that I have ref from child to owner, not from owner to child.
In Owner, spawn child, then set a ref on self.
Have a tmap on the owner and then cry when it doesn't work with replication 😄
Owner
SpawnActor(child) -> Set MyChildRef
The issue is that it's 1 owner and many children, I think, adriel.
So you'd need a TArray of children.
he says many Owners and 1 Child per owner
I would've just spawned every child from every actor locally, but I need child to be properly replicated, not just spawned on every client.
Let's say I have a class AOwner which, server side, spawns a class AChild so that every client gets a AChild spawned
Nowhere does he mention multiple owners
next sentence
What is your relationship for owner->child?
1-1
1-n?
Good point, Adriel. I shall try reading next time! 😄
Lol
This is very much an XY problem question though, Owner having ref to Child is trivial.
hey folks
if (bPrivateInventoryReplicate)
{
DOREPLIFETIME_CONDITION(UPCSInventoryActorComponent, Inventory, COND_OwnerOnly);
}
else
{
DOREPLIFETIME(UPCSInventoryActorComponent, Inventory);
}
So what can I do to make it trivial in my case?
And so is child having a ref to owner
why this not working?
OnBeginPlay (Owner) -> SpawnChild ->Set ref
profit
Where do you set that bool?
it is edit default
And how do you create the component?
But then the child is not actually replicated, but just spawned on every connection. I need child data to sync.
UPROPERTY(EditDefaultsOnly)
bool bPrivateInventoryReplicate = true;
Child -> Replicates (true).
I don't understand what is the problem
BeginPlay triggers on both the server and client, so spawn the child and set the ref when the server beginplay is called
and how can i fix this btw any idea?
Honestly no idea. Should work?!
edit default only ,change in constructor btw ?
So you say that if I spawn locally the child on every connection, and child is set to bReplicates = true, then it will actually replicate? Isn't there a need to spawn it on the server?
Nothing spawned on the client will ever replicate.
What?
A UObject/AActor constructor is only for defaults.
Why would you spawn it on the client? Spawn it on the server side. If it's set to replicate, it's going to spawn a proxy actor for the client.
I think you are misunderstanding how replication works
so can i change replicate condition in runtime?
i mean in beign play
No.
That's what I'm doing, but that's also where the problem raises, since each proxy actor doesn't have access to the child spawned on his connection.
Show code/blueprint please
Set/Change = same thing. You don't want to change the value in BeginPlay at all. It will (probably) call lifetime replicated properties before beginplay
And it only calls it once.
So if you cahnge it after that function is run, it will make no difference.
Does anyone else find that the FPS is awful when playing with 2+ players in PIE as client? I can't really comfortably test anything due to the bad performance, I don't remember this was the case back in 4.26 (right now on 5.0.2)
Owner.h
AChild* Child;
Owner.cpp
func BeginPlay():
if (HasAuthority()) SpawnChild(); // Spawn child via server.
func SpawnChild():
Child = SpawnActor<AChild>(...); // AChild's bReplicates = true
Now the problem is that meanwhile the child is spawned for every connection and is properly replicated, only the the AOwner actors on the server, have a reference to their child (on the server) that was set when they spawned it in AOwner::SpawnChild.
AChild* Child;
are you replicating the variable "Child"? Not the Child itself, but the variable that points to the child.
nope
the pointer is never going to be replicated to the clients if it's not set to replicate
Yeah, but I didn't try to replicate it. As I understand, replicating it will just sync the value of the server with all the proxys, which is not what I need. I need that each AOwner (regardless if proxy or not) will have to the child spawned on his connection.
Sorry for being long with this one, I'm just new to multiplayer and trying to get down the fundamentals well.
Replicate the Owner, replicate the Child, Replicate the reference to the Child.
When you want to access the Child that everyone has on the ClientSide ->
Get the child ref from server side and execute whatever you want on RPC -> OnOwningClient
📹 Part 4 of our replication series unlocks limitless potential with Multicast and RepNotify! In this video, we dive deeper about how Unreal Engine's Actor Replication really works as well as introduce ourselves to a variable replication and how combining the power of variable replication with an event driven design can help us build a multiplaye...
Thanks, I'll look into this. Anyways it seems like something is wrong with my setup (in which the owner needs a ref to it's child).
And in general, thank you all for your help!
It should be this simple
In Owner
Spawn Child -> Set Ref
with ref being replicated
For each proxy owner, will "ref" refer to the proxy child that is on the same connection (that proxy owner is in), then?
Nothing on server side points to anything on ClientSide, but if you spawn one actor with replication on, you will have.
Server Actor
|
Client ProxyActor - Client ProxyActor2 - Client ProxyActorN
if you want to access the Client version of any replicated actor, from the server. You need to do a RPC-OnOwningClient
Which kinda loses sense if you are replicating the actor, because it's going to be the same version for everyone.
I can only think of this being usefull for using non-replicated properties of The ChildActor
That's what I wanted to avoid - getting a full copy from the server, instead of communicating with the local proxy that is already replicated with only important data.
Yes. It'll be one and the same, but NON replicated variables will be able to differ
What exactly are you trying to do? It feels like you're missing how replication works.
Yeah I'm starting to feel this too...😄😄😄 If you want I can explain the whole picture (it really is fine if you're done with me and my long discussion 😄). So far I tried to simplify it but it just seam to create confusion.
Just spell out the InGame mechanic
I have a class "Player" that has two fields of type "Weapon" (extends actor). Now Weapon is made to be very modular to create whatever weapon I want without extra code (uses composition). Now, Player sometimes asks weapon for abstract questions like CanSprint() to prevent sprinting when reloading, for exapmle. On the other side, weapon needs to ask it's Player questions like IsSprinting() to prevent reloading while sprinting. My Idea, was replicating the Player class and the Weapon class and let each pair on each machine communicate with each other, while both classes are updated from the server. That's why I need references between both.
This sounds like something GameplayAbilitySystem would be used for.
What about using ActorComponent for the weapons and go with interfaces?
It's fully created on single player and I really like it, I just need to network it.
If you take the client's side of the history to handle behavior on the server side, you are looking for trouble early on
What do you mean of the history? That I relay on data that might have not been synced yet?
Any information that you take from the client that it's not replicated can be used to exploit your game
I don't mean to do that, only trust server.
And the problem with components weapons is that you cannot have them as a nice blueprint, which means that in order to edit them in the editor I'll need to use something like a data asset.
idk, maybe I'm just protecting my weapon system. But I do feel, that changing it all just for one issue is a bit overkill.
Just spawn them as replicated actors and set the replicated references.
You're not describing anything fancy
You can do NON replicated stuff with replicated actors
That really is a great solution! The only issue I see with it, is that I essentially replicate the each weapon twice (correct me of I'm wrong). Once as an actor in the world, and once as a property. I'll use that in the meanwhile, until I'll find a way to nicely access the local weapon which is already replicated, on each connection from each Player class in that connection.
would this be a good place to a question about headless server stuff?
You already need a property, as you need to be able to talk to the weapon. You aren't replicating the actor twice, you're replicating it AND a reference to it in the Character. That's like saying it's redundant to have an address because my house already exists.
Lol actually blew my mind!😅 Thank you! That's a very clean solution! And thank you all for you're endless help and for not giving up with your explanations and solutions! You both solve my problems and teach me a lot!
Would a replicated UPROPERTY with COND_OnlyOwner replicate itself if the owner is later set?
Try it. I'd guess so since "Considered for replication" is a thing
I tried, seems so
just ask the question fam
thanks got some good leads in the source channel figured it was a better suited question for them
guys I have sql database with php script with logged players in game when I logg in game I can find a match then I will open lobby and there I Have table in this table I am downloading names from my table to know who is finding match too to make a battle but how to know if someone new start finding match or someone will left ? i need update that table but how to know when update ? i cant update every second because then I ma printing all names in table in row again and again
any tips ?
maybe try Steam advanced sessions? i don't think a sql database is the best solution for that sort of things
i am coding in c ++ i dont use blueprints a much but why to dont have own database of players ?
i have own dedicated server
with eos and sesssions
and own database where I am coding backend
for matchmaking
The trouble will be maintaining it after you release or if it gets popular. Chances are you re not writing a scalable system.
And it's probably not going to work 100%.
Does eos or steam not already have the ability to list players looking for games?
steam maybe EOS I think not eos dont have matchmaking they just saying it
but not really
it wont be popular hahahahhahaha
:DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
it's gonna be EXTREMLY popular, good luck
but what is then more scalable ?
I'm not sayi matchmake through steam or eos necessarily, just let them handle the player lists and who is looking for a match.
You can still matchmake yourself and spin up dedi servers.
but atleast I need own database of registered/ players , their loggins
emails
and so on
for this i am just using my own database
via varest
Why? Use steam and eos accounts?
i am using login via eos but I wanna also to use own login so they can register in webbrowser
and i will store their data
in database
why stick with only one login possibility
That's going to make people not play your game.
why ? i know many games where u have to register like warthunder or world of warplanes you make an account and can play
or play just via steam
There's a difference between games with a big enough pull to require users to register.
You said yourself, your game won't be popular.
If I have to register on some website to play a game, I'm probably not going to.
You can't just say, "well Blizzard makes people register with them to play Wow, so it's fine for me."
Also regardless of the whole discussion. You probably don’t want a persistent database for matchmaking. Your clients should interact with your website / backend to request a game or cancel the request. Your servers should then based on those requests matchmake people in the queue together. This can all be done in memory and by communicating with other servers.
You could use Redis or similar if you want an in memory database if you’re afraid of crashes but sql seems like a bad choice honestly.
so varest php and SQL Ngmi?
not gonna make it
😂
better to take tips from someone like u ..
yea but I am giving them a choice login via Eos they don't have to register or create account and login with own data
i did the same setup as my first project to learn multiplayer.
I would not recommend the database to handle the logged/players looking for games stuff.
The database can be handled ok with mysql for player information, statistics, config, etc.
The login may be easier with Firebase (good free plan and easy to setup) and the matchmarking with steam.
That's all the experience i have on that area
i have already experience with firebase
sounds good
i was using it for storing loging data in my app
why matchmaking with steam it's free there?
can I more talk about it with u in DM Tommorow?
the OnPossess() function on the APlayerController, it only run on the server?
is there a point in using switch has authority if it's a listen server?
yes
That's your test for if you're on the server
I see, I thought that a listen server is from one client hosting so therefore it would always return remote
thanks @dark edge
You basically have 4 choices.
Host's pawn on Host= Authority and locally controlled
Client's pawn on Host = Authority and NOT locally controlled
Host's pawn on Client = NOT authority and NOT locally controlled
Client's pawn on Client = NOT authority and locally controlled
yes
thanks
Does anyone have a few minutes to take a look at my project and help me with some multiplayer concepts?
I was hoping to stream my screen in one of the vacant channels, maybe the Programmer Parlor or just a personal call 😁.
Have you read the PDF?
eXi's yeah 😁
yup that one
It's been a awhile but I guess i can read it again.
Asking here with great detail and screenshots is also a good strategy, lots of eyeballs here.
haha for sure. I just feel there are so many parts to this problem i didn't want to bog up the chat.😋
I'll see if I can really refine the question. I think my lack of knowledge is in ownership.
- Engine code, Pushmodel is relatively simple and is used everywhere.
- Yes, significance manager helps you manage reducing performance costs for Actors, it is not specifically tied to Network performance.
- Custom Net Serialization is simply the act of manually managing how data is packed when being sent across the network (for performance and other magic). It is useful for custom types you define.
@fluid summit Watched that Multicast & RepNotify vid, super engaging and fun. I'm sad there's no Part 5 even just to watch him explain shit I might already know but in a fun way. lol 😭
- Fast Arrays are what they are in the name, a faster way (performance wise) to replicate a regular array.
@sonic dock It is best to read the documentation and especially the Engine Code as these things are well commented and explained in extreme detail.
Tried to make a quick info graphic of the problem I'm having. In short, I know its a replication concept I'm missing but I can't figure out what. I even made a different project with a simplified process and it works there but not in my main project😋 .
project that doesn't work^
the sample project that works^
As a caveat, all the tiles are spawn on the server. Any ideas why the server isn't replicating to the client?
Thanks a lot @fossil spoke, will really look into it 😄
Just to clear, for net serialization. If I am not replicating any of my custom structs then i don't need it right? Also we don't consider it for enums right?
Any custom type that is a USTRUCT, UENUM, UCLASS or POD type will be serialized for you.
You dont need to handle serialization yourself if you dont want to.
(assuming UPROPERTY tag on those members)
That to of course.
Hi guys I got a problem I've been try to get my head around for a couple of weeks, basically I got a listen server with 2 player ( player 1 is the server player 2 is the client) I been trying to get rpc run on server on player 2 charcter blueprint or player 2 player controller but neither rpc seems to work it just skip the node at start I thought it might be because of ownership but the problem also appeared on player 2 controller and the log didn't show anything about ownership I could send pic of my code if needed
Thanks, just last one. Suppose I have a custom struct, when should I consider implementing my own serialization instead of default one.
If you have types that cannot be automatically serialized
Like a complex non-Unreal class
Or you want it packed in a specific way.
Oh okkay
You may only care about partial pieces of information being sent across the network, you maybe able to extrapolate whats missing on the other end.
Therefore saving on bandwidth.
But if you do that, be aware that these won't work with the BP VM, so they can't be function local variables or custom pins, as the VM just serializes Reflected properties <.<
Arguably a lot oft hat is possible by slapping NotReplicated on a member
And also by using smaller types.
Hmm so basically if I have my own replicated struct and I don't want some members to be replicated then I can use it right?
But then NotReplicated will do the work
You can specify which UPROPERTY members are not replicated.
Just last doubt. Can you give an example use case where we want serialization which can't be simply done with NotReplicated tag
You only need custom serialization for non-Unreal classes that you cannot bring into the Unreal model / Unreal classes that don't replicate yet still want replication support for. That's it, plainly. You can use custom serialization for optimizing stuff, too, but imho it's rarely useful.
Its not necessarily about something not being able to be done and more about managing bandwidth.
Take a look at FHitResult
Its a good reference for NetSerialization
Look at how the Struct is laid out and exposed to Blueprint, then look at how and specifically why their NetSerialization function is setup the way it is.
Thankyou so much both @fossil spoke @bitter oriole Really appreciate your help
I will look into hitresult, thanks
Always refer to the Engine code for references on how something is done.
Its your best form of documentation.
Yes, just wanted to have a basic idea before that. thanks.
For example if you are so crazy and want a custom generic data type, that uses a UniquePtr with some base class and you want to replicate it \o/
I see, thanks.
?
It is a good idea to show Screenshots.
Be thorough in your explanation
Sure give me a couple of min
ok the first image is the character blueprint and the second is the player controller I'm trying to do the same thing basically in both the character and in the player controller to see which one work but they both won't execute the rpc
One problem is that you CAN'T set owner on client
So the server RPC in the actor itself won't work
You need to already be on the server to set owner
The rpc on the PlayerController however should theoretically work?
Eh
1 sec
Phone autocorrected to can instead of can't
that's what I thought the player controller RPC is my preferred way of doing it but it doesn't work
You also can't just use variables from a different exec line in your rpc
The first image bottom right
You have to pass the data along
You can't use the wires from the top event
The whole setup look super wonky tbh
No idea what hot bar ref is
But if you already have that on the server why do you need the rpc
basically iv got a hot bar with values in the client and I need set those values on the server
its a widget
You can't replicate widgets
You can't send them via rpcs either
They aren't meant to be networked
They should also not hold any data to begin with
Put the data into an actor
And let the UI just display it
hm i will try it
Hi, has anyone worked with PartialDormancy for some connections which says it calls GetNetDormancy, but the engine implementation of says that per peer dormancy is not supported.
So does it work if we want to make an actor dormant for some connections? If not then why does Partial dormancy even exist for now?
Just for reference I am talking about ENetDormancy::DORM_DormantPartial
Hey guys I need to replicate this movement for my character, what is the best way to do this when I have an axis value? I know it is wrong to pass the input directly in the replicated event right?
It's a legacy setting and does nothing. Been there since UE3 days IIRC
Once we set an actor to fully dormant then we cant bring it back to awake right?
You can, dormant just means it's not changing currently. When you change a replicated property you just need to flush dormancy
But note it will stay "awake" until you set it back to dormant again
Just doing SetNetDormancy(Awake) isn't enough?
So basically flush net dormancy is one time replicated data push ?
It will stay dormant after push ?
AFAIK it also sets it to Awake
They never stay dormant after you force an update, if you want them to go dormant you have to set them as dormant again
I just confirmed that FlushNetDormancy only brings the actor to awake for just an instant, pushes the changes & set the actor back to dormant again.