#multiplayer
1 messages · Page 136 of 1
in this example i am pressing "W" on keys
in this next example i am also just pressing "W"
So Its not necessarily that " basically when u press W on client u get D action " i think its that "W" is going to move my character in a forward direction of the camera but for some reason the camera has a different spawn orientation than player 1
i don't think that the camera is broken i think more like the player controller rotation is the one that is not right.. is the character moving forward based on the direction of the root or the camera ?
try to set the player controller rotation after the spawn
Sorry , im not sure what you mean by this? Set the rotation of the pawn?
How would i set a rotation of a player controller?
u can use the set controller rotation function by draging from the PC
what do u use to posses the pawn ?
player controller
drag from it and u should see this
like this yah?
also tried like this , staright from player controller that is the target of the posses
sorry it wasn't so useful 😅
Haha no worries!
@thin stratus I wanted to thank you for the efforts of explaining me how some bits of CMC worked, and alongside the efforts of Vaei of puting it all together. I managed to implement Stamina corrections the way u explained it to me.
Here is a public Pull Request in Vaeí's CMC repo, in case anyone would like to explore it. It will likely be integrated soon by Vaei in his repo:
https://github.com/Vaei/PredictedMovement/pull/3/commits/d03a4ec5f7dd07c48e8a9f0b21255fc258adb865
is there a command to force set ping to a certain number like there is a command for max fps ?
Within Play Settings ull find network emulation settings to emulate latency within the editor
net ptklag = 200
There's also these
Net PktLoss=1
Net PktOrder=0
Net PktDup=0
Net PktLag=75
Net PktLagVariance=0
p.netshowcorrections 1
log lognetplayermovement verbose
Hey
I am spawning a deferred actor with empty mesh and animation but in SpawnActorDeferred() I am setting a new SKAsset and new animation:
NewUnit = GetWorld()->SpawnActorDeferred<APTUnitBase>(APTUnitBase::StaticClass(), transform, this, nullptr, SpawnInfo.SpawnCollisionHandlingOverride);
if (NewUnit)
{
NewUnit->Spawner = this;
NewUnit->Mesh->SetSkeletalMeshAsset(UnitData->Mesh->GetSkeletalMeshAsset());
NewUnit->Mesh->SetAnimClass(UnitData->Mesh->GetAnimClass());
Spawning work but setting mesh doesn't on client because I have Actor->HasAuthority check before doing the spawn (otherwise it spawns twice)
I was wondering what is the "best" way to set a new mesh and animation for all clients?
For now I am thinking about a RepNotify on the SKmesh
I am mostly thinking about other options for replicating not really the "best" cause I think its subjective
You can do it on BeginPlay if the UnitData doesn't need to also replicate down
Otherwise do it on OnRep_UnitData
thanks!
To use dedicated servers in UE5, do I need to use the Unreal Engine source version?
https://docs.unrealengine.com/5.3/en-US/multiplayer-programming-quick-start-for-unreal-engine/ this guide seems to have
https://docs.unrealengine.com/5.3/en-US/setting-up-dedicated-servers-in-unreal-engine/ this one as a pre-requisite, so do I need to download the source version from Github to set up dedicated servers?
Do you want to run server on your pc?
just for development purposes?
or are you trying to like upload it on a server
Like I am planning to host a server on my pc so my and my teammate can test the game, and later on we will have bought servers
"D:\UE_5.2\Engine\Binaries\Win64\UnrealEditor.exe" "D:\ue5fps\Phoenix.uproject" test1 -server -log -nosteam
Change unrealeditor.exe to your unrealeditor.exe destination, and phoenix.uproject is your project (uproject) file destination, test1 is the map name
create a bat file and add the line to it
or call this from cmd
and thats it?
for hosting a server on my pc?
@dark wing ?
i can do it with the from launcher build?
you also need to open ports
Do I google how to do that?
of course
wait one more question
first
open the server
try to join locally
default port is 7777 if you didn't change it
so these are 2 seperate lines right
go to unreal engine, disable separteserverblablablah, and then press ` and type open 127.0.0.1:7777
so I type that, replacing everything that needs to be, with a space, and press enter
yeah I see which is why I got confused
When I make the videos I watch to make multiplayer replicated doors, they don't work when I make them. Can anyone help me with how to do this?
Hi, i have an actor that replicate a variable, and i would like to keep the replicated data when the actor is destroyed, is it possible to replicate a variable from another class (like a subsystem) ?
I'm working on spawning projectiles from a Gameplay Ability currently and running into a bit of a snag.
I setup a UWorldSubsystem to pool some projectile actors, and then ideally I'd like to just send an event to each player that a projectile was fired.
Clients can enable the visuals, and server can do the hit detection.
I was trying to do a NetMulticast function that then called a function on the subsystem, but client's don't see anything other than their own projectiles.
All other projectiles seem to be hidden.
My goal with this was to not fully have to replicate projectile actors, and instead just the event to fire one.
I'm not sure if this is fundamentally wrong/a bad idea, or if I'm just bumping into a small snag. Any suggestions?
https://forums.unrealengine.com/t/programming-subsystems-and-replication/506005
Found this, looks like rpcs directly on subsystems have some caveats.
Programming Subsystems and Replication Article written by Alex K. The engine’s Programming Subsystems provide lightweight and easy to use extension points for core engine classes. When using these subsystems for a multiplayer game or other networked project, these may seem like a good place to include networking related functionality, such as s...
I think the typical approach is for the subsystem to have an actor it replicates stuff through
No game code would talk to the actor directly, only the subsystem
Would calling a netmulticast function on the game mode that then called the subsystem functions also work?
game mode is server only
game state maybe
but just have the subsystem spawn an actor and call it a day
I'm creating a AI, I'm trying to know is someone is looking him, I created a blueprint service. The value of recently renderer is always false for the client. Should I use RPC here?
You probably don't want to use recently rendered as your test
I'll give that a shot.
Just to make sure I understand this,
The subsystem is a UWorldSubsystem,
Each client should have their own version of this right?
Then when I make a call to the subsystem, rather than it being an rpc, it should instead execute that rpc on an actor it has spawned?
Is there a built in method? Or should I calculate if the actor is on players screen?
The usage for anything talking to the subsystem is the same
just the subsystem talks to its actor for network stuff
Do you want clients to fire off projectiles predictively?
Not predictively, just triggered from the server. I'm trying to keep from having to replicate the projectile actors, as there will be a fair amount, and I can just handle the damage dealing on the server.
The logic flow is
Gameplay Ability calls subsystem fire.
Subsystem grabs a projectile from it's pool, and then sends it an init event with some configuration data, and the firing information.
Projectile uses that info to toggle on visuals, and fire in a direction.
On collision, the projectile toggles off visuals and collusion, and if it's the server, applys a GE for damage
Yeah that could look like:
Gun or whatever (Serverside):
Entry -> ProjectileSubsystem.FireProjectile(Data)
ProjectileSubsystem (Serverside):
FireProjectile -> MyNetManagerActor.MulticastFireAProjectile(Data)
MyNetManagerActor (Everywhere):
MulticastFireAProjectile-> ProjectileSubsystem.FireProjectileLocal(Data)
ProjectileSubsystem (Everywhere):
FireProjectileLocal -> Switch/branch on authority and role etc -> do the thing
Ahh gotcha, thanks a bunch for the detailed breakdown. Still green in my multiplayer experience
If you wanted to predictable fire a projectile it'd just be a question of making some id locally when you fire, which is then matched up when the rpc or replicated data comes back
Whether or not that's useful depends
Yea, that's in the plan long term.
ID's could also help for a few other things as well. Just getting my initial proof out of the way, and wanted to make sure I could do a whole lot of projectiles without excess spawning, or eating crazy bandwidth by completely replicating it
Anyone have an idea On why the camera is behaving like this on the client ?
Hmm with this setup, I'm still bumping into the same issue where clients don't see projectiles fired by the server
When I execute the ability on a client, it correctly executes the FireProjectileLocal on both client and server.
But, when executed on the server, it only executes FireProjectileLocal on the server.
I'll toss my code into a txt file and upload that, so i don't break the message length limit.
Here's the code for the subsystem and replication actor.
I'm wondering if the client sees its projectiles because the ability executes locally, and on the server. So it executes the function on its instance of the subsystem.
But when the server executes it, it only runs on the server.
Is it possible that the netmulticast function isn't actually replicating out to the client?
If you are using GAS and it's a predicted Ability, then yeah, it will call locally too
Yea, in that case the rpc isn't what's making it work. I'll have to figure out how to let other clients know to fire a projectile as well. Any suggestions on triggering an event on all clients from within a gameplay Ability?
Depends on the Event
GAs aren't and mostly shouldn't be replicated
Some arbitrary data probably through some other actor
If it's just visual stuff you could use a GameplayCue
Each client has a pool of actors for use, I just need to notify each client to use one because someone fired.
Right, you are mostly struggling with SimulatedProxies
Exactly, still new on multiplayer, gotta figure out the quirks
I would probably have used an ActorComponent on the GameState or similar
And just Multicasted there
While also passing in the "Shooter", so you can check if "IsLocallyControlled" to filter the local player that predicted already.
New to multiplayer but jumping straight into GAS + subsystems + actor pooling?
Quite the jump lol
I mean, ActorPooling and Subsystems aren't really Multiplayer problems in UE
If they already have some understanding of that form SP, then they are quite fine
Oh yea, I've done gas and subsystems plenty, just haven't needed to do replication.
This sounds super straightforward and makes sense. Thanks!
Any ideas ?
You can use any type of object to store data as you see fit.
I can't use the rep macro with an external object, so i'm not sure what you mean
In terms of replication, you need a replicated object/actor and for the property to be marked as replicated in order for clients to receive it. The replicated value would exist only on that particular actor that has that property. You can use OnReps to drive additional logic that could copy that data somewhere else as needed, or use the OnDestroy event on the actor to copy it to where you want.
Mh i was trying to avoid copying data
If you destroy the actor, which contains the reference to the variable, how else would you keep the data contained in the variable if that actor is destroyed other than by copying it somewhere else?
I don't know that's why i ask :p Maybe with a shared ptr so when the actor is destroyed, the object is still alive
Objects (effectively anything in the engine) are the things that contain data. If you destroy the object, the data it contains goes with it.
I'm trying to do somthing like that :
// subsystem
uproperty(replicated)
UObject* Data;
// actor
uproperty(replicated)
UObject* Data; // ref to subsystem data
//
DOREPLIFETIME(subsystem, Data)
So when the object is destroyed, the data is not
Subsystems don't replicate as far as I'm aware. UObjects also do not replicate by default, but can be made to replicate.
In your example provided, if the object that contains these properties are destroyed, they are no longer being referenced by this object. Unless you tell another object to have a reference to those objects, (which isn't copying them directly, it's a matter of copying the pointer to them) then you'd have no way of referencing those replicated objects.
So a shared ptr would work ?
If you mean a TSharedPtr, I'm not sure as I'm not super well versed with them yet, but based on my understanding it wouldn't be necessary to use a TSharedPtr.
An Object will normally continue to exist so long as something has reference to it. If you have a replicated reference, and set something else to also use that reference, you're not copying the object that exists, you're copying the reference, allowing that other thing to have the reference as well, which will also keep the object in memory.
I think where you may run into trouble is that if you're not keeping reference on the server to the replicated object, then when that object reference is destroyed on the server, I imagine it would also destroy it on clients even if they have reference to the object elsewhere, unless you use something like TearOff() which is something that Actors have to essentially tell clients to stop handling the actor as replicated.
It's in a game instance subsystem server side so it's always alive
It seems shared ptr are not working with replicated properties, but TWeakObjectPtr works
Will try with that and use ondestroy functions if it's not working, thanks for your help !
I'm using Lyra for some of the base systems, so I'm already bought into the modular gameplay framework. Was able to setup a GameStateComponent and this worked perfectly. Thanks again! I feel like I understand the workings a lot better now
As Datura said, Subsystems do not replicate
So I overriden PawnLeavingGame and instead Destroy() i called Unpossess from server. It partially works since it doesn't remove the horse but the human character is still stays on top. I can't remove the rider.
You need to detatch the human from the horse
@thin stratus
Is the cost of replicating these is identical:
1.5884483832907
2.0
( @pallid mesa )
CMC rounds the acceleration instead of serializing
Even though the data size of the float wouldn't change it must suggest something is happening behind the scenes? Otherwise they'd serialize
When I make the videos I watch to make multiplayer replicated doors, they don't work when I make them. Can anyone help me with how to do this?
Well i'm replicating a variable in a subsystem so it does :p, you just need a proxy actor
Not entirely sure what you mean
Acceleration is using a special Vector Type that does get serialized differently
It's a bit more complex in code, but summed up all it does is save each component for the Vector as an Integer after "scaling" it first to preserve the decimals
Guess I'm asking why they round the acceleration in SetMoveFor
@grand kestrel Relative simple
They use the Move to ... move
And if the Server moves with a version that has 1300.1 acceleration
And the client moves with 1300.1999
It would ultimately cause a different result
So if they only send a cut off version to the server
They need to ensure the client moves with the same cut off value
Hello, does anyone know how I can change character's mesh relative location on play time? I'm implementing some logic for being knocked down (i.e. the player has to crawl), and I need to move the mesh from -90 to something like -35.
I have a OnRep bool bIsKnocked, and when it's true, I set the mesh offset to -35, but it doesn't work properly. It works fine for local characters, but not for the remove ones. If there're 2 players, (server character is called A, client character is called B) server-side the character A will have the new Z offset, while the B will have the original one (set prior to play time), and client-side character B will have the new Z offset, as well as character A, but as soon as character A starts moving the offset restores to the one set prior to play time.
Any suggestions?
@thin stratus I believe he wants to ask if rounding (removing decimals in this case) reduces the amount of bits the << operator would send.. and i havent looked into this specifically but I think for a normal float it wouldn't... as for FVectors... maybe its serializer does something wild but afaik you are supposed to use the quantized types for that 🤷♂️(@grand kestrel for visibility)
It sounded to me as if he just didn't understand why they are rounding.
ah no, spoke to him earlier about this
Should a non-simulating-physics trigger box, for example, be a replicated actor?
What makes you think it should?
To avoid out of sync. For example, the client computer runs slower, for some reason, than the server does.
Is that box moving?
For example, a projectile owned by a client's player has entered the trigger box on the server while it has not on the client because the client computer runs slower (busy doing computation).
If the box isn't moving and you don't need to replicate any variables or events in it, then there is no need to replicate the actor itself
There is an overlap event on the trigger box. So I need to replicate it.
UHT does not complain when non-replicated actors (or actors with bReplicates=false) have unused or useless replicated properties or RPCs.
whats the best practice to get the server to see what the client wants, I have replicated a variable so the client sees it but now I need the server to see a variable the client sets, do I use a server rpc?
Yeah, only via Server RPC
I am having an issue where i want to replicate a USceneComponent that is not spawned on the actor that replicates and i only attach it after its spawned (i have a reason for having it setup this way) anyways i am unable to set a net condition to said component. i am only able to just do ->SetIsReplicated(). otherwise it wont replicate
so whats the issue? Component->SetIsReplicated(true) is the correct way .... but this is typically done in the constructor. If you're attaching it & trying to replicate it - make sure youre doing it on server auth - otherwise this wont have an effect that is replicated.
the issue is that i want the component that i am spawning on run time to have the net condtion COND_SkipOwner
setting the bOwnerNoSee could work for me too but ideally i would rather just not replicate it to the owning client in the first place
that is a Property replication utility - not a component level....
https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/Networking/Actors/Properties/Conditions/
you cannot set this on a component.... not to my knowledge or any searching I am looking for to help you.
So I'm curious as to how I would spawn and possess for more than one client. This is from my GameMode blueprint. I'm sure there's better ways of doing this though! Right now I'm just testing and currently I'm not able to get my second spawned actor to be functional, its there kind of like possessed but I'm not able to move around or anything. Sorry if I've missed something, my head is abit mushy atm 😅
are you utilizing DefaultPawnClass in GM?
Second and third image is my SpawnPlayer function btw
yes
then you are tripping over yourself.... default pawn class is a method to spawn - if it is used then you are going to spawn this every time.
you need to remove this if you intend to do custom spawn logic.
OR - if you want ot have that used - you need to override the function GM::RestartPlayer() is what worked best for me.
i set mine to none - because i have MULTIPLE types of characters the player can play (MOBA style game) - and i still did the REStartPlayer override.
mine is a bit complex - but not really that hard... simple lobby system that hte player selects a chosen character class - and that is what is loaded into their playercontroller. when the GM runs REstartPlayer - which would require you to ALSO override GetDefaultPawnClassForController()
I cast ot my PController class - and retrieve this class to use from player selection.
inside of GM::GetDefaultPawnClassForController() override
not entirely sure I'm following but will dig into it abit. I'll problably be back if I didn't understand correctly 😁
thanks for the help!
hey guys my character blueprint is really lagging when its on a client while the server isnt. is there a way to see like what part of a blueprint is taking up the most resources or something?
Actors that should not have client RPCs (UFUNCTION(client)):
- ones that are not replicated actors (
bReplicates=false) - ones that are never be owned by player controllers.
Is there anything else?
Maybe about spamming RPC calls?
nah i dont think thats the case im not doing that anywhere
and im using the general movement component which is pretty good for multiplayer
well its kind of a big bp that i havent organized but theres no spamming rpcs anywhere
its kind of weird because a new pawn doesnt lag like this one so i think i might just try and recreate it and see where i went wrong
guyz i have noob question :
There is an ACTOR on the map and I trigger the interface in it by sending a line trace to this ACTOR.
And this Actor increases the value of another Actor listening to her through the delegate.
The problem is that when one player increases the value by triggering, the other party sees the increase, but when the other player applies the trigger, there is no addition to the increased value.
Note: bReplicates = true; in the construct and actor blueprints Replicates = true;
sounds like the server is able to do whatever, and the other player is a client that is not making any RPCs to the server to process anything
bReplicates = true does not automatically mean everything is replicated automatically for you
So I will change the value via RPC is that true?
sure you can
thanks for reply bro Let me investigate RPCs a little more.
hmm so if im trying to replicate an inventory system, do i mostly need to replicate the inventory actor component, as most of the UI is client facing??
assuming most of the logic goes on in the inventory component
I have a problem where client cannot interact with 3D widgets
About replication: I have an Actor (a character) that has an inventory (an UObject with a TArray of UObjects). Is there any builtin replication for this or should I come up with my own code for this setup? I set up both the inventory and the TArray as replicated, but I see the changes in the server while not happening in the client.
Did you set up the UObjects to properly replicate through an actor channel?
I've taken a look to that code, but I don't get the magic behind. Will this find the actor that contains this item as a UPROPERTY?
UFUNCTION(BlueprintPure, Category = "My Object")
AActor* GetOwningActor() const
{
return GetTypedOuter<AActor>();
}
In my case, will it find the Actor (Character) that has the inventory?
You need to add it as a replicated subobject of the actor.
All that TArray does is replicate a list of pointers to objects. The client doesn't actually have those objects, so they'll never resolve to an object.
That article is a bit old now, you don't need a special actor class anymore - just use the replicated subobject list.
So all I need is to override ReplicateSubobjects in the UContainer (UObject that holds the TArray)?
UContainer won't work, it's a UObject. Only actors can replicate
UContainer could also be an Actor Component
I have an AbstractItem (UObject) and my UContainer inherits that. Isn't there a way I can make this heriarchy work? I want containers in my game to be items as well, and therefore items may be an arbitrary tree structure with an arbitrary depth.
Ultimately, an Actor at the top of the chain has to replicate the objects.
Replicating trees of UObjects isn't particularly cheap though, it has to be said
Right, I don't know how networking works behind the scenes, I'm guessing UE won't detect subtree changes out of thin air.
However, I'm happy to learn more and do this by my own
The problem is that I can't even replicate the first layer of items right now, so I can't just go and write the tree traversing or anything
The main thing you need to know is that replicating UObject* is only replicating a reference to an object, not an actual object instance in it's entirety. The engine converts those references/pointers to a NetGUID behind the scenes, which is just a number used to lookup the actual object instance that exists in memory on the local machine.
So how it happens that actors do exist both locally and in the server? There must be an instantiation at some point on both machines
The problem you've got is that right now, clients don't create those object instances so those pointers resolve to nothing. The only way to have clients creating those objects, is to add them as replicated subobjects of an actor at the top of the chain - that specific setup will tell clients to 'create an object of this class' on their local machine, and then the pointers to it will "magically" resolve.
Because Actors are where that system starts - which is why any UObject you want to network has to use the actor system.
Components are done the same way, they are replicated subobjects of the actor.
Right, so the actor has to have a flatten list of all the tree items, and any item in this tree must be added to that list at some point
Objects that exist in the content browser or which are pre-placed in maps can be resolved by their FName, so those don't need to be spawned dynamically.
Essentially yeah
Reparenting those objects to different actors is also extremely error prone, the same reason you can't easily move components between actors in network game either.
It's very not-trivial to transfer a replicated UObject to some other actor, which might factor into the design a bit
so removing it from a list and placing it on a different list won't work?
In theory it should work, but it does often create a lot of issues
You'll have to handle race conditions
And change the outer of your UObjects
Which isn't exactly a walk in the park stability wise
Yeah, changing the outer is where things get really messy, since by name they are no longer the same object. Lots of stuff breaks
nice
I've managed to do it but I had to handle it in two or three different locations to make sure the outer also changed for the client
Since outers aren't replicated
They did improve it I think, like replicated subobjects will actually get created with the same outer as the server now - but that's super recent, maybe since 5.0 or Iris stuff started not sure
But yeah, that was a ballache for a long time
On creation sure, but I don't think renames are replicated
Not to disuade you but inventories that rely heavily on UObjects for item representation are usually a bit of a non-starter for MP
I basically have to maintain my own replicated lists on top of the subobject list and use them to sync up outers on clients
UObject for Inventory is how I do it, but my inventories hold a fast array of structs for item instances
Means I can easily transfer inventories between actors, without copying arrays of structs heh
Okay, so what I'm thinking right now
- UContainer and UAbstractItem (UObjects) will only exist in the server.
- I will create an actor to represent the item (UAbstractItem) and I'll create an actor component for the inventory (to show a widget to the client)
Then if a user grabs an item I will destroy the actor that represents the item, and I will place the UAbstractItem in the UContainer (this is serversided only)
"easily" as in once you get all the edge cases handled and pray to Sweeney long enough, it'll probably work fine
Yeah, my approach was fast array of structs which point to data assets - with an optional 'live' instance if you want it, but you gotta handle the networking yourself.
That's pretty much how I do it as well
I have data assets for item templates, and the data asset has a function to create an instance of the item that's stored in a struct
yeah, same 😄
struct holds primary asset id for the data asset, an fguid, and a TMap<FName, FInstancedStruct> for arbitrary data relating to the item instance
transfers aren't that trivial for me but I don't do them often so not too bothered about that
i love instanced structs
Something that can prepare a mesh to have a representation, and a name, right?
yep
item template holds name, meshes, etc
anything that doesn't need to be replicated since it just describes the item and exists on every client already stored in the disk
And my item instances simply have an FPrimaryAssetId to point to what item the instance was made from
oh so this struct replicates? I was thinking on having this struct in the server, changing the mesh, and replicating the mesh
item template is a UPrimaryDataAsset
No replication
the struct is an instance, doesn't hold meshes etc
Only instance specific data - i.e. how much of the item is stored in the instance for things like stackable items
Is this an enum?
struct
unique identifier for primary assets
I load my data assets on game startup and keep them in memory
soft pointers only in it so I don't kill my memory usage
Right, so you know what assets to use in each item type (like what mesh to render)
yep
I'm sorry I'm pretty much new to UE in general, I need to read more
no worries, that's what this server is for
Your structs, are purely written in code or can you assign assets using the editor? The way I have it right now I can see what I'm doing and I would like to keep that if possible
For example I have made a spawner that spawns in a radius and I can see what will it spawn (in this case a gold coin)
the item instance struct never changes for all items
it's the data inside that changes per item
FInstancedStruct supports blueprints so you can do it there too
I'm confused here. So if in the world there exists more than once instance of an item, and this item is stackable for instance, and both have different amounts, how do you represent different amounts on different items?
two items = two different item instance structs
it's the data inside the struct's TMap<> that changes
I just mean that like all items use the same struct class
So you may have a key for the amount in the map, or for the mesh, etc... And when you have to create a new item you would build the structure with every element in the map again
Is there anyone here who can help me troubleshoot a repnotify issue ? I have a door that when interacted with by a client sends a server rpc call to open the door. If the door can be opened, a repnotify bool is sent to clients to run the open door function. It works for players in the server at the time of the repnotify but new clients don't get the updated value so the door is closed for them. When they interact with it, it opens the door for them and closes the door for everyone else who it was open for.
Based on what you've described, it should be working.
Client Input > Server RPC > Server Sets replicated variable
OnRep should trigger for currently connected clients and any clients that join later and have the appropriate value that the server has for the door.
I'll post a couple of screenshots of my setup.
@wispy veldt https://www.youtube.com/watch?app=desktop&v=UstLLZbkmOQl&ab_channel=OmidKiarostami
this is a good resource. Even showed you how to test with late joiners in pie
First one is the on rep notify function, second is the interaction
The 'testing rep notify' doesn't print to newly connected clients, and the door doesn't open even though it's open for everyone else already connected. If somebody interacts with the door, all currently connected clients do get the print message though and the door opens/closes accordingly.
They will only call the RepNotify if it differs from the default/serialized value for the actor.
It is different
The default value is false (not open). The server changes is to true (open) when a client interacts with it.
So shouldn't the new client get a 'true' value ?
They should yeah. If you simply print the value of Is Open, do they actually receive the value?
No
It doesn't print anything
The repnotify itself isn't even being called on new clients
Ah, make sure they are ticking
What I meant is, print the value of Is Open on tick, to make sure its actually being received first
Yeah I can do that
You're not setting the value of Is Open anywhere but that RPC right? Like from some setup during begin play or anything?
Nowhere
Only the server sets it on interaction
I'll post the results of my on tick print in a few. Had to step out to get some food.
hmm on tick it's printing twice for some reason. At first connect (as host) it prints false all the time but then when it's open it's printing one true and one false.
It'll be printing one for the Server, another for the Client. Sounds like the value isn't replicating
oh even on clients it will print the servers value?
Clients will print the local value
How many doors you have? One?
More than two
yeah so all the ticking doors that inherit that BP will be printing the value, which doesn't make it easy to debug
Need to identify them somehow
I think there are four right now. Let me remove the other ones for now
I knew that too, wasn't even thinking of it.
okay only one door now. Let's see what it does.
Hmm, it's printing true on the connecting client too
as soon as they connect and the door is open it prints true. The repnotify doesn't appear to be triggering though (or at least, the stuff inside of the repnotify function)
Hmm, RepNotifys in BP are particularly crappy. Maybe it's a BP thing. Try calling it manually from BeginPlay or something.
try calling what from beginplay?
the OnRep function
Or at least doing it's logic
This shouldn't be neccesary, but Blueprint networking is buggy af
I don't think you can call onrep function manually.. at least if you can it won't let me
Ah, probably not in BP then
This should just work at the end of the day, but BP networking/onreps having this sort of issue doesn't shock me
They're a bit of a hack at best
omfg... I am an idiot..
I set my interact input action up, but never set a trigger on it, so every time you interact it triggers multiple times. I think it was throwing off the variable for the server as once I switched it to 'pressed' as the trigger (so it only fires once), it seems to have fixed it..
I am not sure why everything else was printing correctly but maybe it was just happening too fast.
well that's embarassing...
Seems to be good to go now. Thank you for helping Jambax
its probably a stupid question but im new to replication and sort of struggling with implementing my own logic. Basically i want to send a request to the server to do some inventory logic and then do some more logic based upon if theres room in the inventory
my question is then: is it possible to pass input parameters to the server from the client and how would i do so?
You can send whatever you like through an RPC
void MyServerRPC(int32 SomeExampleIntValue);
I see, i was trying to use the custom events replication settings to no avail but i guess RPCs are then the answer. cool.
Custom Events in Blueprint become RPCs when marked as such.
hmm really
You should read the Network Compendium.
probably yeah lol
It is the first Pinned Message
That image is far to small to make out any detail
u have to click on it to see it, its full res.
Full res is still tiny
nvm then lol
I can't figure out how to pass variables in still
i call this Server Add Item function and pass in some values but they return as junk
eh im probably just misunderstanding the multiplayer architecture because im calling that from a client to execute on the server to no avail
like it calls from the character BP
Is the thing you're feeding in something that is replicated from the server to begin with?
I believe so, let me double check
Ah no it wasn't, but i've now set that var to be replicated. Hmm. What else could there be, it seems to be similar behaviour.
Im almost certain the actor owns the inventory component (as its attached to it). So its not that.
Just marking the variable as replicated doesn't mean the server has the value associated. Replication of variables is only one way, from server to clients. If you're spawning something on the client and attempting to reference it on the server, you wouldn't be able to.
You can pass values to the server in an RPC, including references, but when using references in the RPC, it must be something that has been made net addressable - for example, spawning a replicated actor on the server will usually result in that actor being spawned on clients as well, and clients can pass along a reference to that actor back to the server without requiring a replicated variable referencing that actor - you just need a way to get a reference to that actor and send that reference back to the server and the server will know which actor it is you're referencing as it was made net addressable when it was spawned.
Another example would be say, using a reference to an asset of some kind, like a blueprint class, or a data asset. These things aren't necessarily spawned, but you can pass these to the server, and in the background it's actually sending along the path to the asset - the server will then associate that path and assign a network addressable ID to that asset making future calls to that asset a bit more efficient as the path information no longer needs to be sent each time its referenced.
Well i can pass in the variable here and it reads on the client, but it doesn't get passed to the server?
but the item actor does
ItemObject if that is just a normal Object
will not replicate
and client will never know about it
its a uobject
you cant replicate UObjects (with Blueprint alone)
UObject replication needs to be done in c++ via an actor/component
via ReplicateSubobject function
hmm that might be tricky but let me see what i can do
the actor component bit anyway
Hello, would anyone be able to direct me to a good tutorial for a "online Brawler" type game. Specifically the correct way to impliment accurate physics between server and client
That is farrr beyond tutorial territory
Having this issue where my GUIComponent can detect my character being LocallyControlled but my HealthComponent can't, idk if it's smth to do with me calling it in the onrep of the healthComponent, please ask for anything else if you need, ty
Is it ok to use replication notification (to changes to a trivial property) to trigger all clients to play visual effects instead of using netmulticast rpc?
(Ab)using RepNotify:
// ...
{
UFUNCTION(Server, Reliable)
void ServerRpc_Fire();
UPROPERTY(ReplicatedUsing=RepNotify_VisualEffectParity)
bool VisualEffectParity = false;
UFUNCTION()
void RepNotify_VisualEffectParity();
}
void APlayerCharacter::ServerRpc_Fire_Implementation()
{
VisualEffectParity = !VisualEffectParity;
}
void APlayerCharacter::RepNotify_VisualEffectParity()
{
UGameplayStatics::SpawnEmitterAtLocation(...);
}
// others...
Using NetMulticast:
// ...
{
UFUNCTION(Server, Reliable)
void ServerRpc_Fire();
UFUNCTION(NetMulticast, Reliable)
void NetMulticastRpc_VisualEffect();
}
void APlayerCharacter::ServerRpc_Fire_Implementation()
{
NetMulticastRpc_VisualEffect();
}
void APlayerCharacter::NetMulticastRpc_VisualEffect_Implementation()
{
if(!IsRunningDedicatedServer)
UGameplayStatics::SpawnEmitterAtLocation(...);
}
// others...
The frequency of the changes to VisualEffectParity must be keep smaller than that of net replication.
how do i use replication on animation instance?
My question might be relevant to your question. #multiplayer message
thank you for pointing that out
what is the differance between repnotify and replicatedusing?
Be careful because if you changes the property fast enough, only the last change will trigger repnotify. 🙂
nvm i am dumb
The same. C++ uses ReplicatedUsing and Blueprint uses RepNotify.
yeah i noticed i thought it was syntax and not a name
brain dead moments
@solid river as for your question i think rep notify is better since replication is faster then rpc calls
and from what i know as a general rule of thumb none gameplay critical stuff shouldn't use rpc's
so effects are better with rep notify if possible
Playing visual effects can also be triggered via physics simulation events and it does not need rep notify. It is the most efficient I think.
that is even better
if you already have stuff replicated its good to take advantage of the information they replicate to do as much as possible
obviously without comprimising something important
If you have a bullet, which approach do you prefer?
- A: Using a replicated bullet spawned only from server.
- B: Using a non-replicated bullet that is spawned from each machine in response to netmulticast rpc called from server.
Here is the more detailed story.
A replicated player character P1 on a client calls its UFUNCTION(server) ServerRpcFire().
The player character (only) on the server then executes ServerRpcFire().
I split into two cases:
Case A: Using replicated bullet
ServerRpcFire()spawns a replicated bullet B (only) on the server.- The bullet is replicated from the server to all clients.
Case B: Using not-replicated bullet
ServerRpcFire()callsUFUNCTION(NetMulticast) NetMulticastRpcFire()only on the server.NetMulticastRpcFire_Implementation()then executes on all clients and server.- Each machine spawns non-replicated bullet.
The following applies for both scenario after the bullet hits another replicated player P2.
Code in the bullet's hit event does the following:
- on all machines except for dedicated server, play its explosion effect and destroys itself.
- only on server, deduct certain points from P2's
UPROPERTY(ReplicatedUsing=OnRep_Health) Health. - (only) on all clients, replicated P2's
OnRep_Health()updates health status. - only on server, call P2's
UFUNCTION(Client) ClientRpcShakeCamera(). - (only) on P2's client, shake P2's camera with blood spill.
It seems to me the case B is more efficient because replication used in case A is not cheap.
in this case rpc might be better but you have much more fine grain control on net updates and other stuff with replication + destruction should replicate too so you wont have to over complicate your code. you could also like before use a repnotify for when to spawn the projectile on the client (some kind of boolean is firing or something then you have a toggle fire function that is called from the rep notify depending on your gun (so basically its like an rpc call but without using rpcs which is better in my opinion. if you find regular replication too expensive you could always use push model and just mark the isFiring variable dirty when needed)
@solid river
Is there a way to make stun or slow abilities using the ASC and CMC? If I change the movespeed using a Gameplay Effect then I get terrible rubberbanding since ASC and CMC are not synced
My current idea is to delay the slow effect so it has time to replicate. So if it is initiated at server time 0 then I'll apply it at server time 300 on both server and client
Potentially stupid question: I'm trying to spawn a different type of default pawn in PostLogin when a new player connects. I would like to not spawn any pawn when someone already placed a pawn in the world and set auto-possess to the respective player.
Can't really find a nice way to do this, as
a) the pawn itself asks the PC to possess it in PreInitializeComponents
b) for some reason using TActorRange<APawn>(NewPlayer->GetWorld()) in PostLogin returns only 1 Spectator Pawn, so I can't really check if any of the pawns have auto possess enabled.
Does anyone have an idea what could work here?
thanks a lot
You can predict the applying fwiw. But the removal can't be due to GAS limitations
For the removal you might need to give the client some time
Also you will want to handle those effects manually in the cmc by listening to apply and remove of GEs and then converting them to something you can manage in the cmc by hand
It's not super straightforward sadly
I wouldn't use the built in stuff for that. I would manually check if there is a pawn with a matching UniqueNetId, property you will need to create on the pawn, in the world and otherwise spawn a new pawn.
Hmm, but for that I'd also need to iterate over all pawns on PostLogin - which I seem to be unable to do. Is the GetWorld() call there not yet safe to call?
How do I give the client some time so that it agrees with the server on the movement?
Should be fine
Are you sure the pawn is actually in the world?
That would go too much into detail
I don't have the code at hand
It's dragged in the scene, and the auto-possess works fine afterwards too
Neither was it mine so I won't share it exactly
but for some reason I only get a SpectatorPawn
Not sure tbh
okay maybe my debugger is just being weird
oki, thank you @thin stratus . I'll try to get the start of the slow/stun working then by listening to apply and removes of GE, and then think about the removal of it once I reach that point
Hmm nope, TActorRange<APawn>(NewPlayer->GetWorld(), APawn::StaticClass(), EActorIteratorFlags::AllActors) only gives me a spectator pawn - which isn't even in the scene. Almost seems like it's called too early somehow.
Keep in mind you need to tie this into the saved moves too
Never used actor range. usually use actor iterator
Same result - however, if I use GEngine->GetWorldContexts()[0].World() instead of GetWorld(), it seems to work.
Quite interesting, I think I probably just cannot call it before Super::PostLogin
Pickup actors must be replicated?
Hello guys, can someone help me?
I'm facing the difficulty in that I want to use the On Rep notify event when a variable gets replicated, but I don't get this event run for the host or server, and it ruins the whole logic.
How do I accommodate or do a work around for the host when working with the On Rep notify?
If you're working in C++, you'll have to call the OnRep function manually on the server/host.
If you want them to appear on clients so they can pick them up yeah
I'm using blueprints.
I'm doing a simple mechanic where:
player enters -> set their player ID based on an integer -> set their team ID based on the % of the integer -> update everyone's UI to add those new players .
what is the best way to do this?
Now I am using the On Possess in the player controller and speak with the Game State, but I get the issues with the server that it doesn't run the On Rep notify for that player information
I would appreciate in general what is the best practice when it comes to speaking with every player's UI like this because I have suffered with it
I'd say avoid using arbitrary IDs when referencing players as it makes things extremely difficult to manage. Every player has a PlayerState and this is the unique thing about each player you can use to identify them, and it is associated with their controlled pawn (accessible to all other clients) and the player controller (accessible only by the owning player) making it easy to determine which player you're working with when you have reference to their pawn or controller. When a PlayerState begins play, that playerstate is also added to the GameState's PlayerArray, so you have an easy means of getting a listing of all players currently in the game.
So then if you want to have everyone's UI updated when someone joins, your best bet is to use a combination of the GameState and the PlayerState.
On the GameState you can create a couple of event dispatcher that has a PlayerState as an input, you can call them OnPlayerJoined and OnPlayerLeaving.
On Begin Play of the PlayerState, you can have it get your game state and call the OnPlayerJoined dispatcher with reference to self as the playerstate.
On Destroy of the PlayerState, you would have it call your game state and call the OnPlayerLeaving dispatcher, again wtih reference to self for the playerstate.
This now gives you a generic place (the game state) to know when a player is leaving or joining. You can have your UI elements bind to the event dispatchers on the gamestate in order to add or remove elements based on that PlayerState joining or leaving the game.
In terms of the Team ID, you're likely better off using a different system for determining the team, like looping through the Player Array on the gamestate and getting count of how many players are on each team, and assigning the joining player with the team with the lowest members. This too should of course be an OnRep which you can then have your UI update based on the value changing, which you may want to use event dispatchers for as well.
Wow incredible!
Thanks a lot for the rich information 🤩 , I appreciate it.
I will follow your suggestions and see where it leads me
Can i multicast straight from interface event?
If you're already running on the server, sure.
i wanna support dedicated so probably server to mc as usual
Hello, is it possible to get the old value to the OnRep, but the blueprint one? In C++ we can make void OnRep_MyValue(int32 OldValue), but in BPs it automatically makes void OnRep_MyValue(). Am I missing something or it's just impossible to do?
Someone answered me before, you can only do that in C++ not in bp
Hello, wondering something about dedicated servers, are there any platform that sells a cloud solution for a unreal 5 dedicated game server (that can have inside it sessions of 12 players) but also scales the price on the quantity of use on this server. For exemple if I only have 1 guy playing for a month I pay 20 dollars but if I have 500 I pay 1k dollars?
Basically I don't want to pay 1k if only 1 guy plays on the server
That's more or less what stuff like PlayFab offers
The servers there cost a set price per time and you'll have to see what you need and what you can fit on one of the servers in terms of quantity of dedicated servers.
Does it automatically adjust the amount of servers if I need more?
In theory yes
They spin up new fleets and keep them idle
And spin them down if not needed
And the price adapts then
That sound really nice thanks!
20 dollars is probably not gonna be a thing
Aw lol
How can i make sure to only send this server rpc only on locally controlled characters and not simulated proxies?
if (IsLocallyControlled() && GetLocalRole() == ENetRole::ROLE_AutonomousProxy)
{
ServerRequestWeapon();
}```
if i remove the ENetRole check then in editor where there is 1 server and 1 client 3 weapons are spawned, 1 on server and 2 on client, I am imagining the extra weapon is from simulatedproxy?
right now i am calling this in begin play
They have a free tier iirc. So you can try it out and see what specs you need to host a few dedi servers (with different ports) per cloud server
And then try to calculate what it would cost eventually
But it's usually a few hundred per month, even for just a handful of servers iirc.
And you would want to deploy Linux servers cause Windows is even more pricey
I think I'm really looking for something modular and scalable really, I don't mind paying 1k of there are a lot of players
I see
Server RPCs are generally dropped if not done by the owning client
BeginPlay might be too early for the is locally controlled check to work
You would want to wait until the client knows it's possessed
E.g. via OnRep_Controller
It's questionable though why you need an RPC for that
You could just override possessed on the server side and use that to spawn the replicated weapon
Unless the server needs to know what weapon by clients choice or so
No nothing like that i just didnt know what to override to make such calls so i used begin play
Sorry but what is the function called where i should do such calls?
Yeah it's that. There is more than PlayFab but I can't recall anymore. Things have changed in the last few years. It's still expensive though
BeginPlay is in theory also fine but if you don't need client info, you can just limit it to Server via HasAuthority
I usually use possessed to make sure the client is full in control of the character before giving out a weapon
I was always getting controller null had to do a poll to get it even now i know why....i am trying to solve this since last 5 hours btw 🥹
I don't know the exact name
OnPossessed or PossessedBy
Or just Possessed
It's the "callback" server side when a pawn gets possessed
You can just override it similar to BeginPlay
Understood I will find that function and do it in that then will let you know how it goes!
No need for an RPC then though
Yup yup
Wait why wouldnt i need an rpc if done in OnPossess in AController class?
doesnt this class exist on both client and server?
First of all, the function is in the Pawn, not the Controller (the one I mean)
And second, because that already only calls on the Server, what would you want to RPC for?
Thanks you for the link! i almost went on hunt in character and pawn class lol
I'm currently facing the difficulty that when I call the event dispatcher on the begin play of the player state, I get the function for setting the team -> updating the UI multiple times.
I tried to only do it if the controller is locally owned, but that led to the different problem of under UI update.
So I'm dealing with either over UI updating or under UI updating 😵💫
What are you trying to do
@tame kraken
The quoted message is a bit long, any tl;dr?
It is about setting information for each player and having this information communicated to all of the players' widget blueprints.
player 1 joins -> assign to them ID 0 -> assign them to either team 0 or 1 based on whether they are an even or odd number -> set their icon in the widget blue print.
then player 2 joins -> assign to them the next ID -> assign their team ID -> set the icon in the widget blue print.
now player 1 should see their icon and player 2 icon. player 2 should see their icon and player 1's icon... and so on, the more people join, the more it will be updated
Yeah that's a bit annoying
Cause you have a LOT of race conditions
You basically need to have callbacks for any kind of data that can change via OnReps
yea I'm now following this implementation with using on reps.
I have now set up this system by using the begin play of the player state, but that calls my On Player Joined dispatcher as many times as there are current players hha.
I will try to do the process in the On Possessed in the player controller instead
In Theory, it should be enough to
- Create Widget Entries on BeginPlay of the PlayerState
- Destroy Widget Entries on EndPlay of the PlayerState
- When creating the Widget, get the current Values of the PlayerState and update the UI
- When creating the Widget, bind to EventDispatchers for any Value that can update
- When destroying the Widget, unbind from the EventDispatchers again
OnPossessed doesn't make sense
Cause that's Server only
void APanoCharacter::PossessedBy(AController* NewController)
{
Super::PossessedBy(NewController);
if (!IsLocallyControlled()) return;
APanoverseGameMode* PanoverseGameMode = GetWorld()->GetAuthGameMode<APanoverseGameMode>();
if (PanoverseGameMode)
{
PanoverseGameMode->RequestWeapon(this);
}
GEngine->AddOnScreenDebugMessage(-1, 10.f, FColor::Red, FString("Possessed By"));
}```
Does this look fine or am i doing something wrong? @thin stratus
It getting called 3 times according to that debug and tho i only have editor set on 2 players on listen-server mode
but the player state begin play calls my dispatcher as many times as there are clients.
LocallyControlled check makes no sense, that is false for any of the Characters that aren't owned by the Server
Yeah, cause BeginPlay calls for every instance
ohh i meant to check for getlocalrole() i thought it works something like that
If you have 3 Players, each of them has an Instance of the PlayerState of the other 2 and their own.
So locally, for Player 1, BeginPlay would call 3 times. Once for its own and 2 times for the other two.
In total you get 9 calls, 3 per client, 1 per PlayerState per Client
Just don't check that at all
ok 🥹
I'm not sure why it would call more often
You might want to check if the Controller pointer is valid
Maybe it calls with an invalid controller at the start
And side note, for better readability of your code, stop those one liner ifs :P
ok and this, do you consider it as a feature that is unwanted, or we actually want to make use of it in our implementation?
because now in my implementation, I get double the player icons.
Each Player wants to see 3 Widget entries if there are 3 players, or not?
yes, one for themselves and 2 of the other players
So then I would consider that a feature
Client1: PlayerState1 (Client1), PlayerState2, PlayerState3
Client2: PlayerState1, PlayerState2 (Client2), PlayerState3
Client3: PlayerState1, PlayerState2, PlayerState3 (Client3)
Per Client you get 3 BeginPlay calls, one for each of the PlayerStates
If you end up with more than 3 Widgets, then check where the additional calls come from
Keep in mind that there are Idle/Inactive PlayerStates when Player's leave the game.
the problem I'm facing is that the game state assigns the teams -> update info -> replicates them and calls the widget updating multiple times
Which might call BeginPlay again
But you would have 2 different "Updates"
One is to create the 3 Entries
And then inside each entry you would listen for Updates to the values
The Team assignment shouldn't create widgets or?
Or are they in different lists? (which I didn't know)
You disgusting animal.
the game state assigns the teams, and the team information gets replicated and in the on rep notify we call the widget for updating
</3
"for updating" means what
the widget will create a new widget blueprint for the icon of the player and put it in the respective size box according to their team
maybe in this case I shouldn't make the variables replicated since they're already kind of replicated by the player state
Right, so they need to be in Team Slots, which I didn't know
I would then do that differently
I would have either Team Arrays
Or even a Team Actor
(I like creating ATeamState : public AInfo actors to mimic APlayerState etc.)
And then have an OnRep on the Team Array
And update the Widgets from that
I see it as the main problem is about the begin play of the player state is getting called as many times as there are clients.
I just want it once, when this client has entered.
we will assign it a team and after this assignment we will update the UI's
it kind of works gamemode spawns 4 weapons tho with now 4 times on possessed calls even with valid controller checks
But it does only call once
Per player
You might want to print the name of the Character and generally maybe start breakpointing
There is no reason for this to call more than once
Maybe it calls for 4 different characters?
Maybe you have 2 characters that are auto possessed and then you spawn new ones or some joke like that?
You also want to destroy the weapon on UnPossessed
(if valid)
otherwise you have floating weapons
no it doesn't.
now i'm the host -> I create the session -> begin play gets called once.
but when I join the session on the client -> I get begin play for the server and the client.
while it should just be the client who has just joined the game
That's not how BeginPlay works
BeginPlay calls for every actor when it gets spawned.
Ok i will try that thanks 🥹
When your Server starts the Game, there is only one PlayerState
So 1 BeginPlay call
When the Client joins, the PlayerState is spawned on the Server, so the Server gets a BeginPlay call for the Client's PlayerState
And the same time, the Client receives 2 replicated PlayerStates, their own and the one from the Server
Both calling BeginPlay
Which totals to 2 BeginPlay, one per PlayerState
ah ok.
maybe then I can make on player joined to be on authority only
Sure, but then only your Server will create the Widgets
the widgets are created in the on possessed for my case
OnPossessed is also Server Only
yes I do run on owning client
And per Character, not even per PlayerState
do you recommend I create the load out widget in the player state begin play?
Idk, depends on what the Loadout is where the info is stored
But using OnPossessed + ClientRPC isn't even the same
Cause the ClientRPC, on the Server Character, will only call on the Server
And if you handle the Widget in both, the Server would create a Widget twice for the same character
hmm, I haven't thought about it to this extent :D.
If you only need the Widget locally, you can use "OnControllerChangedEvent", which calls for Server and Client, and there you can do the IsLocallyControlled check to limit it to only the owner
If you are in C++, the player controller has an AcknowledgePossession function you can override. Which is something UE calls on the client when the PC possess a pawn.
I come from the background where I used to make everything in the character blueprint, but now I'm trying to diverge a little bit to use the other classes
so I'm still not sure about the best practices on where we should do what
You did read the Compendium I assume?
hmk
when joining with client in dedicated server, spawns 2 pawns for all existing clients
Eg: I have 2 players in the server and a third one joines. The third one spawns 2 pawns for each of the previous existing players.
show your gamemode code that's doing this
switching to a replicated property, could someone verify this is the right approach?
UPROPERTY(ReplicatedUsing=OnRep_IsDead)
bool bIsDead = false;
UFUNCTION()
virtual void OnRep_IsDead();
```cpp
```cpp
void ABaseAiCharacter::Die()
{
bIsDead = true;
if(HasAuthority())
{
OnRep_IsDead();
}
}
void ABaseAiCharacter::OnRep_IsDead()
//...
Yeah, pretty much. But I prefer to wrap that in a SetIsDead() function.
So Die() would just call SetIsDead(true); and then that same logic is applied.
And the OnRep_IsDead() function handles the actual actionable stuff that need to happen when the stuff changes.
That's the issue, Idk what's doing it
This is the Join session and then I just launch the new map which has a player start
Hello, I'm making an AI character that's supposed to do a jump on spawn, and in order to predict the spawn flow I'm using the OnLanded event, however it doesn't seem to be called on clients. After some tests I found out that it's not called on non-owning clients, i.e. if there's a player client character, it'll receive the OnLanded as well as server, while other clients won't receive it for that particular character.
So, is there some work around to predict the land event client-side?
The only working (yet dumb) work around I found:
void ATestActor::Interact()
{
if (HasAuthority())
{
ActiveSwitchCount = ActiveSwitchCount + 1;
OnRep_ActiveSwitchCount();
}
}
void ATestActor::OnRep_ActiveSwitchCount()
{
if (HasAuthority())
{
SwitchCountRenderer->SetText(FText::FromString(FString::SanitizeFloat(ActiveSwitchCount)));
GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Cyan, "From Server:"+FString::SanitizeFloat(ActiveSwitchCount));
}
else
{
SwitchCountRenderer->SetText(FText::FromString(FString::SanitizeFloat(ActiveSwitchCount)));
GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Cyan, "From Client:" + FString::SanitizeFloat(ActiveSwitchCount));
}
}
void ATestActor::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
//Replicate ActiveSwitchCount.
DOREPLIFETIME(ATestActor, ActiveSwitchCount);
}
server works properly
but client does not affect
It's probably because the client interaction is not happening server-side?
I assume you're just trying to call "Interact" on the client?
So when I using Interfaces shoul i do something special on interface for replication
Interfaces don't support RPCs
You have to call a server RPC or client RPC and then inside of that you call the interface method
thanks for reply guyz
one more quick question
if i chose collision for interaction rather than interface with line trace
then able to support RPC
In this case you probably wouldn't use an RPC as you could detect the collision on the server.
i mean in tutorial he is using sphere collison for interaction and works
but i prefer line trace with trigger to interface
Ok guyz thanks again for replies
Hello everyone,
I am having an issue with my clients controllers not facing the PlayerStart rotation. I tryied to set FinishRestartPlayer in AGameModeBase with no change.
NewPlayer->ClientSetRotation(NewControllerRot, true);
NewPlayer->SetControlRotation(NewControllerRot);
They are always facing the (0,0,0) rotation, even if the values of NewControllerRot are correct.
The Pawn is spawned in the right direction but not the client controller (on server I don't have the issue)
I saw multiple forums on this issue with no explanation, can somebody help?
is it safe to use Add Movement Inputs from external actors? I'm just trying to work around using add force to be more multiplayer friendly but i need a slight black hole affect that pulls players inword, but doesn't completely override their current movement
this is related to your game logic
So join any channel and ask for help, because no one can help you like this
Show your code, but be warned that a multiplayer sprint will require C++ to be butter smooth.
It's not enough to just replicate the changing of max walk speed
Having this issue where my GUIComponent can detect my character being LocallyControlled but my HealthComponent can't, idk if it's smth to do with me calling it in the onrep of the healthComponent, please ask for anything else if you need, ty
Are there extra steps to creating a cross-platform multiplayer game other than having to compile on each individual system? From what I understand about network programming is that different end systems can send data over the network to each other and should be able to read the data. So a server should be able to read data from different platforms and also send data about the game state. This makes me assume the only requirement for cross-play is having to compile the game on each system.
You are correct, the Engine abstracts away for you all of the nitty gritty details for dealing with different Platforms.
Ah that's cool!
There is very little these days in the way of stopping a Player on PC from connecting to a Server with a Player on a Console.
At least with UE.
Thnx!
That's pretty cool. Did you ever get to test a cross platform multiplayer build in action?
I always thought it would be a pain in the ass to setup
Not as of yet no. But theoretically I cant see much that wouldnt cause it to work fine.
Especially if you are using EOS
Epic have done a lot of work to get the engine on that level, to support Fortnite for example.
Well it's good to hear that it is possible. Honestly the first time I've seen people talk about cross platform multiplayer. Thought it would be voodoo. Indeed I can def see the framework is already in the engine because of fortnite.
Would be really nice to have Epic tell us what to do with Listen server when it comes to CMC tickPose
Now I'm contemplating wether to do dedicated server or to override CMC tickpose, I feel like there will be repercussion for overriding that
Why do you need them to tell you that
A bit frustrating that it doesn't work out of the box 🫠. Also don't know what's gonna happend if I stop calling tick pose. It's there by design so switching it off may produce issues
@grand kestrel what do you end up doing on Ur end, if u r doing multiplayer
Is iris production ready yet?
no
You still haven't provided any context
@grand kestrel #multiplayer message
Listen server sees other client anim jittering due to tick pose()
But client see other client fine
pretty much out of the box, listen server with cmc is not play worthy
I have no issues with it on listen server myself sorry, so I can't really comment
Lyra/Paragon/Maybe Fortnite style TIP produced issues due to the mesh smoothing
Distance matching has issues with fluctuating latency and ofc you need to replicate the acceleration similar to how Lyra does it
The issue can be replicated without doing anything. Simply playing any Unreal template in steam will produce the jitter effect (Pie is fine, even with emulated lag)
I haven't dealt with this myself either, though I've seen others report about it.
And yes - I've even done playing with my team across Steam. People from halfway across the world included.
🤔
So I'm always confuzzled about the issue personally.
You guys use listen server I assumed?
I'm indie - so yes.
I see 😔 , I will take a video when I can
@quasi tide @grand kestrel What exactly happend
I tested with 3 computers. Client see other client fine. It's just the listen server that suffer 😦
im gonna do online solutions today but I heard cmc has changed ever since. Gonna try to make sure none of the TickPose get called
hi, when a user closes the app after they are in session, that session still remains for maybe 10 minutes or more. if i try again to find, it finds session but tries to send packets for 60 seconds before timing out ( connection timeout) . how can we avoid this ? like, i can't find a event (to add destroy session node) that fires if user force closes the app or next time the player logs in and tries to find, they should not find it ( i put valid session or valid index, they both are coming true) -- until session resets itself - that is after 10 minutes or above .. how to solve this ? thanks for answers
In case you are curious: It seems to be a World Partition thing. (Auto) Possession and the whole PostLogin Spawn flow works as expected in all classic Levels, but the ones with World Partition Streaming enabled make it weird. I guess it makes some kind of sense, but is annoying to deal with.
So I'm trying to destroy an item that's picked up, but however it only happens when triggered on the server, not the client
When the server player does it it's destroyed just fine, but the client cannot do it
if i start a session as a listen server then use the open console command to change maps, does the session persist?
Session maybe, connections not
ye i expect the connections wont. is there a way to check if the session is still good?
In C++ probably
ok ill check it out. maybe advanced sessions has something
Same check that Epic does when you get denied creating a session cause one already exists
Right, I haven't dealt with WorldPartition yet
At least not in Multiplayer
Yeah, cause Replicated Actors have to be destroyed on the Server.
UE is Server Authoritive
Client's can only do local stuff that has no affect on others, or send a ServerRPC in a Client owned Actor if they want the Server to do something
Picking up an Item should happen on the Server with maybe a prediction system in place to counter the ping.
Shutdown event of the GameInstance for what it's worth
Not sure if that works if the game crashes, but might work for ALT+F4 cause UE handles that manualy
Is it not possible to use USTRUCTS as replicated properties?
USTRUCT()
struct FDeathInfo {
GENERATED_BODY()
public:
bool bIsDead = false;
FVector KillerOrigin = FVector(0.0f);
bool bHasKillerOrigin = false;
void SetKillerOrigin(FVector Origin)
{
KillerOrigin = Origin;
bHasKillerOrigin = true;
}
};
UPROPERTY(ReplicatedUsing=OnRep_IsDead)
FDeathInfo DeathInfo;
This was working as a bool, but it is now no longer working as a struct
I’m mainly worried about the rotation part of it, I know how to fix the sprint I believe
create session - invalid player state I get this error on a dedicated server. Why does the game instance need player state?
I have no clue what is going on
Right, but all I'm really doing is calling a run-on-server event in the character controller triggered by an input action, which should work
But oddly enough, when I have the client try to pick up the item but then pick it up in the server, the item is destroyed but UE then complains about a null object reference, which doesn't happen if the server picks it up first
where is the most efficient place to have all 2d sound or music /ui sfx? the widgets that the player is interacting with? or an audio component on the player controller?
When I make the videos I watch to make multiplayer replicated doors, they don't work when I make them. Can anyone help me with how to do this?
i could prob help
If you have any multiplayer codes for door can you send ss from event graph
or can you explain in detail
what can I do if something works on a listen server with client but clients dont work on their own in editor
That's a very broad question, that thing will need to be investigated and fixed
hi anyone knows anything about dynamic sky ? and the error if use cel shades? i having a error on the shades not replicated on client side
Make the struct properties you want replicated UPROPERTYs (no need to mark them as replicated though as long as the struct itself is)
or how can i call the sky here ?
options and tips to solve are also welcome , i think to make my own shade or just use another sky for the day night shift . it sucks as my demo was almost out but this delays it oh well anyone want to party up Dm me
ahah, yeah that was it. Thank you!
it seems the cel shaded use , the light source , but dynamic sky don't use light source it has its built in . its why its a replicated error but i understand all my question our out of anyone's levels
@modest coral This is not the channel for this, and if you have a question, feel free to DM a moderator. Please keep this out oF these channels.
Hey guys i have this problem, does anyone know a good documentation on server rpc? im trying to pick up an item but only the server can pick it up. the clients cant interact with it
@white smelt Read the Network Compendium linked in the Pinned Messages
ty
this
Its literally the first pin
2017 is this updated?
It's fine. It's not like things have changed that much.
Anyone manage to get ping from Steam Session?
What's the best way to send a USaveGame* object to the server from the client? Is my only option to send all the information individually?
// What I want to achieve:
Server_RestoreCharacter(/* USaveGame* */ SaveGame);
// What I am doing currently:
Server_RestoreCharacter(
/*FString*/ SaveGame->CharacterName,
/*int*/ SaveGame->CharacterLevel,
...
);
is there a type I can use to send a compressed float, just like FVector_NetQuantize to send a compressed vector?
Probably make your own type struct that wraps a float and implement net serialize for it. I assume the engine already have helper methods to compress them
You'd have to send everything from the client to the server. Even if you had the save game as replicated, replication only occurs from server to clients.
If you want to make it a bit more managable, break it up into a structure, and maybe make substructures
Yeah, that's what I was worried about. Since the USaveGame is an object made on the client, I know I can't send it to the server. Just trying to avoid a Server RPC with 10+ arguments lol
Ahh, good point!
Yeah that works perfectly; Just using a struct for the scattered data like name, class, level, etc.
struct FCharacterRestoreData
{
FString CharacterName;
int CharacterLevel;
float ExperiencePoints;
...
}
I've been having issues the past few days with an issue where my health component can't detect my character to be locally controlled but my gui component can, they're both being called in their respective beginplays, they're both set to be replicated, and i have no other idea why this could be the case, can anyone help? thank you and ill give anythign else if needed
BeginPlay may not be the best place to be detecting whether or not the actor is locally controlled.
I just did it in TickComponent and still not getting anything from Health Component
Do you know what could be the issue?
Don't set Owner that early
do it on begin play like you did with your gui component
I think the constructor is called to make the CDO, so it doesn't have an owner yet
but I know almost nothing about C++ side of things
Hello, when it comes to multiplayer do SubLevels make it possible for a game like albion online to have private dungeons? If yes, where can I learn this?
I think you can't set the owner in constructor. But for better practice do it in begin player if you want to assign it when the game starts if the pawn/character is in the game on the start
when you are running widgets, they are all locally controlled, no need for checks, it is all client side for each player.
To know if it is running locally for the player, you need to see the widget on the player's screen
put this inside your character/pawn class in tick event
if(IsLocallyControlled())
{
//your print logs ("Yes it is locally controlled")
}
by default it should print, which means it works, else if it doesnt then your character is not possessed by the player
try and tell us more
Hey gang,
Is there any chance there's an easy way to force a replicated variable to replicate to the client without needing to change that variable? I've got an array that is replicated and I'm finding that the BP node "Set Array Element" actually won't replicate to the client like "set" does.
I'm currently using an RPC which passes through the server's value to the owning client and sets the replicated variable on the client. That works, I'm just wondering if I should be doing it another way because this feels gross. Any pointers appreciated!
I don't think you can, I might be wrong. If I were you, I would try alternatives. From my perspective I think you are trying to make an anti-cheat system but it wont work because local is faster than the net
Gotta remember that for clients, the player controller isn't guaranteed to be replicated yet on begin play. I've had that issue, where I assumed the player controller was always going to be valid, but it isn't when running on begin play. Since "IsLocallyControlled" uses the player controller, if there isn't a player controller then it will return false. Could be an issue here
I think if you immediately set the InvStacks to InvStacks (yea setting the variable to itself) after doing this set array elem node it would consider it being set and replicate as expected.
I'm making a custom prediction system. I track the changes of replicated variables and store them in array, then I make predictions and store them in an array. When adding a new change to the server array, I check that index in the prediction array and if there is a mismatch it fire an RPC and correct the incorrect prediction. Packet loss was really bugging me and this system fixes that. This issue actually has no repercussions when it comes to prediction since it is immediately corrected, but it's annoying me because when serialising to disk (always locally), it uses the replicated variable rather than the predicted variable.
I just wanted to know if I could say to the replicated variable "hey, I know you think it hasn't changed but could you check anyway?"
I tried that and it didn't work. I'm guessing because it recognises that it's not changing at all so it doesn't try to replicate any changes
Alternatively, if this is within a function, you could make a copy of the Inv Stacks array in a local variable, modify the copy as needed using the set array elem, then setting the inv stacks array at the end of the function.
I'm doing this, which works... it just feels wrong
yeah I might end up doing that. I'd have to go through and change quite a few functions to do that which is kind of annoying. Was hoping I could just manually replicate it with a single node when I'm about to serialise on the client since it'd be just one change. Thanks for the help
So um... Testing on my end...
This does indeed call the OnRep function of the array, but only on the client. The server doesn't call it like it usually does in blueprints.
huh.... hmm okay I'll test a little further, I guess something weird is happening then.
This is printing on tick and shows that the client hasn't updated.
I'll test with a new variable
I got it to work, and only by switching my Owner variable to a public from a protected, idk how that works but ill look into it later T_T might have anothe rissue (possible relating but i have no idea yet) but il look into it later
i did do what you said yesterday inside my character class and it id dprint that they were locally controlled tho :3
i did also move it to begin play instead of the constructor as well
Okay I have discovered the problem. it's not because I'm using "Set Array Elem", its actually because the only thing I'm changing is a json object.
As long as the Json object that was already there has all the same fields, changing the value in a field doesn't get detected as a change and is therefore not replicated to clients. That sucks but good to know
first of all you don't probably don't want to call DOREPLIFETIME macros anywhere but GetLifetimeReplicatedProps
which is a thing that gets called once(?) to set meta data the replication backend needs to store
your issue is likely trying to pass a none direct field uproperty into DOREPLIFETIME
i dont do it didnt know all my others is working fine this way
i had get lifetimereplicatedprops before that
like you did say in the beginning the array starts with nothing in there.
the issue isn't the array having nothing, the issue is you trying to put a member of a property in there
so is NuN i think how can we fix this
i tried to go only Inventory but it didnt work
now it does what is going on
see you in 2 minutes when you post again with actual context I guess...
oh nevermind, nice
i thought only the entries need to be replicated since its the only thing in there
DOREPLIFETIME( UMyAwesomeObject, fieldname);
you could use something else to store and replicate the data and have your component actually handle what it does with it on both machines?
Is it even marked replicated?
i think i saw this
yea it is
are you actually using DOREPLIFETIME or are you still calling GetLifeTimeReplicatedProps twice for some wacky reason
you where right actually
i did not create this array tbh
someone logged into my computer and made all that for me. (i wont say a name) although it was nice of him. i dont understand none of the shit in there and have to figure it out
The internet is full of surprises
are you paying people on Fiverr to make your replicated game? uh oh
is it okay if i leave it in protected?
no it was someone for free from this server
i did not ask he just made it
If you need/want it to be protected, then yeah
I mean, that's a question you gotta answer yourself
im doing the replication but the tarrayserializer got created by him
would that prevent other players from accessing it if a player dies for ex.
then protection shall be good
You can google that though, cause it's very fundamental to C++
And yes, in theory it's better to have protected or even private members than public
I banish ye to https://www.learncpp.com/
everything coding i learned with GPT
GPT is a compression algo that avoids swear words... it can't help you ask things you never knew to ask
sometimes it gives shit results but i feel like its a better and faster way of learning. sometimes docs. but people that code hate to write
so they keep it short
also chances are it will not even give accurate info for anything but extremely surface level unreal stuff... there are no shortcuts to actually doing stuff unfortunately
my first cpp project was a helicopter made of multiple components
ive being doing cpp for below ~2 months
i think im doing fine for what people put me through with their crazy ideas in #cpp
i wait creating a vehicle since that is like really complex i researched and stay away from it for couple months
but thanks guys for the help i havent slept the night and tried to get it to work
If #cpp is giving "crazy ideas" what the fuck did you think GPT trained off of?
that's because you never actually made a working fastarray item and container
gpt tries to simplify a lot
I would suggest starting with a raw replicated array for now just to get going
markarraydirty in here
you could even pass over the data in RPCs to represent changes instead of replicating the array
yea thats more crazy ideas i dont want to participate in haha
okay, then actually read the documentation and in-engine examples for fast array replication
I'm good dude... I can't help from just random snippets of this fast array
kind of putting the cart before the horse... doing some more basic stuff would help you a lot to reason about stuff without needing help
just a dumb question but since its a struct i dont have to replicate it right
its already replicated inside the inventory
how I got my fastarray working (for the most part)
- follow the steps in
FastArraySerializer.hentirely, while comparing with existing engine code
2 checking outFLobbyPlayerStateInfoArrayor any of the other pairs of FFastArraySerializerItem/FFastArraySerializer etc
its the normal one not iris right?
yeah, the FIrisFastArraySerializer struct is if you are using Iris
I will say actor components can send RPCs if they have a stable net name to resolve the RPC over the network
which is a bit of a stringent requirement:
i inherit these things dont i?
this is not a normal virtual function thingy
there are probably other examples of fastarray items+serializers online
for some guidance: the functions are not overrides here and it just tells you that:
is your array inside an actor?
or did you create an enum and struct library>
yep, it is replicated inside an actor
you should really do some basic unreal multiplayer stuff first
FastArraySerializers are kind of a pain and just winging it here is going to make it much harder
that's cool, you still need to actually make a working fastarrayserializer that does all of the stuff detailed in the stuff I just sent you
FWIW the tiny 3 lines here are fine, it's the rest of the fastarray boilerplate that isn't set up correctly
i think the guy that made it, did the right things man
yea it could be that im missing something
check your dms
it should be okay but you can have a look over it
not interested in DMs especially if you still seem to be avoiding the advice I gave already
im reading through the header
i just send you the files if you keen looking if its constructed the right way. it should be working
i send you 2 .h 2.cpp they both interact
the ArraySerializer is in structs.h
teach a man to fish, etc
then dont complain that im giving only snippets
if i where to put all my stuff on here, everybody could just make what im working on
I guess I'm in the superposition of not wanting to read 2000 lines and not being able to help with 3 line screenshots without context
Here is the thing:
- People who can make what you are making, don't need your code
- People who can't make what you are making, can't use your code
Generally, if you need help with something, especially code related, you gotta share as much information as needed.
And sending unsolicted DMs is against the #rules after all.
What a lot of people do is obfuscate the names of their project etc from the snippets
Yop, that's what I do. But I also kinda know how much I need to share to not make my clients angry
Despite that, it doesn't really matter if someone shares a few lines of code. There is a lot more to gamedev after all.
And the whole "I don't want to share my stuff" part is what makes all of us having to reinvent every freaking thing
But well, I'm heading back to Godot and work on my pet project
i never did
i share a lot here
I mean, they did share it with me and I just ignored it for now
How about this @white smelt :
1, do all 6 steps in FastArraySerializer.h
2. check some in-engine examples of FastArrays and try to compare them with your own. Try to check out what they do every time they add/remove/set items in the array
and if that doesn't work ask me tomorrow/some other day and I'll try to look it over... I would also suggest trying to pare down how many lines are in the snippet as well and renaming things you don't want other people to see
I'm definitely not a fast array expert though so YMMV
i did send in the parts of code that are related to the issue
i compared them all i just dont get why it doesnt mark them dirty
//Adjust the count for the item
EntryIt->PreviousCount = EntryIt->Count;
EntryIt->Count = NewCount;
//Mark our last stack added too, so we have something to return.
LastItemEntryAddedTo = *EntryIt;
//Adjust Count now we have merged some stacks.
Count -= AmountToAdd;
//Mark it dirty so it can be replicated
MarkItemDirty(*EntryIt);
//Finished merging all items, as count is now 0, so no need to continue iterating
if (Count == 0)
{
break;
}
}
}
}
}
its mentioned in the code
thats the end of the AddEntryFunction
?
what is that about
where can i see engine implementation then?
I clicked ignore, sorry
thats in here man
one very very important skill to doing unreal C++ is being able to quickly find stuff in the engine
lol, did it like soft block you or something? I don't want that
some spam protection thing?
oh well, anyways
in your fancy IDE just find stuff inheriting from FFastArraySerializer
in my case I have some already from Lyra (a good source of example code here)
but the engine has many more as well
well maybe if someone has time in the mean time check it.
if you dont want to dont do it im not forcing you.
also i dont use lyra
that's cool, I didn't tell you to use Lyra
in this case it's more to serve as an example
you need to download the engine source in the launcher
But its a little bit slow, to package it and share the files etc..
but unfortunately symbols for debugging are indeed huge in the binary
learned about what?
i was thinking source source
chances of me helping you won't go up if you just try to imply I don't know what I'm talking about 😅
usually new people start on a binary build and skip getting binaries, sorry
when people usually talk about source its from github
"source" can mean either the binary's source + symbols or the full "source build"
you don't need a source build to search for simple examples of a fast array...
and also its not like its being there for forever
you learned about it 2 days ago
learned about what? binary builds?
ufffff
I've been telling people to download symbols in here for years 
don't become like me lol...
if you mean 2 days ago being your problems I guess that's true? I didn't understand, sorry
for my aprox 2m~ cpp im really good
thats an advanced topic here the arrays
and instead of tellin me off maybe try to help
or just dont participate in this disscussion
after all im looking to learn, im young freshly started c++
my eyes are young aswell and reading code you or me is completely different thats why i ask for advice in here of well developed people where the majority is trying to help
and when i can help someone i help
dude, i've been helping you replicate one property for like an hour... this isn't the customer service desk lol
If you want professional help ask in the job board
you are completely missing the point what this discord is for
also NEVER feel bad about having gaps in C++ knowledge but a lot of the qeustions you ask make me think you could use learncpp.com or something to help have the foundations to read anything else
and by anything else I mean: being able to just read engine code to figure out how to use stuff
if this is your problem me asking stuff about specific topics im sorry
just dont reply to my questions
I think you won't find many people in here who like vague questions lol
i have being through this header 2 days ago still
its not like you made me discover it
I mean, I could share one I made I guess?
the problem here is it seems correct
and then i change again?
The FastArraySerializer if someone wants to look over to me it looks like there is no issues in the code provided in these files
one thing i could think of if its really not the Array it could be cause by the way i set up my pick up logic, which i highly doubt cause its cleanly set up
Hey guy what’s good
Am curious about something please
Is match making same thing as hosting a match session?
Or it only applies to dedicated servers and not listen servers
matchmaking is more a tool that creates or unlocks a server if a specific amount of players are looking for a game instance
Matchmaking is a lot of things. And it really depends on what you need it to be.
normally you use third party stuff i think like play fab
Most people think about matchmaking as a "I press 'PLAY' and the Game matches me with other's of my skill level and lets me join a Server." System
But in theory that can also work with one of the player that got matched being the ListenServer host.
That however allows for cheating by the host.
I think oldish CoD lobbies were done like that
Steam also has some matchmaking API calls, but I never used them or looked into them
It's not necesserily the same as the PlayFab matchmaking
Also in general Matchmaking has nothing to do with the hosting part
No easy way to get session ping without being inside the session? :3
You've been farr too accommodating 😅
does this look like bad practice? this is in my BaseItem class and it sends/calls the function in the players inventory component
count 1 is debugging purposes and always adds one item per pick up
I do want to help as fastarrays suck ass but... yeah it's one of those days lol
Ok…. So ,,, how do I implement or what’s the best practice in implementing matching making in a multplayer game
You already hand hold for an hour. Usually I give up helping someone after 20 mins have past
That's usually not an Unreal Engine feature or topic. Most people fall back to relatively pricey third party systems like PlayFab
They handle hosting, scaling and matchmaking for you, but it costs a chunk of money.
Not that hosting this yourself would be any cheaper.
In general, if you don't have a lot of money to throw at this, you will want to rethink your plan
There a plug-in Kronos matchmaker in unreal marketplace
Am utilizing it
play fab gives you 2 cores and an amount of hours for testing tho
Sure, but ultimately you have to pay
Heard of it?
No
You can try it, but all it does is rely on existing Subsystems, like Steam.
It won't host Servers for you
You still have to host the Servers or use ListenServer, which will allow cheating
So if any part of your game is competitive or you want to do stuff where people unlock things by playing, that will all be cheatable
`No server fees, or any external service costs!
Kronos is built on the Online Subsystem framework of Unreal Engine. The Online Subsystem is an interface that provide a common way to access the functionality of online services such as Steam® or EOS. This means that Kronos can support a wide range of online platforms, that allow hosting sessions without any cost!`
i would go play fab if the game is worth it
Yeah, most likely just build on top of the conceptof ListenServers
I'm not a fan of relying on a third party company, but I get why creating such stuff yourself is not easy
Overall, any kind of game that requires this should not be developed by a single dev or small studio
wow
You say "wow", but you do know "Gamespark" or whatever they were called was just like PlayFab and they died the same way PlayFab can just vanish from one month to another?
here's my shitty fast array I made a while back, I tried to have it serve as a single thing to send over transforms for tons of stuff but it didn't work out well as it ran up against replication rate issues that I found hard to control
i got mine from Kaos
play fab is a microsoft daughter company
So it’s still listen server stuff and can’t be dedicated right
Any of you guys that uses steam able to get Session ping?
i can have a look but you say that its breakydancy
this is Iris
- when receiving data I need to copy it into an external container, not everyone will need to do that...
- I honestly don't know if I do everything right here, I haven't used it in a long time or really stress tested it
- AddItem/SetItem are the important bits imo
happy??