#multiplayer
1 messages · Page 476 of 1
have a gander at the DOREPLIFETIME macro, it gets the UPROPERTY offset index or something
tbf doing it by FName would be mental
And all my variable names would be one-character 😄
Also yes and no
If it can be statically determined at compile time, it can use an index - but if created at runtime it can't be
Could be wrong, but that's how I've understood it
the first time a FName is replicated it goes through as a string
as soon as its acked by client they start using a shared integer mapping index
yeah but that's a problem - how can you know if the client has that FName in their map locally
its kept per NetConnection or something
Could be - I'm not 100% on that though
either way they are integers after initial sync
It's certainly true for uclass* at least. The first time they go through by Name, after that they have a NetGUID mapped
Typically the docs have no docs on said subject
Be interesting (and good) if that was the case though RE FNames
can't really make a NetGUID for something that is not a pointer
with UClass* they can be referenced by their asset path, and then they are mapped to GUID
Yeah that's what I mean, so once it's loaded it's a live UObject
first time sending of the entire path is so client can map it
it would not work for FName
Yeah, I can't see it working for FNames - unless there's a unique hash table for each connection. Can't see any evidence in source for that though
Quizzing on UDN.. would be nice to know for certain
@indigo robin FName is replicated as string every time
while objects have the netguid kept in the package map, no one bothered to make a net string table for fnames
it would be quite difficult too because of the multi channels
Are there any good documentations for implementing network smoothing for pawns? I noticed it in the PostNetReceiveLocation that the interface it uses for smoothing the location update only applies to CMC.
General approach is:
1 - Separate visual mesh and the collision component.
2 - When receiving an update, set the collision component's location immediately.
3 - Interpolate the visual position to the collision position each tick
That's the laymans-term approach at least
For CMC it does at least, as you don't want to be sending 'smoothed' positions to the server otherwise you'll be corrected constantly
void UCharacterMovementComponent::SmoothClientPosition(float DeltaSeconds) is the place to look
How do you address receiving another update if the current lerp hasn’t completed yet?
Do the moves need to stack up?
CMC just accumulates the error and continues interpolating, unless the distances get too high at which point it snaps
But usually the interpolation is uber fast
Like, less than a few frames
Ahhh
I believe they also have an option for running simplified movement on remote players too IIRC, which reduces the error a lot when you know input isn't changing often.
I only remember them talking about how they disable that on mobile in fortnite, since it's costly to do so
I do that for my physics vehicles at least, though the approach is a bit different there anyway
Input is replicated too in my case (i use it for driving FX/audio and such anyway) - so I just have clients keep simulating with the last received input
Falls apart when you have a lot of packet loss
But helps assist the smoothing a bit
Well this is just for AI, not players in my case
So it’s always server -> client one way
Yeah just simple interpolation is probably fine in that case
I would still snap the collision, just so you can garauntee that is always up-to-date
If you're feeling dangerous, you can also offset the render matrix for the root component and smooth that... but that brings fresh problems with it
Tried it but it doesn't really solve the issue for attached objects and in extreme cases you get weird bounds issues with rendering
I am definitely more interested in just smoothing the jittery AI than implementing any complex code
Haha
yeah
I think interpolating the visual mesh should more than cover it for something simple
I finally got all of the pathfinding and movement and everything all moved over and working with my custom pawn movement rather than CMC. Just need to address the interpolation now
And I’ll be happy for a while
heh i didnt even think of that, the root component being the capsule means that any attachments that go to sockets/bones have to explicitly go to the mesh component
yeah.. I thought I was a genius when I did the render matrix smoothing for my skeletal vehicles meshes - then realised all the weapon attachments still snap anyway 🤦🏻
Characters can get away with a lot with that nice simple capsule proxy 😦
how does that work for root motion extraction though, the root motion would be applied to the skeletal mesh which isnt the root component
to be honest I never digged into the root motion side of CMC.. the most I know about that really is it's not as cheap as the default kinematic stuff
In a Component on a Pawn: if(GetOwner()->GetNetOwner()) is working, if(GetOwner()->HasNetOwner() is not working. Both times breakpointed, both show "Owner" as NULL in my Pawn.
(╯°□°)╯︵ ┻━┻
- How can that even happen (DebugEditor)?
- How can a controlled Pawn, on the Server, no have an Owner?
colour me confused 😄
That's to make sure I only call a CLient RPC if the Component is sitting on something owned by a Client
-_-
Which brings me to the question, what's the preferred way of doing so if HasNetOwner fails?
Just calling the RPC anyway? Not sure if a LevelPlaced Actor would then call the ClientRPC on the Server (which with a listenServer isn't really wanted)
What exactly is the Twitch Online Subsystem used for?
Anyone know if this would work on an iOS listenserver -- meaning does GetResolvedConnectString automatically detect/find IP addresses for live sessions?
FString URL;
IOnlineSessionPtr Sessions = OnlineSub->GetSessionInterface();
if (Sessions.IsValid() && Sessions->GetResolvedConnectString(InSessionName, URL))
Anyone know why running a dedicated server in the editor would not read True for NM_DedicatedServer
ie GetNetMode() == NM_DedicatedServer is false (when checked in debugger)
void AFFCGameMode::InitGame(const FString& MapName, const FString& Options, FString& ErrorMessage)
{
Super::InitGame(MapName, Options, ErrorMessage);
if (GetNetMode() == NM_DedicatedServer)
{
GameSession->RegisterServer();
}
}
Has two players and one dedicated server. Each one is considered "Standalone" using PIE multiplayer
Damn their is so few documentation on custom pawn movement replication in C++ 😦 !
dude there is no documentation for anything multiplayer
the built in simple replication is like "wow, amazing' then everything else we are left on our own
Concerning my issue above. Found the answer. If you run dedicated server and clients as "Use Single Process" they are all marked as "Standalone"
@timber garnet PIE can't be dedicated
Generally speaking, PIE sucks for multiplayer - no sessions, etc
So if you go to advanced settings and turn off single process, then set Multiplayer Mode to Play As Client the dedicated server works
But do you have a good way of properly testing this?
I'm building for iOS and testing with Unreal replication has been a nightmare
@fierce grove Custom pawn movement basically means you have to reimplement movement networking entirely, and there's really no easy tutorial for that. There's a great one at Udemy that teaches you a custom C++ movement comp
@timber garnet Basically you'll want to start two local Windows games and connectt each other outside editor
haha i mean executable
The game doesn't need to be cooked and packaged
ive got all my replication and gameplay working great. i never would have thought that games and sessions and dedicated servers and dev ops would have been what killed me
and since every unreal tutorial or doc involves "set two players and click play. yay, now you have multiplayer"
Dedicated servers require a lot of work, yeah
I'm usually around here telling people not to have them
yeah. its the only flow i can kind of understand though. i have a 1v1 or 2v2 game and I can't find information anywhere that says iOS clients can act as listen servers
do you know?
@bitter oriole you have the link of that Udemy class 😃 !
I was suggested to use pawn and custom movement for a multiplayer game around 3D planets 😉
@timber garnet I'm not sure why they wouldn't be able to be listen servers, other than phone connectivity being terrible
@fierce grove https://www.udemy.com/course/unrealmultiplayer/
Large part of that is custom movement
oh thanks
Hey, I am trying to use NetSerialization in a custom struct I made - the FArchive that I am using to send and receive the struct data has total size -1 on both server and client. Does anyone know why this could be happening?
I should be able to see UE Log commands regardless of them coming from server vs client, right?
In PIE? Yeah.
Ok so I have a parent GameMode class with a bool AllowPlayerSuicide with GameMode subclasses that have this set to true or false in their constructor. The idea is that this bool will never be changed at runtime, and needs to be in the GameMode class as that is where respawning is done.
So why should I have to duplicate this variable to the GameState for multiplayer games? I know that the game mode only exists on the server, but if the value never changes outside of the constructor of the subclass, why can't I grab this value, say from a local instance of the GameMode subclass on the client?
Duplicating this bool to GameState seem like a waste of bandwidth (yes, I know it's only a bool) and is a design that is prone to more upkeep and user error from a programmatic standpoint.
I generally think of GameState as being used for replicated variables that are changed at runtime. Maybe this is incorrect thinking.
So, I have a skin selector in my lobby (for testing purposes the lobby and game level are the same level, just in another room, so no level transition here). When the player has selected the skin they want, it casts to their PlayerState and sets the variable. The variable is replicated. Later on when the host starts the game, the gamemode goes to their playerstate and pulls that variable out and spawns them an avatar and applies that mesh to it. This works fine for the host. But when the gamemode goes to the playerstate for the client the variable returns blank. Do I need to run this "as server" from the widget that lets them pick an avatar? This is in blueprint
player states are set to replicate and always relevant.
I've printed out the functions and the widget is setting the variable on HSPlayerState1 and the gamemode is trying to get the variable from HSPlayerState1
when removing instanced static meshes there is much lag for me. It is coming from a client pawn and I want the meshes to disappear when someone comes from far away comes by later.
It detects and clears the grass successfully
I was told to try get overlapping instances and I did like this but it still made no improvement
any thoughts?
appreciated in advance
So the grass is being removed, but it's laggy?
how often are you using those traces?
what's the frequency on them? @limber mortar
one trace every second or two
those boulders representing the dug up ground will only place if none exist in the collision box
and the dozer drives slow while digging
If I put a print string after cast to instanced static mesh, and do not remove instances
no lag
I can make the bulldozer faster too no problem
so the instance removal is the issue I assume
i could scale the size of the grass if the instance array size is a problem
it just looks better removing it
think my world has 4 different grass meshes with 285k each on the map
usually how many are you removing at once?
and how are you testing this? pie only? have you packaged versions to test those?
I've tested in Pie, I have some updates I need to put on my dedicated server
I can see how that goes if it lags
The amount of times I forget to add a newly added replicated variable to the GetLifetime.. function is too damn high...
it warns you if you add a variable in GetLifetime, but do not mark it as replicated
other way around it just fails silently and laughs at you
Yeah it's one of these situations where you go over everything and you are like :"Do I even call the new function?!"
my recent one was with replicated TScriptInterface<T>
doesn't complain at all
just doesn't replicate them either
So.. I have a 3D lobby widget. Both the client and host can see it. There is a "hidden" timer on it for when the start button is pressed. As players join the lobby the lobby adds child widgets with the players name to it. Both the host and client can see these. When the host pushes start, the widget goes to the game mode and kicks off the logic to start the match. At this point it gets a reference to the widget, and starts the timer. Immediately after starting the timer, it goes back to the widget and runs a "Run on server/reliable" custom event that sets a replicated boolean to true (to show this countdown timer) I also tried a multicast/reliable event. The host can see this, but the client cannot.
Here are the events on the widget. These are called from the gamemode.
here is what the function looks like called from the game mode
the reference to the lobby widget is correct, I've printed that out when it's set on the game mode
Maybe I misunderstood here, but I Thought when you wanted to set a replicated variable on an actor, you run the function as the server, set it reliable and made sure the variable was replicated and it should be replicated to the actors
even when they're a 3D widget?
What Server and Client see are unique, non-connected, non-replicated instances
Yeah even then
The Actor might be, but the UUserWidget won't
so..wtf are we supposed to do in VR where we have shared 3D menus?
Replicate it through some proxy object/actor
Yop, it's not shared anyway, it doesn't matter if it's an Actor it sits on or if it's created through a normal 2D process.
The Widget is not shared, it's one instance per player
You have to execute RPCs in Actors that can use them
so..I need to set these values on the gamestate and then have the widget go get it from the game state?
Yeah
That is one option yes
UI should always only get information anyway
The Timer itself should sit on e.g. the GameState
Right..well I was just thinking about how I set a value on the playerstate by making a call to it and setting it via a run on server.
so I thought you had to do that all the time.
Yeah you don't wanna be in a situation where widgets are in control of game flow etc.
That's also fine, as the PlayerState is owned by the client and the PlayerState is replicated
E.g. your Widget can have a button called "SetIsReady"
Which gets the PlayerState and tells it to set the Ready Boolean
Which then either is already an RPC or performs an additional RPC (all located in the PS) to set the boolean
So when the gamemode sets the value on the gamestate, do I need to set it there via a run on server custom event?
For player experience, always set things like this locally AND on the server
and make sure it's replicated?
No, the GameMode already only exists on the Server
RPCs are used to move from Clients to Server or back
If you are on the Server and you call a function that is not an RPC, you'll still be on the server
ah okay
You do need to make sure the variable is replicated though
Yes of course
@chrome bay Quick question for you: If you have client predicted stuff like Switching a Weapon, which executes on Server and Client.
And you have an OnRep_CurrentWeapon that performs stuff that should execute on everyone, how do you handle that?
I currently have a function in CurrentWeapon that I also call in the function
That explains why the players could see the server info since that was taken from game state
/// Server and Local Client
void UWeaponManager::SwitchWeapon()
{
[...]
SetWeapon(NewWeapon);
}
/// Server and Local Client
void UWeaponManager::SetWeapon(AWeapon* NewWeapon)
{
// Triggers OnRep
CurrentWeapon = NewWeapon;
OnWeaponChanged();
}
/// Everyone but Server
void UWeaponManager::OnRep_CurrentWeapon()
{
OnWeaponChanged();
}
/// Everyone, but maybe twice for local client?
void UWeaponManager::OnWeaponChanged()
{
// Do stuff on everyone
}
@thin stratus That did it, thanks. I didn't realize widgets won't replicate like that at all.
Any other ideas for a setup like this? Usually I mark the Variable in question as SkipOwner, but the CurrentWeapon could also be set only by the Server and then the OnRep has to call for the Local Client too
I've got just about everything done and replicated for the menu, lobby, and starting the game.
Actually it might never call twice for the local client, cause if the CurrentWeapon is changed locally already and the Server change comes in, it won't fire the OnRep if it's the same value
Maybe I'm safe :D
in that case you can just send a client RPC, exi
@thin stratus I actually don't to prediction for switching the weps on my end! Too much of a pain to handle desyncs etc.
I wonder if it actually could desync
It technically only could if the client overrides the Server, but Ping wise that should only happen other way round
I guess it's only a problem if you have situations where you in fact can't equip a weapon and server disagrees etc.
But you could always send a one-time RPC back to say "eyy don't do this"
Basically the same way CMC works again
Client Switches, sends Server what they ended up with
Server switches, compares, if not the same -> correction
yeah you could do that for sure
I guess it just comes down to the specifics really.. like if client switches, triggers a reload before they get corrected etc etc
We can't reload anyway
or fires 😄
So if they shoot a linetrace and spawn a hit fx on a laggy day before getting corrected, then so be it
That would happen technically anyway, if I only let the server do the switch
Would need to lock them
yeah.. i have my tank game thing open atm so I can only speak to that but I have a bit of a different setup there anyway because it's the firing group rather than the weapon which is what matters when it comes to equipping etc.
so equipping is all handled locally, it's just the firing group that replicates
Right, yeah it's not that "complex" here
I'm already happy that I have everything predicted that the player can do with a weapon
Was just wondering if the OnRep situation when predicting has a clever solution
Cause for one you want to skip the owner
cause they predict
Yeah I might try it and see how it behaves for funsies
but then if the Server corrects etc. or the whole stuff is just executed server only (first spawn of the weapons!) then you need it again
I guess conditions can't be overridden on the fly for a replicated variable?
I don't think so as the rep driver gathers all that stuff at startup
e.g. skip owner in general, but not if bIsFirstSpawn is true
I also found out to my detriment that you can't set replication conditions/toggles in an actor component, unless it's a class BP
Which is super annoying for my weapons because they're almost all built up of components
Oh?
DOREPLIFETIME_ACTIVE_OVERRIDE( ACharacter, RepRootMotion, true );
That stuff exists
but not sure if that exists for condition toggling
yeha lemme find an example a sec. going off topic a bit..
Might only be on/off switch
:D still all multiplayer
There is probably someone just monitoring this channel, sucking up all the info and knowledge xD
if (bReplicateBursts) { DOREPLIFETIME_CONDITION(UHT_OrdnanceModule, BurstCounter, BurstReplicationCondition); }
So that was originally in an actor component - but it only checks to bReplicateBursts value on the CDO not the actual instance I've created in an actor component
What I didn't realise is GetLifetimeReplicatedProps is actually called on the CDO not the instance
Right, but what about the active override then?
Yeah I can use ACTIVE_OVERRIDE - I just didn't want to 😄
premature optimization and all that...
ha
But it's kind of annoying as some weapons only care about the burst counter for certain connections since they might do something differnet locally, but if I want to set that it has to be in a component sub-class
Since I don't think there's an override for conditions 😦
Yeah doesn't seem so
Just whether it's active or not
Oh
#define DOREPLIFETIME_CHANGE_CONDITION(c,v,cond) \
{ \
static UProperty* sp##v = GetReplicatedProperty(StaticClass(), c::StaticClass(),GET_MEMBER_NAME_CHECKED(c,v)); \
bool bFound = false; \
for ( int32 i = 0; i < OutLifetimeProps.Num(); i++ ) \
{ \
if ( OutLifetimeProps[i].RepIndex == sp##v->RepIndex ) \
{ \
for ( int32 j = 0; j < sp##v->ArrayDim; j++ ) \
{ \
OutLifetimeProps[i + j].Condition = cond; \
} \
bFound = true; \
break; \
} \
} \
check( bFound ); \
}
Nice highlighting there
haha
Yeah I think you can only change that in sub-classes within GetLifetimeReplicatedProps
I don't think you can change it once it's been setup
So not runtime?
yeah
(╯°□°)╯︵ ┻━┻
I guess it's to do with how it builds the RepLayout stuff
but I didn't dig in too far
I mean I guess it makes sense if you need it changed in the child
Yeah
I guess if you're changing conditions all the time you need to handle it some special way anyway
Hi, i have some problems/crash, when i try to equip a item from inventory.
I have
TArray<UItemBase*> Inventory
When i equip the item to the character i add the pointer to the character weapon pointer
UItemBase* WeaponEquipped
But when i equip and i set the Inventory[0] (the weapon is from the position 0 of the inventory) i set to nullptr and my game crash
well is my approach of the inventory system :/
There's probably nothing at Inventory[0]. If the array index doesn't exist, it'll crash.
Error probably says something about being out of bounds.
Still fighting with this months later, I'm a bit daft but I'm still trying, Anyone able to help me figure this one out? Basically in the player controller I have an enum variable that determines which team the player is on, but I'm trying to access it elsewhere an can't for the life of me figure out how to work this.
I'm screwing with just two players for the time being, trying to get the opponent location checking if there's anyone on the opponent's team and if so, then find the location of their pawn .
...
hold on, I think I'm just stupid
Or Maybe I've got absolutely no Idea what I'm doing, w.e back to the lab.
Can you expose an arbitrary webservice endpoint using an Unreal Plugin?
I'm looking at ways to accept inputs from something other than an Unreal client
I know I could use Unreal and poll somewhere to derive input
But I am curious to see if anyone has had to accept non-Unreal client inputs as inputs before
If that makes sense?
Something similar to the Jackbox implementation, where the player input/'client' is just an HTML/Javascript page
Is what I am considering
I know I can use the REST extensions and an intermediary webservice (written in any language, really) that the Unreal 'server' would poll at intervals to accomplish, but I was hoping to remove the need for the intermediary webservice
is it possible to put my game in steam without using their subsystem?
if yes then what should i keep from the below setup in my DefaultEngine.ini?
[/Script/Engine.GameEngine]
+NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="OnlineSubsystemSteam.SteamNetDriver",DriverClassNameFallback="OnlineSubsystemUtils.IpNetDriver")
[OnlineSubsystem]
DefaultPlatformService=Steam
[OnlineSubsystemSteam]
bEnabled=true
SteamDevAppId=480
[/Script/OnlineSubsystemSteam.SteamNetDriver]
NetConnectionClassName="OnlineSubsystemSteam.SteamNetConnection"
Is it possible to replicate an animation blueprint separately for local and others?
For example: I want to modify the transform of a bone for myself, but not for others.
This clears foliage but lags with my 1 million instances on the level. Is there a better way to handle the removal/indexes? I also tried a direct trace with break hit, removing the hit item and hit index. Same lag, and on a blank new project.
If I only have 10k foliage on the map its no big deal. Here is the notify function, basic
does anyone know if the vehicle movement component has prediction?
Im wondering something; i made a actor BP_ and added a couple of child actors on the static mesh. all set to replicated. If i play the game in pie (everything works as expected) however if i play trough online, the child actors are not visible on the client side. (Hello btw im new to the unreal community)
I can reproduce the issue with the pie, if i disable the net load on client - on the BP
how do i get the clients to also see the child actors trough internet play; what am i missing... is there anyone who can guide me in the right direction?
GameMode doesn't use Beginplay via CPP?
gamemode uses startplay, which calls beginplay for everything.
and IIRC, stuff created on the server that is replicated, does not do beginplay on client. but if something is created on client-side, it does call beginplay.
if it's placed in the map, and bNetLoadOnClient = true (which is default) it will
Replicated actors created on the server do play BeginPlay on client.
the last one i did, didn't. i had to override PostNetInit becuase beginplay never called
when the thing was spawned at runtime
it called on server, but not client
so maybe thats a bug then
playercontrollers also don't do beginplay on client
Hmm, let me test. Because, aside from PlayerControllers, I'm 99.9% sure BeginPlay is called on both in all cases.
as i said, if it's in the map, ans bNetLoadOnClient is true, it does.
because it gets called from UWorld
I mean, even spawned at runtime.
Because PostNetInit calls BeginPlay which is pretty much for clients to init stuff. Currently testing.
yeah i see that it's supposed to
so it must be a bug when it doesnt happen
cuz i've had it that way many times, where it just doesn't.
Yeah, just from reading some stuff on this Discord, there were some people having issues, particularly with Listen Servers, BeginPlay having strange behavior.
Anyway, from my testing just with Dedicated Server + Client in PIE, BeginPlay is played on PCs and a child of AActor.
like ActorHasBegunPlay is already in 'hasbegunplay' state or somehting
so it must just be broken in listen then
cuz i have this same issue with one of my VR games, which is NOT doing multiplayer in PIE, and only from an actual build.
but, one is listen, other is client.
I think it's just with that engine version. I'm on 4.21, and PIE with 2 clients (1 listen server + net client), BeginPlay is firing on both server and client.
Oh, damn. Listen Server stuff always seem to have problems.
i wonder if it coul dbe the fact that ActorHasBegunPlay is never initialized by default
it's just assumed to be 0 / HasNotBegunPlay
on monday i'll modify engine and test the VR thing.
Probably check with other engine versions if they handle that variable differently before you modify the engine.
well ive seen this issue from 4.19 to 4.22
and i dont believe it's changed.
it's just not iniialized anywhere in Actor.cpp
Hmm I think it had something to do with my logs
Do you guys test dedicated servers via the editor or spin up a separate server? I'm pretty early in, so I just want to verify multi is calling the right stuff.
Both.
Well, I mean, you can test PIE (for most things) for development, and when you're done with something, test in a packaged build.
Particularly shipping is useful too.
Yeah I figured. Man I haven't touched Multi in about a year. I'm so rusty
anyone successfully used remove instance on foliage with 1,000,000 plus meshes on the map?
Hmm how do you guys go about setting references on the PC to actors?
In my case, the server is setting a reference to a ball. For certain functions, I want to reference that ball to do some line tests tec. In my case, if the reference is being set by the server, it's not being set via the client. So client functions fail that require that actor's reference.
Should I set a reference on both client and server, do you think?
void Server_MoveForward(float Axis);
UFUNCTION(Client,reliable)
void Client_MoveForward(float Axis);
void MoveForward(float Axis);```
If I use NetMulticast (on server), is that the same as calling both of these?
hmm damn.
What i had before should have worked.
I had a server calling a netmulti on the MoveForward function - the variables inside weren't updating on the client.
I have an interface on a door. There is a door access panel that has a reference to that door (configured in the instance). When the correct object overlaps it, it unlocks the door and kicks off a timeline to slide the door open. The interface call doesn't have the option of being run on server or replicated or anything like that. The door actor and the components are replicated, as are all the variables. Do I need to create another event on the door itself to be run as server and replicated when that door opens? So interface event->Runonserverevent->Timeline->set actor location
which one is properly replicated for MP?
Quick question, which approach would be better replication wise: adding new attached actors to a character as weapons, or adding said weapons as actor components and additional mesh/audio/effect components spawned into the character itself? 🤔
Very good Q.
In my honest opinion I preffer to have weapons as separate actors since the weapons could have multiple actor components by themselves, to decouple logic.
But it all depends on the scope you are aiming at, there is not really an universal solution which will be the best and work out of the box for every single project
Its per case basis
@visual cosmos
It doesn't really affect net bandwidth, though. They should be quite similar. The difference is negligible regardless, isn't it?
Does adding a replicated actor to another actor use the parent actor's net settings?
Well there are further implications
You have fine grain control on replication settings
Such as using owner relevancy and so forth
But in this case, net performance shouldnt be your concern
Although with weapons as separate actors you can do really cool things with network culling based on weapon shoot distance
So.. yeah, first study how your game is
And based on that, take decisions
Hmm, thanks for the answer. Guess its separate actors then, since those proved to be way easier to swap around dynamically.
Does the AIController not get created by the pawn?
yes on startup and if defined on the class
once you possess the pawn the aicontroller gets dropped
and on unpossess you have to re-add it with "add default controller"
Looks like my client can't find the controller that's associated with the pawn.
However, I am creating the pawns on the server (which I figured was standard), so maybe I have to explicitly get them from server to client when accessing the AIController.
Which kinda makes sense.
I assumed the Pawn would automatically replicate the AIController on the client.
In my case I Spawn the default controller on the server
and I've got no issues
actually the cmc shows that, since without a controller you can't server rpc movement changes
take a better look to your system and debug it because maybe an external behaviour is causing an incongruence there
ah I'm using the float pawn movement, but movement isn't the issue for me in this case, it's the blueprint animation
Ah
AIControllers do not exist on clients by design.
In my case I have a PC that references an AI Controller, but doesn't possess them.
PC's exist on the server and owning client so knowing that... you should change your logic, maybe it's better to reference the pawn instead
Only the local player controllers exist on clients, that's a UE4 multiplayer fundamental.
when you said clients I thought of the owning client out of the box I don't know why.
btw James, do you have an answer for the world origin shifting and physics?
I still have the doubt
My answer is don't use it
Origin shifting is shit
Caused us nothing but constant problems
PhysX doesn't like the origin being yeeted away at the game threads discretion
If you want to use it, you have to handle teleporting the constraints and bodies as well, and resetting any smoothing etc.
To be honest that's just the beginning of my issues with the way origin rebasing has been implemented
but IIRC it was a pull request, Epic themselves didn't implement it
I see... well let's see how the vehicle plays in like 6km away from W.O
that's a shame
Probably not very well I would guess.. but yeah it's not a walk in the park
Maybe Chaos will make life easier in that regard
But a while to wait for that yet
hopefully, anyways thanks for the info 😄
np's, wish I could say something more useful haha
heheh xD at this point that's enough
dumb newb question, but animations should run on client, right? So my design should be to replicate any varibles that'd impact animation movement (velocity et al) and perform that on the client?
I've got animation running on the server, just not seeing it via the client
you gotta be sure your simulated proxies get the information, so yes.
but remember, instead replicating a lot of variables for different things
if you have the velocity replicated you can calculate with that the direction, the horizontal velocity and the vertical velocity
good point
Maybe my setup isn't great. I've got a number of AI, PC references the AI it wants to control, and then sends various inputs through the PC to the AI
maybe you could change a bit the paradigm trying to decouple your own PC from the AI Controller
or.. from the server you can always send a message to the owning client of that actor
but If I got right your system, I would actually re-think the overall setup
maybe it's possible to follow the 'possess' and 'unpossess' of the pawns, and leave the AIControllers to.. well AI
possess and unpossess are server sided only on BP.
It's a sports game, like fifa, so it's not like I'm controlling more than one at any given time.
that sounds fun hehe
8\
Yeah, the emerging rugby market. whoo.
I can't seem to get the replicated AI Controller to work on client, even if I replicate it via BP.
😄 either way, try to go back to the drawing board and come up with decoupled ideas if posible
(i'm in cpp mostly)
oh no, BP or not, the replication shenanigans are kind of similar
the good thing on C++ is that you can know on the client when a pawn has been possessed
just look around to the different onrep functions
TBH, I'm not having any big dramas with AIC and pawns.
I think my lack of knowledge is hurting, so I'll keep reading. I'm sure I'm doing something silly.
Ive figured out the issue with the child actors not beeing shown trough network play
On the BP_ i setted the net load client to false
and also on the child bp actors that are attached to the parent bp
now when i play trough internet the child actors appear as intented
internet play btw
trough pie it was no issue
when i did standalone steam play the client didnt see any child actors
Do I more or less have this correct and what the intended purpose is behind each function?
on input event, tell server that u are firing
server tells everyone to update that u shot
So when exactly should you simply run on server vs doing a multicast?
the input even above the 2nd calls locally
after the multicast
u check if it is locally controlled
if its false
I mean in what usage scenarios should you be running on server vs multicasting
mulitcast is the visual part so to speak
the run on server makes sure no ones cheats
so thats why its checking locally
So if I have a door panel, with a material on that changes color if it's locked. My character unlocks it. I use a "run on server" to set the bool that it's been unlocked and that bool is replicated. So in that case I don't need multicast right?
So what is it about shooting that makes me need multicast?
u need a repnotify for the material change
ive found out
since everyone needs to see the same visuals
like projectile
ah okay, so things like muzzle flare and sounds?
but the actual ionput
is run on server
the server decides if u can shoot
if u have enough rounds for example
multicast for that
some things dont even work with multicast ive found out
ive found out that i coudnt change a material on multicast
but could with a repnotify
So if I have a sliding door that's controlled on a timeline. The door itself is replicated, should that timeline be called with a run on server or a multicast because I want everyone to see it? Do they need to run that code, or do they simple need to receive the replicated actor to see it moving?
run on server
since the timeline is replicated and the door
its a bit confusing i know
i still have a real hard time grasping it myself
if i say anything wrong, perhaps some experts here can come in and adress my mistakes
im just saying what i found out trough own experiment
the server owns the door
so there is no need for a multicast
1 timeline is enough with replicated
and the actor that has to move has to be replicated and replicated movement
back to the shooting, if you're shooting a physical thing the rep of the bullet is handled by the server. It spawns it and sends it out to all the clients right? The multicast is really only handling the stuff like flare and sounds?
yes
and if it were a skeletal mesh weapon that moved it would handle that as well?
yes
but i think it depends who is the owner
ownership i dont understand much
who spawns in the actor
etc
most time u want to spawn actor on server
that is replicated
u dont have to do anything about that
todd howard would say
it just works
though i can be completly wrong
since im also still struggling with my multiplayer game
i have a issue for example
the input is run on server
then it needs to remove item from client
and open door for example
ive got no idea how to set that up
lool
i got it working on server
but the client halts at remove item
then i need a check if i removed item
and then unlock the door
Okay so A good rule of thumb is if there is no visual effects, run it on the server only
and let it replicate out itself
yes
Okay I think I got that
remember that the actor has to be replicated
and if it needs to move
replicate movement
hope i helped u a bit
movement..that means like character movement right?
Not just setting the actor location?
@narrow prairie Yes, that was a big help 😃
the character is allrdy owned on the server
u own the player controller
so movement is allrdy replicated
u dont control the character locally
u run in on server
its what u see
What I mean is, like a character itself which has a character movement component you rep movement on that.
its allrdy replicated
but a static mesh that you move around with "set actor location" does that need movement rep?
u dont have to to anything for character movement out of the box
if u play in PIE editor
2 player
is that "moving" or is it just having it's location set.
u can walk around like no problem
u move on the server
server tells everyone u moed
moved
its allrdy replicated
u only have to tell server that u increased sprint speed
and do that locally too
otherwise u warp
Okay thanks 😃
since u out of sync with server
and ur own location
i would start out really small
and try do some stuff
like for example sprint function
I've already got a fair bit done, I'm just wondering about some of these more advanced functions 😃 My lobby and start game is already pretty much working and fully replicated. But now i'm moving on to things like abilities
and a little less sure about those
I did most of tom looman's one.
I got tied up about 50% of the way through the last unit
That was also like 7 months ago, so not everything is fresh haha 😉
btw take everything i said with a grain of salt, i only started coding myself 7 months ago
working on a zombie game
coop
im gonna be afk and work on my project
gl man
no worries, big help. thanks 😃
everyone makes zombie games 😄
Any tutorials on how to create a server side for multiplayer? Coming from web development, so could use some advice
building the server once the game is done, or making the game in unreal engine to run off a server?
I used the epic guide to make my dedicated server once I finished the game, it worked, I just had to cook the server version of my game in the project launcher first. I successfully used it this year on UE4 4.19 making my first game:
https://wiki.unrealengine.com/Dedicated_Server_Guide_(Windows_%26_Linux)
If you're looking at making the game itself ready for multiplayer I'd check these out:
https://www.unrealengine.com/en-US/blog/blueprint-networking-tutorials
http://cedric-neukirchen.net/Downloads/Compendium/UE4_Network_Compendium_by_Cedric_eXi_Neukirchen.pdf
Does anyone recognize this variable, I can't seem to find it. I'm trying to remove small bits of foliage from a 1 million unit array and wanted to try this.
I see BuildTreeIfOutdated, guess it could be this person's custom variable but it isn't on his page anywhere else so I was just googlin
Hey, I've been trying to get Steam Friends integrated into my project for a couple days now, and have stumbled across a problem with the Friends Game info. Following the tutorial posted buy Cedric. i have created the c++ classes needed for this. The problem is that i am not getting the Generated.h files needed,
I have Right clicked on the .uproject and generated Vs project files
and this has not worked
I have Rebuilt the project from VS and this hasn't worked
I wonder if this is the reason for the failure to create the generated files
And i realise this is in the wrong chat. Nevermind. I'll move it over
Does the ProjectileComponent perform any smoothing on the clients?
Most likely doesn't need it I guess cause it's flying on both anyway and will sync if the server repliates the location
Can you force a RepNotify? As in if a boolean is false, and I set it to false again, can I force this to apply and replicate?
Ah will just make sure the projectile starts deactivated
Can you loop your replicated actions n amount of times you want it to be false?
Was more about me doing some stuff if bIsActive is false, and I was setting that when spawning the projectile but bIsActive starts false
But setting it completely to be "deactivated" at the start is better anyway
You can do DOREPLIFETIME_CONDITION_NOTIFY and specify REPNOTIFY_Always
If I set a replicated variable and after that set Replicated to false, will that still replicate the variable before turning off replication for that actor?
That will force the OnRep function to be called whenever the property is received from Server, even if it's the same as the current value
Thanks!
(Same value on the client that is I meant)
On the server it would still have had to change between replication frames
So I guess not?
Would love to turn off replication for deactivated projectiles
But not sure if that's even needed
That would get rid of it completely
Yeah it's about pooling
Never set that up and checking what I can all deactivate etc
void AHLProjectile::ActivateProjectile(const FHLProjectileSetupInfo& ProjectileSetupInfo)
{
bIsActive = true;
OnProjectileActivated();
SetActorTransform(ProjectileSetupInfo.FireTransform);
WeaponInfo = ProjectileSetupInfo.WeaponInfo;
}
void AHLProjectile::DeactivateProjectile()
{
bIsActive = false;
OnProjectileDeactivated();
SetActorTransform(FTransform::Identity);
WeaponInfo = FHLWeaponInfo();
}
void AHLProjectile::OnProjectileActivated()
{
SetActorTickEnabled(true);
RootSphereComponent->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);
if (GetNetMode() != NM_DedicatedServer)
{
ProjectileMeshComponent->SetVisibility(true);
TrailParticleComponent->Activate(true);
ProjectileMovementComponent->Activate(true);
}
}
void AHLProjectile::OnProjectileDeactivated()
{
SetActorTickEnabled(false);
RootSphereComponent->SetCollisionEnabled(ECollisionEnabled::NoCollision);
if (GetNetMode() != NM_DedicatedServer)
{
ProjectileMeshComponent->SetVisibility(false);
TrailParticleComponent->Deactivate();
ProjectileMovementComponent->Deactivate();
}
}
I'm using net dormancy for that... but I'm yet to check if it actually works 😄
Tick, Collision and visible stuff
And moving the projectile to 0,0,0
cause why not
Might actually rather teleport it
Oh, on another note: How common is it to check with a trace if you are very close to something and then simulating the shot instead of actually using a projectile?
Good Q not actually sure tbh
I'm currently still using actual projectiles for everything
but I've really gotta make a more rapid-fire-friendly trace based projectile thing
I just reimplemented fast shots as linetraces with prediction and simulation for the rest of the clients
And that works nicely
Now refactoring the projectile
And wondering if I should add the initial trace back that check if we need the projectile
But that was without pooling
Yeah that's one of my future things I need to do again
Also added some RandomStream replicated spread
Which was easier than I thought
How do people actually do projectiles that can hurt the player but at the same time don't initially overlap the player by mistake?
Just spawn it far away enough and hope the player doesn't notice?
Man I hate projectile based weapons
you can disable collision with the owning character until overlap ends
or spawn it further away from them and set the location of the visual component at the gun while the collision component is at the true location
and interp the mesh back to the collision
I do dis
Also, I change the collision profile of the projectiles when they actually sweep as I was getting sick of physics stuff bouncing off them -.-
Right, but what is "OwnerIgnoreTime"?
Just a float
No I mean, how long
so < 0 means ignore so long as it's active
0 = never ignore
0 = ignore for a bit then unignore later
not necessarily collision disabled but when it spawns, have a bool flagged true if its overlapping the owner and set it false when that overlap ends
if it overlaps the owner when its true, dont consider it a hit
We are most likely working with HIT not Overlap
So the Projectile is set to produce hit effects
Yeah I use hits for projectiles
too damn expensive to move them and update overlaps each frame too
i use hits for world but overlaps for characters
depending on how many you have of course
same 😄
Na actually not anymore, but still want it to work properly
Guess I will see if it even does problems (the overlap it is)
If the owner shoots themselves, then I'm gonna revisit your both ideas
last time i used hits for projectiles, the character would occasionally be pushed really far from the physics
Not quite sure how you determin the ignore time though, James
Just an edit defaults only setting atm
so it's up to the scrub who makes the weapon to decide how long for 😄
But I can always call 'ResetOwnerIgnore' if say, the instigator teleports somewhere or something
@graceful cave 1. We aren't using Physics, pfui :D 2. Primitives should have a boolean to toggle impulse on damage
Or when it ricochets off something
Yeah if the bullet hits a wall it can be clearly turned off to ignore the owner
MoveIgnoreActors doesn't that need to be set on either side?
Yeah I reset it when they bounce off something, so it you shoot a wall and it comes back and hits the owner it's hard luck 😄
Ah... so it would
but I'm being crafty
I've overridden projectile move component
and when the movement is ticking, I change the collision profile
then at the end of the tick I set it back again
So when it's "not moving" that frame, it doesn't overlap other stuff which is moving
So a projectile can fly into something... but the something cannot fly into the projectile if that makes sense
a kind of hack to make collision one-way
Haha what a cheat
Works for now 😄
Although it being both ways is stupid in my eyes anyway
The stuff should check if either has the other in the array and then ignore
Epic please
Well it was a pain, because physics would think I was smacking into it each time I spawned it
So everytime I fired, tank would hit the floor or something
was v stupid
Ha nice
This was the best "fix" I had for that for now...
It wasn't even that, just physics treating it like a kinematic object
Which is also nice, but with the amount of bullets and fast paced movement that would be annoying i think
Not gonna give my client that idea
So it would think it was hitting a wall... but it was it's own projectile -.-
Uh
Trouble is I spawn a lot of my projectiles inside the collision of the vehicle initially
So I would spawn it, physics runs, it thinks it "hit" the projectile or is overlapping it, and would eject the tank away from it's own projectile
GG physics
10/10
I just happen to move into them after spawning
Drone moves faster than projectile
xD
Idk actually, I really hate my original projectile system
I actually coded something like this:
- Save SpawnLocation and Direction on BeginPlay
- Perform an InitialTrace on the Server from 100 units behind the SpawnLocation to the current location
- Fake all the bouncing etc.
- If we didn't hit anything, turn the projectile fully on
- If we hit something that would destroy the projectile don't activate the projectile and just handle the hit
Worked for very close shots where the projectile was acting out cause of delay in spawning or so idk
I even had a problem where Client shooting a projectile was working fine but the listenServer hit itself
¯_(ツ)_/¯
It doesn't even make sense cause the Collision should also hit the client on the server's end
But well
is foliage the best way to go for grass, if you want a BP overlap to later clear out a small area of grass?
depends, this doesn't sound multiplayer-specific 😃
I don't know if it is lag due to replication problems 😄
I'm year 1, self taught
doing alpha testing
I want to remove foliage for all, and I want it gone later, so I rep notify the multicast function
I guess if the networking looks good I will go to the BP channel, the circled part is the lag inducer, sorry forgot to remove it from my pic
I removed the part about level design and using foliage above
I'll post elsewhere
are there any good tutorials for multiplayer(not steam, normal multiplayer) that use only BP?
@tepid ingot i personally haven't found any tutorial with has EVERYTHING
but i have been able to find seperated ones each with some data
first thing is learning to do replicating
start with a project
it can be anything, i started with a ball fight project
try to put 2 people in there and go from there
search youtube for simple tutorials (i currently can't find the videos, sorry)
https://www.unrealengine.com/en-US/blog/blueprint-networking-tutorials I thought these were good to watch and I'm doing my first game
for me the hardest part has been the replication
thx
In a multiplayer context, I need a widget bp to access functions from a character class, should I pass a reference to the character as a variable or is it okay to just call GetPlayerCharacter?
@harsh lintel The Widget BP should have an owning player controller, through that you can access the possessed pawn
Thanks there is GetOwningPlayer (controller) and GetOwningPlayerPawn, should I still access it through controller?
probably GetOwningPlayerPawn is just a shortcut and internally uses the controller, you could check the engine source
@thin stratus regarding your upper question (this time I made sure discord scrolled): Yes Projectile Component performs client smoothing. Actually, this is working very well. You can "misuse" Projectile Component just to have smooth movement actually...
Hmm one basic thing I'm struggling with is how you get a variable set by the server to replicate to a client's variable. I can't seem to get it via BP, code is fine however.
Anything I should read / check on ?
I think my issue is that the Pawn Owner I'm accessing via BP Anim is on the server, so even if I create a variable based off the Pawn Owner (AIController ) that's associated with the pawn, it's only accessible via the server.
hello guys. i wanna ask some question. how does fortnite setup their server? is it run on dedicated server, the server create session? or player create the session and other players join the host?
imagine a client holding 100 players and playing the game?
it uses dedicated servers which spawns up instances on demand
how they do that? give command to the dedicated server to create one session?
because i read in the forum they says that one single instance one session
yes
one instance per game
so 30 different games would be 30 instances of the server
a powerful dedicated server could hold a good amount of game servers tho
Matchmaking system
tries to find a running server with space, if no space, and no games, after a while it will create a new instance and shove those players in that
is there any tutorial about that?
not that i have seen
server open up another dedicated server
if the main vehicle pawn replicates does the vehicle movement component still need to be set to replicate?
hi ,i wonder how can i test my VR multiplayer game , this is what i did:
- using a game that already works with lan multiplayer, i have added the replication for motion controller -for hands- and tracking of the hmd to the camera for the first player
- trying internet creation and joining for sessions didnt work (session did not appear in any other pc, does not matter the order or firewalls / ports )
- using hamachi or other virtual lan software didnt make the lan session visible either
any suggestion or test project you have over there?
@limber mortar For characters, the character movement component ignores whether you set it to replicated or not. So probably this is the same for vehicles...
Thanks
Hi guys
I'm trying to make a multiplayer game where there's a "god" on pc joined by various Quest clients in vr. But every time i call the join session on the quest, its finds the session created by pc, the on success is fired on join session, but my player doesn't join the server. (OnPostLogin is not run) Anyone has any experience with this?
hi anyone can help me"?
so im done following this tutorial on replicationgraph https://www.youtube.com/watch?v=7P11RwKfuEM and i donloaded the project and did everything in the vid to setup repgraph for my game i take the template from the project and put it in mine and when i build i got these errors
In 4.21 the ReplicationGraph was released in Unreal Engine as it had been an experimental feature in 4.20. When I first heard about the ReplicationGraph in 4...
anyone know why it gives out the errors?
from what i can tell it mad bout this
Use the output log window
Don't paste screenshots - use pastebin
Your issue is probably the prefix
what should i replace the prefix with?
replication graph its parent is replication driver
What is the class name ?
DAReplicationGraph just like in tut
Usually, people call actor classes AProjectNameClassName, and the file is called ProjectNameClassName
The issue here is probably the file name
Rename your class to something that follows the UE4 convention, rename the file, change the includes accordingly, regenerate the solution and build
@limber mortar If you want a component to replicate, it has to have the replicate flag set. Otherwise it won't.
The actor has to be replicating as well as the component.
If the actor doesn't replicate the component won't either.
@wary path Thanks!
@thin stratus that guide you wrote is great, btw
Still wrapping my head around simulated proxies, but I -think- I understand the use-case.
@chrome bay but character movement replicates always even if character movement component replication is disabled
Because it doesn't replicate anything, it has no replicated properties - and as of a few versions ago all the RPC's are routed through the owning character to save on component RPC overhead
Because apparently ACharacter and CMC weren't already monolithic enough
ok
@chrome bay Its almost impressive they managed to make something that monolithic (great word for it :D)
I wouldn't have been able to proceed past a point with that massive cobweb
I think it's the wrong word but nevermind 😄
But yeah... they're so entwined with each other now it's crazy
I want to know just how much overhead it really saves sending all those RPC's to the character actor instead
is there anyone out the who can help answer a question regarding rpc's
im trying to open a door trough a condition that the client has to have the key
atm im using run on server as input event
so the pickup is actually beeing done by the server
then i use a run on owning client to do the actuall pickup
this works fine , no erros and correct replies etc
how do i make it so after i removed the item trough the owning client event
it only works on server in the owning client event
its prolly something with authority, ive tried a couple of things
it only removes the item on the run on server event in the pickup actor
when i do the same thing
but change the flow from owning client
towards the run on server event
though i can never check it has actually beeing removed :S
so it removes regardless if im full or not
it looks like the client never does the remove function that is beeing called inside the owning client event
anyone ?
@chrome bay It actually tells you specifically, let me find it
@chrome bay The overhead for component replication is relatively low. Each component within an Actor that replicates will add an additional NetGUID (4 bytes) 'header' and an approximately 1 byte 'footer' along with its properties. CPU wise, there should be minimal difference between replicating a property on an Actor vs replicating on a component.
So each RPC sends the equivalent of an additional uint32 and uint8 🤔
That's pretty expensive 😄
(Given the frequency)
Just realizing how badly I messed up making my weapons actor components 🤦
Ah screw it.. my weapons are actors made up of components 😄
so to ask my question better, how to perform a run on server event after a owning client event
Hi everyone, I am creating a polaroid but the frame of the photo comes black on the client... When I grab it on the server suddenly the client is the same as the server (both white) but when I grab it from the client both become black any ideas why?
Hi anyone here have experience using the replication graph
I have some questions regarding it?
a fair bit
i think i finally figured out what was wrong
allthough i dont get it
lol
moved some of the code over to player controller and it works now
``` good software design practices won't help you in performance
as I say always... universal solutions will make you sweat a lot and will perform worse than a monolithic solution
however a monolithic solution just sucks design wise
Anyone know the easiest way for me to determine who is client zero with either the player controller or playerstate?
client 0?
client 0 is different on every client
you need to explain what you are trying to do
might be a better approach
The server basically but where it wont mess up if its standalone
I just need to set some bools to true on begin play in the playerstate if you are player 1
This should work but for some weird reason its not
@hollow nexus Thanks, I had a problem earlier in development where I was told here if the main actor replicates the components don't need to. I had a fire spreading through my map and the fire actor broke all my character actions as the game progressed. It was a few months ago, but setting only the main component to replicate fixed my problems at the time. Are you saying that the particle effect subcomponent should be replicated?
I think I just figured out my problem
bah for some reason it didn't work. I need these permissions to be true no matter what for the server or player one.
I ask because I fear I have some replication issue in my game causing vehicles to have different locations on the server/client like so and don't want to do a bunch of useless stuff troubleshooting
https://youtu.be/ElbqVc93g0I
In fear of stating the obvious @limber mortar it seems like data from client to server is being lost, or never transferred, can you try pushing the vehicle with like a physics ball, or something from the environment to impact the vehicle at begin play, without you giving it input, so you can see if the way you are feeding player input is the culprit
That is a great idea, and I am just finishing my first year of dev/game. So nothing is probably obvious, all self taught
I will try that
Hey guys do you think this is good to make to all 8 player a ref in an multiplayer ?
I want to test it 4 minutes in, because the repositioning gets worse as time goes on within the game so I'll create one from the level BP with a delay
the other stinky thing is, the problem doesn't occur in PIE, so I have to upload to my sever to test 😄
@limber mortar standalone helps, but yeah its best to test on your server
@twin juniper where is that, in which blueprint
luckily I took the grass out for my alpha testers and it reduced the size of my game from 1.1 GB to 700, 😉 so my upload time was cut in half
almost, but when I test in standalone, my game doesn't work in PIE like it does my dedicated server. For example, the vehicles don't even possess
They do possess in game running off my azure server and in PIE
@high current gamemode
Hi does someone know how to spawn for every player there own widget cauz currently the UMG are overlapping on every clients
Then you are kinda fine, as the GameMode only exists on the server, and no client has access to it
?
gamestate has an array of all playerstates
you really should be iterating them
when needed
not creating pointers to each player
and how can i call events on every client with gamestate ?
Wait, are you storing the PlayerStates in that screenshot or something else
i am storeing the players in game mode so i can call on every client the event what not works
because the server can only find with get all actor 1 player !
even when 4 are on the map
the something is wrong
i have never ever have to store all 8 players in our co-op game
to access them
it is a multiplayer game
@meager spade how can then call event on every client from the game mode ?
what do you want to do on that client, access the character or something else?
@twin juniper example:
i only use bp sry but thanks 😄
The thing is i want to change a bool in from the player from the gamemode !
Hey guys anyone know a good multiplayer spectator tutorial? They can link me to?
@twin juniper ok so then its best to use the GameState, your game state exists both on server and client
and its best if your GameMode calls the game state, to do that something you want to do, as mentioned, the game state already has the player state arrays
i know that i all ready had the array with the players but i cant call a event with for each loop
is that event situated in the player character of each client?
@meager spade I know that approach hehe
@high current jup
try this
get the character of each client, by the index in the player state array
wait, I am stupid, there is a high possibility that this wont work
@twin juniper do you need to exclude any specific client when you want to run your event, or are you doing it for all connected clients
Hey, I am trying to rotate a Sun Direction object around my scene, but when I try to use a boolean to start its rotation, the boolean is not replicated even if I set it to replicate. I use the gamemode to switch the boolean on or off. Rn, only my server starts to turn the light. I can't find the replication option for that blueprint, which I suppose are not exposed in to the blueprint side. I tried using RPCs, but they do not seem to be able to switch the boolean. Should I try to create my own class for this? Should I try moving the boolean control to the gamemode instead of the gamestate?
Nevermind, the light is not replicated. How would you guys rotate a light dynamically?
I'm super curious to see if my test in 10 minutes on the server moves my vehicles 😄
the impulse 4 minutes in
@lean ocean the game mode only exists on the server, so your clients don't event have that actor, let alone any Boolean you set in it
use the GameMode to instruct the GameState to switch your thing
as the GameState exists both on server and client
@high current ok thanks. That is what I am doing atm, but it seems that directional lights are not replicated
I think I might need to switch to a spot light
you dont need to replicate the actor itself, if you are executing the same action which drives the actor on both client and server
that one has exposed replication settings
BUT your directional light does need to be either stationary or dynamic
ok, I will look into it. Thank you very much 😃
@high current When I applied a large upward impulse to my vehicle 4 minutes into the game it jumps too, and my character can still run and undertake normal actions, so I don't think its the game. I am going to look at my vehicle movement again. I'm new to multiplayer and UE4, and have had to receive help to resolve some vehicle issues, so there is a good chance my mistake is there.
at one point I had that cube smacking into the dozer, but it wasn't doing enough, or it was hard for me to tell at least how jumpy it was
ok so in that 4 minutes, was there any point where you interfered with the vehicle's default position
@high current Thank you so much for your help! I did not think to use a multicast RPC in my gamestate to activate the lights of the client!
😃
@limber mortar Weren't you the one saying you can do Vehicle Multiplayer in BPs and that's all you need?
:D
I'm unsure about the complete context
Lemme check
Getting my vehicles working has been my last obstacle for alpha testing
I had a helicopter impulse issue which a physics pro helped me, a foliage clearing issue for my dozer
But I use blueprints and have had my vehicles driving fine in multiple versions of my game
I've just broke them at some point and don't know what I am doing 100%
😃
I also asked about replicating components like movement
But you can make vehicles in BP right? Maybe I misunderstand the question or reference
Nvm, was someone else then. Either way what you are seeing is a normal problem.
Are you using the default Vehicle classes?
Believe so
Depends on the vehicles but in most cases yes you can
from that GTA project
Well are you inheriting from a Vehicle class?
that download from 4.8 or 15
And are you using some sort of given Vehicle Movement Component?
That's the one from UE4?
opening to confirm
yes
Wheeled vehicle parent class
I do talk a lot though 😉 Who knows what I have said
Na I found the person who said it, don't worry
The lagging driving you should makes me believe the vehicles has zero prediction
most likely
You are constantly getting reset to what the Server has etc.
I didn't not attempt to build in any prediction
It does have some replication in C++, but I don't see any SavedMoves like the character has
wasn't in that youtube video 😄
Googling details and info on implementing vehicle prediction
It really only looks like the basic state is replicated
But nothing related to you giving input
This is pretty complex tbh
The CMC for the Character has a few thousand lines of code
Even if you cut away the root motion stuff
The rubber bending effect you see is most likely not solvable without a custom C++ Vehicle Component
I'm not afraid of that
Specially since the Vehicle is based on PhysX it might actually not be possible to use this base one
Cause PhysX + Multiplayer = NOGO
You can try to switch this to a CLient Auth Model
well, that would be a good hiccup for my game
So the Server has to do what the Client does I guess
Yeah so he more I read into it: Epic always had Vehicles client authoritive
So there is no Client Prediction for Vehicles
So as soon as you set it up ion a way that the Server can override the client possition, you run into lags
You need to make sure that only the state is synced
Try to not have the Vehicle set to ReplicatedMovement
at risk of stating the obv (again) if you didnt touch the vehicle before hand then as eXi is suggesting its a matter of the initial replication settings configured wrong, might be lack of prediction might be lack of replicated movement
Cause the State of the MovementComponent should drive the car the same way
If at all you can send the Location from Client to Server and then multicast to everyone (simulated only though, cause Server and local client already have the location at that point)
But keep in mind that this does no smoothing for you
or lack of variables pushed, in the video you showed us, how are you pushinf the car up, I am assuming an impulse, but can you share a screenshot on how you are setting that impulse
So if there is package loss, you car will teleport
good to know
I pushed it up from the level blueprint to ensure it wasn't from some client action
Add impulse
- Z 9 mil or so
but was that event replicated
Man so weird to scroll through random a** UE4 forum threads and see people talking about you
I thought pawn movement was replicated to the server by default
Character Movement is
Pawn Movement is also if you tick it
But it's not more than Actor Movement replication
Send Transform -> Apply Transform
No prediction, no smoothing
Only the CMC has that properly implemented
Random forum thread about me? Fabulous, never even used the forum part I believe, lol
No about me :D
oh
lmao
makes a lot more sense
also going to look for an article on physx and multiplayer so I can understand
the problems
I can explain it to you pretty quickly:
If you do Client Prediction you usually save the Move the player performed (so what direction, how fast, did they jump, etc.)
In physX you'd need to save the whol PhysX scene, which is basically impossible
Further in Client Prediction, if a Server, after some time, sends the updated location back, the Client throws away all the saved moves that are outdated, applies the new location and plays the newer moves again
That is to make sure that the client doesn't get reset back to the way later incoming update
Cause well, ping
It takes x ms for the move input to reach the server, and x ms to get back to the client. I nthat time the client already moved further again and the client prediction makes sure it won't reset him back
And this replaying etc. is all kinda impossible with Physics
Cause for one you can't easily save the whole physix scene
And then physics aren't deterministic either
So if you perform the exact thing twice, it could happen differently
I get you
because of floating point precision errors afaik
I got more work to do than I realized to get my vehicles working
So you really really really don't want to have Vehicles or Pawns using actual Physics if you need them to be Server Authoritive
That is if you move the actor as a client
A cube flying around can be Server Authority of course
Ok, my other in game actions work, hopefully I can knock this out and start alpha testing without big bug fixes
yes, I understand