Anyone able to hop in a call that understands multiplayer inventory systems well? Im working on a few prototypes to plan out my development pipeline and want another opinion on the best aproaches/practices. System needs to eventually handle upwards of 100 players interacting with a shop, plus handle world item drops and loot. Want to minimize server load as much as possible.
#multiplayer
1 messages ยท Page 709 of 1
is this what you meant? I couldnt get it to work, the montage still plays on the server only. It doesnt even show one the clients like this
Must a controller possess a pawn in order to move about the world and have the server correctly stream data based on relevance?
Or can a pawn-less controller still work somehow?
Clientside PlayerController
Input -> Run on Server Event
Serverside PlayerController
Run on Server Event -> get MyDude -> Multicast Event
Everywhere Pawn
Multicast Event -> Do Thing
Why don`t you use GAS? it just works
How much ping is equal to 100 netpktlag?
What kind of game architecture **World Of Warcraft ** have? It actually can runs ~5000 players in one game server.
for starters it doesnt use the character movement component
Can Aws Gamelift serve location based multiplayer game like Wow?
i dont know the first thing about this sort of thing
my advise is, get your game to work with 50 or 100 players, then worry about supporting more
I'm in the camp that if you have to ask that kind of question - you're not ready to make that kind of game.
Start with an easier networked game.
I've been working on a multiplayer shooter for a while, and there are a lot of things that Lyra has that I want in my project
would it make more sense to just work on top of the lyra project or just port over the things that I want
depends what you want and how far along your current project is and how difficult it would be to start over/migrate. unreal is pretty forgiving about exporting assets, you can even copy/paste some of them in explorer and it could work fine
Hello, im trying to make a saving/loading system where infomation will be saved to a database. Similar to something like Rust or Ark. Can anyone point me to documentation on it? All i can find is how to make singleplayer saving systems which is not helpful at all
I guess your database is a centralised server. Use the http stuff in unreal to communicate with it.
Everything else is very specific to your requirements.
Awesome dude, that got it working!! Here's what it looks like
Thanks for helping!
how make multiplayer work in LYRA please somebody helpppp!
Probably not. Just press play in editor with more than one player
While in an actual gameplay level
Any idea how i could avoid that ? ๐
L"ValidateArraySize: Replicated arrays must be smaller than 65535 elements in size. ArraySize = (372006) Property = (/Script/ProjectMulti.ProceduralLandscape_Generator:Triangles)."
Chunk your arrays into smaller pieces
Or procedurally generate your landscape on the client without sending over the triangles.
Thought about generating on client, just wasn't sure if that's a good idea
As long as it's deterministic and you use the same base data, it should be fine?1
Wont do much damage to try it
Well you haven't really asked anything specific. All you have to do is open a gameplay level, set the number of players to more than one, and press play.
i wanna play with player online through the internet with my friends
Then you need to package it up, distribute it to them, run the game and connect via IP (if Lyra supports that, I don't know if it does).
If it doesn't, you'll need to use an online subsystem. The easiest one is Steam. There are a tonne of guides out there to get a game connecting via Steam but there's a lot more setup involved.
but epic says that lyra is already using the epic games subsystem
great
but how can i play with friends online or should i try creating the dedicated server and hosting it with gamelift
Ah nevermind, if you're at that place it wont benefit you to use that
I only read your previous message and not the ones prior
Generate the landscape with the same seeds et.c. Then just store the edits in an array
If you want the landscape to be able to be edited in runtime
That's for now not of need for me. Would make things too complicated xD
@grand kestrel not sure to what degree you can do that ;(
Do what?
private msg?
If you want
Greetings, could you tell me how to get the first PlayerController from the network?
Without the network I did this, GetWorld()->GetFirstPlayerController(), now it returns NULL to me
Only the server has access to all controllers. Clients only have their own.
GetFirstPlayerController will return the first logged-in player on the Server (the local player if it's a listen server), or the local player on a client.
Thanks
Hi, does anyone have a good insight into replication graphs? I'm building one based on the Shooter Game (sadly, Lyra doesn't have a rep graph to use as an example), which seems to be very similar to the Fortnite one that they showed on one of their streams https://youtu.be/CDnNAAzgltw?t=2556
They mention that you shouldn't have things like weapons in the rep graph, but instead have them as dependant actors of Character. That makes complete sense. What I don't understand is, why in InitGlobalActorClassSettings do they add:
AddInfo( AShooterWeapon::StaticClass(), EClassRepNodeMapping::NotRouted); // Handled via DependantActor replication (Pawn)
when that configuration only applies to that specific class, but not any of its subclasses.
My weapon actors kept showing up in the rep graph until I figured out that the above line has nothing to do with it, and instead the Shooter Game has bNetUseOwnerRelevancy=1 in the AShooterWeapon, which is then picked up by the code:
{
return CDO->GetIsReplicated() && (!(CDO->bAlwaysRelevant || CDO->bOnlyRelevantToOwner || CDO->bNetUseOwnerRelevancy));
};```
in the replication graph. Once I've set bNetUseOwnerRelevancy in my main weapon class, everything started working. I'm just not sure whether it's safe to get rid of the AddInfo(AShooterWeapon... line or not, because as far as I can tell, it's completely pointless
Working on a multiplayer game? Are there many players in-game together? On this livestream, our networking team will demonstrate 4.20's new Replication Graph Plugin and the server optimizations that were implemented for Fortnite Battle Royale.
NEWS
Unreal Engine Drives Monster Puppet for The Mill and Monster.com
https://www.unrealengine.com/...
There are different ways of doing it. The downside of DependantActor is that the children are only considered for replication when the parent is.
Relevancy is something different
It's set to NotRouted explicitly to make sure that it doesn't end up being added to a graph node accidentally, and replicating anyway.
Are you calling SetReplicates in the constructor? If so that will break things too
But there are no weapons that are of type AShooterWeapon - all weapons are some subclass of it. And for those, the NotRouted is never applied, because it's added to a map with a key of AShooterWeapon class, but the map is always queried with a key of the actual implementing class
Should just set bReplicates = true
The child classes of AShooterWeapon will share the parent classes' replication policy
The policy system in ShooterGame looks for a parent class policy when an actor instance added to the graph
People who used replication graphs said they regret it but it's too ingrained in their game to remove it ๐
I do mine differently tbh, I have a special policy for dependant actors
That scared me off
RepGraph is powerful but it only makes sense to use it if you either have a large number of replicated actors or large number of players
For most games, it's pointless and has no benefit
E.g you're making an RTS or BR game, makes total sense to use it. If it's a 10-player arena shooter or 2 player co-op game, there's no point
Also the actor dependency stuff will silently break if the parent actor is not routed when the child actor is. That's a fun "gotcha"
You can workaround it though
If bReplicates is true, then
{
return CDO->GetIsReplicated() && (!(CDO->bAlwaysRelevant || CDO->bOnlyRelevantToOwner || CDO->bNetUseOwnerRelevancy));
};```
will always be true (unless it's also always relevant, only relevant to owner, or has netUseOwnerRelevancy
Which then triggers
{
AddInfo(Class, EClassRepNodeMapping::Spatialize_Dynamic);
}```
Oh, hold on, I think I see what you've meant, there's a continue with extra ifs above it
ShouldSpatialize is only used for the GridNode AFAIK
Yeah, that's what I'm trying to figure out - I don't want the weapon actors in the spatial grid
I've not got a base version of ShooterGame installed but "NotRouted" should prevent it being added to any node
But it depends on your implementation of rep graph ofc
Yeah, the only issue was with subclasses, but I think it's probably
if (AActor* SuperCDO = Cast<AActor>(SuperClass->GetDefaultObject()))
{
if ( SuperCDO->GetIsReplicated() == ActorCDO->GetIsReplicated()
&& SuperCDO->bAlwaysRelevant == ActorCDO->bAlwaysRelevant
&& SuperCDO->bOnlyRelevantToOwner == ActorCDO->bOnlyRelevantToOwner
&& SuperCDO->bNetUseOwnerRelevancy == ActorCDO->bNetUseOwnerRelevancy
)
{
continue;
}```
Yeah you don't need to worry about that
The PolicyMap only contains the base classes until it detects a change between children and parents, then it stores the policy for that class
The other problem with it is that it only picks up loaded UClasses at initialization time
So it's best not to set any of those properties in BP's
Yup, hence the above code - it was not triggering, which probably means that one of these four is set differently in the subclass for some reason
Oh, I see
From what I remember, InitGlobalActorClassSettings() looks at all loaded UClasses and based on their settings creates the policy for them (unless explicitly added first)
Then RouteAddNetworkActorToNodes() looks for a policy for that class, and routes it to the nodes according to that policy
NotRouted should just not add it to any nodes AFAIK
Then if you want to replicate a non-routed actor via a dependency, the game-code has to notify repgraph to add/remove the dependency, will will then mean it replicates with the parent.
I've approached it slightly different, I have custom policies called "DependantOnOwner" which automatically adds/removes the owner dependencies
Yup, that part I have already up and working - the only issue I was getting was that the actors were still being added to the spatial grid. Setting the bNetUseOwnerRelevancy=1 worked like a charm, but now I'm looking into what you've said to implement it correctly
yeah that's odd, maybe RouteAddNetworkActorToNodes() is still adding it to the grid node
Mine just looks like this:
{
const EHT_ClassReplicationPolicy RepPolicy = GetClassReplicationPolicy(ActorInfo.Class);
switch (RepPolicy)
{
case EHT_ClassReplicationPolicy::CRP_NotRouted:
break;````
With the spatialized policies below:
GridNode->AddActor_Static(ActorInfo, GlobalInfo);
break;
case EHT_ClassReplicationPolicy::CRP_SpatializeDynamic:
GridNode->AddActor_Dynamic(ActorInfo, GlobalInfo);
break;
case EHT_ClassReplicationPolicy::CRP_SpatializeDormant:
GridNode->AddActor_Dormancy(ActorInfo, GlobalInfo);
break;
default:
break;```
That looks more or less the same as the Shooter Game's, just slightly different names
yeah
the main thing is it shouldn't be being added to any nodes if the returned policy is "NotRouted", so I'd start there
But tbh UseOwnerRelevancy is probably fine too
Yeah, and I think it's
if (AActor* SuperCDO = Cast<AActor>(SuperClass->GetDefaultObject()))
{
if ( SuperCDO->GetIsReplicated() == ActorCDO->GetIsReplicated()
&& SuperCDO->bAlwaysRelevant == ActorCDO->bAlwaysRelevant
&& SuperCDO->bOnlyRelevantToOwner == ActorCDO->bOnlyRelevantToOwner
&& SuperCDO->bNetUseOwnerRelevancy == ActorCDO->bNetUseOwnerRelevancy
)
{
continue;
}```
that should ensure that the subclasses are not added to the policy - the continue will ensure that the code that *does* add them doesn't trigger. So it's probably an issue with the subclasses having different one of the settings from the parent class in that huge if
Basically a "if the child's behavior is the same as parent's, don't add its own policy". It somewhat lacks transparency, because the purpose of this is to keep the graph lean, but they are also piggybacking the concept of setting explicit rules for a class and it propagating to all its subclasses
yeah that's essentially it
Heh, yup, I'm just an idiot. My main c++ class didn't set bReplicates - the main blueprint child has it set, which then propagated to all weapon implementations
I have a year's worth of work in my project but I started out when I wasn't very skilled at replication and game framework in general
Adding it to the class made it work. Thanks for the help ๐
I suppose I could refactor it but I'm trying to determine if it's worth it
I'm saving that conversation you guys just had about the rep graph there isn't much information out there
defo using it to learn
Sadly, there isn't. Even sadder that Lyra doesn't have one. The youtube link I've posted is pretty good, but it's also a little bit like drinking from a firehose
yeah once you get your head around SG's implementation it's fairly straightforward but there are the occasional gotchas
Yup!
But I do stress it's totally pointless unless you're dealing with networking at some kind of scale
And apart from the dependant actors, it pretty much works out of the box
yeah
itsn't the rep graph something you require to add in early phases on the project
you don't have to tbh
rather than in late phases?
But if you have actors that have very specifically relevancy settings, again it's not worth it
The point of rep graph is to reduce the checks, assuming you can batch lots of actors together
Yeah, it doesn't matter too much when you add it. It might actually be better to add it later on when you know what specific needs which of your actors has - otherwise, when you create a new type of actor that isn't covered by the definitions you have already put in, you will have to remember to add it to rep graph
yeah that's essentially what I am asking, what if in late phases of the development you realise that it could have been convenient... can you just patch it in?
Totally
it's not like making a singleplayer game then adding multiplayer afterwards if that's what you mean ๐
nono of course not ๐คฃ
Yup - and if you don't bother with the dependant actors, patching it in is actually a breeze. Just copy it from Shooter Game and add your custom actors and how they should behave to InitGlobalActorClassSettings
I'm trying to apply damage impulse to characters after they get hit from a bullet, but if player shoots a character with a frequently firing weapon it looks so wacky due to latency. I'm wondering if anyone has a clever idea for that?
so specific relevancy rules should all be implemented in isnetrelevantfor? the repgraph enabled better policies and control than just the traditional isnetrelevantfor right?
This mechanic adds so much quality to game experience in overall and working on different workarounds since months, but no luck 
IsNetRelevantFor is not used at all when you use rep graph
so if you had special rules, you'd have to implement them in your nodes
ah!! oki so it'd be a matter to migrate my relevancy logic to these nodes
that sounds "fun" haha
yeah. But you can also leave the old logic there and just hotswap between using repgraph or the normal driver
So it's quite easy to switch over without breaking anything too
hey, is that documented somewhere?
Just change the driver class in your config file then relaunch
Easy as that to turn it on and off
wow that's pretty convenient until you get the thing to work 100%
that's great, thank you
ShooterGame is a pretty solid starting point though tbh
To get an idea of what it's trying to do
yes im mostly interested in the gridding features shipping with the rep-graph
Also, one thing I've noticed in the BasicReplicationGraph is:
GridNode->CellSize = 10000.f;
GridNode->SpatialBias = FVector2D(-WORLD_MAX, -WORLD_MAX);```
which I think could potentially be dangerous with large world coordinates? If I understand it correctly, the grid is basically an array of arrays, with indeces being coordinates divided by cell size. With old world sizes, the grid cell [0][0] would be for coordinates -20km,-20km, and when you spawned an actor on coordinates 0,0, that would be grid cell [200][200]
But with large world coordinates, grid cell [0][0] would be for coordinates -87960930km,-87960930km, which means that actor spawned at the 0,0 coordinates would suddenly make the grid allocate a crapton of memory to get a grid cell[879609300][879609300]
I wanted to see how much I could customize it
Yeah I'm trying to remember what the purpose of that is.. we've actually edited it for our game so that it moves the bias point based on the layout of the map you're playing on
Need to dig into the specialization node a bit more
I mean, you could also place an actor at the lowest X and Y coordinate of your map and not set the bias at all - letting it default to 0, and once it does the first pass, it will adjust bias based on the actor with lowest coords
yeah that would also work
I think that is basically the point of it, to be the point at which the cells start to "spread out" from
But I do wonder if there's a max cell count to avoid it going beserk
But then LWC and multiplayer doesn't seem overly well thought-out so far..
But considering that the BasicReplicationGraph is being sold as an quick and easy way to have spatiazation, it might be dangerous for whoever starts using it ๐
And yeah, that's what the bias is - I've spent a lot of time digging through the guts of the system to figure out wtf it means, because there's zero documentation ๐
I doubt that realistically you would run into issues with how much memory the grid eats if it only spans the actual playable area. The problem is that the BasicReplicationGraph implementation makes it span the entire universe ๐
I mean, even if your game had the entire solar system to scale, that's still 1/20 of the size of that grid
Are RPCs automatically virtual?
If you don't declare the _Implementation etc. body yourself then yes
I'm currently switching from Dedicated servers to a listen server
Does the "host" have both a client and a listen server instance
Or is the "Host" just a listen server
So if I host a game do I have one game instance with "NM_ListenServer" and one with "NM_Client" Or is it one instance of "NM_ListenServer" only?
The client is the server
https://www.youtube.com/watch?v=YarjTi0UhG0
Does anyone have an idea what could be causing collision to behave like this? Event hit and collision detection is only happening when the target is moving
I havent done anything special except enabling "block all" on the player pawn and projectile collision sphere
was 2 hours 45 minutes for a full build of 5.0.1 last night 4>Total execution time: 10250.95 seconds on an i7 7700k @ 5ghz and 32gb ram...
What's the best method to switch maps in multiplayer, when I use open level. the players don't join the same instance for some reason.
Thanks
Hi Folks,
Trying to get some work done on a steam multiplayer game, but when creating a lobby and transitioning to a lobby map using the listen command in UE5, all I'm getting is a black screen with touch controls.
If I take out the listen command the map loads with the widget as expected.
The issue I have here is that AFAIK I need to use the listen command in order for the lobby the player creates, to show up in the lobby finder.
Has anyone else experienced this issue at all or know how to fix it?
Using UE5 with Steam subsystem
// Server_MakeMode, called from server
LogTemp: Warning: AChessPlayerController::Server_MakeMove_Implementation(1), HasAuthority: true
LogTemp: Warning: AChessPlayerController::Multicast_MakeMove_Implementation(1), HasAuthority: true // Log from server
LogTemp: Warning: AChessPlayerController::Multicast_MakeMove_Implementation(1), HasAuthority: false // Log from client
// Server_MakeMove, called from client
LogTemp: Warning: AChessPlayerController::Server_MakeMove_Implementation(0), HasAuthority: true
LogTemp: Warning: AChessPlayerController::Multicast_MakeMove_Implementation(0), HasAuthority: true
// Why no log from client?
This is all happening on the player controller.
But that should not really matter since it's called though a ServerRPC.
Wait, this might not be a Networking problem... I just realized that player controllers only exist on local client.
hey everybody, how can i replicate Actor::AddImpulse --- for some reason simply putting it into NetMulticast, Server, Reliable, WithValidation function does not allow client to add impulse by calling that wrapper serfer-function, only server can add impulse to actors
Read docs about ownership.
thx
The solution to this was that the default scene root had to be replaced with the collision component, that made it collide properly. Funny because it worked before but suddenly stopped
Is there a reason for my server increasing a float faster than my client?
this is what is running(on the client)
the float showing in the first screenshot is Max Walk Speed
That's a recipe for disaster
Let the server tell the value to the client
There's a run on owning client for a reason
I'm trying to setup Proximity Voice Chat, the voice chat works but it's global and not proximity, what could I be doing wrong?
this is with run on owning client
You gotta pass the value to the client from server through the function
how is this any different than run on server?
Cause it will set on owning client too with the same exact value if that's what you want, while leaving the auth of the value to the server
Im not sure if that is what im looking for, my problem is that each player has a dynamic movement value that determines the walk speed, but the clients speed changes at a different rate than the server thinks it is, which causes it to desync and rubber band
will this fix the problem?
the 'server' is just another player
I apologize for my lack of expertise
You need to do it through RPCs to keep in proper sync
You can't just randomly connect in different places and expect the same result
If you want the server to set a value and let the client know locally too but not the other players about your local change
Server -> Set Value -> Owning Client (Set Value ref) -> Set Value (With server Set Value)
so I send the initial values from the client to the server, do the math on the server for every player, then send the final float back?
That would mean it's client authoritative to a degree
Which is not something you want
Unless some degree of prediction where the server corrects
And validates
so the server does all the math, all the time?
Do you trust clients to do the math for the sever?
no
Then there's your answer
Idk your current setup and what you exactly are trying to do
each player has script to adjust the walk speed depending on the buttons they are pressing, and the time they are in the air, this walk speed is what is what the problem is.
I now know that I need to have the server find each players walk speed
Could I use a for each loop for all the players and calculate it there?
Just ask yourself what changes the walk speed and you should have a method in the character to change the speed
For example if it's a button in the world, the button can get who pressed it and call the set speed function on it
it's every tick
I think I get it now
Then each instance can handle their own calculations and states?
yes
There we go
thanks, you explain it very well
So I put all of the calculations part as an event replicating to the server?
Yes
YEah, don't do that.
Only time you would want the client to send something to the server is for inputs
Ofc not always but yeah, generelly
so far, it works
all except for one thing
when it comes to deaccelerating it gets really laggy
Since accelerating works, i think the problem comes from somewhere else
Is that another function / event?
Then probs something you doing when deacc
I fixed it
I just missclicked something
wait nvm
So would I ahve this event use Run On Server or Run On Owning Client?
I would assume run on server
RoS then Client if you wanna sync the value to the client (self)
so, Both?
Yes, but use the returning value of the server to set the client
Pass it through the function
And Set the same variable again
So when I set the variable, I set it with run on owning client, but all the math is handled by the server?
like this?
@obsidian gyroWhat exactly are you trying to do? This sounds super fucky.
Change the players walk speed dynamically,
its not sketchy, its just I dont know how to do it
K so to do that perfectly smoothly you'll have to do it in C++. What's that got to do with acceleration though, are you trying to do a max acceleration by just slowly changing the max walk speed?
yes
The CMC already has acceleration parameters.
Something like this might work in singleplayer but in multiplayer you're barking up the wrong tree.
alright
tysm
it works flawlessly
thanks to u
โค๏ธ
Nice!
Is it somehow possible to let the client only fully join after he got all the data from the server ?
Like in my case the server is spawning 8k trees 8k stones and similar.
Currently the client will join and see how tree after tree pops up for him
They have to join before they can receive anything
Don't replicate that
But how would i know whenever everything is on the client ?
If you're literally spawning thousands of things, replicate the seed and spawn it locally
You can't - there is no way to know
You can farm those trees/stones. So it's gameplay relevant
Doesn't matter
You can still spawn them procedurally, they just have to be stably named
You absolutely cannot replicate that many actors and expect it to work well, or scale even
Rule of thumb if you have more than a hundred or so replicating actors.... you have issues
Sorry for tag but @winged badger has some insight on this btw
even if you spawn them separately, you don't want to have those trees replicated, 8k actors is a lot
Isn't that kinda covered by their relevancy ?
but, if the server and clients were to spawn 8k trees using the same algorithm, and same seed, while at the same time using FActorSpawnParamaters to inject the deterministic name for each of those trees at the time of spawning them
you can override the IsFullNameSupportedForNetworking on your tree Actors
and that gives you trees which are NetAddressable
if you also spawn them with bNetStartupActor and bNetLoad on client = true
they will be treated as if they were loaded from the level - they will have a static NetGUID
which is a massive plus, as non relavant Actors are despawned, and you really do not want 200 trees respawning because they became relevant just because you took a step to the left
Not sure if it's possible as the landscape generation to the interactables will all spawn fully at runtime
everything procedural needs to run off the same seed, and it needs to be deterministic
Also assuming whether a tree is alive/dead or not is it's only replicated property, it makes much more sense not to replicate them all individually, and replicate their state in a single global actor. You can just sequentially pack the state into bitmasks. We do something similar for our resource system like this:
TArray<uint64> PickedMasks;
UFUNCTION() void OnRep_PickedMasks(const TArray<uint64>& PreviousValue);```
Since all the resources are generated procedurally from a seed, they all get a deterministic ID.
server then just needs to replicate the seed and maybe couple extra level generation parameters
i took Jambax's concept a step further, so my single global actor is packed with fastarrays
if a non replicated actor gets damaged, it updates its data on that network managers fastarray responsible for replicating destruction/damage
and then it gets propagated to clients
without the actor itself having to be replicated
Yeah makes much more sense to do it that way, also you don't have trees popping in/out all the time ๐
only minor downside to the approach is that you also need a separate fastarray to habdle what ULevels ReplicatedStaticActorDestructionInfo would do
to replicate what actors have been fully DestroyActor()ed for late joiners
its also much much more responsive then standard replication, as the global actor or 4 can run high net priority high net update frequency
and updating a fastarrayitem works better then the push model too
it is also not too much work - took me 2 days to get this fully working from scratch
That's for sure enough text to make me busy studying it for a while.
So thanks for all the in-depth information :D
the idea for splitting fastarrays is that each would correspond to replicating what one interface covers
i have one that is customized for my interaction interface, other one for destructible interface
got one for tags, one for buffs
and FFastArrayItem structs basically have a UPROPERTY() TWeakObjectPtr<AActor> for the Actor they are replicating properties for
timestamp and payload
so this manager spawns the trees in client and server using the same seed and registers them in a tarray, if a player gets to interact with the tree, player sends an event to the manager, right?
no
the plugin spawns an entire level from seed and a couple of tags
all Actors spawned this way share the same base, which contains logic to interact with NetworkManagers and PostSpawnedFromPrefab
after it spawns each Actor it calls the PostSpawned function
at this point those Actors find their closest NetworkManager and register with it, usually turning off their replication in the process
very few exceptions where they don't turn replication off in case actor needs to send RPCs
even when they are still replicated, i still send updated via NetworkManagers, as they are more reliable and responsive
by closest net manager you mean by distance? so i assume you can do relevancy with these?
by distance yes
can have 6000 or so Actors replicating in this way on larger levels
so they will typically have more then 1 NM
right right the only thing I don't get is who is the responsible to spawn the trees in the client, which component, the plugin aswell? different code path or there is an initial replication implied?
in RS2
client sends RPC to confirm the generation data
when it receives a RPC back
it runs a deterministic algorithm which determines which prefabs must spawn - ones supporting a selected primary mission for example
that results in a list of prefabs that have to spawn in deterministic order
then that is stashed in an ActorComponent on a MissionSetupActor (persists through seamless travel)
component being part of the prefab plugin here, so it can read it
then the prefabricator takes over
and starts spawning
aham interesting, when you say client in the initial steps you mean the PC?
PostNetInit in PC i think
so client joins, server goes like: hey, here's your seed, use it.
client -> ok!! take it prefrabricator do your stuff!
prefab -> sure! :D
note that nobody can call BeginPlay before all clients finished procedural generation
and no playerpawn spawns for someone who is still spawning
we ran into some weird engine replication bug
first version didn't have RPCs there, it was all passed by the MissionSetupActor in the lobby
still does, but very rarely, it doesn't trigger replication callbacks
as we know exactly what assets we need in the lobby, we also preload them
interesting, and then interactions and whatnot server authorative, as always, and you simply update your arrays, and they'll replicate so you can update the client version of the tree without the need of it being replicated
yes
PostReplicatedChange just calls a function on the Actor that the struct has a weak pointer to
name, no, pointer is to that actor
name is just there for initial NetGUID assignment
so we can replicate pointers, instead of Names
ah perfect!!
so yeah once the NetGUID is setup we can go through the pointer route
okay good good, nice
and just out of curiosity, do you follow any specific technique to generate these deterministic names?
or just the order of spawning works?
order is deterministic, so yes
they have a prefix
and an ActorTag, if they are inside a prefab
IsFullNameSupportedForNetworking returns true if they have that tag
so the Actor can be used elsewhere, with vanilla replication if need be
as all of those Actors would still replicate if one were to delete all NetworkManagers from the level
its just performance would be... not great
Anyone know how to mirror a transform / rotation across a plane?
This code doesn't seem to do it
This code seemed to work good enough
you have a function that does that out of the box
but its basically a Vector - 2* Vector DOT PlaneNormal
in your case, both vectors going outwards from plane, you would need to multiply it by -1 as well
I've got a CharacterMovementComponent question. I have a custom movement mode whose implementation of PhysCustom is copied straight from PhysFlying. However, if I play a networked montage (via an AbilityTask), I get a bunch of network corrections when it's in my custom mode, but no issues in any of the built-in modes.
I've made sure that the movement mode change is being replicated. Is there some other thing I'm missing in order to make this movement mode work? I know I've gotten this working before but I'm a bit rusty.
I'm getting the following error when loading the editor:
LogAssetManager: Display: Ignoring PrimaryAssetType Building - Conflicts with BP_BuildingType_C - Asset: DA_House
DA_House is a data asset that derives from BP_BuildingType which derives from PrimaryDataAsset - does anyone know what this error message means?
for the server the asset still appears to load correctly and can be referenced in the world, but for the client it always appears as null until I open it, change some field and save it again, at which point it starts working
Hello, I have a problem with a bot that follows a path that is defined by an array of actor points. I receive this message, but only on the client, on the server it does not show this problem
LogScript: Warning: Script Msg: Divide by zero: Divide_VectorFloat
It also happens only with the bots that spawn because the bots that are from the beginning of the level do not give this problem
outside of the message, the bot completes the entire journey without problems.
Anyone ever run into replicated actors spawning at different sizes? (my projectiles like to spawn at like 10 times their normal size for clients)
already solved!!! I leave the solution here in case someone finds it useful in the future.
The problem was not with the bots, it was with my level, which is generated with static mesh instances for the floor. the problem was that the client was not replicating these instances. It was fixed by making each instance replicate.
Set your player count before you start seamless travel, inside game instance. Then in your game mode you can do event on post login and add the controllers to an array and just check the length of the array and make sure it equals the player count in the game instance. Then do whatever start functionality you would like after that
Would you mind providing screenshots of how your spawning the actors?
I figured it out - somehow the static mesh component had its scale set to 10. For whatever reason i do not know, this only affected the clients version
Hi, im creating a loading screen widget stored in the Game Instance from the Pre Lobby's Player Controller when a GameStarted bool is set to true which is stored in the Game State, GameStarted is set to true from the host's start button, players then seamlessly travel over to the map and new GM/PC ect.. are created, when I then try to remove the loading screen from parent from the new player controller it only seems to remove from the client and not the server, any ideas on how I can get this to replicate properly?
Hey quick multiplayer question... are you able to do multiple conditions for DOREPLIFETIME_WITH_PARAMS? Wanted to do initial + simulated only...
Thought I've seen it before but can't remember...
COND_Custom
Sec
Nevermind, not what you want to do 
Replication conditions aren't a bitmask, you cannot mix and match them
What exactly are you trying to do?
Literally just only replicate a value to the simulated proxy as the initial bunch, thought I could get away with it by using the replication conditions
Out of the two I would probably pick initial, then just add an if check for simulated proxy.. oh well
So like, only replicate the initial value to simulated actors?
Yup, obviously the server will have the original but the server isn't really going to make use of it
I'd just go with COND_Simulated and an OnRep with the previous value
Well there is no previous value its when I'm spawning an actor
Thus the initial part...
COND_Simulated and dormant once you've replicated your stuff ๐ด
// COND_SimulatedOnly
UPROPERTY(ReplicatedUsing = "OnRep_MyValue")
int32 MyValue;
bool bReceivedInitialValue = false;
UFUNCTION()
void OnRep_MyValue(int32 PreviousValue);
void AMyActor::OnRep_MyValue(int32 PreviousValue)
{
if (bReceivedInitialValue)
{
MyValue = PreviousValue;
return;
}
bReceivedInitialValue = true;
// do stuff
}
assuming nothing else needs to replicate yea
Oooh thats a smart move... gonna play with that and see how it goes
Thanks @pallid mesa and @solar stirrup ๐
o7
o7
hehe
๐ no way we went both for the salute
great minds think alike 
Any idea why a Montage for HitReact would play on server, be seen by the client getting hit, but not play locally on the attacking player?
You are probably doing that on the server side PC, that's why it's not working properly
How is the information sent
Via a Gameplay Ability calling
https://prnt.sc/3u-Ej6nOz_Qc
or you manage to splatter two instances of the widget up client side and are removing just one
Hi guys, I am having an issue with some server client architecture. I am currently trying to replicate blueprints that change the scale of existing actors in my game. For whatever reason I still collide with the actors as if their size has been changed on the client, yet I cannot see that any rescaling has happened. On the server everything works fine. Thoughts?
In case anyone has the same issue, it was that I was triggering the root motion via PhysCustom -- moving it to an input event fixed it! When I had been testing using the different move modes, the trigger method had been different, causing the discrepancy, not the movement mode.
**multiplayscape **vs eeldev, which one is the best?
Hi, how are replicated actors normally handled in world space, I want to place an actor in the world that both players can interact with, but I am unable to call RPCs when it has no owner.
The interaction system from your character/player controller. Setup a server RPC with a interface that can talk with the actor
I'm trying to change my project from ue4.27 to 5.0 but keep getting errors (new errors every time I try to re-compile.
Every #include "Net/UnrealNetwork.h" I have changed to #include "Online/CoreOnline.h" which made the majority of errors disappear.
Any have any idea how to fix?
Making a multiplayer game and I am confused on the difference between levels and maps.
From what I understand the playercontroller is made upon hosting or joining a session. The playercontroller then persists through different levels and maps. So it is a good place to store the UI and variables that need to persist such as player username or player skin (player can change their appearance).
What I don't understand though is apparently changing levels or maps breaks multiplayer and you need to rehost or rejoin.
Isn't there a way to transfer players from the lobby level/map into the actual game level/map without breaking multiplayer?
I am making a party game that has a bunch of minigames (similar to crab game)
however you cannot join mid-game, only at the lobby so I dont need to worry about handling players joining mid game
@compact talon The game instance should be used when you want to carry variables between levels. Each player has their own game instance which is created when they load the game and doesn't get destroyed until the game is closed. The player controller shouldnt really be used for this
Look into seamless travel ๐
Oh I see, does the game instance persist through servers too so its perfect for UI and settings like skins?
what do you mean by persists through servers?
Do you mean does it persist upon changing levels? Or do you mean does the server has access to the game instances?
I'm sorry I am new and I am unfamiliar with how UE works. I don't know what the different "objects" are like player controller, maps and levels.
My understanding is when you join a server or host a server a lot of stuff "reset" and you get a new player controller. Would I get a new game instance or would the game instance change when joining a server?
ahh no worries, I'm pretty new too. Basically when you travel to a new level (if you join someones game for example) you will be assigned a new player controller. This means anything that was set to your previous player controller (the controller in the main menu for example) will be destroyed. However the game instance is persistent no matter what. In my game for example, players can choose which character they wish to play in the lobby, and this information is stored in each player's game instance. When the host starts the match and all players travel to the play area, the player character they selected is grabbed from each players game instance and is set in their new player controller
So basically, the game instance persists no matter what
No player can access any other players game instance apart from the server
Like I said, I'm pretty new too so im not 100%, but i'm pretty sure. It's worked for me so far
ah that is very helpful. Game instance sounds perfect for me then. I also have a couple questions about maps/levels.
I am making a party game with a bunch of minigames, and these minigames have multiple maps to choose from.
These are chosen at random when the host clicks "start game" from the lobby area.
For these minigames and the maps on them I was going to make each minigame its own level, and make each map its own map.
However this seems to be the wrong way to do it, and whenever you join a new level it disconnects you from the server and puts you on your own "local" level.
Do you know anything about that?
from my understanding maps and levels are the same thing. If I was to make a feature like this. I would create multiple different maps (or levels) each with their own game mode. When the host presses 'start game' I would select a map from random and travel to this new map with all clients
Interesting, I noticed the gamemode objects but didn't fully understand it. My brain sees gamemode and assumes stuff like "deathmatch" or "team deathmatch" etc. So perhaps I could store the actual games in those and load the map with the gamemode I want for it? As some maps will allow more than 1 gamemode (for example the beach map can have hide and seek and tag)
Thats correct, the gamemode is stuff like deathmatch and capture the flag etc. I'm not 100%, but I'm sure you could load a level and then change the game mode
which would allow different game modes for the same map
Thats interesting. Perhaps I can load it the other way where I load the gamemode and within the gamemode it chooses a random map to open. Unless you cannot open gamemode first and it has to be map/level
I dont think you can open the gamemode first
If you wanted capture the flag on map A and deathmatch on Map A. I would create copies of the map and assign level the "capture the flag" game mode and the other "deathmatch" game mode
this can be found in world settings
on each map
I see, I wanted to avoid making copies because that means if I want to change the terrain for Map A it wouldnt automatically change for the other gamemode
A gamemode has nothing to do with the actual map
Yes, but you said create copies of the map
Yes you can create copies, but assign each copy a different gamemode
so MapA made for deathmatch and MapA made for CTF, if I changed the CTF map I would have to manually change the deathmatch version
Unless I made BeachMap and made the gamemode variants a child so they inherited the changes? If thats possible
Ye that sounds like it would work too
alright, thanks for helping me out. I will lookup seamless travel for the multiplayer section. Might want to repost cus all this has covered your question xd.
Thanks again
No worries, if you need anything else feel free to drop me a dm ๐
@fathom aspen interesting.. so ive tried a few different ways of creating the widget and tried different RPCs to get it to work but this is how im creating it on the Pre Lobby Player Controller, then to remove it I've got it on the begin play of the new player controller after a 7.5 second delay (for textures to load) it calls to the Game Instance and calls a remove loading screen event, ive tried making these run on client/server is different ways but keeps just removing from client not the server
Should i be creating the widgets in a different way?
i take it you do seamless travel to transition a map?
Yeah
there is a PreClientTravel function in the PC that gets called in order to clean up whatever needs to be gone from previous level, and also get up loading screens
you will need c++ i think, but just a few lines to make use of it
// in .h
virtual void PreClientTravel(const FString& PendingURL, ETravelType TravelType, bool bIsSeamlessTravel) override;
UFUNCTION(BlueprintImplementableEvent, Meta = (DisplayName = "PreClientTravel")
void K2_PreClientTravel(const FString& PendingURL, ETravelType TravelType, bool bIsSeamlessTravel);
// in.cpp
void AWhateverYourBasePCClassiIsCalled::PreClientTravel(const FString& PendingURL, ETravelType TravelType, bool bIsSeamlessTravel)
{
Super::PreClientTravel(PendingURL, TravelType, bIsSeamlessTravel);
K2_PreClientTravel(PendingURL, TravelType, bIsSeamlessTravel);
}```
that would hook up a blueprint event that gets called in the PlayerController prior to clients starting any travel
epic didn't take this into account so might need this on K2 signature instead
void K2_PreClientTravel(const FString& PendingURL, TEnumAsByte<ETravelType> TravelType, bool bIsSeamlessTravel); in order for blueprints to be able to process that enum parameter
(ETravelType is not exposed to blueprints)
and Tick-Delays is trully terrible, never do that ๐
Are you able to handle a Multiplayer inventory with a map for item name > item id, or do have to make a construct table for multiplayer?
asking ahead of time so don't code map entire way thru to regret it
Do maps even replicate yet?
the maps itself cant be replicated
but thinking if can replicate the fetch of the DT
yeah dont think thats gonna work, got replicated for interact, and destroy actor but cant add it to inventory over maps lol
so ig gotta change the map to a structure
So what exactly is the problem with replicating maps? Like what would be so hard about it?
What would that mean?
I'm wondering why they aren't replicated already. What's the difficulty with them vs TArray?
So you're asking TSet/TMap and not maps as in levels?
They're just a bit more complicated and if you're replicating a map you're probably replicating something a bit too large
Can I create multiplayer with sessions using BP or should I be using C++? Most of the posts I find online explain how the BP sessions are very limited in what they can do compared to C++
You'll at least want some C++ boilerplate but there's a bunch of drop-in plugins you can use to get off the ground.
I see, there are tons of guides on it. Do you know a good one in particular? I don't mind pure C++ implementations
I'd prolly start here
https://github.com/mordentral/AdvancedSessionsPlugin
tyvm
I'm trying to make my own character movement component to get root motion animations synced correctly. I've a float "ForwardSpeed" and "SideSpeed" added to the character component and made two functions for each (e.g. SetForwardSpeed and Server_SetForwardSpeed) and then I'm calling SetForwardSpeed from the client which updates ForwardSpeed and calls Server_SetForwardSpeed. Server_SetForwardSpeed currently just sets ForwardSpeed to the new speed. This seems to work fine from client -> server and I can at least see the position and rotation replicated to the other client however it seems like it's not replicating my two floats to the clients. Am I at least on the right track and just need to multicast the floats to the other clients or am I missing something fundamentally here?
Well i got my inventory working now and drinking system, So i'm gucci passed that entire "map" struggle, Next up is to learn how to make shopkeeper ugh
Do you have inventories and transactions?
Hey guys, do you know how to store a live/global variable from every session, i.e a player from every session in the game? Would use this to track contribution of a material to unlock a new area ๐
hey bros im still a bit confused about sending actors over RPC. if i have void Foo(AActor* myActor) (say if im accessing a storage chest in my game which i do not own), does that actor have to be as Replicates/bReplicates = true? if it doesnt have any fields marked as replicated does it still work?
quick question, i'm really new to replication n stuff n unreal engine in general
i'm updating a rotator variable in character blueprints and then feeding into the anim graph to drive an animation but the client can only see the servers new animation but the server cant see the clients new one
im confused :/
clients dont update the server, this is how you get cheating and stuff. normally you would update it on the server, then tell the client about the update
any reason that a replicated player state variable would take more than a second to update?
The actor itself needs to be replicated or stored within the level itself, otherwise you're effectively sending null. Whether any properties are replicated is irrelevant.
ok thanks. i had some issues sending an actor over rpc which i did not own. the client was getting nullptr sometimes even when the actor existed on the client
i feel like stuff like death messages should be replicated asap
but for some reason value changes for say death count takes about a second to replicate to a client
whereas its instant to the server
yes but I dont understand why the client cant see what the server is doing
oh wait
I think im thinking of this wrong
some clients can see what the server is doing if u run the server as client
oh so you are saying that is normal?
sorry im new
in that case then the only problem I have left is that the other clients arent receiving the updated animation
I calculate the variable in the character blueprints like this
That'll be outside the engine in your own database
Oh, so no way to do this in-engine. Got'cha
if you are accessing this data in ue on the same pc each time (eg a dedicated server) you could probably use savefiles
This works fine, however, when I simulate latency in unreal I notice that the client has to send its request to the server before actually seeing it on screen which makes it feel very unresponsive. I tried to have a client only rpc hooked up to the false branch which seemed to work for the client but all other multicasted clients started spazzing out. sorry i'm a bit new I dont understand?
Struggling to find a multiplayer sessions tutorial that doesn't use Steam sessions. So I just wanted to clarify, you can only use the Steam sessions feature if your game is on Steam right?
you need the steam subsystem plugin installed
you also need to make sure you are using the generic playtesting steam ID that steam provides
so I don't need to official release my game onto the steam store to use it?
as I don't plan on releasing it to steam store publicly, or at all for that matter
no you dont
steam provides a playtesting "dummy" game ID u can use
its publiuc
I assume this dummy game ID has limitations because it seems absurd they allow people to use their services for multiplayer even if the game isn't on Steam.
Like can I host multiple servers with a server browser? Sorry if these questions are common sense
you can do whatever you like just like a normal game on steam
Damn, I was pretty oblivious to this. Thanks a bunch for the help.
I haven't even got multiplayer working so I wouldn't know how ๐
Might want to repost your question so people see it because my question covered it ๐
:C
Just note, some people have a hard time finding their steam session on the free 480 ID because of so many using it. It's like a public swimming pool. Keep your mouth closed when you go in.
You wouldn't happen to know a good guide for it would you? I am not opposed to custom sessions as my game is private to my friends, it's just all the tutorials I find use steam sessions
There's no real difference there, Sessions are sessions.
I see, I will just follow this steam guide then and maybe it will make more sense as it comes to it
What i mean is that the Online Subsystem is agnostic
Do I need a plugin for hosting and joining sessions if I just want the game host to be the server, as opposed to connecting to a dedicated server?
I am following a steam guide and I got so far and now its talking about implementing the steam sub-system which I won't be using
I know that I need to add the platform I will use in the DefaultEngine but I cannot find a list of the options.
[OnlineSubsystem]
DefaultPlatformService=<Default Platform Identifier>
For example how NULL is supposed to be used for LAN testing, or I could put steam/epic to use their subsystem
hey guys i have been reading Epic Shooter game and faced a lot of validatie functions like this :
bool AShooterCharacter::ServerSetTargeting_Validate(bool bNewTargeting)
{
return true;
}
what is the point of it ? Your validation will always be true
For a ranged projectile that needs to be thrown from point a to b. What's the best way to get a smooth projectile? The way I have it now is that I have the actor set to replicate and a server rpc spawns it for server and client. I also have replicate movement check. Slight issue with this is that the projectile seems a bit teleporting/laggy and it's not a smooth projectile. Not the biggest deal but I'm planning to have a lot of similar attacks like this one and don't want them to be laggy at all if possible. I was thinking maybe a multicast rpc to spawn a seperate rock for server/client? I think that would be smoother, but not sure what downsides that could come with. Anyone have any ideas/recommendations?
I think in the past Validate was a must, unlike now that is optional
So they probs just went around that by returning true
Oookey got it , Thanks !
Hi , whats is this syntax means :
uint32 bWantsToFire : 1;
is this equal to ?
uint32 bWantsToFire = 1;
No. It's a bit-field
What it means, is that bWantsToFire is an unsigned integer of size one bit only. So it can be either 0 or 1.
So simply it's like a "compressed" bool that is not 1 byte, but 1 bit.
oh alright ! thanks a lot !
Tbh these questions are better suited for #online-subsystems . If you're not planning on using Steam as your subsystem, then what are you planning to use? Players can host their own sessions fine for p2p games.
I don't know, I just assumed there would be a default subsystem or something that allowed p2p games. For example you can just "open" a level with "listen" as a property and people can join however I want to use sessions instead.
there is a p2p
p2p is easier to do actually
just use steam plugin to setup p2p through steam
pretty convenient
yeah if u want some global server + game server its not so easy
The online subsystem is essentially an accessor service to a backend. A commonly used backend is Steam.
There's also Epic Online Services (EOS)
I see, I have got it setup using Steam but I don't know if it uses Steam servers or I have it setup wrong because its very laggy even for the "host"
You can make your own solution, but it's far easier to just use one of those to get the job done and save your self time and lots of money
There's no such thing as a "Steam Server"
It's literally being routed from your PC -> Steam -> Players
and very loosely through Steam
I see, so its still players hosting games. Its just steam directs that hosting "procedure"
That makes sense. My understanding was wrong originally. I will just stick to using Steam then
thanks for the help
๐
There's a good guide in the pins of #online-subsystems of setting up sessions and some good best practices for working with online subsystems from Cedric.
side question, is there a priority order for replicated data?
I will definitely give them a check. Also is there a guide anywhere for properly setting up multiplayer "features"? For example my characters ragdoll from certain attacks but the ragdolls are not the same on each others screens and some attacks are exclusively client side when they should be seen by everyone.
u cant make ragdoll physics server side
u would need everyone to have optic fiber connections
Not necessarily
u can just tell it to run the physics with same settings
but there is usually some differences
thats what i mean
u tell it same settings and how its similar
in terms of forces applied
So there will be some differences, but you can keep things in roughly the same spots by force correcting the root bone location of the thing you're moving
similar to how the CMC will force correct players that move too fast
Hrm, yeah ragdolling is a pretty big part of my game so I suppose I will try to find some kind of guide for that.
As for more generic things like having my characters attacks same on all players screens. Its such a common goal I assume there are some good videos out there for it?
its just a matter of multicasting the right event
That's pretty basic replication stuff
Yeah ragdolls effect gameplay in the game I am making, and I would hate to scratch the idea entirely
There's a few resources in the pins you should check out
u have to replicate the variables that determine logic of attacks
How do ragdolls effect gameplay?
then multicast the functions
You don't necessarily need to multicast, but it depends on what you're aiming for
It's basically a form of party game and the characters main attack is a kick that ragdolls other players upwards. Then you could push these ragdolls off the edge or into attacks to kill the other players
Personally I would just use GAS for this kind of thing
I was also going to have a lot of random traps that could ragdoll players
thats fine
I have heard GAS mentioned a lot but I only plan on having 1 ability, maybe 2 if I count the basic form of "attack". Is it worth setting up GAS for such limited usage?
Yeah
oh if its ragdolls that hit things that would be hard
ah thats interesting. I was going to add a health system so I will check that out
and regarding your ragdolling, it's far better for performance to just have a sphere collision around your ragdolled players to knock things over.
It's not 100% impossible to do what you want, but it'll require some advanced replication
GAS may be overkill for what you're trying to do though
Is your project BP only?
I liked the root bone idea you mentioned where the root bone moves around so the players have the ragdolls in similar "areas", even if the poses are different
Well, you would need to extend that to the hands and feet bones as well
Currently yes, however I know a bit of C++ and want to learn it so I have nothing against using it
For ragdolls in my games its less the poses that are important and more just the general location.
as long as the whole body is somewhere around x100 y100 z100 for example it will work just fine
Well, for example, if you want hands hitting something to cause a reaction on all clients, then you'll need to replicate the position of the hands
if it's just general then, you can just put a collision capsule around the ragdolled players and call it good
yeah I like the collision capsule idea
I will avoid GAS then and I will check out those pinned tutorials in #online-subsystems
one last question, should I be making a separate character for online games?
I have a singleplayer mode and multiplayer mode, and if I need to cast to the server to perform actions then wouldn't I need a non-multiplayer character for singleplayer as it wont have a server to cast to
singleplayer also has a server, which is the local computer*. Afaik, if your multiplayer is setup correctly, singleplayer works out of the box.
oh neat, thanks
In Single player games, you essentially are the server. The same thing happens in P2P games.
Cast?
Think they meant RPC
guys have someone here experience with EOS ? epic online services ? and maybe some pdf about it or other source ?
Maybe the channel #epic-online-services ?
I'm wanting to replicate advanced movement for the client of a listen server, and found a video on it explaining a great way to get it done, but there are a lot of steps missing, and the video creator is unresponsive. Dose anyone know of any great resources explaining this specific topic?
Hello guys, I have something that I don't understand, if I start my game in the editor number of player 3 and for the net mode I chose "Play as listen server" I can see both client on my map no problem, If I compile dedicated server, the Client #1 I could not see the Client #2 on the map .... but see Client #1 if I play the Client #2 .
everything is replicated
the first client don't work as suppost to... in the editor windows "server side" I see every clients
How can I set the visibility of a component to true for all my teammates?
Like the nickname to indicate who is part of your team?
I already have the team system and I can get the team with a variable. I tried getting all the actors and comparing that variable to set the visibility just for owner but sometimes is not working
I've been reviewing the Lyra game project... am I blind? I don't see any replication code in there at all
I don't see a replication graph anywhere
Replication isn't just made using a replication graph
I remember one of the devs working on lyra saying that they will bring that in newer updates
Oh ok, so I'm not going crazy then. It's just not there.
I've never used a replication graph. I've only ever used the traditional method of replication, but I didn't see that in there either and I figured it was because they would've used the replication graph
I haven't got to look into the networking code, but that should be a thing for sure
Wait... they say that it is setup with EOS... so why wouldn't it have replication?
EOS would only be integrated if it supported multiplayer. I mean technically they could bolt EOS on there and not write a single line of replication code... but that would be weird
hey, Ive been stuck on this problem for a while now, Ive tried alot of things and nothing has seemed to help, to start, im trying to make a multiplayer game, the problem I have is when I get to a certain point in the combo, I want the hit actor to play an anim montage which has himf ly backwards, im timing this with an anim notify, I noticed though that everytime I get to the certain part of the combo, my character is the one getting pushed back and not the actual enemy/other player, here are some pictures of my graph and a video of the problem
Are you using the correct target for the knock down anim montage?
Target is set to self, shouldn't it be the other character?
yea, but im using only one char bp for multiplayayer, so im not sure what target rlly should be
Okay so are you at any point using Apply damage?
yea I am, should I send a pic of that graph?
It's the same sort of line of thinking, the target can be the same base class but you have to specify the instance of the character.
ok hold on
So however you managed to figure out which character to apply damage to use the same sort of approach to implement your target for the specific character you want to be knocked down, otherwise it happens on self by default.
the problem is, it is drawing the hi actor as a actor object refrence and the anim montage is saying it needs a character refrence
You might be overthinking things a bit, you've already managed to make it so character A can hit character B and have them run different animations right? So it's the same sort of thing where you just need to set character B as the target.
Your knockdown server function can have an actor input, then use that as the target.
or it should be a character instead of actor
Then its just a matter of going to where you call the knockdown event and pass in the character being hit into it.
Right, ok Ill try to do this right now, ill let you know how it goes
If you have some sort of overlap event going on, you can get the actor from there and cast it as a generic character before sending it to the knockdown server event.
Oh I do have an overlap event in the beggining (SphereOverlapActors), only question is, how do you cast it as a generic character from out actors? im not familiar with that
Drag from the blue pin of the foreach, (you may want to do some kind of check, perhaps a tag?) then cast as character and feed that into your new knockdown input which then feeds into the anim montage.
Ok, thank you, ill try this right now
Hmm, I tried to do as said and it still failed, just this time it does no damage and the animation doesnt play
cast to character (its a default thing)
oh mb lol
But don't feed that into the apply damage that part was correct before. Feed the new overlap detected character into the knockdown server event (after you make a new input for it)
ok
Wow, thank you, it finally works, I will post the bp here in case sm1 else needs it, thanks alot, anyway you want me to vouch or anything?
does anyone know how to package a game so i can send it to my friends and they can play it
I have a projectile that needs to (more or less reliably) play some FX On Destroyed for everyone. Is there a better formula/solution to ensuring those FX also play when the projectile collides/is destroyed instantly upon spawning (e.g. player shooting into a wall right in front of him)?
Since Event Destroyed never fires on the clients if the projectile is destroyed on the server in the same frame that it spawned
If somebody has a suggestion, please ping me or reply to me, otherwise I will most likely miss the post
Well to have it accurate you will need to handle it on a different actor and not on the component itself.
If you send an RPC anyway, you could just send the RPC over the player, or the gamestate or what ever.
Another solution would be that you spawn the projectile on client and server and have the client just simulate it, e.g. shoot a projectile for FX only.
Sending an RPC would already guarantee the fx, but I kinda wanted to save on reliable rpcs as much as possible, with the solution above working without one
Simulating it is kinda out of the question since it's a highly complex projectile that can bounce off of the environment or even home in on a target etc
It won't work, as you should never rely on server frames for this. Packages can get lost etc.
Last time I had fast bouncing projectiles that could destroy the frame they were created I ended up faking it locally with line traces
Well it's just for the sake of FX, so I would be willing to loose a tiny bit of reliability.
then you can do a client side prediction
That might be pretty performance intensive though, with the projectile potentially being homing and not traveling in straight lines at all (it can also home erratically)
Then spawn a fake one locally
well if its costly, it's costly on the server as well, which might not be good at all xD
Predicting would be costly
and without local simulation it will be more costly due to a lot of RPCs I guess to update the position
Why
Since doing additional line traces on tick sounds like a performance sink
prediction = exact same code the server runs to move the projectile
get location where FX you want to happned, send to all near by client and play that fx locally
I'm already playing the fx locally, and their location basically just needs to be where the projectile was as it got destroyed, so I'm doing it on event destroyed currently, which doesn't need any extra rpcs
It's just a pity that unreal has no flag to guarantee actor replication before destruction
ehm
actor destruction is also sent to the client
so in fact it's somewhat a rpc
An inevitable rpc
then add delay
Which I'm abusing to get more out of it
I mean, you can also just send an unreliable RPC, if you fear the overhead
Scroll up, it's basically how my question started (if my delay method was ok)
Yeah those unreliable rpcs almost never work out at the speed and count my projectiles are moving at sadly
if you are on cpp side, you can wait until the actor channels for all players were opened for the projectile, before destroying it
Interesting
it doesn't matter how fast they move
it's just one RPC per projectile, not per frame
Yeah bad wording, they're just many
then I actually really would go for client side prediction, as there will be a lot of replication to be done for the movment I think.
Like up to 10 or 15 projectiles at the same time, and all of them are relevant
10 to 15? that's not that much tbh
Well currently I simply interpolate the movement using the built in interpolation of the projectile movement component
Not sure how costly that is
Afaik it simply sends velocity and location on net update
The rest is interpolated locally
as far as i know event destroy only calls for controller or controlled pawn from server.
and two frame time delay may be won't work if ping is very high, some client won't get update that fast. i really would suggest add simple 1 sec delay and try.
1 sec delay starts to look odd since the projectile will have bounced by then on the client
But I could go for like a 200ms delay
The kind of game I'm making would be no fun at more than 200ms anyway, since it needs very fast reactions
just hide projectile mesh and send location to client. so client only see that projectile collided.
any type of delay is odd, why don't you just send a RPC or do a client side prediction "If wall, VFX" this is more accurate than any dely
I've tried that and due to the often deliberately unpredictable movement of the projectile, I got very frequent mispredictions
you don't need to predict the full missile ... just if there is a wall in front of you, other cases should work
Yeah but if I'm sending an rpc the problem isn't really solved, since I was wondering if there was a way to solve it without additional reliable rpcs, which is why I've been using the event destroyed function for now
Will you have pearcing missiles?
Potentially, I'm still working on a variety, currently have bouncing and erratically homing projectiles
well then you need a RPC anyway for the hit response, so why bother with one extra RPC for thee final VFX
I'm using GAS for gameplay relevant stuff, but one off gameplay cues from gameplay effects don't play reliably on simulated proxies in GAS, and GAS effects don't replicate to them either usually, so neither are helpful for this on destroyed effect
Basically with GAS, only the server and the hit actor will be notified of the damage, but not the other Clients
well, you got my input, the rest is up to you^^
The main issue with prediction for me is that I have many fast moving projectiles and characters, which makes it prone to misprediction
Thx guys, I'll think this all through again, maybe I can incorporate some of those suggestions for my use case
just to be clear, I don't necessarily mean full client side prediction.
If you do a simple ray cast on shoot to predict, if you actually will fire a bullet, or if you hit a wall could already be enough as a first approach.
Yes, that's a very interesting approach, might be worth looking into, although it would also require an rpc in the end (for the other clients to be able to see the FX too)
I wonder, the netcode in unreal by default always sends a replication request on the next frame after a replicated actor spawned? Or how exactly is that initial rpc timed?
Oh yeah maybe I forgot to mention the scenario, the game is not an fps or tps, it's using a shared camera for all players and has a sort of tilted orthogonal view
An arena game basically
hm if everyone needs to see all hits, you maybe should just collect all hits in the GameState, and if the list of hits is not empty, just send it with one RPC to all peers
(send the RPC in the Update of the Gamestate)
Hmm, that might potentially be one pretty big rpc though (hit location + sound fx + particle fx class to play per array entry)
3 doubles + 2 IDs, not that much. I mean, create a database of your FX to play and give them some sort of ID, like GUID.
Also we use oodle comprression(I think?) , so I guess it won't be that big, even if it sends strings, as it will reduce the cost, if you have a lot of same entries for example
Thx, I'll explore that approach too then, can probably be simplified with gameplay cues and sending a tag ID instead of several fx ids
Yep
Would also get rid of having to make a database
\o/
Thx again everyone, have a good one
Hey guys I have a very confusing Issue. I have a function that works correctly only if you "Play as Client" in the editor. If you do Play Standalone, it does not work as intended which is fair. However when I packaged the project the function works as if the project is running Standalone. Is there something I'm missing? Can I configure it to run as client every time?
Well you need to package it as client only, so without server code.
But what are you actually doing? Could you give an example?
An error occurred (FleetCapacityExceededException) when calling the CreateGameSession operation (reached max retries: 2): No available process.
I have this function to enter a combat stance.
I can show more but its very simple, It basically checks authority and if client it runs the same function on the server to change a Player State Enum, which is Rep Notified which updates the anim graph to display the combat stance.
If I select. Play as Client. It works fine and plays exactly as I want it to.
When I do standalone. the code breaks and the player does not enter the combat stance.
The game is made for multiplayer so it wont obviously work on standalone.
But the problem comes when I package the game. The game works as if the it's running stand alone and the player does not enter its combat stance.
I don't see where you check for authority^^ But anyway, you need to send an RPC to the server if you want to request a combat state change.
Your game runs in bundle as standalone as you didn't package it as client only You need to create a build target for Client, if you only use a dedicated server. If you clients also can be listen server you need the default game IIRC.
How ever, it's likely that you messed smth around with your auth checks^^
This is the combat state code
Server Toggle
Rep notify
How do you set the build target as client only? Is there something I have to do?
actually I'm not sure if that's possible with a BP only project with a bundled engine, as the bundled engine doesn't support creating a dedicated server, so I think it also doesn't support client only bundles
I have the unreal engine source. I have built dedicated servers but I was not aware of their being a client build.
ah ok, well as for the server target, you need to create a client target.cs file
If you have any documentation or video regarding this. It would be appreciated.
and then you should be able to select this target for packaging
No I don't, but basically its just like the server target, a list of modules we need to build
okay thanks. At least I know where to look now. Appreciate it.
hi!
what the best solution to change player data - ask game mode functionality to do this through player controller, then change through player state functions. or better directly run RPC from player state (because it's already owned by controller) and change all it here.
I think state only for reflecting data for clients as a game state is.
And stores server changing logic here isn't correct.
But very confusing RPC's here. Maybe they could serve only for asking the game mode, not changing directly. And we should to not store asking logic in the controller, but in the player state.
how do you think, guys?
also @thin stratus writes (huge Thanks for compendium) that "In Multiplayer, the PlayerState is meant to hold information about the State of the connected Player."
only hold, not to manipulate.
but RPC's breaks encapsulation, no?
Can you direct me to which parts of this I should change? Should I change everything that says Server to Client?
Along with the name?
Sorry for bothering you again, But I could not find any resource online for this.
well, file needs to be renamed to ProjectNameClient.Target.cs,
the Type needs to change to TargetType.Client, and you can remove the SupportedPlatforms thing
Awesome, thank you so much.
Is it just me, or does overall network performance in a standalone game running from the editor with a separate server process, and network emulation, vary from session to session?
Some sessions the net performance is terrible (packet loss, frequency of updates is really low, etc), and sometimes everything just works as intended?
That's a you thing
is there a typical approach for making an FPS multiplayer in the sense that its first person for the player but others see the a different model in 3rd?
idk if there is maybe a visibility setting somewhere for that, or if I just have to do it in the event begin
one solution is setting visibility flags with Owner No see or smth like this.
second to simple setup the actor different if not controlled locally
then this is on actor level, k^^ then you might need to set it up different ๐
ill just try in the begin play
wait i found it
there is an owner no see flag in the LOD
rendering tab
was looking for a drop down for visibility as ive seen in widgets
Sure
Yes, it's actually quite common
Generally speaking, it's cheaper to have a beefy server that can run 10-20 instances of a dedicated server, than it is to have 1 server per game server instance.
There's pros and cons
you can even run the same exe multiple times as long as you have multitenancy in mind for configuration and such
Yup, usually I just setup X number of scripts that pass different parameters to the command line when launching the server, specifying the port, session name, etc
If I want to move the player's camera to an overview point where they can see the entire level when they die, will net relevance update correctly if I use a camera modifier? Or should I be moving the player controller itself, somehow?
How do I pass a SurfaceType enum value through a C++ RDP function?
these are giving me errors regardless of how I do it. If I don't use TEnumAsByte, it says...
error LNK2019: unresolved external symbol "__declspec(dllimport) class UEnum * __cdecl Z_Construct_UEnum_PhysicsCore_EPhysicalSurface(void)" (__imp_?Z_Construct_UEnum_PhysicsCore_EPhysicalSurface@@YAPEAVUEnum@@XZ) referenced in function "void __cdecl `dynamic initializer for 'public: static struct UE4CodeGen_Private::FBytePropertyParams const Z_Construct_UFunction_AVRCoopPlayerCharacter_CL_MulticastTriggerFootstep_Statics::NewProp_SurfaceType'
but if I add TEnumAsByte, it doesn't actually use it in the generated function
I guess maybe this is because the EPhysicalSurface enum isn't actually a strongly typed one
is this just because you didn't add PhysicsCore to Build.cs
Typically speaking - when you see "unresolved external symbol", generally means you forgot an include or to add something to Build.cs
Yeah I was being dense. I was thinking I didn't have the RDP format right (since that also triggers unresolved external symbols) and just didn't consider it being an actual linker issue.
Maybe RDP is "Remotely Defined Procedure"
is that a common term for it? I've only seen them referred to as RPCs and the concept is commonly called RPCs even outside of Unreal
Oh - I'm just guessing here. I've always seen and heard and known it as RPC
I was thinking of Remote Desktop tbh
RDP Drop in replacement for UDP when
Haha yeah, I think rpc + udp = rdp in my head ๐
Remote desktop only in vr work environments ๐คฃ
If you spawn a replicated actor on the server and attach it to a replicated character right after spawning, will it reliably attach on the client also?
It seems to work fine, just sanity checking
Hello, a question about server performance and bandwidth concern.
My players can use some inventory item to spawn a big explosion area in my multiplayer game. Each area has around 100 projectiles looping from sky to the ground.
I have set the projectiles to only replicate locations from server when they hit something and are put back in the sky, and they have a short NetCullDistance of 50m.
If players spawn lots of these areas, is it gonna be a performance issue for the server (calculating hundreds of projectiles moving and overlapping the ground)?
I'm thinking about only spawning some projectiles around players if they are inside the area, while distant projectiles are only local visual. This can drastically decrease wasted number of projectile actors on the server, but requires some work.
Are these errors safe to keep if everything works or should be resolved? LogNet: Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor
Hi, what's the proper way to limit character's speed in certain direction so it couldn't be hacked over the network?
Example: I want moving backwards to be slower than moving forward
What I consider:
- setting the axis scale of backwards buttons in the project settings - probably not a good idea, there probably are hacky ways to call input events with higher values
- doing algorithms like if(axisvalue<0)maxspeed=100else maxspeed=200
Probably not a good idea if I want to only clamp the forward/backwards factor, also seems whacky to replicate thos behavior
- root motion locomotion- looks cool on paper, especially for soulslike games, but I heard it's hard to implement networked root motion outside anim montages(in blendspace in anim blueprint)
I mean, I did that for testing purposes, but on higher ping, the results are weird- character gets teleported 100ms backwards and then 100ms forwards, (so the result of movement is good, but with all the weird small useless snaps it's irritating, like movement component doesn't predict the movement well)
Is there a reason you don't want to use the CharacterMovementComponent which does this out of the box for you?
Yeah should be
This is generally an issue when you call a server RPC from client on an unowned actor which makes the RPC get dropped.
Is this the whole warning?
Yes, there are more. It mentions the actor
It doesn't let me adjust the speed in a certain axis without me manually doing RPCs, does it?
I mean, i can use the approach 2) but idk if it's the right approach
Oh yeah that's what I meant
Would that cause any issues down the line or could be ignored?
It's an issue already. It's clearly saying that the function won't be processed.
You have to set the PlayerController or PlayerCharacter or any other client owned actor you see suitable to own that actor.
You can do that using a SetOwner function
Assertion failed: PIEInstanceID != INDEX_NONE [File:D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\LazyObjectPtr.cpp]
anyone getting this with UE5? Trying to run 2 clients. Loading into their own worldspaces
What exactly does the term NetAddressable mean ?
Kinda having a hard time to google it ๐
Hello ๐
I am looking for a Tutorial.
I want to learn how to connect to a dedicated server over the internet from all over the world and be able to play on it as a Client.
I find it really confusing to learn this, i only find Tutorials for local connection's, some use Online subsystem's, some not , i dont know do i need that? What is best practice? I would prefer to make my game without Steam.
If anyone has a good Tutorial or something(must not be free, i am willing to pay for it, if its good ^^) please send a link or so ๐
Thank you ๐
I'll give you what I understand is the case, though I may be wrong... It has to do with memory pointers and replicated actors. When you are referencing an actor on a client, you're using a memory pointer, so that reference is actually pointing to a memory address on your computer where the engine then knows to look for the data for that particular actor. When dealing with replicated actors, that memory pointer would not be the same on both computers - your server may have stored that actor at one memory address, but your client would have it stored at another, so you can't just pass the memory address across the network and hope the other side understands where to look. That's where NetAddressable comes in - instead of trying to point to the actual memory location of the actor, there is a "key" that is established that each side sets to understand which particular piece of memory they would need to access for that particular actor. So when you pass through a reference to a replicated actor in an RPC for example, you're not passing the actual memory pointer, you're passing through the key that lets the other system know which particular actor you're trying to reference across the network.
How am I supposed to test hosted multiplayer mode? I am getting extreme frame drop on the window I am not focusing, it seems to be more on client side but happens on the listen server too, and the issue is mainly 'render view family' but I don't see why average draw calls would vary so much between server/client?
I think you want to turn the option in Editor Preferences off called Use Less CPU when in Background
Yeah, that makes sense.
Thanks for the informations ๐
Well you don't need anything to just connect to your server, you just need the servers IP and port. If you don't have an IP for the server it self you may need to setup port forwarding and map the ports to the PC running the server.
NetAddressing documentation is decent
and understanding it is also a key to understanding how to optimize your network
Am I being super dumb or is there a large bug with multiplayer PIE on UE5 right now? If I play with ListenServer and 1 player and do a print statement in BeginPlayer for any actor. It will run twice once for server and once for client.
not a bug, BeginPlay runs on both client and server
I've really tried to google it, but i only found a single useful result which had rather small content.
Any chance that you could send me something cuz i apparently can't google properly ๐
But ListenServer 1 player there is only one machine? Or...
That's normal
If you have a listen server, and an additional player, that's 2 players.
Are you sure? I would assume the reason would be the host being out of focus rather than the editor, but I'll try that.
No additional players only 1 player in total
Shouldn't ListenServer host be the only player
or do I not know anything ๐
So settings are like this. Shouldn't this just give me one machine?
Should, yeah.
Kinda thought there would be more informations, but thanks in any case :D
If I add this to the level blueprint with one player I will get a print statement on the server and the client (unmodified engine)
If your multiplayer options are set to this, then you should technically only see one line from server saying Level Report
I've just read about Adaptive Network Update Frequency which is by default off.
With this description here
With Adaptive Network Update Frequency, we can save CPU cycles that would normally be wasted in redundant attempts to replicate an actor when nothing is really changing. When this feature is enabled, the system will dynamically adapt the update frequencies of individual Actors based on whether or not their updates are meaningful. In this context, a "meaningful" update is any update which initializes the Actor, adds or removes a subobject (i.e. an owned Component), or changes the value of a replicated field on the Actor or any of its subobjects.
I don't really see why it isn't the case by default :thinkie:
AFAIK This does not change when an actor actually sends an update, it changes when an actor is even available to check if an update should be sent
Meaning, if you had a few "failed" update checks in the sense that nothing changed, it will start to skip that actor for longer and longer periods of time
For some scenarios that may be undesirable. If an actor needs to replicate changes/update quickly after an event and it is currently slowed down via the adaptive frequency it could take (depending on config) a relatively long time to "wake up" and send that update
Is it common to pass a FVector_NetQuantize DamageLocation and a FVector_NetQuantizeNormal ImpactNormal with a damage struct that is replicated to clients in order to more easily position and place FX? (assuming the location and rotation of said FX must match on client and server)
If you can't predict this on the client
Then sure, send it along. Just be aware that those are compressed, so if you use the normal FVector on the Server, it might be slightly different location. You usually use the NetQuantize version on the Server then too.
CMC does something similar where it sends the compressed data to the Server, and makes sure to also use that compressed data to move on clientside, to not get out of sync
Thanks, great to know! Trying to not be wasteful but there are plenty of occasions where location info can't be derived and would be very useful on the client so I think it's worth putting into my damage struct
Hello, please advise how to run and test a dedicated server correctly
My current flow looks like this:
- I marked
Launch Separate Serverin Multiplayer Options - I select two players
- I click the play button.
But it does not work correctly
I want to make a menu where the player chooses a character and then connect to the server via OpenLevelByName with IP:Port in level name, but in the console of the server only writes that the player is connected, but in the game nothing happens
Hey fellas hope you all doing well!
It's my first time using Unreal's Networking system, and I am trying to create a multiplayer version of the Unreal's Twin Stick Shooter template.
So far... I managed to replicate the shooting but can't seem to figure out how to replicate the movement. It's using the APawn class so its not as easy as ACharacter.
From server side everything looks good and updates on client if i move the server, then I try controlling the client and nothing happens.
Any of you guys got any suggestions what i could try?
Any particular reason you're NOT using ACharacter? What sort of movement do they have?
hey, how can I get this to properly replicate? The characters can shoot a projectile, but I need it to inherit their speed and add it to the projectile's since the players are able to move really fast. The server is getting the new speed, but not the client.
well... the template gave the character as a pawn not character so thats really the reason. Movement is basic forward left right down.
RootComponent->MoveComponent(Direction);
I'd use Character if it fits your design
It already automagically handles movement for you just fine. No need to reinvent the wheel.
fair enough
Are you spawning replicated projectiles or doing something else?
I'm spawning replicated projectiles
Both of them see it, but the construction script which takes the player's velocity and adds it to the projectile isn't replicating to clients
You prolly don't wanna use the construction script for this, instead use Begin Play
Ok ๐
Also, the additional velocity should be a vector
ok, I'll change that too. I was getting vector length from my velocity
Unless you only want velocity inheritance in the travel direction
Ahh
Just pass over the spawners velocity on spawn and on begin play, set velocity = velocity + inheritedvelocity
ok ty. Also, how do I add that into initial speed, since it's a float?
Not sure how to do it besides getting vector length
I'm not 100% sure when speed is actually used but It's at least used on begin play to calculate velocity.
So it's just a helper property for startup
so you can say BulletX.Speed = 10000 instead of BulletX.InitialVelocity = 10000,0,0
๐
This worked as I intended it to work, but i set it up before I started working on multiplayer is all
It probably didn't work on strafe tho
depends on if you want that to be a thing or not
Well no, the fireball was set up for multiplayer, but not the speed inheritance
I'll test it out
Yeah just BeginPlay -> ProjectileVelocity = ProjectileVelocity + InheritedVelocity should do it.
I got my thing working from the other day btw, turning adds yaw to the character and I just made my turn animations add a more extreme angle, so it has the feel i wanted. No rolling necessary ๐ Thanks for your help on that
Hrmmm. The clients are seeing the new speed, but the fireball is still hitting me in the face while I'm flying.
That's why I had it on construction script at first, cus it wasn't working on event begin play. I think the new speed isn't being added before the fireball is already shot
Try the construction script approach but with a velocity addition.
IDK much about the guts of the projectile movement component, I made my own.
What do you mean? Like what should I do differently from the code I had before ๐ค
Instead of adding projectile initial speed?
Hi, im having an issue with players spawning, all clients spawn just fine but the server player spawns at 0, 0, 0 world position with no character, any idea why this might happen? This is my SpawnPlayers event which is kept on the Game Mode and is called from the Game State when the pre game timer has finished, am i doing something wrong here?
LogNet: Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor BP_FlyingPlayer_C_0. Function SetHasMovementInput( SERVER ) will not be processed.
LogNet: Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor BP_FlyingPlayer_C_0. Function SetLookAtLocation( SERVER ) will not be processed.
LogNet: Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor BP_FlyingPlayer_C_2. Function SetHasMovementInput( SERVER ) will not be processed.```
Getting my log spammed with this error. any ideas?
You're doing RPCs (server event) on an actor you do not own locally
hmm this is a plugin doing it so it's going to be interesting to debug then. it's supposed to be multiplayer compliant too
another strange thing is there are 3 of the pawns, but only two are spawned on the dedicated server
Interesting, it seems marking a property with UPROPERTY(NotReplicated) in a struct will actually set any values sent from the client to the server to 0.0f too! I had though it would only do that from server to client but I guess it makes sense to ignore it on the way up too and save bandwidth
Ok more information. The error only occurs when a second instance of the pawn is spawned. So perhaps it's something conflicting with multiple instances trying to own the same reference?
The pawn is probably spawned on a client
im running it on a dedicated server. OnPostLogin I spawn the actors and possess them with the login controller. I've tested it by not using RunUnderOneProcess also
Any general advice on what to use to build a backend that orchestrates and spawns UE4 processes for each multiplayers "game instances" ? (#linux)
@shell sorrel generally that is done via your cloud provider. AWS and Azure have functionality for it. However if you were custom hosting, you could always just keep a database of connections and according to requirement use a script to run a new server from a command line. Python would be able to run an executable from a symbolic link/shortcut with the right parameters.
@granite jolt I will probably start with custom hosting (scaling issues are only exists if you succeed ๐ฅฒ ).
I'm looking for examples: for instance, are you able to communicate with the spawned processes or fetch "end of process data" (or do you have to create an API for that).
@shell sorrel Unreal can use socket servers to communicate info. So I guess that would be the ideal way to have interoperability without some intermediary like json or xml
I need to replicate audio stream data (uint8). If I send it with a client RPC, it's fine. With a multicast it's throttled and a lot is lost. The actor's update frequency is pretty high (~ 40 if I remember) so how can this throttling be helped?
Hi im trying to get the instigator/Owner of the projectile but when the projectile is looking for the instigator it comes out as none is there a part I am missing to get the owner of the projectile so the server knows who killed who the death counter works, i just cant seem to find the killer!
for a bit of added info its getting death and kills and adding it to the same player
Does anyone know how regions work when searching for sessions on steam? Do the regions have to be identical? Or is it more generally NA, EU, etc.
Knowledge check - is the reason you shouldnt use child actors when making a multiplayer game because the actors that are spawned arent recognized as the same on server and client? Thus causing reference errors?
Are you setting instigator when you spawn the projectile?
Child actor components are pretty bad, doubly so in multiplayer. I wouldn't use them
Is the explanation I provided accurate? I want to make sure I understand why.
Dunno, they probably would be considered the same if they were a replicated actor but I never messed with them enough to find out. They're fragile.
I hate how many traps there are in programming..
Is it possible to have 2 different player controller classes in a level? Like when a player joins can I assign a class to them based on some passed information?
like this correct?
Probably what you're looking for
Perfect, thanks.
I wasn't sure if it was something that was even possible.
Man this is Unreal Engine
What are you trying to do?
And if I understand you correct, the player does travel to a new level after he inserts the password?
Yeah I get your worries. For that I would do it in an other more elegant and safe way, I think
I would save that password in the PlayerState, and override CopyProperties to save it for level change
In the new level you could wait for OnRep_PlayerState and check for that password
Or in HandleSeamlessTravelPlayer probably
Well yes, it makes sure your properties persist level changes
I'm not sure, but it might get called for reconnecting players as well
Well then you have Beacons
But again if you're too worried your player state is null, then wait for an OnRep_PlayerState call
And not on BeginPlay
AController::OnRep_PlayerState
Yeah I guess so
In C++, if I set a Replicated variable using plain old myReplicatedVariable = newValue from a non-owning client, does that automatically cause the variable to be replicated? Or is that bad practice, and I should always set it with some UFUNCTION(Server) SetMyReplicatedVariable(newValue)?
Setting a replicated variable on client won't make any effect on that variable at least not for others. Setting replicated variables should happens always on server. Now it's up to you how you wanna get to the server(depends on the situation), but calling an RPC is an option yes.
Gotcha, I wasn't sure if there was magic that detected the value being changed and handled it automatically. I'm thinking I'll call the server-side Set() and set the local value at the same time for snappiness sake.
The server is the one detecting value changes(NetDriver or ReplicationDriver not sure).
Doing that local set call is redundant as the value will end up replicating to the client.
Then go for this: #multiplayer message
I like this one:
But that replication may take a moment, no? I was thinking I would set it locally at the same time so the client doesn't have to see the delay (and also "refresh" if the new variable value gets replicated back with a different value because validation/whatever from the server)
You can increase the NetPriority if you want that to happen faster than usual, but yeah if you want that like really fast you can set it locally I guess
But that really depends on your situation. This shouldn't be your go to workflow
Well if another value gets replicated back to you then you could be liable to inconsistency bugs
That's why setting values on the client is really discouraged
Yeah... the more I think about it, the more I realize that the "update the value immediately" is really only needed for the UI, so really it should be the UI's responsibility to 1) immediately update the value displayed so it feels snappy, and 2) update the displayed value again when replication happens.
Thanks for talking me out of that ๐
might be time to take a break for the night ๐
UI is an info placeholder and not a gameplay changer thingy. So I wouldn't say it's even needed there either. But a case where that might be needed is probably a timer that shows you how much time left for your ability to be ready for use, so replicating how much time left might be an issue. How to handle that is a whole different story...
Hey people. we're in the early stages of a multiplayer VR prototype (industrial application not a game) where the intention is to have 2 players in VR with mocap suits (XSENS) each. Each player needs their own body presence and the other players body. I was hoping that livelink would be able to broadcast both suits animations to each client rather than be replicating them across from one or the other.... Looking into it I've seen Livelink rebroadcasting mentioned in some particular livelink plugins but cant find more concrete info on it. I've then also heard elsewhere that livelink doesnt work for multiplayer. Anyone have any experience on this?
LiveLink was also for Runtime purposes? I don't use it, but always thought it was mainly for allowing quicker iteration time during development, specifically for previewing MotionCapture. Didn't know you could use it runtime in packaged applications.
However, that said, I would usually treat those Plugins and External Devices (let's just assume the Motion Capture Suit is an External Input Device for the sake of simplicity) as Local only.
Means whatever they do is only known to the Local Client and any data that needs to be known to everyone has to be sent to the Server for replication first.
@dreamy terrace However, again, that said, I have not dealt with this specific problem.
this particular project they can all run just from editor without needing to be packaged.
it's a proof of concept project so corners can be cut
Can't you, for the proof of concept, link the library for the Mocap suit (I assume smth like that exists?) Grab the information for head, hands etc and link this data relative to the character and use IK to move the hands etc to the requested positions, and also replicate this information?
At least this would be ma naรฏve approach, never worked with mocap so just some random thoughts^^
Hi im trying to get the instigator/Owner of the projectile but when the projectile is looking for the instigator it comes out as none is there a part I am missing to get the owner of the projectile so the server knows who killed who the death counter works, i just cant seem to find the killer!
Is there a way to get these working on the client from the lyra project?
Hey fellas, im new to unreals networking system (or networking in general). I am trying to make a multiplayer version of the Twin Stick Shooter game but im struggling to wrap my head around how to properly replicate functions or variables in that matter. I had shooting working completely fine working on both client and server, but when I added Movement and had that working my shooting function stopped working.
Header
UPROPERTY(Replicated)
float FireForwardValue;
UPROPERTY(Replicated)
float FireRightValue;
void FireForward(float Value);
void FireRight(float Value);
void Fire();
void FireTimerExpired();
UFUNCTION(Server, Reliable, WithValidation)
void ServerFire();
cpp
void ASpaceGameCharacter::Fire()
{
if (!HasAuthority())
{
ServerFire();
return;
}
const FVector FireDirection = FVector(FireForwardValue, FireRightValue, 0.f);
if (bCanFire == true)
{
if (FireDirection.SizeSquared() > 0.0f)
{
const FRotator FireRotation = FireDirection.Rotation();
const FVector SpawnLocation = GetActorLocation() + FireRotation.RotateVector(GunOffset);
UWorld* const World = GetWorld();
if (World != nullptr)
{
// Spawn the projectile
World->SpawnActor<ASpaceGameProjectile>(SpawnLocation, FireRotation);
}
bCanFire = false;
World->GetTimerManager().SetTimer(TimerHandle_ShotTimerExpired, this, &ASpaceGameCharacter::FireTimerExpired, FireRate);
if (FireSound != nullptr)
{
UGameplayStatics::PlaySoundAtLocation(this, FireSound, GetActorLocation());
}
bCanFire = false;
}
}
}
void ASpaceGameCharacter::FireTimerExpired()
{
bCanFire = true;
}
void ASpaceGameCharacter::ServerFire_Implementation()
{
Fire();
}
bool ASpaceGameCharacter::ServerFire_Validate()
{
return true;
}
void ASpaceGameCharacter::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
DOREPLIFETIME(ASpaceGameCharacter, FireForwardValue);
DOREPLIFETIME(ASpaceGameCharacter, FireRightValue);
}
who sets the direction values?
sorry
void ASpaceGameCharacter::FireForward(float Value)
{
FireForwardValue = Value;
}
void ASpaceGameCharacter::FireRight(float Value)
{
FireRightValue = Value;
}
void ASpaceGameCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
Super::SetupPlayerInputComponent(PlayerInputComponent);
PlayerInputComponent->BindAxis("MoveForward", this, &ASpaceGameCharacter::MoveForward);
PlayerInputComponent->BindAxis("MoveRight", this, &ASpaceGameCharacter::MoveRight);
PlayerInputComponent->BindAxis("FireForward", this, &ASpaceGameCharacter::FireForward);
PlayerInputComponent->BindAxis("FireRight", this, &ASpaceGameCharacter::FireRight);
}
Through Input I set the directions and replicate them
well you don't replicate them, as property replication goes from Server to client, never the other way around. you need Server RPCs for this
google?
And well, what do you want to study. You need an RPC as you already use for fire
but you say for the variables yea?
the forward and right fire need an rpc call?
UPROPERTY(Replicated)
float FireForwardValue;
UPROPERTY(Replicated)
float FireRightValue;
But isnt this it?
No
this is UPROEPRTY replication, not an RPC and replication goes from the Server to the Client, so if you change smth on client side, it will not effect the server. you need to call an RPC, so a function, for this
just check the pinned messages here, there are a lot of network guides
I see thanks for the help
, but its a pita
